vcenter vm template library items: create
Request:
HTTP request
Request Body Structure:
"spec" : {
"library" : "obj-103",
"disk_storage" : {
"datastore" : "obj-103",
"storage_policy" : {
"type" : "USE_SPECIFIED_POLICY",
"policy" : "obj-103"
}
},
"name" : "string",
"description" : "string",
"vm_home_storage" : {
"datastore" : "obj-103",
"storage_policy" : {
"type" : "USE_SPECIFIED_POLICY",
"policy" : "obj-103"
}
},
"disk_storage_overrides" : [
{
"value" : {
"datastore" : "obj-103",
"storage_policy" : {
"type" : "USE_SPECIFIED_POLICY",
"policy" : "obj-103"
}
},
"key" : "obj-103"
}
],
"placement" : {
"cluster" : "obj-103",
"folder" : "obj-103",
"host" : "obj-103",
"resource_pool" : "obj-103"
},
"source_vm" : "obj-103"
}
}
Request Body Parameters:
Name | Type | Description |
---|---|---|
bold = required | ||
spec | create_spec | information used to create the library item from the source virtual machine. |
spec.source_vm | string | Identifier of the source virtual machine to create the library item from. This attribute was added in vSphere API 6.8. When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: VirtualMachine . When operations return a value of this structure as a result, the field will be an identifier for the resource type: VirtualMachine . |
spec.name | string | Name of the library item. This attribute was added in vSphere API 6.8. |
spec.description | string | Description of the library item. This attribute was added in vSphere API 6.8. Optional. If unset, the newly created library item has the same description as the source virtual machine. |
spec.library | string | Identifier of the library in which the new library item should be created. This attribute was added in vSphere API 6.8. When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: com.vmware.content.Library . When operations return a value of this structure as a result, the field will be an identifier for the resource type: com.vmware.content.Library . |
spec.vm_home_storage | create_spec_vm_home_storage | Storage location for the virtual machine template's configuration and log files. This attribute was added in vSphere API 6.8. Optional. If unset, the virtual machine template's configuration and log files are placed on the default storage backing associated with the library specified by library . |
spec.vm_home_storage.datastore | string | Identifier of the datastore for the virtual machine template's configuration and log files. This attribute was added in vSphere API 6.8. Optional. This field is currently required.
When Datastore . When operations return a value of this structure as a result, the field will be an identifier for the resource type: Datastore . |
spec.vm_home_storage.storage_policy | create_spec_vm_home_storage_policy | Storage policy for the virtual machine template's configuration and log files. This attribute was added in vSphere API 6.8. Optional. If unset, datastore must be specified and the virtual machine template's configuration and log files are created with the default storage policy associated with the datastore . |
spec.vm_home_storage.storage_policy.type | string | Policy type to be used when creating the virtual machine template's configuration and log files. This attribute was added in vSphere API 6.8. Policy type for the virtual machine template's configuration and log files. This enumeration was added in vSphere API 6.8. Value is one of: USE_SPECIFIED_POLICY: Use the specified policy. This constant was added in vSphere API 6.8. |
spec.vm_home_storage.storage_policy.policy | string | Identifier for the storage policy to use. This attribute was added in vSphere API 6.8. Optional. It is only relevant when type has value USE_SPECIFIED_POLICY. This field is optional and it is only relevant when the value of type is USE_SPECIFIED_POLICY.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: com.vmware.spbm.StorageProfile . When operations return a value of this structure as a result, the field will be an identifier for the resource type: com.vmware.spbm.StorageProfile . |
spec.disk_storage | create_spec_disk_storage | Storage specification for the virtual machine template's disks. This attribute was added in vSphere API 6.8. Optional. If both disk_storage_overrides and disk_storage are unset, the virtual machine template's disks are placed in the default storage backing associated with the library specified by library .
If If If both |
spec.disk_storage.datastore | string | Identifier for the datastore associated with a virtual machine template's disk. This attribute was added in vSphere API 6.8. Optional. This field is currently required.
If Datastore . When operations return a value of this structure as a result, the field will be an identifier for the resource type: Datastore . |
spec.disk_storage.storage_policy | create_spec_disk_storage_policy | Storage policy for a virtual machine template's disk. This attribute was added in vSphere API 6.8. Optional. If unset, datastore must be specified and the virtual machine template's disk is created with the default storage policy associated with the datastore . |
spec.disk_storage.storage_policy.type | string | Policy type to be used when creating a virtual machine template's disk. This attribute was added in vSphere API 6.8. Policy type for a virtual machine template's disk. This enumeration was added in vSphere API 6.8. Value is one of: USE_SPECIFIED_POLICY: Use the specified policy. This constant was added in vSphere API 6.8. |
spec.disk_storage.storage_policy.policy | string | Identifier for the storage policy to use. This attribute was added in vSphere API 6.8. Optional. It is only relevant when type has value USE_SPECIFIED_POLICY. This field is optional and it is only relevant when the value of type is USE_SPECIFIED_POLICY.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: com.vmware.spbm.StorageProfile . When operations return a value of this structure as a result, the field will be an identifier for the resource type: com.vmware.spbm.StorageProfile . |
spec.disk_storage_overrides | list | Storage specification for individual disks in the virtual machine template. This is specified as a mapping between disk identifiers in the source virtual machine and their respective storage specifications. This attribute was added in vSphere API 6.8. Optional. If both disk_storage_overrides and disk_storage are unset, the virtual machine template's disks are placed in the default storage backing associated with the library specified by library .
If If If both com.vmware.vcenter.vm.hardware.Disk . When operations return a value of this structure as a result, the key in the field key/value pairs will be an identifier for the resource type: com.vmware.vcenter.vm.hardware.Disk . |
spec.placement | create_placement_spec | Information used to place the virtual machine template. This attribute was added in vSphere API 6.8. Optional. This field is currently required. In the future, if this field is unset, the system will place the virtual machine template on a suitable resource.
If specified, each field will be used for placement. If the fields result in disjoint placement, the operation will fail. If the fields along with the placement values of the source virtual machine result in disjoint placement, the operation will fail. . |
spec.placement.folder | string | Virtual machine folder into which the virtual machine template should be placed. This attribute was added in vSphere API 6.8. Optional. If unset, the virtual machine template will be placed in the same folder as the source virtual machine.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 template should be placed. This attribute was added in vSphere API 6.8. Optional. If unset, the system will attempt to choose a suitable resource pool for the virtual machine template; if a resource pool cannot be chosen, the library item 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 template should be placed. If host and resource_pool are both specified, resource_pool must belong to host . If host and cluster are both specified, host must be a member of cluster . This attribute was added in vSphere API 6.8. Optional. This field may be unset if resource_pool or cluster is specified. If unset, the system will attempt to choose a suitable host for the virtual machine template; if a host cannot be chosen, the library item 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 onto which the virtual machine template should be placed. If cluster and resource_pool are both specified, resource_pool must belong to cluster . If cluster and host are both specified, host must be a member of cluster . This attribute was added in vSphere API 6.8. Optional. 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"
}
Response Type:
Name | Type | Description |
---|---|---|
bold = required | ||
value | string | Identifier of the newly created library item. |
Errors:
HTTP Status Code | Type | Description |
---|---|---|
400 | already_exists | if an entity with the name specified by vcenter.vm_template.library_items.create_spec.name already exists in the folder specified by vcenter.vm_template.library_items.create_placement_spec.folder. |
500 | error | if the system reports an error while responding to the request. |
400 | invalid_argument | if vcenter.vm_template.library_items.create_spec contains invalid arguments. |
400 | not_allowed_in_current_state | if the operation cannot be performed because of the source virtual machine's current state. |
404 | not_found | if the source virtual machine specified by vcenter.vm_template.library_items.create_spec.source_vm does not exist. |
500 | resource_inaccessible | if there was an error accessing a file from the source virtual machine. |
400 | resource_in_use | if the source virtual machine is busy. |
503 | service_unavailable | if any of the services involved in the operation are unavailable. |
500 | unable_to_allocate_resource | if any of the resources needed to create the virtual machine template could not be allocated. |
401 | unauthenticated | if the user that requested the operation cannot be authenticated. |
403 | unauthorized | if the user that requested the operation is not authorized to perform the operation. |