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://{api_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 9.0.0.0 APIs.


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

The configuration of the virtual machine hardware.

pool
Required

The resource pool to which the virtual machine will be attached.

Required privileges: Resource.AssignVMToPool

host
Optional

The target host on which the virtual machine will run. This must specify a host that is a member of the ComputeResource indirectly specified by the pool. For a stand-alone host or a cluster with DRS, host can be omitted, and the system selects a default.

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
"MoRefTask Object"

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: InlineVimFault0
"VimFault Object"

Code Samples
COPY
                    curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '[{}]' https://{api_host}/sdk/vim25/{release}/StoragePod/{moId}/CreateVM_Task
                
Virtual Infrastructure Operations
POST
Storage Pod Add Standalone Host Task
POST
Storage Pod Batch Add Hosts To Cluster Task
POST
Storage Pod Batch Add Standalone Hosts Task
POST
Storage Pod Create Cluster
Deprecated
POST
Storage Pod Create Cluster Ex
POST
Storage Pod Create Datacenter
POST
Storage Pod Create DVS Task
POST
Storage Pod Create Folder
POST
Storage Pod Create Storage Pod
POST
Storage Pod Create VM Task
POST
Storage Pod Destroy Task
POST
Storage Pod Move Into Folder Task
POST
Storage Pod Register VM Task
POST
Storage Pod Reload
POST
Storage Pod Rename Task
POST
Storage Pod Set Custom Value
POST
Storage Pod Unregister And Destroy Task
GET
Storage Pod Get Alarm Actions Enabled
GET
Storage Pod Get Available Field
GET
Storage Pod Get Child Entity
GET
Storage Pod Get Child Type
GET
Storage Pod Get Config Issue
GET
Storage Pod Get Config Status
GET
Storage Pod Get Custom Value
GET
Storage Pod Get Declared Alarm State
GET
Storage Pod Get Disabled Method
GET
Storage Pod Get Effective Role
GET
Storage Pod Get Externally Managed Folder Info
GET
Storage Pod Get Name
GET
Storage Pod Get Namespace
GET
Storage Pod Get Overall Status
GET
Storage Pod Get Parent
GET
Storage Pod Get Permission
GET
Storage Pod Get Pod Storage Drs Entry
GET
Storage Pod Get Recent Task
GET
Storage Pod Get Summary
GET
Storage Pod Get Tag
GET
Storage Pod Get Triggered Alarm State
GET
Storage Pod Get Value