Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 170134

Re: Need some help getting started with cloning via customization specification

$
0
0

Here is what I did:

 

I create an action; with 3 inputs as follows:

specName                string                              Name of the customization Specification to look for             

SDKConnection        VC:SdkConnection           Vcenter Server to connect to

VMtocustomize        VC:VirtualMachine            Name of the VM to Customize

 

script in the action:

var custspec = new VcCustomizationSpec();

var con = SDKConnection;

var cms = con.customizationSpecManager;

var customSpecExists = cms.doesCustomizationSpecExist(specName);

 

 

if (customSpecExists) {

     var customSpecItem = cms.getCustomizationSpec(specName);

    System.debug("got custSpecItem: " + customSpecItem);

    custspec = customSpecItem.spec;

    System.debug("contents custSpec: " + custspec);

  VMtocustomize.customizeVM_Task(custspec);

    } else throw "customspec not found";

 

//let it sleep so it is ready

System.sleep(10*1000);

 

//Start the VM

VMtocustomize.powerOnVM_Task(null);

 

 

I created a workflow; added the built in  workflow "Clone Virtual Machine, no customization" and after that I added my action.

 

Works like a charm for me. Notice I added the powerOnVM at the bottom, the customization will not start until the VM is turned on. Wait about 5 min. and all is well.

 

I did try the code from above from Joerg to change the IP in the spec..;I could find no way to get that to work. I would love to though if someone could help?


Viewing all articles
Browse latest Browse all 170134

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>