From 056876860a1b2c8b0dbb0bda770397cdce5222c6 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 1 Sep 2010 18:12:41 +0000 Subject: [PATCH] -Support switching models on the VM nics in vmware git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7339 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/esx.pm | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/esx.pm b/xCAT-server/lib/xcat/plugins/esx.pm index fab9aff3a..8ac197c2a 100644 --- a/xCAT-server/lib/xcat/plugins/esx.pm +++ b/xCAT-server/lib/xcat/plugins/esx.pm @@ -2029,17 +2029,23 @@ sub create_nic_devs { connected=>0, startConnected => 1 ); + my $model=$tablecfg{vm}->{$node}->{nicmodel}; + unless ($model) { + $model='e1000'; + } foreach (@networks) { my $pgname = $hyphash{$hyp}->{pgnames}->{$_}; s/.*://; - s/=.*//; + s/=(.*)$//; + my $tmpmodel=$model; + if ($1) { $tmpmodel=$1; } my $netname = $_; #print Dumper($netmap); my $backing = VirtualEthernetCardNetworkBackingInfo->new( network => $netmap->{$pgname}, deviceName=>$pgname, ); - my $newcard=VirtualE1000->new( + my %newcardargs=( key=>0,#3, #$currkey++, backing=>$backing, addressType=>"manual", @@ -2047,6 +2053,22 @@ sub create_nic_devs { connectable=>$connprefs, wakeOnLanEnabled=>1, #TODO: configurable in tables? ); + my $newcard; + if ($tmpmodel eq 'e1000') { + $newcard=VirtualE1000->new(%newcardargs); + } elsif ($tmpmodel eq 'vmxnet3') { + $newcard=VirtualVmxnet3->new(%newcardargs); + } elsif ($tmpmodel eq 'pcnet32') { + $newcard=VirtualPCNet32->new(%newcardargs); + } elsif ($tmpmodel eq 'vmxnet2') { + $newcard=VirtualVmxnet2->new(%newcardargs); + } elsif ($tmpmodel eq 'vmxnet') { + $newcard=VirtualVmxnet->new(%newcardargs); + } else { + xCAT::SvrUtils::sendmsg([1,"$tmpmodel not a recognized nic type, falling back to e1000 (vmxnet3, e1000, pcnet32, vmxnet2, vmxnet are recognized"], $output_handler,$node); + $newcard=VirtualE1000->new(%newcardargs); + } + push @devs,VirtualDeviceConfigSpec->new(device => $newcard, operation => VirtualDeviceConfigSpecOperation->new('add')); $idx++;