Virtual Machine Clone VM Task

Virtual Machine Clone VM Task

Creates a clone of this virtual machine.

If the virtual machine is used as a template, this method corresponds to the deploy command.

Any % (percent) character used in this name parameter must be escaped, unless it is used to start an escape sequence. Clients may also escape any other characters in this name parameter.

The privilege required on the source virtual machine depends on the source and destination types:

  • source is virtual machine, destination is virtual machine - VirtualMachine.Provisioning.Clone
  • source is virtual machine, destination is template - VirtualMachine.Provisioning.CreateTemplateFromVM
  • source is template, destination is virtual machine - VirtualMachine.Provisioning.DeployTemplate
  • source is template, destination is template - VirtualMachine.Provisioning.CloneTemplate
  • source is encrypted virtual machine - Cryptographer.Clone

If customization is requested in the CloneSpec, then the VirtualMachine.Provisioning.Customize privilege must also be held on the source virtual machine.

The Resource.AssignVMToPool privilege is also required for the resource pool specified in the CloneSpec, if the destination is not a template. The Datastore.AllocateSpace privilege is required on all datastores where the clone is created.

Request
URI
POST
https://{vcenter-host}/sdk/vim25/{release}/VirtualMachine/{moId}/CloneVM_Task
COPY
Path Parameters
string
moId
Required

The unique identifier for the managed object to which the method attaches; the serialized managed object reference for a request has the form moType/moId, in this case VirtualMachine/{moId}.

string
release
Required

The vSphere release schema. The current specification covers vSphere 8.0.2.0 APIs.


