Author: arkurth
Date: Mon Mar  3 14:59:25 2014
New Revision: 1573576

URL: http://svn.apache.org/r1573576
Log:
VCL-685
Fixed problem in VMware.pm::get_datastore_imagerevision_names. It wasn't 
searching recursively.

Updated Module.pm create_vmhost_os_object to override which OS module gets 
created if the VM host profile image is pointing to a UnixLab image. The 
UnixLab module won't work under most circumstances. Changed to use regular 
Linux.pm.

Modified:
    vcl/trunk/managementnode/lib/VCL/Module.pm
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm

Modified: vcl/trunk/managementnode/lib/VCL/Module.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module.pm?rev=1573576&r1=1573575&r2=1573576&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module.pm Mon Mar  3 14:59:25 2014
@@ -545,6 +545,13 @@ sub create_vmhost_os_object {
                return;
        }
        
+       # Do not try to load the UnixLab module for VM hosts -- most likely not 
the intended OS module
+       if ($vmhost_os_perl_package =~ /UnixLab/i) {
+               my $vmhost_os_perl_package_override = 'VCL::Module::OS::Linux';
+               notify($ERRORS{'OK'}, 0, "VM host OS image Perl package is 
$vmhost_os_perl_package, most likely will not work correctly, changing to 
Linux");
+               $vmhost_os_perl_package = $vmhost_os_perl_package_override;
+       }
+       
        # Load the VM host OS module
        notify($ERRORS{'DEBUG'}, 0, "attempting to load VM host OS module: 
$vmhost_os_perl_package (image: $vmhost_profile_image_id)");
        eval "use $vmhost_os_perl_package";

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm?rev=1573576&r1=1573575&r2=1573576&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm 
(original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm Mon 
Mar  3 14:59:25 2014
@@ -8156,16 +8156,17 @@ sub get_datastore_imagerevision_names {
        
        print "Retrieving list of files and directories in datastore: 
$datastore_base_path\n";
        
-       my @file_paths = $self->vmhost_os->find_files($datastore_base_path, 
"*", 0);
-       
+       my @file_paths = $self->vmhost_os->find_files($datastore_base_path, 
"*.vmdk", 1);
+
        my @datastore_imagerevision_names;
        my @ignored;
        
        for my $file_path (@file_paths) {
                $file_path =~ s/\/+$//;
                next if $file_path eq $datastore_base_path;
-               my $file_name = $self->_get_file_name($file_path);
-               next if !$file_name;
+               
+               my $file_name = $self->_get_parent_directory_name($file_path);
+               next if !$file_name || $file_name !~ /v\d+/;
                
                if (defined($imagerevision_name_hash{$file_name})) {
                        push @datastore_imagerevision_names, $file_name;
@@ -8184,7 +8185,7 @@ sub get_datastore_imagerevision_names {
        
        print "\n";
        if (@ignored) {
-               print "$ignored_count files and/or directories ignored: " . 
join(", ", @ignored) . "\n\n";
+               print "$ignored_count files and/or directories ignored: " . 
join("\n", @ignored) . "\n\n";
        }
        print "$datastore_imagerevision_name_count images found in datastore 
'$datastore_base_path'\n";
        


Reply via email to