vcenter vm storage policy: update

Updates the storage policy configuration of a virtual machine and/or its associated virtual hard disks. This operation was added in vSphere API 6.7

Request:

HTTP request

PATCH https://{server}/rest/vcenter/vm/{vm}/storage/policy

Path Parameters

Name Type Description
Required
vm string Virtual machine identifier.

Request Body Structure:

{
    "spec"{
        "disks"[
            {
                "key""obj-103",
                "value"{
                    "policy""obj-103",
                    "type""USE_SPECIFIED_POLICY"
                }
            }
        ],
        "vm_home"{
            "policy""obj-103",
            "type""USE_SPECIFIED_POLICY"
        }
    }
}

Request Body Parameters:

Name Type Description
bold = required
spec update_spec Storage Policy Specification for updating the virtual machine and virtual disks.
spec.vm_home vm_home_policy_spec Storage policy to be used when reconfiguring the virtual machine home. This attribute was added in vSphere API 6.7

Optional. if unset the current storage policy is retained.

spec.vm_home.type string Policy type to be used while performing update operation on the virtual machine home's directory. This attribute was added in vSphere API 6.7

Defines the choices for how to specify the policy to be associated with the virtual machine home's directory. This enumeration was added in vSphere API 6.7 Value is one of:
USE_SPECIFIED_POLICY: Use the specified policy (see vcenter.vm.storage.policy.vm_home_policy_spec.policy). This constant was added in vSphere API 6.7
USE_DEFAULT_POLICY: Use the default storage policy of the datastore. This constant was added in vSphere API 6.7

spec.vm_home.policy string Storage Policy identification. This attribute was added in vSphere API 6.7

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.vcenter.StoragePolicy. When operations return a value of this structure as a result, the field will be an identifier for the resource type: com.vmware.vcenter.StoragePolicy.

spec.disks list Storage policy or policies to be used when reconfiguring virtual machine diks. This attribute was added in vSphere API 6.7

Optional. if unset the current storage policy is retained.When clients pass a value of this structure as a parameter, the key in the field key/value pairs must be an identifier for the resource type: 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.disks[].key string
spec.disks[].value disk_policy_spec
spec.disks[].value.type string Policy type to be used while performing update operation on the virtual disks. This attribute was added in vSphere API 6.7

Defines the choices for how to specify the policy to be associated with a virtual disk. This enumeration was added in vSphere API 6.7 Value is one of:
USE_SPECIFIED_POLICY: Use the specified policy (see vcenter.vm.storage.policy.disk_policy_spec.policy). This constant was added in vSphere API 6.7
USE_DEFAULT_POLICY: Use the default storage policy of the datastore. This constant was added in vSphere API 6.7

spec.disks[].value.policy string Storage Policy identification. This attribute was added in vSphere API 6.7

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.vcenter.StoragePolicy. When operations return a value of this structure as a result, the field will be an identifier for the resource type: com.vmware.vcenter.StoragePolicy.

Response:

HTTP Status Code: 200

None

Errors:

HTTP Status Code Type Description
500 error if the system reports an error while responding to the request.
503 service_unavailable if the system is unable to communicate with a service to complete the request.
401 unauthenticated if the user is not authenticated.
403 unauthorized if the user doesn't have the required priveleges.
400 invalid_argument if the storage policy specified is invalid.
400 resource_busy if the virtual machine or disk is busy performing another operation.
400 resource_inaccessible if the virtual machine or disk's configuration state cannot be accessed.