Storage Pod Create VM Task

Storage Pod Create VM Task

Creates a new virtual machine in the current folder and attaches it to the specified resource pool.

This operation creates a virtual machine, instead of cloning a virtual machine from an existing one.

The server does not support creating templates using this method. Instead, you should create templates by marking existing virtual machines as templates, or by cloning an existing virtual machine or template.

This operation only works if the folder's childType includes VirtualMachine. In addition to the VirtualMachine.Inventory.Create privilege, may also require any of the following privileges depending on the properties of the virtual machine bring created:

  • VirtualMachine.Config.AddExistingDisk if including a virtual disk device that refers to an existing virtual disk file (not RDM)
  • VirtualMachine.Config.AddNewDisk if including a virtual disk device that creates a new virtual disk file (not RDM)
  • VirtualMachine.Config.RawDevice if including a raw device mapping (RDM) or SCSI passthrough device
  • VirtualMachine.Config.HostUSBDevice if including a VirtualUSB device backed by a host USB device
  • VirtualMachine.Config.AdvancedConfig if setting values in ConfigSpec.extraConfig
  • VirtualMachine.Config.SwapPlacement if setting swapPlacement
  • VirtualMachine.Config.ChangeTracking if setting changed block tracking for the virtual machine's disks.
  • Datastore.AllocateSpace required on all datastores where the virtual machine and its virtual disks will be created
  • Network.Assign required on the network which is assigned to the new virtual machine that is being created
  • Cryptographer.EncryptNew on the folder if the created virtual machine is encrypted
  • Cryptographer.RegisterHost on the host if the created virtual machine is encrypted, but encryption is not enabled on the host

To create a VirtualDisk on a persistent memory storage, the storage must be specified via profile while the datastore property of corresponding VirtualDisk backing must be unset.

To create a VirtualNVDIMM device, the storage profile must be set to the default persistent memory storage profile while the datastore property of the device backing must be unset.

Required privileges: VirtualMachine.Inventory.Create

Request
URI
POST
https://{vcenter-host}/sdk/vim25/{release}/StoragePod/{moId}/CreateVM_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 StoragePod/{moId}.

string
release
Required

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


Request Body
CreateVMRequestType of type(s) application/json
Required

Show optional properties

{
    "config": {},
    "pool": {}
}
{
    "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,
        "metroFtEnabled": false,
        "metroFtHostGroup": "string"
    },
    "pool": {
        "_typeName": "string",
        "type": "string",
        "value": "string"
    },
    "host": {
        "_typeName": "string",
        "type": "string",
        "value": "string"
    }
}
config
Required

This data object type encapsulates configuration settings when creating or reconfiguring a virtual machine.

To support incremental changes, these properties are all optional. If an optional property is unset, or any nested optional property is unset, the property will not be changed unless 'unset' is a valid value for the property. To determine whether 'unset' is a valid value for a particular property, refer to the documentation for that property.

pool
Required

Reference to an instance of the ResourcePool managed object.

host
Optional

Reference to an instance of the HostSystem managed object.

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 created 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

VmConfigFault: if the configSpec has incorrect values. Typically, a more specific subclass is thrown.

OutOfBounds: if Host.capability.maxSupportedVMs is exceeded.

FileAlreadyExists: if the requested cfgPath for the virtual machine's configuration file already exists.

FileFault: if there is a problem creating the virtual machine on disk. Typically, a more specific subclass, such as NoDiskSpace, will be thrown.

DuplicateName: if another virtual machine in the same folder already has the specified target name.

InvalidName: if the name is not a valid entity name.

NotSupported: if the virtual machine is being created within a folder whose childType property is not set to "VirtualMachine".

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

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

VmWwnConflict: if the WWN of the virtual machine has been used by other virtual machines.

AlreadyExists: if the requested cfgPath (or the default cfgPath) for the virtual machine's configuration file is already loaded in the inventory.

InvalidState: if the operation is not allowed in current state of the entities involved.

NoPermission: if the created virtual machine is encrypted but the user does not have Cryptographer.EncryptNew on the folder.

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"
        }
    ]
}