Clone VM operation


The Clone VM operation is used to clone a virtual machine with the same configuration as a specified virtual machine. In addition, this operation can be used to clone a virtual machine into a template.

If the <status> response element contains _success_, the <Task> response element contains the ID of the queued task, which you can use to obtain the task status.

The following table describes the elements for this request.

Adapter request elements for the Clone VM operation

Element

Definition

Required

<operation-type>

Defines the type of the operation: Configure_Vm

Yes

<operation-name>

Defines the name of the operation: Clone_VM

Yes

<soap-url>

Specifies the URL for the remote SOAP service running on the VMware VirtualCenter

If the <soap-url> element is not specified, the request uses the VirtualCenter Server details specified in the adapter configuration.

Default format for HTTPS: https://<hostName>:<port>/sdk/vim

Default format for HTTP: http://<hostName>:<port>/sdk/vim

Note

If you want to use an HTTP value, you might need to change the configuration of the VMware Infrastructure application.

No

<transport>

Specifies the transport protocol for the message

If the <transport> element is not provided, the request uses the VirtualCenter Server details specified in the adapter configuration.

Valid values: https-rpc (default), http-rpc

Note

If the value of the <transport> element is https-rpc, you must install the security certificate for the VMware Virtual Center to the keystore of the peer on which the adapter is enabled.

No

<user-name>

Specifies the user name that is used for HTTP basic authentication on the VMware Virtual Center

If no user name is specified, the request is executed with the user name that is specified in the configuration.

No

<password>

Specifies the password corresponding to <user-name>

Conditional; required if <user-name> is specified

<parameters>

Contains the elements required to execute the operation

Yes

<virtual-machine>

Contains the name of the virtual machine intended to be cloned

Yes

<folder>

Specifies the folder in which the clone must be created
If this element is not specified, the clone is created in the default vm folder.

No

<datacenter>

Specifies the name of the datacenter where the clone is to be created

Yes

<name>

Specifies the display name of the virtual machine

Yes

<power-on>

Specifies whether the new virtual machine should be powered on after creation

As part of the customization, this flag is normally set to true, since the first power-on operation completes the customization process. This flag is ignored if a template is being created.

Valid values: true, false

Yes

<template>

Specifies whether the new virtual machine must be marked as a template

Valid values: true, false

Yes

<location>

The location of resources that the newly cloned virtual machine will use

Datastore is a mandatory tag.

For more information about the child elements, see location.

Conditional

If the virtual machine is being cloned from a template

The following code sample shows a sample adapter request for the Clone VM operation.

Sample adapter request for the Clone VM operation

<vmware-infrastructure-request>
    <operation-type>Configure_Vm</operation-type>
    <operation-name>Clone_VM</operation-name>
   <soap-url></soap-url>                    
   <transport></transport>
    <user-name></user-name>
    <password></password>
    <parameters>
        <virtual-machine>win1</virtual-machine>
        <folder></folder>
        <datacenter>Development</datacenter>
        <name>win8</name>
        <spec>
                <power-on>false</power-on>
                <template>false</template>
        </spec>
    </parameters>
</vmware-infrastructure-request>

The following code sample shows the response for the sample Clone VM operation.

Sample adapter response for the Clone VM operation

<vmware-infrastructure-response>
     <metadata>
        <status>success</status>
     </metadata>
     <CloneVM_TaskResponse>
        <Task>task-724</Task>
     </CloneVM_TaskResponse>
</vmware-infrastructure-response>

The following code sample shows a sample adapter request for the Clone VM operation, to clone a virtual machine from a template.

Sample adapter request for the Clone VM operation

<vmware-infrastructure-request>
    <operation-type>Configure_Vm</operation-type>
    <operation-name>Clone_VM</operation-name>
    <user-name></user-name>
    <password></password>
    <parameters>
        <virtual-machine>win1</virtual-machine>
        <folder></folder>
        <datacenter>Development</datacenter>
        <name>win8</name>
        <spec>
            <power-on>false</power-on>
            <template>false</template>
            <location>
               <resource-pool>TestRP</resource-pool>
                <cluster-compute-resource>TestCluster</cluster-compute-resource>
               <host-system>xyz.bmc.com </host-system>
               <datastore>storage1</datastore>
               <transform>flat</transform>
               <disk-list>
                  <disk>
                     <disk-name>Hard Disk 1</disk-name>
                     <datastore>storage1</datastore>
                  </disk>
               </disk-list>
            </location>
        </spec>
    </parameters>
</vmware-infrastructure-request>

The following table describes the response element.

Adapter response element for the Clone VM operation

Element

Definition

<Task>

Specifies the task ID of the submitted task

Use the task ID to obtain the status of the specified task.

For information about using the task ID to check the task status, see Request and response for the Retrieve_Task_Status operation.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*