Request Body
CloneVMRequestType of type(s) application/json
Required
{
    "folder": {
        "_typeName": "string",
        "type": "string",
        "value": "string"
    },
    "name": "string",
    "spec": {
        "_typeName": "string",
        "location": {
            "_typeName": "string",
            "service": {
                "_typeName": "string",
                "instanceUuid": "string",
                "url": "string",
                "credential": {
                    "_typeName": "string"
                },
                "sslThumbprint": "string"
            },
            "folder": {
                "_typeName": "string",
                "type": "string",
                "value": "string"
            },
            "datastore": {
                "_typeName": "string",
                "type": "string",
                "value": "string"
            },
            "diskMoveType": "string",
            "pool": {
                "_typeName": "string",
                "type": "string",
                "value": "string"
            },
            "host": {
                "_typeName": "string",
                "type": "string",
                "value": "string"
            },
            "disk": [
                {
                    "_typeName": "string",
                    "diskId": 0,
                    "datastore": {
                        "_typeName": "string",
                        "type": "string",
                        "value": "string"
                    },
                    "diskMoveType": "string",
                    "diskBackingInfo": {
                        "_typeName": "string"
                    },
                    "profile": [
                        {
                            "_typeName": "string"
                        }
                    ],
                    "backing": {
                        "_typeName": "string",
                        "parent": "VirtualMachineRelocateSpecDiskLocatorBackingSpec Object",
                        "crypto": {
                            "_typeName": "string"
                        }
                    },
                    "filterSpec": [
                        {
                            "_typeName": "string"
                        }
                    ]
                }
            ],
            "transform": "string",
            "deviceChange": [
                {
                    "_typeName": "string",
                    "operation": "string",
                    "fileOperation": "string",
                    "device": {
                        "_typeName": "string",
                        "key": 0,
                        "deviceInfo": {
                            "_typeName": "string",
                            "label": "string",
                            "summary": "string"
                        },
                        "backing": {
                            "_typeName": "string"
                        },
                        "connectable": {
                            "_typeName": "string",
                            "migrateConnect": "string",
                            "startConnected": false,
                            "allowGuestControl": false,
                            "connected": false,
                            "status": "string"
                        },
                        "slotInfo": {
                            "_typeName": "string"
                        },
                        "controllerKey": 0,
                        "unitNumber": 0,
                        "numaNode": 0,
                        "deviceGroupInfo": {
                            "_typeName": "string",
                            "groupInstanceKey": 0,
                            "sequenceId": 0
                        }
                    },
                    "profile": [
                        {
                            "_typeName": "string"
                        }
                    ],
                    "backing": {
                        "_typeName": "string",
                        "parent": "VirtualDeviceConfigSpecBackingSpec Object",
                        "crypto": {
                            "_typeName": "string"
                        }
                    },
                    "filterSpec": [
                        {
                            "_typeName": "string"
                        }
                    ],
                    "changeMode": "string"
                }
            ],
            "profile": [
                {
                    "_typeName": "string"
                }
            ],
            "cryptoSpec": {
                "_typeName": "string"
            }
        },
        "template": false,
        "config": {
            "_typeName": "string",
            "changeVersion": "string",
            "name": "string",
            "version": "string",
            "createDate": "string",
            "uuid": "string",
            "instanceUuid": "string",
            "npivNodeWorldWideName": [
                0
            ],
            "npivPortWorldWideName": [
                0
            ],
            "npivWorldWideNameType": "string",
            "npivDesiredNodeWwns": 0,
            "npivDesiredPortWwns": 0,
            "npivTemporaryDisabled": false,
            "npivOnNonRdmDisks": false,
            "npivWorldWideNameOp": "string",
            "locationId": "string",
            "guestId": "string",
            "alternateGuestName": "string",
            "annotation": "string",
            "files": {
                "_typeName": "string",
                "vmPathName": "string",
                "snapshotDirectory": "string",
                "suspendDirectory": "string",
                "logDirectory": "string",
                "ftMetadataDirectory": "string"
            },
            "tools": {
                "_typeName": "string",
                "toolsVersion": 0,
                "toolsInstallType": "string",
                "afterPowerOn": false,
                "afterResume": false,
                "beforeGuestStandby": false,
                "beforeGuestShutdown": false,
                "beforeGuestReboot": false,
                "toolsUpgradePolicy": "string",
                "pendingCustomization": "string",
                "customizationKeyId": {
                    "_typeName": "string",
                    "keyId": "string",
                    "providerId": {
                        "_typeName": "string",
                        "id": "string"
                    }
                },
                "syncTimeWithHostAllowed": false,
                "syncTimeWithHost": false,
                "lastInstallInfo": {
                    "_typeName": "string",
                    "counter": 0,
                    "fault": {
                        "_typeName": "string",
                        "faultCause": "MethodFault Object",
                        "faultMessage": [
                            {
                                "_typeName": "string",
                                "key": "string",
                                "arg": [
                                    {
                                        "_typeName": "string",
                                        "key": "string",
                                        "value": {
                                            "_typeName": "string"
                                        }
                                    }
                                ],
                                "message": "string"
                            }
                        ]
                    }
                }
            },
            "flags": {
                "_typeName": "string",
                "disableAcceleration": false,
                "enableLogging": false,
                "useToe": false,
                "runWithDebugInfo": false,
                "monitorType": "string",
                "htSharing": "string",
                "snapshotDisabled": false,
                "snapshotLocked": false,
                "diskUuidEnabled": false,
                "virtualMmuUsage": "string",
                "virtualExecUsage": "string",
                "snapshotPowerOffBehavior": "string",
                "recordReplayEnabled": false,
                "faultToleranceType": "string",
                "cbrcCacheEnabled": false,
                "vvtdEnabled": false,
                "vbsEnabled": false
            },
            "consolePreferences": {
                "_typeName": "string",
                "powerOnWhenOpened": false,
                "enterFullScreenOnPowerOn": false,
                "closeOnPowerOffOrSuspend": false
            },
            "powerOpInfo": {
                "_typeName": "string",
                "powerOffType": "string",
                "suspendType": "string",
                "resetType": "string",
                "defaultPowerOffType": "string",
                "defaultSuspendType": "string",
                "defaultResetType": "string",
                "standbyAction": "string"
            },
            "rebootPowerOff": false,
            "numCPUs": 0,
            "vcpuConfig": [
                {
                    "_typeName": "string",
                    "latencySensitivity": {
                        "_typeName": "string",
                        "level": "string",
                        "sensitivity": 0
                    }
                }
            ],
            "numCoresPerSocket": 0,
            "memoryMB": 0,
            "memoryHotAddEnabled": false,
            "cpuHotAddEnabled": false,
            "cpuHotRemoveEnabled": false,
            "virtualICH7MPresent": false,
            "virtualSMCPresent": false,
            "deviceChange": [
                {
                    "_typeName": "string",
                    "operation": "string",
                    "fileOperation": "string",
                    "device": {
                        "_typeName": "string",
                        "key": 0,
                        "deviceInfo": {
                            "_typeName": "string",
                            "label": "string",
                            "summary": "string"
                        },
                        "backing": {
                            "_typeName": "string"
                        },
                        "connectable": {
                            "_typeName": "string",
                            "migrateConnect": "string",
                            "startConnected": false,
                            "allowGuestControl": false,
                            "connected": false,
                            "status": "string"
                        },
                        "slotInfo": {
                            "_typeName": "string"
                        },
                        "controllerKey": 0,
                        "unitNumber": 0,
                        "numaNode": 0,
                        "deviceGroupInfo": {
                            "_typeName": "string",
                            "groupInstanceKey": 0,
                            "sequenceId": 0
                        }
                    },
                    "profile": [
                        {
                            "_typeName": "string"
                        }
                    ],
                    "backing": {
                        "_typeName": "string",
                        "parent": "VirtualDeviceConfigSpecBackingSpec Object",
                        "crypto": {
                            "_typeName": "string"
                        }
                    },
                    "filterSpec": [
                        {
                            "_typeName": "string"
                        }
                    ],
                    "changeMode": "string"
                }
            ],
            "cpuAllocation": {
                "_typeName": "string",
                "reservation": 0,
                "expandableReservation": false,
                "limit": 0,
                "shares": {
                    "_typeName": "string",
                    "shares": 0,
                    "level": "string"
                },
                "overheadLimit": 0
            },
            "memoryAllocation": {
                "_typeName": "string",
                "reservation": 0,
                "expandableReservation": false,
                "limit": 0,
                "shares": {
                    "_typeName": "string",
                    "shares": 0,
                    "level": "string"
                },
                "overheadLimit": 0
            },
            "latencySensitivity": {
                "_typeName": "string",
                "level": "string",
                "sensitivity": 0
            },
            "cpuAffinity": {
                "_typeName": "string",
                "affinitySet": [
                    0
                ]
            },
            "memoryAffinity": {
                "_typeName": "string",
                "affinitySet": [
                    0
                ]
            },
            "networkShaper": {
                "_typeName": "string",
                "enabled": false,
                "peakBps": 0,
                "averageBps": 0,
                "burstSize": 0
            },
            "cpuFeatureMask": [
                {
                    "_typeName": "string",
                    "operation": "string",
                    "removeKey": {
                        "_typeName": "string"
                    },
                    "info": {
                        "_typeName": "string",
                        "level": 0,
                        "vendor": "string",
                        "eax": "string",
                        "ebx": "string",
                        "ecx": "string",
                        "edx": "string"
                    }
                }
            ],
            "extraConfig": [
                {
                    "_typeName": "string",
                    "key": "string",
                    "value": {
                        "_typeName": "string"
                    }
                }
            ],
            "swapPlacement": "string",
            "bootOptions": {
                "_typeName": "string",
                "bootDelay": 0,
                "enterBIOSSetup": false,
                "efiSecureBootEnabled": false,
                "bootRetryEnabled": false,
                "bootRetryDelay": 0,
                "bootOrder": [
                    {
                        "_typeName": "string"
                    }
                ],
                "networkBootProtocol": "string"
            },
            "vAppConfig": {
                "_typeName": "string",
                "product": [
                    {
                        "_typeName": "string",
                        "operation": "string",
                        "removeKey": {
                            "_typeName": "string"
                        },
                        "info": {
                            "_typeName": "string",
                            "key": 0,
                            "classId": "string",
                            "instanceId": "string",
                            "name": "string",
                            "vendor": "string",
                            "version": "string",
                            "fullVersion": "string",
                            "vendorUrl": "string",
                            "productUrl": "string",
                            "appUrl": "string"
                        }
                    }
                ],
                "property": [
                    {
                        "_typeName": "string",
                        "operation": "string",
                        "removeKey": {
                            "_typeName": "string"
                        },
                        "info": {
                            "_typeName": "string",
                            "key": 0,
                            "classId": "string",
                            "instanceId": "string",
                            "id": "string",
                            "category": "string",
                            "label": "string",
                            "type": "string",
                            "typeReference": "string",
                            "userConfigurable": false,
                            "defaultValue": "string",
                            "value": "string",
                            "description": "string"
                        }
                    }
                ],
                "ipAssignment": {
                    "_typeName": "string",
                    "supportedAllocationScheme": [
                        "string"
                    ],
                    "ipAllocationPolicy": "string",
                    "supportedIpProtocol": [
                        "string"
                    ],
                    "ipProtocol": "string"
                },
                "eula": [
                    "string"
                ],
                "ovfSection": [
                    {
                        "_typeName": "string",
                        "operation": "string",
                        "removeKey": {
                            "_typeName": "string"
                        },
                        "info": {
                            "_typeName": "string",
                            "key": 0,
                            "namespace": "string",
                            "type": "string",
                            "atEnvelopeLevel": false,
                            "contents": "string"
                        }
                    }
                ],
                "ovfEnvironmentTransport": [
                    "string"
                ],
                "installBootRequired": false,
                "installBootStopDelay": 0
            },
            "ftInfo": {
                "_typeName": "string",
                "role": 0,
                "instanceUuids": [
                    "string"
                ],
                "configPaths": [
                    "string"
                ],
                "orphaned": false
            },
            "repConfig": {
                "_typeName": "string",
                "generation": 0,
                "vmReplicationId": "string",
                "destination": "string",
                "port": 0,
                "rpo": 0,
                "quiesceGuestEnabled": false,
                "paused": false,
                "oppUpdatesEnabled": false,
                "netCompressionEnabled": false,
                "netEncryptionEnabled": false,
                "encryptionDestination": "string",
                "encryptionPort": 0,
                "remoteCertificateThumbprint": "string",
                "dataSetsReplicationEnabled": false,
                "disk": [
                    {
                        "_typeName": "string",
                        "key": 0,
                        "diskReplicationId": "string"
                    }
                ]
            },
            "vAppConfigRemoved": false,
            "vAssertsEnabled": false,
            "changeTrackingEnabled": false,
            "firmware": "string",
            "maxMksConnections": 0,
            "guestAutoLockEnabled": false,
            "managedBy": {
                "_typeName": "string",
                "extensionKey": "string",
                "type": "string"
            },
            "memoryReservationLockedToMax": false,
            "nestedHVEnabled": false,
            "vPMCEnabled": false,
            "scheduledHardwareUpgradeInfo": {
                "_typeName": "string",
                "upgradePolicy": "string",
                "versionKey": "string",
                "scheduledHardwareUpgradeStatus": "string",
                "fault": {
                    "_typeName": "string",
                    "faultCause": "MethodFault Object",
                    "faultMessage": [
                        {
                            "_typeName": "string",
                            "key": "string",
                            "arg": [
                                {
                                    "_typeName": "string",
                                    "key": "string",
                                    "value": {
                                        "_typeName": "string"
                                    }
                                }
                            ],
                            "message": "string"
                        }
                    ]
                }
            },
            "vmProfile": [
                {
                    "_typeName": "string"
                }
            ],
            "messageBusTunnelEnabled": false,
            "crypto": {
                "_typeName": "string"
            },
            "migrateEncryption": "string",
            "sgxInfo": {
                "_typeName": "string",
                "epcSize": 0,
                "flcMode": "string",
                "lePubKeyHash": "string",
                "requireAttestation": false
            },
            "ftEncryptionMode": "string",
            "guestMonitoringModeInfo": {
                "_typeName": "string",
                "gmmFile": "string",
                "gmmAppliance": "string"
            },
            "sevEnabled": false,
            "virtualNuma": {
                "_typeName": "string",
                "coresPerNumaNode": 0,
                "exposeVnumaOnCpuHotadd": false
            },
            "motherboardLayout": "string",
            "pmemFailoverEnabled": false,
            "vmxStatsCollectionEnabled": false,
            "vmOpNotificationToAppEnabled": false,
            "vmOpNotificationTimeout": 0,
            "deviceSwap": {
                "_typeName": "string",
                "lsiToPvscsi": {
                    "_typeName": "string",
                    "enabled": false,
                    "applicable": false,
                    "status": "string"
                }
            },
            "simultaneousThreads": 0,
            "pmem": {
                "_typeName": "string",
                "snapshotMode": "string"
            },
            "deviceGroups": {
                "_typeName": "string",
                "deviceGroup": [
                    {
                        "_typeName": "string",
                        "groupInstanceKey": 0,
                        "deviceInfo": {
                            "_typeName": "string",
                            "label": "string",
                            "summary": "string"
                        }
                    }
                ]
            },
            "fixedPassthruHotPlugEnabled": false
        },
        "customization": {
            "_typeName": "string",
            "options": {
                "_typeName": "string"
            },
            "identity": {
                "_typeName": "string"
            },
            "globalIPSettings": {
                "_typeName": "string",
                "dnsSuffixList": [
                    "string"
                ],
                "dnsServerList": [
                    "string"
                ]
            },
            "nicSettingMap": [
                {
                    "_typeName": "string",
                    "macAddress": "string",
                    "adapter": {
                        "_typeName": "string",
                        "ip": {
                            "_typeName": "string"
                        },
                        "subnetMask": "string",
                        "gateway": [
                            "string"
                        ],
                        "ipV6Spec": {
                            "_typeName": "string",
                            "ip": [
                                {
                                    "_typeName": "string"
                                }
                            ],
                            "gateway": [
                                "string"
                            ]
                        },
                        "dnsServerList": [
                            "string"
                        ],
                        "dnsDomain": "string",
                        "primaryWINS": "string",
                        "secondaryWINS": "string",
                        "netBIOS": "string"
                    }
                }
            ],
            "encryptionKey": [
                0
            ]
        },
        "powerOn": false,
        "snapshot": {
            "_typeName": "string",
            "type": "string",
            "value": "string"
        },
        "memory": false,
        "tpmProvisionPolicy": "string"
    }
}
folder
Required

