1.5

Table Of Contents
Relocate a Virtual Machine to a Different Datastore
A Vm element, whether part of a Vapp or VappTemplate element, includes an action/relocate link that you can
use to move the virtual machine to a different datastore
In both vApps and vApp templates, virtual machines are defined by a combination of metadata in the
vCloud Director database and virtual disk files stored on a datastore in the cloud. vCloud Director determines
the initial location of this datastore based on how the virtual machine was created. You can move the disk files
to another datastore in the cloud by POSTing a RelocateParams element to the virtual machine's
action/relocate link.
When a virtual machine is deployed in a vDC that supports fast provisioning, its disks can become part of a
tree structure that includes parent and child disks. Disk tree structure and total storage consumption remain
the same regardless of the order in which virtual machines are relocated The folder structure in the target
datastore might change depending on the order in which virtual machines are relocated.
Prerequisites
Verify that you are logged in as a system administrator.
Procedure
1 List the datastores available in the cloud.
Use a request like this one.
GET https://vcloud.example.com/api/admin/extension/datastores
The response is a DatastoreReferences element, as shown here:.
<vmext:DatastoreReferences
xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5"
xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"
type="application/vnd.vmware.admin.datastoreList+xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://vcloud.example.com/api/v1.5/schema/master.xsd">
<vcloud:Link
rel="up"
type="application/vnd.vmware.admin.vmwExtension+xml"
href="https://vcloud.example.com/api/admin/extension" />
<vcloud:Reference
type="application/vnd.vmware.admin.datastore+xml"
name="example-lun2"
href="https://vcloud.example.com/api/admin/extension/datastore/607" />
<vcloud:Reference
type="application/vnd.vmware.admin.datastore+xml"
name="example-lun4"
href="https://vcloud.example.com/api/admin/extension/datastore/191" />
</vmext:DatastoreReferences>
2 Retrieve the representation of the virtual machine.
The following request retrieves a Vm from a Vapp:
GET https://vcloud.example.com/api/vApp/vm-257
vCloud API Programming Guide
192 VMware, Inc.