From 43ded5fd6b24d43cbce0bd3b75b787a2778296fd Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 26 Aug 2010 14:45:12 +0000 Subject: [PATCH] -Have mkvm populate kvm_nodedata xml for reference git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7257 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/kvm.pm | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 9ceb748bc..c5eefbf7c 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -520,7 +520,7 @@ sub refresh_vm { my $dom = shift; my $newxml=$dom->get_xml_description(); - $updatetable->{kvm_nodedata}->{$node}={xml=>$newxml}; + $updatetable->{kvm_nodedata}->{$node}->{xml}=$newxml; $newxml = XMLin($newxml); my $vncport=$newxml->{devices}->{graphics}->{port}; my $stty=$newxml->{devices}->{console}->{tty}; @@ -1015,7 +1015,7 @@ sub chvm { $devicesnode->appendChild($disknode); $newxml=$vmdoc->toString(); } - $updatetable->{kvm_nodedata}->{$node}={xml=>$newxml}; + $updatetable->{kvm_nodedata}->{$node}->{xml}=$newxml; } } elsif (@purge) { @@ -1043,9 +1043,9 @@ sub chvm { if ($currstate eq 'on') { $dom->detach_device($devxml); my $newxml=$dom->get_xml_description(); - $updatetable->{kvm_nodedata}->{$node}={xml=>$newxml}; + $updatetable->{kvm_nodedata}->{$node}->{xml}=$newxml; } else { - $updatetable->{kvm_nodedata}->{$node}={xml=>$moddedxml}; + $updatetable->{kvm_nodedata}->{$node}->{xml}=$moddedxml; } }; if ($@) { @@ -1121,7 +1121,13 @@ sub mkvm { } } if ($mastername or $disksize) { - return createstorage($diskname,$mastername,$disksize,$confdata->{vm}->{$node}->[0],$force); + my @return= createstorage($diskname,$mastername,$disksize,$confdata->{vm}->{$node}->[0],$force); + unless ($confdata->{kvmnodedata}->{$node} and $confdata->{kvmnodedata}->{$node}->[0] and $confdata->{kvmnodedata}->{$node}->[0]->{xml}) { + my $xml; + $xml = build_xmldesc($node); + $updatetable->{kvm_nodedata}->{$node}->{xml}=$xml; + } + return @return; } } else { if ($mastername or $disksize) { @@ -1165,20 +1171,20 @@ sub power { } elsif ($subcommand eq 'off') { if ($dom) { my $newxml=$dom->get_xml_description(); - $updatetable->{kvm_nodedata}->{$node}={xml=>$newxml}; + $updatetable->{kvm_nodedata}->{$node}->{xml}=$newxml; $dom->destroy(); undef $dom; } else { $retstring .= "$status_noop"; } } elsif ($subcommand eq 'softoff') { if ($dom) { my $newxml=$dom->get_xml_description(); - $updatetable->{kvm_nodedata}->{$node}={xml=>$newxml}; + $updatetable->{kvm_nodedata}->{$node}->{xml}=$newxml; $dom->shutdown(); } else { $retstring .= "$status_noop"; } } elsif ($subcommand eq 'reset') { if ($dom) { my $newxml=$dom->get_xml_description(); - $updatetable->{kvm_nodedata}->{$node}={xml=>$newxml}; + $updatetable->{kvm_nodedata}->{$node}->{xml}=$newxml; $dom->destroy(); undef $dom; if ($use_xhrm) {