Reference to an instance of the Folder managed object.

string
name
Required

The name of the new virtual machine.

spec
Required

Specification for a virtual machine cloning operation.

Authentication
This operation uses the following authentication methods.
Responses
200

This method returns a Task object with which to monitor the operation. The info.result property in the Task contains the newly added VirtualMachine upon success.

Returns MoRefTask of type(s) application/json
This response body class contains all of the following: MoRefExtensibleManagedObject
{
    "_typeName": "string",
    "type": "string",
    "value": "string"
}

500

InvalidArgument: if the host cannot run this virtual machine.

CustomizationFault: if a customization error happens. Typically, a specific subclass of this exception is thrown.

TaskInProgress: if the virtual machine is busy.

NotSupported: if the operation is not supported by the current agent.

InvalidState: if the operation cannot be performed because of the virtual machine's current state. For example, if the virtual machine configuration information is not available.

InvalidDatastore: if the operation cannot be performed on the target datastores.

FileFault: if there is an error accessing the virtual machine files.

VmConfigFault: if the virtual machine is not compatible with the destination host. Typically, a specific subclass of this exception is thrown, such as IDEDiskNotSupported.

MigrationFault: if it is not possible to migrate the virtual machine to the destination host. This is typically due to hosts being incompatible, such as mismatch in network polices or access to networks and datastores. Typically, a more specific subclass is thrown.

