vCloud Independent Disks: Part 3 - Updating Disks

vCloud Independent Disks: Part 3 - Updating Disks

In order to make a change to an Independent Disk, you have to the XML representation of the disk as it is now, make your changes to the XML and then send the updated XML back into the vCloud API.  You can change the name and the Storage Profile. I couldn’t change the size of the disk, but I understand this is possible on vCloud 8.

Updating a Disk
To get the XML for the current settings, you just make a GET to the HREF (the URL) for the disk.  In my example this was: and the what is returned looks like this:

vCloud API Response 1

The XML returned contains all the setting for the disk and will be the basis for the PUT request which will make the update.  Edit the XML to include whatever changes you need to make.  Then you make a put request as follows:

Once you have the edited XML block, use it as the body of a PUT request to the same URL as the previous GET request. Make sure the Content-Type is set to application/vnd.vmware.vcloud.disk+xml

So in this example I used:

Action PUT
Content-Type application/vnd.vmware.vcloud.disk+xml
Request Body
<?xml version="1.0" encoding="UTF-8"?>
<Disk xmlns="" busSubType="lsilogicsas" busType="6" size="53687091200" status="1" name="IndDisk_DBFiles1" id="urn:vcloud:disk:bda4fb2c-d4eb-4976-8bdc-52b2b7f28b3a" href="" type="application/vnd.vmware.vcloud.disk+xml" xmlns:xsi="" xsi:schemaLocation="">
    <Link rel="up" href="" type="application/vnd.vmware.vcloud.vdc+xml"/>
    <Link rel="remove" href=""/>
    <Link rel="edit" href="" type="application/vnd.vmware.vcloud.disk+xml"/>
    <Link rel="down" href="" type="application/vnd.vmware.vcloud.owner+xml"/>
    <Link rel="down" href="" type="application/vnd.vmware.vcloud.vms+xml"/>
    <Link rel="down" href="" type="application/vnd.vmware.vcloud.metadata+xml"/>
    <Description>Disk for DB Files</Description>
    <StorageProfile href="" name="Standard Disk" type="application/vnd.vmware.vcloud.vdcStorageProfile+xml"/>
    <Owner type="application/vnd.vmware.vcloud.owner+xml">
        <User href="" name="customerlogin" type="application/vnd.vmware.admin.user+xml"/>

The response you get back from the vCloud API will give you information about your request, including the HREF to the task so you can check on the progress.

vCloud API Response 2

If nothing appears to happen following your PUT request, do a GET to the HREF of the task and see what it says. In this case, the disk was already attached to a VM so a change could not be made to the disk.

vCloud API Response 3

This proves that you must detach the disk from the VM before you can make change. Well, that’s almost true…

Updating a Disk via the VM Object

You have been able to make changes to disks on running VMs, via the vCloud API, for a while now. If the Independent Disk is mounted to a VM, then target the disk section on the VM instead and make your changes there. I tested that I was able to move the disk to a new Storage Profile which worked fine. Changing the name and description of the VM didn’t but that’s no big deal. I’m going to take a guess but I would assume you could also increase the disk of the disk while it is mounted on the VM. I couldn’t test this as resizing Independent Disk is not supported on the version of vCloud Director I’m using.

This post is licensed under CC BY 4.0 by the author.