From 539282a4d218ab2e35789cdfb56e02b6f5302b22 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 2 May 2011 15:02:34 +0000 Subject: [PATCH] Fix offline update of optical media in KVM git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9455 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/kvm.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 7da2bdd22..ebf76cd53 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -1554,16 +1554,20 @@ sub chvm { $vmxml=$confdata->{kvmnodedata}->{$node}->[0]->{xml}; } my $domparsed = $parser->parse_string($vmxml); - my $candidatenodes=$domparsed->findnodes("//disk[device='cdrom'"): + my $candidatenodes=$domparsed->findnodes("//disk\@device='cdrom']"); if (scalar (@$candidatenodes) != 1) { die "shouldn't be possible, should only have one cdrom"; } my $newcd=$parser->parse_balanced_chunk($newcdxml); $candidatenodes->[0]->replaceNode($newcd); - my $moddedxml; - $vmxml=$moddedxml; + my $moddedxml=$domparsed->toString; + if ($moddedxml) { + $vmxml=$moddedxml; + } + } + if ($vmxml) { + $updatetable->{kvm_nodedata}->{$node}->{xml}=$vmxml; } - $updatetable->{kvm_nodedata}->{$node}->{xml}=$vmxml; } if ($cpucount or $memory) { if ($currstate eq 'on') {