Menu

(no subject)

2016-06-03
2016-06-08
  • mistercaste

    mistercaste - 2016-06-03

    Hi

    While cloning a VM from a template I need to change its network. How can I do that?
    I was thinking to go through the VirtualMachineCloneSpec, however I don't know how.
    Below the snippet of code that I use to clone the virtual machine:

                // Get customization specifications
                CustomizationSpec customizationSpec = serviceInstance.getCustomizationSpecManager().getCustomizationSpec(customizationSpecName).getSpec();
    
                // Setup customization
                VirtualMachineCloneSpec virtualMachineCloneSpec = new VirtualMachineCloneSpec();
                virtualMachineCloneSpec.setCustomization(customizationSpec);
    
                // Get folder reference
                Folder folder = Utilities.getFolder(serviceInstance, datacenterName, folderName);
    
                // Clone VM
                LOG.info("Cloning the VM. Please wait...");
                Task task = vm.cloneVM_Task(folder, newCloneName, virtualMachineCloneSpec);
    

    Thank you

     
  • mistercaste

    mistercaste - 2016-06-08

    ping :)

     

Log in to post a comment.