vcenter VM: register
Creates a virtual machine from existing virtual machine files on storage. This operation was added in vSphere API 6.8.7.
Request:
HTTP request
POST https://{server}/rest/vcenter/vm?action=register
Request Body Structure:
{
"spec" : {
"path" : "string",
"datastore" : "obj-103",
"name" : "string",
"placement" : {
"cluster" : "obj-103",
"folder" : "obj-103",
"host" : "obj-103",
"resource_pool" : "obj-103"
},
"datastore_path" : "string"
}
}
"spec" : {
"path" : "string",
"datastore" : "obj-103",
"name" : "string",
"placement" : {
"cluster" : "obj-103",
"folder" : "obj-103",
"host" : "obj-103",
"resource_pool" : "obj-103"
},
"datastore_path" : "string"
}
}
Request Body Parameters:
Name | Type | Description |
---|---|---|
bold = required | ||
spec | register_spec | Specification of the location of the virtual machine files and the placement of the new virtual machine. |
spec.datastore | string | Identifier of the datastore on which the virtual machine's configuration state is stored. This attribute was added in vSphere API 6.8.7. Optional. If unset, vcenter.VM.register_spec.path must also be unset and vcenter.VM.register_spec.datastore_path must be set.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: Datastore . When operations return a value of this structure as a result, the field will be an identifier for the resource type: Datastore . |
spec.path | string | Path to the virtual machine's configuration file on the datastore corresponding to {@link #datastore). This attribute was added in vSphere API 6.8.7. Optional. If unset, vcenter.VM.register_spec.datastore must also be unset and vcenter.VM.register_spec.datastore_path must be set. |
spec.datastore_path | string | Datastore path for the virtual machine's configuration file in the format "[datastore name] path". For example "[storage1] Test-VM/Test-VM.vmx". This attribute was added in vSphere API 6.8.7. Optional. If unset, both vcenter.VM.register_spec.datastore and vcenter.VM.register_spec.path must be set. |
spec.name | string | Virtual machine name. This attribute was added in vSphere API 6.8.7. Optional. If unset, the display name from the virtual machine's configuration file will be used. |
spec.placement | register_placement_spec | Virtual machine placement information. This attribute was added in vSphere API 6.8.7. Optional. This field is currently required. In the future, if this field is unset, the system will attempt to choose suitable resources on which to place the virtual machine. |
spec.placement.folder | string | Virtual machine folder into which the virtual machine should be placed. Optional. This field is currently required. In the future, if this field is unset, the system will attempt to choose a suitable folder for the virtual machine; if a folder cannot be chosen, the virtual machine creation operation will fail.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: Folder . When operations return a value of this structure as a result, the field will be an identifier for the resource type: Folder . |
spec.placement.resource_pool | string | Resource pool into which the virtual machine should be placed. Optional. This field is currently required if both host and cluster are unset. In the future, if this field is unset, the system will attempt to choose a suitable resource pool for the virtual machine; if a resource pool cannot be chosen, the virtual machine creation operation will fail.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: ResourcePool . When operations return a value of this structure as a result, the field will be an identifier for the resource type: ResourcePool . |
spec.placement.host | string | Host onto which the virtual machine should be placed. If If resource_pool or cluster is specified. If unset, the system will attempt to choose a suitable host for the virtual machine; if a host cannot be chosen, the virtual machine creation operation will fail.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: HostSystem . When operations return a value of this structure as a result, the field will be an identifier for the resource type: HostSystem . |
spec.placement.cluster | string | Cluster into which the virtual machine should be placed. If If resource_pool or host is specified, it is recommended that this field be unset.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: ClusterComputeResource . When operations return a value of this structure as a result, the field will be an identifier for the resource type: ClusterComputeResource . |
Response:
HTTP Status Code: 200
Representation:
{
"value" : "obj-103"
}
"value" : "obj-103"
}
Response Type:
Name | Type | Description |
---|---|---|
bold = required | ||
value | string | Identifier of the newly-created virtual machine. |
Errors:
HTTP Status Code | Type | Description |
---|---|---|
400 | already_exists | if a virtual machine with the specified name already exists or if a virtual machine using the specified virtual machine files already exists. |
500 | error | if the system reports an error while responding to the request. |
400 | invalid_argument | if any of the specified parameters are invalid. |
404 | not_found | if any of the resources specified in spec could not be found. |
500 | resource_inaccessible | if a specified resource (eg. host) is not accessible. |
503 | service_unavailable | if the system is unable to communicate with a service to complete the request. |
500 | unable_to_allocate_resource | if any of the resources needed to register the virtual machine could not be allocated. |
401 | unauthenticated | if the user cannot be authenticated. |
403 | unauthorized | if the user doesn't have the required privileges. |