From 0395679e367a6468468bb141987271236493f40a Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 25 Aug 2010 15:42:36 +0000 Subject: [PATCH] -Try to honor the now prefered nicmodel/storagemodel columns in vm git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7231 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/VMCommon.pm | 2 +- xCAT-server/lib/xcat/plugins/esx.pm | 4 +++- xCAT-server/lib/xcat/plugins/kvm.pm | 17 ++++++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/perl-xCAT/xCAT/VMCommon.pm b/perl-xCAT/xCAT/VMCommon.pm index 7ee8f9477..5a33666e5 100644 --- a/perl-xCAT/xCAT/VMCommon.pm +++ b/perl-xCAT/xCAT/VMCommon.pm @@ -25,7 +25,7 @@ sub grab_table_data{ #grab table data relevent to VM guest nodes if ($vpdtab) { $cfghash->{vpd} = $vpdtab->getNodesAttribs($noderange,['uuid']); } - $cfghash->{vm} = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','cfgstore','storage','memory','cpus','nics','bootorder','virtflags']); + $cfghash->{vm} = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','cfgstore','storage','storagemodel','memory','cpus','nics','nicmodel','bootorder','virtflags']); my $mactab = xCAT::Table->new("mac",-create=>1); my $nrtab= xCAT::Table->new("noderes",-create=>1); $cfghash->{mac} = $mactab->getAllNodeAttribs(['mac'],1); diff --git a/xCAT-server/lib/xcat/plugins/esx.pm b/xCAT-server/lib/xcat/plugins/esx.pm index ae48ab7f5..a0a1ebfbb 100644 --- a/xCAT-server/lib/xcat/plugins/esx.pm +++ b/xCAT-server/lib/xcat/plugins/esx.pm @@ -1955,6 +1955,8 @@ sub create_storage_devs { my %disktocont; my $dev; my @storelocs = split /,/,$tablecfg{vm}->{$node}->[0]->{storage}; + my $globaldisktype = $tablecfg{vm}->{$node}->[0]->{storagemodel}; + unless ($globaldisktype) { $globaldisktype='ide'; } #number of devices is the larger of the specified sizes (TODO: masters) or storage pools to span my $numdevs = (scalar @storelocs > scalar @sizes ? scalar @storelocs : scalar @sizes); while ($numdevs-- > 0) { @@ -1963,7 +1965,7 @@ sub create_storage_devs { my $disksize = shift @sizes; unless (scalar @sizes) { @sizes = ($disksize); } #if we emptied the array, stick the last entry back on to allow it to specify all remaining disks $disksize = getUnits($disksize,'G',1024); - $disktype = 'ide'; + $disktype = $globaldisktype; if ($storeloc =~ /=/) { ($storeloc,$disktype) = split /=/,$storeloc; } diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 5473a87b7..9a8f92834 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -283,7 +283,11 @@ sub build_diskstruct { my $diskhash; $disk =~ s/=(.*)//; my $model = $1; - unless ($model) { $model = 'ide'; } + unless ($model) { + #if not defined, model will stay undefined like above + $model = $confdata->{vm}->{$node}->[0]->{storagemodel} + unless ($model) { $model = 'ide'; } #if still not defined, ide + } my $prefix='hd'; if ($model eq 'virtio') { $prefix='vd'; @@ -427,6 +431,9 @@ sub build_nicstruct { } $nic =~ s/.*://; #the detail of how the bridge was built is of no #interest to this segment of code + if ($confdata->{vm}->{$node}->[0]->{nicmodel}) { + $type = $confdata->{vm}->{$node}->[0]->{nicmodel}; + } if ($nic =~ /=/) { ($nic,$type) = split /=/,$nic,2; } @@ -822,6 +829,10 @@ sub createstorage { } $filename=~s/=(.*)//; my $model=$1; + unless ($model) { + #if not defined, model will stay undefined like above + $model = $cfginfo->{storagemodel}; + } my $prefix='hd'; if ($model eq 'scsi') { $prefix='sd'; @@ -883,6 +894,10 @@ sub chvm { $location =~ s/,.*//; #no comma specified parameters are valid $location =~ s/=(.*)//; #store model if specified here my $model = $1; + unless ($model) { + #if not defined, model will stay undefined like above + $model = $confdata->{vm}->{$node}->[0]->{storagemodel} + } my $prefix='hd'; if ($model eq 'scsi') { $prefix='sd';