From ef5b28fa7c7ce31db6b0380dbe42af9fa0e77bbf Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 8 Feb 2011 21:13:19 +0000 Subject: [PATCH] -Expose ability to specify arbitrary vmx key=value pairs via chvm -o git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8802 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/esx.pm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/esx.pm b/xCAT-server/lib/xcat/plugins/esx.pm index 01d4c767c..27257dfcd 100644 --- a/xCAT-server/lib/xcat/plugins/esx.pm +++ b/xCAT-server/lib/xcat/plugins/esx.pm @@ -656,10 +656,12 @@ sub chvm { $SIG{__WARN__} = sub { xCAT::SvrUtils::sendmsg([1,"Could not parse options, ".shift()], $output_handler); }; + my @otherparams; my $rc = GetOptions( "d=s" => \@deregister, "p=s" => \@purge, "a=s" => \@add, + "o=s" => \@otherparams, "resize=s%" => \%resize, "cpus=s" => \$cpuCount, "mem=s" => \$memory @@ -811,6 +813,24 @@ sub chvm { if(@devChanges) { $conargs{deviceChange} = \@devChanges; } + if (@otherparams) { + my $key; + my $value; + my @optionvals; + foreach (@otherparams) { + ($key,$value) = split /=/; + unless ($key) { + xCAT::SvrUtils::sendmsg([1,"Invalid format for other parameter specification"], $output_handler,$node); + return; + } + if ($value) { + push @optionvals,OptionValue->new(key=>$key,value=>$value); + } else { + push @optionvals,OptionValue->new(key=>$key); #the api doc says this is *supposed* to delete a key, don't think it works though, e.g. http://communities.vmware.com/message/1602644 + } + } + $conargs{extraConfig} = \@optionvals; + } my $reconfigspec = VirtualMachineConfigSpec->new(%conargs);