VMware

Disk Namespace

The Disk namespace provides commands for configuring the virtual disks of a virtual machine. A virtual disk has a backing such as a VMDK file. The backing has an independent lifecycle from the virtual machine when it is detached from the virtual machine. The Disk.create command provides the ability to create a new virtual disk. When creating a virtual disk, a new VMDK file may be created or an existing VMDK file may used as a backing. Once a VMDK file is associated with a virtual machine, its lifecycle will be bound to the virtual machine. In other words, it will be deleted when the virtual machine is deleted. The Disk.delete command provides the ability to detach a VMDK file from the virtual machine. The Disk.delete command does not delete the VMDK file that backs the virtual disk. Once detached, the VMDK file will not be destroyed when the virtual machine to which it was associated is deleted.

List of commands:



List Command

dcli com vmware vcenter vm hardware disk list

Description

Returns commonly used information about the virtual disks belonging to the virtual machine.

Options

Option Name Type Required Description
vm string Yes Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine.

Example

dcli com vmware vcenter vm hardware disk list --vm testId


Get Command

dcli com vmware vcenter vm hardware disk get

Description

Returns information about a virtual disk.

Options

Option Name Type Required Description
vm string Yes Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine.
disk string Yes Virtual disk identifier. The parameter must be an identifier for the resource type: com.vmware.vcenter.vm.hardware.Disk.

Example

dcli com vmware vcenter vm hardware disk get --vm testId --disk testId


Create Command

dcli com vmware vcenter vm hardware disk create

Description

Adds a virtual disk to the virtual machine. While adding the virtual disk, a new VMDK file may be created or an existing VMDK file may be used to back the virtual disk.

Options

Option Name Type Required Description
vm string Yes Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine.
type string No Type of host bus adapter to which the device should be attached. If unset, guest-specific default values will be used Valid values are: {IDE, SCSI, SATA}
ide‑primary bool No Flag specifying whether the device should be attached to the primary or secondary IDE adapter of the virtual machine. If unset, the server will choose a adapter with an available connection. If no IDE connections are available, the request will be rejected.
ide‑master bool No Flag specifying whether the device should be the master or slave device on the IDE adapter. If unset, the server will choose an available connection type. If no IDE connections are available, the request will be rejected.
scsi‑bus int No Bus number of the adapter to which the device should be attached.
scsi‑unit int No Unit number of the device. If unset, the server will choose an available unit number on the specified adapter. If there are no available connections on the adapter, the request will be rejected.
sata‑bus int No Bus number of the adapter to which the device should be attached.
sata‑unit int No Unit number of the device. If unset, the server will choose an available unit number on the specified adapter. If there are no available connections on the adapter, the request will be rejected.
backing‑type string No Backing type for the virtual disk. Valid values are: {VMDK_FILE}
backing‑vmdk‑file string No Path of the VMDK file backing the virtual disk. This option is optional and it is only relevant when the value of type is VMDK_FILE.
new‑vmdk‑name string No Base name of the VMDK file. The name should not include the '.vmdk' file extension. If unset, a name (derived from the name of the virtual machine) will be chosen by the server.
new‑vmdk‑capacity int No Capacity of the virtual disk backing in bytes. If unset, defaults to a guest-specific capacity.

Example

dcli com vmware vcenter vm hardware disk create --vm testId


Update Command

dcli com vmware vcenter vm hardware disk update

Description

Updates the configuration of a virtual disk. An update command can be used to detach the existing VMDK file and attach another VMDK file to the virtual machine.

Options

Option Name Type Required Description
vm string Yes Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine.
disk string Yes Virtual disk identifier. The parameter must be an identifier for the resource type: com.vmware.vcenter.vm.hardware.Disk.
backing‑type string No Backing type for the virtual disk. Valid values are: {VMDK_FILE}
backing‑vmdk‑file string No Path of the VMDK file backing the virtual disk. This option is optional and it is only relevant when the value of type is VMDK_FILE.

Example

dcli com vmware vcenter vm hardware disk update --vm testId --disk testId


Delete Command

dcli com vmware vcenter vm hardware disk delete

Description

Removes a virtual disk from the virtual machine. This command does not destroy the VMDK file that backs the virtual disk. It only detaches the VMDK file from the virtual machine. Once detached, the VMDK file will not be destroyed when the virtual machine to which it was associated is deleted.

Options

Option Name Type Required Description
vm string Yes Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine.
disk string Yes Virtual disk identifier. The parameter must be an identifier for the resource type: com.vmware.vcenter.vm.hardware.Disk.

Example

dcli com vmware vcenter vm hardware disk delete --vm testId --disk testId