From 702aaacec9aa236073d5f118d27c04a5940078f2 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 22 Sep 2010 19:16:08 +0000 Subject: [PATCH] -Fix for clonevm when a master has never been given a uuid git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7584 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/kvm.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index c10b3765c..c1a225447 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -1532,14 +1532,19 @@ sub promote_vm_to_master { return; } my $parsedxml = $parser->parse_string($xml); - my $tmpnod = $parsedxml->findnodes('/domain/uuid/text()')->[0]->setData("none"); #get rid of the VM specific uuid + my ($tmpnod) = $parsedxml->findnodes('/domain/uuid/text()'); + if ($tmpnod) { + $tmpnod->setData("none"); #get rid of the VM specific uuid + } $target =~ /^(.*)\/([^\/]*)\z/; my $directory=$1; my $mastername=$2; - $tmpnod = $parsedxml->findnodes('/domain/name/text()')->[0]; - $tmpnod->setData($mastername); #name the xml whatever the master name is to be + ($tmpnod) = $parsedxml->findnodes('/domain/name/text()'); + if ($tmpnod) { + $tmpnod->setData($mastername); #name the xml whatever the master name is to be + } foreach ($parsedxml->findnodes("/domain/devices/interface/mac")) { #clear all mac addresses if ($_->hasAttribute("address")) { $_->setAttribute("address"=>''); } }