1.5
Table Of Contents
- vCloud API Programming Guide
- Contents
- vCloud API Programming Guide
- About the VMware vCloud API
- Hello vCloud: A Simplified RESTful Workflow
- Exploring a Cloud
- Provisioning an Organization with vApps, Templates, and Media
- Deploying and Operating vApps
- Summary of vCloud API vApp and Virtual Machine Operations Requests
- Create a vApp From a Template
- Compose a vApp From Existing Virtual Machines
- Recompose a vApp to Add or Remove Virtual Machines
- Operate a vApp
- Configuring vApps and Virtual Machines
- Retrieve the Configuration Links for a vApp
- Retrieve the Configuration Links for a Virtual Machine
- Retrieve or Update a Modifiable Section
- Update a vApp Network Configuration
- Update the NetworkConnectionSection of a Virtual Machine
- Retrieve or Modify the CPU Configuration of a Virtual Machine
- Retrieve or Modify the GuestCustomizationSection of a Virtual Machine
- Retrieve or Modify ProductSection Elements
- Retrieve or Modify Groups of Related Sections in a Virtual Machine
- Retrieve or Modify the Hard Disk Configuration of a Virtual Machine
- Creating, Provisioning, and Managing Organizations
- Summary of Administrative Requests
- Administrator Credentials and Privileges
- Organization Administration
- Network Administration
- vDC Administration
- Catalog Administration
- User and Group Administration
- Working With Roles and Rights
- Controlling Access to vApps and Catalogs
- Using vCloud API Extensions to Provision and Manage a Cloud
- Working With Object Metadata
- Using the Query Service
- Configuring and Using Blocking Tasks and Notifications
- XML Representations in the vCloud API
- Index
3 Find the action/relocate link for the Vm, and note the datastore that the Vm currently occupies.
This fragment of the response to the request made in Step 2 includes the action/relocate link and the
reference to the datastore that the Vm currently occupies.
<Vm
xmlns="http://www.vmware.com/vcloud/v1.5"
... >
<VCloudExtension
required="false">
...
<vmext:VimObjectRef>
<vmext:VimServerRef
type="application/vnd.vmware.admin.vmwvirtualcenter+xml"
name="VC1"
href="https://vcloud.example.com/api/admin/extension/vimServer/35" />
<vmext:MoRef>datastore-191</vmext:MoRef>
<vmext:VimObjectType>DATASTORE</vmext:VimObjectType>
</vmext:VimObjectRef>
</VCloudExtension>
...
<Link
rel="relocate"
type="application/vnd.vmware.vcloud.relocateVmParams+xml"
href="https://vcloud.example.com/api/vApp/vm-257/action/relocate" />
...
</Vm>
4 Construct a RelocateParams element that specifies the destination datastore for the Vm.
See “Example: Relocate a Virtual Machine,” on page 193.
5 POST the RelocateParams element to the action/relocate link described in Step 3.
You do not need to power off the virtual machine before you make the request. See “Example: Relocate a
Virtual Machine,” on page 193.
The system creates a task to manage the relocation and returns a Task element in the response. When the task
is complete, the virtual machine is relocated.
Example: Relocate a Virtual Machine
This request relocates the virtual machine retrieved in Step 2 to one of the datastores listed in Step 1. The
response is a Task.
Request:
POST https://vcloud.example.com/api/vApp/vm-257/action/relocate
Content-Type: application/vnd.vmware.vcloud.relocateVmParams+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<RelocateParams
xmlns="http://www.vmware.com/vcloud/v1.5">
<Datastore
href="https://vcloud.example.com/api/admin/extension/datastore/607" />
</RelocateParams>
Chapter 7 Using vCloud API Extensions to Provision and Manage a Cloud
VMware, Inc. 193