From 8251123d261f21e5c9560fc2a8a8601f1f13afe4 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 13 Jul 2012 13:42:33 +0000 Subject: [PATCH] vSphere autologin configurability git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13292 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Schema.pm | 3 ++- xCAT-server/lib/xcat/plugins/esx.pm | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 7d74d038c..88c9293ba 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -167,7 +167,7 @@ vmmaster => { #storagemodel to allow chvm on a clone to be consistent with the master by default #nics to track the network mapping that may not be preserved by the respective plugin's specific cfg info #nicmodel same as storagemodel, except omitting for now until chvm actually does nics... - cols => [qw(name os arch profile storage storagemodel nics vintage originator virttype comments disable)], + cols => [qw(name os arch profile storage storagemodel nics vintage originator virttype specializeparameters comments disable)], keys => [qw(name)], nodecol => 'name', #well what do you know, I used it... table_desc => 'Inventory of virtualization images for use with clonevm. Manual intervention in this table is not intended.', @@ -181,6 +181,7 @@ vmmaster => { 'nics' => 'The nic configuration and relationship to vlans/bonds/etc', 'vintage' => "When this image was created", 'originator' => 'The user who created the image', + 'specializeparameters' => 'Implementation specific arguments, currently only "autoLogonCount= 'The type of virtualization this image pertains to (e.g. vmware, kvm, etc)', } }, diff --git a/xCAT-server/lib/xcat/plugins/esx.pm b/xCAT-server/lib/xcat/plugins/esx.pm index ade4a0f6a..cad5f76c7 100644 --- a/xCAT-server/lib/xcat/plugins/esx.pm +++ b/xCAT-server/lib/xcat/plugins/esx.pm @@ -2198,7 +2198,7 @@ sub clonevms { my $masterref; if ($base) { #if base, we need to pull in the target datastores my $mastertab=xCAT::Table->new('vmmaster'); - $masterref=$mastertab->getNodeAttribs( $base,[qw/storage os arch profile storagemodel nics/]); + $masterref=$mastertab->getNodeAttribs( $base,[qw/storage os arch profile storagemodel nics specializeparameters/]); unless ($masterref) { foreach my $node (@$nodes) { xCAT::SvrUtils::sendmsg([1,"Cannot find master $base in vmmaster table"], $output_handler,$node); @@ -2350,7 +2350,9 @@ sub clone_vms_from_master { $clonespecargs{snapshot}=$masterview->snapshot->currentSnapshot; } if ($specialize) { - $clonespecargs{customization} = make_customization_spec($node,ostype=>$ostype); + my %custargs; + if ($masterent->{specializeparameters}) { %custargs = ( parameters=>$masterent->{specializeparameters} ); } + $clonespecargs{customization} = make_customization_spec($node,ostype=>$ostype,%custargs); } my $clonespec = VirtualMachineCloneSpec->new(%clonespecargs); my $vmfolder = $vmhash{$node}->{vmfolder}; @@ -2417,13 +2419,19 @@ sub make_customization_spec { ) ); } - + my %autologonargs = ( autoLogon=>0, autoLogonCount=>1, ); + if ($args{parameters} and $args{parameters} =~ /autoLogonCount=([^,]*)/i) { + my $count = $1; + if ($count) { + $autologonargs{autoLogon}=1; + $autologonargs{autoLogonCount}=$count; + } + } my $identity = CustomizationSysprep->new( %runonce, %lfpd, guiUnattended => CustomizationGuiUnattended->new( - autoLogon=>0, - autoLogonCount=>1, + %autologonargs, password=>CustomizationPassword->new( plainText=>1, value=>$password,