mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-11-04 13:22:36 +00:00 
			
		
		
		
	Better handle clonevm storage conflicts
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9723 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		@@ -1958,11 +1958,27 @@ sub clone_vm_from_master {
 | 
			
		||||
            eval {
 | 
			
		||||
             $newvol =$destinationpool->clone_volume($targxml,$sourcevol);
 | 
			
		||||
            };
 | 
			
		||||
	    if ($@) {
 | 
			
		||||
		if ($@ =~ /already exists/) {
 | 
			
		||||
                        return 1,"Storage creation request conflicts with existing file(s)";
 | 
			
		||||
		} else {
 | 
			
		||||
                        return 1,"Unknown issue $@";
 | 
			
		||||
		}
 | 
			
		||||
	   }
 | 
			
		||||
        } else {
 | 
			
		||||
            my $sourcevol = $hypconn->get_storage_volume_by_path($srcfilename);
 | 
			
		||||
            my %sourceinfo = %{$sourcevol->get_info()};
 | 
			
		||||
            my $newbasexml="<volume><name>$filename</name><target><format type='$format'/></target><capacity>".$sourceinfo{capacity}."</capacity><backingStore><path>$srcfilename</path><format type='$format'/></backingStore></volume>";
 | 
			
		||||
	    eval {
 | 
			
		||||
           $newvol = $destinationpool->create_volume($newbasexml);
 | 
			
		||||
		};
 | 
			
		||||
	    if ($@) {
 | 
			
		||||
		if ($@ =~ /already in use/) {
 | 
			
		||||
                        return 1,"Storage creation request conflicts with existing file(s)";
 | 
			
		||||
		} else {
 | 
			
		||||
                        return 1,"Unknown issue $@";
 | 
			
		||||
		}
 | 
			
		||||
	   }
 | 
			
		||||
           $updatetable->{vm}->{$node}->{master}=$mastername;
 | 
			
		||||
        }
 | 
			
		||||
        my $newfilename=$newvol->get_path();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user