You can update an
independent disk to increase its capacity or change the storage profile that
the disk uses.
Use this procedure to update
an independent disk when it is not attached to a virtual machine.
When an independent disk is
attached to a virtual machine, it is listed in the virtual machine's
VirtualHardwareSection
along with the other disks that are not independent of the virtual machine. You
can update an attached independent disk by using the
reconfigureVm
operation. See
Update Multiple Sections of a Virtual Machine.
Prerequisites
This operation requires
the rights included in the predefined vApp Author role or an equivalent set of
rights.
Procedure
-
Retrieve a reference to
the independent disk.
You can use a query
like this one to retrieve references to all independent disks to which you have
access:
GET https://vcloud.example.com/api/query?type=disk&format=references
-
Retrieve the XML
representation of the independent disk.
Use one of the
references returned by the query shown in
Step 1,
as shown in this example:
Request:
GET https://vcloud.example.com/api/disk/128
The response is a
Disk
element.
Response:
<Disk
...
name="500GB-SCSI"
href="https://vcloud.example.com/api/disk/128">
...
</Disk>
-
Verify that the disk is
not attached to a virtual machine.
Use the query service.
A query like this one returns information about the returned in
Step 2.
GET https://vcloud.example.com/api/query?type=adminDisk&filter=name==500GB-SCSI
The response includes an
isAttached attribute.
If this attribute has a value of
false
, the disk is not attached, and you can update
it with a PUT request as shown in
Update an Independent Disk.
Otherwise, you can update it by using the
reconfigureVm operation
to update the appropriate
Item
in the
VirtualHardwareSection
of the virtual machine to which the disk is attached.
-
Modify the
Disk
element you retrieved in
Step 2.
See
Update an Independent Disk.
Request bodies must contain
all required elements and attributes, even if you are not changing their
values. Because optional elements and attributes typically revert to default
values if they are omitted or empty, it is a best practice to include optional
elements in request bodies that modify existing objects.
Link
elements and
href
attributes from responses do not need to be included in modified sections. Some
elements and attributes are read-only and cannot be modified. See the schema
reference for details.
-
Update the
Disk
with your modifications.
-
In the retrieved
Disk element, find the
Link element where
rel="edit"
.
-
Make a PUT request
to the URL in that link's
href
attribute value, and supply the modified
section as the request body.
Example: Update an Independent
Disk
This example updates the
independent disk created in
Create an Independent Disk
to change the storage profile.
Request:
PUT https://vcloud.example.com/api/disk/128
Content-Type: application/vnd.vmware.vcloud.disk+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<Disk
xmlns="http://www.vmware.com/vcloud/v1.5"
size="500000000000"
name="500GB-SCSI">
<Description>Independent Disk</Description>
<StorageProfile
type="application/vnd.vmware.vcloud.vdcStorageProfile+xml"
name="gold"
href="https://vcloud.example.com/api/vdcStorageProfile/3" />
<Owner type="application/vnd.vmware.vcloud.owner+xml">
<User
type="application/vnd.vmware.admin.user+xml"
href="https://vcloud.example.com/api/admin/user/120" />
</Owner>
</Disk>
The response is a
Task
element that tracks the update operation. When the task is complete, the object
is updated.
Response:
202 Accepted
Content-Type: application/vnd.vmware.vcloud.task+xml
...
<Task ... operation="Updating Independent disk 500GB-SCSI (128)" ...>
...
</Task>