InsufficientResourcesFault: if this operation would violate a resource usage policy.

NoPermission: if the virtual machine is encrypted, but encryption is not enabled on the destination and the user does not have Cryptographer.RegisterHost permission on the host.

NoPermission: if source virtual machine is encrypted, but the the user does not have Cryptographer.Clone permission on it.

Returns VimFault of type(s) application/json
This response body class contains all of the following: MethodFault
{
    "_typeName": "string",
    "faultCause": "MethodFault Object",
    "faultMessage": [
        {
            "_typeName": "string",
            "key": "string",
            "arg": [
                {
                    "_typeName": "string",
                    "key": "string",
                    "value": {
                        "_typeName": "string"
                    }
                }
            ],
            "message": "string"
        }
    ]
}

Virtual Machine Operations
POST
Virtual Machine Acquire Mks Ticket
POST
Virtual Machine Acquire Ticket
POST
Virtual Machine Answer VM
POST
Virtual Machine Apply Evc Mode VM Task
POST
Virtual Machine Attach Disk Task
POST
Virtual Machine Check Customization Spec
POST
Virtual Machine Clone VM Task
POST
Virtual Machine Consolidate VM Disks Task
POST
Virtual Machine Create Screenshot Task
POST
Virtual Machine Create Secondary VM Task
POST
Virtual Machine Create Secondary VM Ex Task
POST
Virtual Machine Create Snapshot Task
POST
Virtual Machine Create Snapshot Ex Task
POST
Virtual Machine Crypto Unlock Task
POST
Virtual Machine Customize VM Task
POST
Virtual Machine Defragment All Disks
POST
Virtual Machine Destroy Task
POST
Virtual Machine Detach Disk Task
POST
Virtual Machine Disable Secondary VM Task
POST
Virtual Machine Drop Connections
POST
Virtual Machine Enable Secondary VM Task
POST
Virtual Machine Estimate Storage For Consolidate Snapshots Task
POST
Virtual Machine Export Vm
POST
Virtual Machine Extract Ovf Environment
GET
Virtual Machine Get Alarm Actions Enabled
GET
Virtual Machine Get Available Field
GET
Virtual Machine Get Capability
GET
Virtual Machine Get Config
GET
Virtual Machine Get Config Issue
GET
Virtual Machine Get Config Status
GET
Virtual Machine Get Custom Value
GET
Virtual Machine Get Datastore
GET
Virtual Machine Get Declared Alarm State
GET
Virtual Machine Get Disabled Method
GET
Virtual Machine Get Effective Role
GET
Virtual Machine Get Environment Browser
GET
Virtual Machine Get Guest
GET
Virtual Machine Get Guest Heartbeat Status
GET
Virtual Machine Get Layout
GET
Virtual Machine Get Layout Ex
GET
Virtual Machine Get Name
GET
Virtual Machine Get Network
GET
Virtual Machine Get Overall Status
GET
Virtual Machine Get Parent
GET
Virtual Machine Get Parent V App
GET
Virtual Machine Get Permission
GET
Virtual Machine Get Recent Task
GET
Virtual Machine Get Resource Config
GET
Virtual Machine Get Resource Pool
GET
Virtual Machine Get Root Snapshot
GET
Virtual Machine Get Runtime
GET
Virtual Machine Get Snapshot
GET
Virtual Machine Get Storage
GET
Virtual Machine Get Summary
GET
Virtual Machine Get Tag
GET
Virtual Machine Get Triggered Alarm State
GET
Virtual Machine Get Value
POST
Virtual Machine Instant Clone Task
POST
Virtual Machine Make Primary VM Task
POST
Virtual Machine Mark As Template
POST
Virtual Machine Mark As Virtual Machine
POST
Virtual Machine Migrate VM Task
POST
Virtual Machine Mount Tools Installer
POST
Virtual Machine Power Off VM Task
POST
Virtual Machine Power On VM Task
POST
Virtual Machine Promote Disks Task
POST
Virtual Machine Put Usb Scan Codes
POST
Virtual Machine Query Changed Disk Areas
POST
Virtual Machine Query Connections
POST
Virtual Machine Query Fault Tolerance Compatibility
POST
Virtual Machine Query Fault Tolerance Compatibility Ex
POST
Virtual Machine Query Unowned Files
POST
Virtual Machine Reboot Guest
POST
Virtual Machine Reconfig VM Task
POST
Virtual Machine Refresh Storage Info
POST
Virtual Machine Reload
POST
Virtual Machine Reload Virtual Machine From Path Task
POST
Virtual Machine Relocate VM Task
POST
Virtual Machine Remove All Snapshots Task
POST
Virtual Machine Rename Task
POST
Virtual Machine Reset Guest Information
POST
Virtual Machine Reset VM Task
POST
Virtual Machine Revert To Current Snapshot Task
POST
Virtual Machine Send NMI
POST
Virtual Machine Set Custom Value
POST
Virtual Machine Set Display Topology
POST
Virtual Machine Set Screen Resolution
POST
Virtual Machine Shutdown Guest
POST
Virtual Machine Standby Guest
POST
Virtual Machine Start Recording Task
POST
Virtual Machine Start Replaying Task
POST
Virtual Machine Stop Recording Task
POST
Virtual Machine Stop Replaying Task
POST
Virtual Machine Suspend VM Task
POST
Virtual Machine Terminate Fault Tolerant VM Task
POST
Virtual Machine Terminate VM
POST
Virtual Machine Turn Off Fault Tolerance For VM Task
POST
Virtual Machine Unmount Tools Installer
POST
Virtual Machine Unregister VM
POST
Virtual Machine Upgrade Tools Task
POST
Virtual Machine Upgrade VM Task