Relocate a Virtual Machine to a Different Datastore
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.
Prerequisites
Verify that you are logged in to the VMware Cloud Director API as an administrator or the object owner. Verify that you are logged in to the vCloud Air Compute Service as a Virtual Infrastructure Administrator or the End User who owns this object.
Procedure
Example: Update the Storage Profile for a Virtual Machine
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 ...> ... <StorageProfile type="application/vnd.vmware.vcloud.vdcStorageProfile+xml" name="Gold" href="https://vcloud.example.com/api/vdcStorageProfile/3" /> </Vm>
202 Accepted Content-Type: application/vnd.vmware.vcloud.task+xml ... <Task ... operation="Updating Virtual Application Linux FTP server (7)" ...> ... </Task>