From 0d60102d356d62bd91d9502a866adf1c07ededb9 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 31 May 2011 20:52:03 +0000 Subject: [PATCH] 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 --- xCAT-server/lib/xcat/plugins/kvm.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index ca3de1bac..db1b14e0a 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -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="$filename".$sourceinfo{capacity}."$srcfilename"; + 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();