You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by fa...@apache.org on 2009/03/11 15:00:41 UTC
svn commit: r752449 - in /incubator/vcl/trunk/managementnode/lib/VCL:
DataStructure.pm Module/Provisioning/vmware.pm utils.pm
Author: fapeeler
Date: Wed Mar 11 14:00:41 2009
New Revision: 752449
URL: http://svn.apache.org/viewvc?rev=752449&view=rev
Log:
VCL-29
VCL-29
utils.pm : extended query in get_vmhost_info to fetch username and password
since these variables can be NULL, added a checks for NULL or undefined return values and set to '0' so DataStructure doesn't send warnings.
DataStructure.pm : added vmprofile username and password to data hash
These variables can be accessed using:
$self->data->get_vmhost_profile_username();
$self->data->get_vmhost_profile_password();
ie.
my $mvhost_username = $self->data->get_vmhost_profile_username();
my $vmhost_password = $self->data->get_vmhost_profile_password();
vmware.pm : cleanup removal of useless commented out lines
Modified:
incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm
incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
Modified: incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm?rev=752449&r1=752448&r2=752449&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm Wed Mar 11 14:00:41 2009
@@ -224,6 +224,8 @@
$SUBROUTINE_MAPPINGS{vmhost_profile_virtualswitch1} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{vmhost}{vmprofile}{virtualswitch1}';
$SUBROUTINE_MAPPINGS{vmhost_profile_vmdisk} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{vmhost}{vmprofile}{vmdisk}';
$SUBROUTINE_MAPPINGS{vmhost_profile_vmpath} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{vmhost}{vmprofile}{vmpath}';
+$SUBROUTINE_MAPPINGS{vmhost_profile_username} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{vmhost}{vmprofile}{username}';
+$SUBROUTINE_MAPPINGS{vmhost_profile_password} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{vmhost}{vmprofile}{password}';
#$SUBROUTINE_MAPPINGS{vmhost_typeid} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{vmhost}{vmprofile}{vmtypeid}';
$SUBROUTINE_MAPPINGS{vmhost_type_id} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{vmhost}{vmprofile}{vmtype}{id}';
Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm?rev=752449&r1=752448&r2=752449&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm Wed Mar 11 14:00:41 2009
@@ -2041,13 +2041,10 @@
notify($ERRORS{'DEBUG'}, 0, "subroutine was called as a function, it must be called as a class method");
}
- #my ($vmhash) = shift;
-
my ($package, $filename, $line, $sub) = caller(0);
- # try to contact vm
- # $self->data->get_request_data;
- # get state of vm
+ # Collect local variables from DataStructure
+
my $vmpath = $self->data->get_vmhost_profile_vmpath;
my $datastorepath = $self->data->get_vmhost_profile_datastore_path;
my $requestedimagename = $self->data->get_image_name;
@@ -2055,9 +2052,9 @@
my $vmhost_hostname = $self->data->get_vmhost_hostname;
my $vmhost_imagename = $self->data->get_vmhost_image_name;
my $vmclient_shortname = $self->data->get_computer_short_name;
- my $image_os_type = $self->data->get_image_os_type;
- my $request_forimaging = $self->data->get_request_forimaging();
-
+ my $image_os_type = $self->data->get_image_os_type;
+ my $request_forimaging = $self->data->get_request_forimaging();
+
my ($hostnode, $identity);
# Create a hash to store status components
Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=752449&r1=752448&r2=752449&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Wed Mar 11 14:00:41 2009
@@ -6490,6 +6490,8 @@
vmprofile.virtualswitch0 AS vmprofile_virtualswitch0,
vmprofile.virtualswitch1 AS vmprofile_virtualswitch1,
vmprofile.vmdisk AS vmprofile_vmdisk,
+ vmprofile.username AS vmprofile_username,
+ vmprofile.password AS vmprofile_password,
vmtype.id AS vmtype_id,
vmtype.name AS vmtype_name,
@@ -6550,8 +6552,13 @@
$vmhost_info{$original_key} = $value;
}
elsif ($key =~ /vmprofile_/) {
- #$vmhost_info{vmprofile}{$original_key} = $value;
- $vmhost_info{"vmprofile"}{$original_key} = $value;
+ # Set values to 0 if database values are null to avoid DataStructure warnings and concat errors
+ if(!defined($value)){
+ $vmhost_info{"vmprofile"}{$original_key} = 0;
+ }
+ else{
+ $vmhost_info{"vmprofile"}{$original_key} = $value;
+ }
}
elsif ($key =~ /vmtype_/) {
$vmhost_info{"vmprofile"}{"vmtype"}{$original_key} = $value;
@@ -6562,20 +6569,12 @@
} # Close loop through hash keys (columns)
$vmhost_info{vmprofile}{"datastorepath4vmx"} = $vmhost_info{vmprofile}{datastorepath};
- $vmhost_info{vmprofile}{"vmpath"} = $vmhost_info{vmprofile}{datastorepath} if (!(defined($vmhost_info{vmprofile}{vmpath})));
- #$vmhost_info{vmprofile}{datastorepath} =~ s/(\s+)/\\\\ /g; #detect/handle any spaces;
- #$vmhost_info{vmprofile}{vmpath} =~ s/(\s+)/\\\\ /g; #detect/handle any spaces;
+ # FIXME - set vmpath to not null in database and update frontend
+ # IF vmpath is not defined set it to the datastorepath variable
+ $vmhost_info{vmprofile}{"vmpath"} = $vmhost_info{vmprofile}{datastorepath} if (!($vmhost_info{vmprofile}{vmpath}));
$vmhost_info{vmprofile}{datastorepath} =~ s/(\s+)/\\ /g; #detect/handle any spaces;
$vmhost_info{vmprofile}{vmpath} =~ s/(\s+)/\\ /g; #detect/handle any spaces;
- #for legacy datastructure
- #$vmhost_info{"datastorepath4vmx"} = $vmhost_info{vmhost}{datastorepath};
- #$vmhost_info{"vmpath"} = $vmhost_info{datastorepath} if(!(defined($vmhost_info{vmpath})));
- #$vmhost_info{datastorepath} =~ s/(\s+)/\\\\ /g; #detect/handle any spaces;
- #$vmhost_info{vmpath} =~ s/(\s+)/\\\\ /g; #detect/handle any spaces;
- #$vmhost_info{datastorepath} =~ s/(\s+)/\\ /g; #detect/handle any spaces;
- #$vmhost_info{vmpath} =~ s/(\s+)/\\ /g; #detect/handle any spaces;
-
return %vmhost_info;
} ## end sub get_vmhost_info