From dea2dd3b594e436a67bbfd4a50336f37e84820cb Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 25 Aug 2010 19:04:52 +0000 Subject: [PATCH] -Correct get_disks_by_userspecs when VM only has one disk git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7242 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/kvm.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 44cb2362d..c2158b811 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -994,13 +994,13 @@ sub chvm { sub get_disks_by_userspecs { my $specs = shift; my $xml = shift; - my $struct = XMLin($xml); + my $struct = XMLin($xml,forcearray=>1); my @returnxmls; foreach my $spec (@$specs) { - foreach (@{$struct->{devices}->{disk}}) { + foreach (@{$struct->{devices}->[0]->{disk}}) { if ($spec =~ /^.d./) { #vda, hdb, sdc, etc, match be equality to target->{dev} - if ($_->{target}->{dev} eq $spec) { - push @returnxmls,[XMLout($_,RootName=>'disk'),$_->{source}->{file}]; + if ($_->{target}->[0]->{dev} eq $spec) { + push @returnxmls,[XMLout($_,RootName=>'disk'),$_->{source}->[0]->{file}]; } } elsif ($spec =~ /^d(.*)/) { #delete by scsi unit number.. if ($_->{address}->{unit} == $1) {