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:
jbjohnso 2011-05-31 20:52:03 +00:00
parent a37ef4e722
commit 0d60102d35

View File

@ -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();