If the datastore that contains a virtual machine has been disabled by the system administrator or is no longer associated with virtual machine's designated storage profile, you must update the Vm element that represents the virtual machine. That update revalidates the storage profile and relocates the virtual machine if necessary.

Every Vm element includes a StorageProfile element. The value of the href attribute of that element is a reference to the virtual machine's storage profile. The initial value of this attribute is inherited from the VDC that contains it unless you specify the value when the virtual machine is created. To change the value, you must update the entire Vm element that contains it.


When the system administrator changes the datastore that stores a virtual machine, you must update the Vm element as shown in Example: Update the Storage Profile for a Virtual Machine, but leave the href of the current StorageProfile unchanged. This action, which replaces the deprecated relocate action, forces revalidation of the existing storage profile. If the current datastore is disabled or no longer supports the specified storage profile, the system relocates the virtual machine to a different datastore that supports the referenced storage profile. After the returned Task completes, the validation and, if necessary, relocation is complete.

Verify that you are logged in to the vCloud API as a system administrator or the object owner.


Retrieve the Vm element.

Make a GET request to the URL in the value of the href attribute of the Vm.


Modify the retrieved Vm to change the StorageProfile reference.

Modified sections must contain all required elements, even if you are not changing their values. Because optional elements revert to default values if they are omitted or empty, it is a best practice to include optional elements in updates. Link elements and href attributes from responses do not need to be included in modified sections. Some elements and attributes might be read-only. See the schema reference for details.


Update the Vm with your modifications.


Find the Link element in the Vm where rel="edit".


Make a PUT request to the URL in that link's href attribute value, and supply the modified Vm as the request body.

The response to this request is a Task element that tracks the relocation of the virtual machine to a datastore in the new storage profile. When the task is complete, the virtual machine has been relocated.

This example shows a Vm element containing a StorageProfile. The actual update operation requires the entire Vm element, including the StorageProfile, in the request body. Only a small part of the element appears in this example.


PUT https://vcloud.example.com/api/vApp/vm-4
Content-type: application/vnd.vmware.vcloud.vm+xml
<?xml version="1.0" encoding="UTF-8"?>
<Vm ...>
      href="https://vcloud.example.com/api/vdcStorageProfile/3" />



202 Accepted
Content-Type: application/vnd.vmware.vcloud.task+xml
<Task ... operation="Updating Virtual Application Linux FTP server (7)" ...>