Using Independent Disks in vCloud

Yesterday I wrote about the PowerShell module I've written (CIDisk.psm1) to allow manipulation of independent disks in a vCloud environment. This post shows some usage options and details some of the caveats to be aware of when using disks in this manner.

My test environment has two VMs (named imaginatively 'vm01' and 'vm02'), and the VDC they are in has access to four different storage profiles ('Platinum', 'Gold', 'Silver' and 'Bronze' storage). The default storage policy for the VDC is 'Bronze', but what if we want to create independent disks on other profiles? The -StorageProfileHref parameter to New-CIDisk lets us do this. Once connected to our cloud (Connect-CIServer) we can find the Hrefs of the available storage profiles we can use:

 1C:\> $vdc = Get-OrgVdc -Name '<My VDC Name>'
 2
 3C:\> $vdc.ExtensionData.VdcStorageProfiles.VdcStorageProfile | Select Name, Href
 4
 5Name                     Href                                                                                       
 6----                     ----                                                                                       
 7Platinum Storage Profile https://my.cloud.com/api/vdcStorageProfile/4777f1a3-1f71-4e47-831e-fc7ed80376c3
 8Silver Storage Profile   https://my.cloud.com/api/vdcStorageProfile/d14c6c2e-2cfb-4ffe-9f31-599c3de42150
 9Bronze Storage Profile   https://my.cloud.com/api/vdcStorageProfile/dc382284-bc65-4e61-b85f-ea7facba63e4
10Gold Storage Profile     https://my.cloud.com/api/vdcStorageProfile/f89df73a-2fa5-40e4-9332-fdd6e29d36ac

Let's create 2 independent disks, a 10G disk on 'Platinum' storage and a 100G disk on 'Silver' storage:

 1C:\> New-CIDisk -DiskName 'disk01-plat' -DiskSize 10G -StorageProfileHref https://my.cloud.com/api/vdcStorageProfile/4777f1a3-1f71-4e47-831e-fc7ed80376c3 -DiskDescription 'Platinum test disk'
 2Request submitted, waiting for task to complete...
 3Task completed successfully.
 4
 5Name        : disk01-plat
 6Href        : https://my.cloud.com/api/disk/a1b00fa4-3d84-4c75-bc76-7604b96cdcab
 7Description : Platinum test disk
 8Size        : 10 GB
 9BusType     : lsilogicsas
10Storage     : Platinum Storage Profile
11AttachedTo  : Not Attached
12
13C:\> New-CIDisk -DiskName 'disk02-silv' -DiskSize 100G -StorageProfileHref https://my.cloud.com/api/vdcStorageProfile/d14c6c2e-2cfb-4ffe-9f31-599c3de42150 -DiskDescription 'Silver test disk'
14Request submitted, waiting for task to complete...
15Task completed successfully.
16
17Name        : disk02-silv
18Href        : https://my.cloud.com/api/disk/b02b50fd-1305-454d-923c-26ef9874a3fd
19Description : Silver test disk
20Size        : 100 GB
21BusType     : lsilogicsas
22Storage     : Silver Storage Profile
23AttachedTo  : Not Attached

We can see in the vCloud interface that these disks now exist in our VDC (Note: you may have to completely refresh your vCloud session using your browser's refresh before the 'Independent Disks' tab appears):

Independent Disks tab

There are no context actions for these disks though and we can't attach/detach them to VMs in the vCloud interface.

Our VM01 virtual machine currently has a 40GB base disk attached and no other storage:

VM01 Disks

We can mount both our new independent disks to this VM using the following:

 1C:\> $vm01 = Get-CIVM -Name 'vm01'
 2
 3C:\> $disk01 = Get-CIDisk -DiskName 'disk01-plat'
 4
 5C:\> $disk02 = Get-CIDisk -DiskName 'disk02-silv'
 6
 7C:\> Mount-CIDisk -VMHref $vm01.Href -DiskHref $disk01.Href
 8Request submitted, waiting for task to complete...
 9Task completed successfully.
10
11C:\> Mount-CIDisk -VMHref $vm01.Href -DiskHref $disk02.Href
12Request submitted, waiting for task to complete...
13Task completed successfully.

Looking at the VM01 Hardware tab following this shows both disks mounted:

VM01 Hardware Tab

Note again that no manipulation options are available in the vCloud UI, but at least it's obvious that independent disks have been attached to VM01.

After rescanning storage in the guest, we can see the new storage devices on VM01:

New storage volumes in VM01

And once these are brought online, initialized, storage volumes created and drive letters assigned, we can use the disks inside the guest (the volume names don't get automatically mapped - I've just named the volumes the same as the independent disk objects for consistency):

Local disks in VM01

At this point everything appears to be working fine, but there can be a catch here - if you restart the virtual machine you may find that the server attempts to boot from one of the newly mounted independent disks. Luckily vCloud Director 8.10 allows us to get into the VM BIOS and change the boot order settings:

Selecting Enter BIOS Setup option

Once restarted into BIOS we can select the correct boot order:

BIOS boot order selection

With the server restarted, we can create some test content in 'disk01-plat' to prove that the data moves when we reattach this disk to VM02:

Creating some data to be transferred

And to dismount 'disk01-plat' from VM01 and mount it to VM02 we can:

1C:\> Dismount-CIDisk -VMHref $vm01.Href -DiskHref $disk01.Href
2Request submitted, waiting for task to complete...
3Task completed successfully.
4
5C:\> $vm02 = Get-CIVM -Name 'vm02'
6
7C:\> Mount-CIDisk -VMHref $vm02.Href -DiskHref $disk01.Href
8Request submitted, waiting for task to complete...
9Task completed successfully.

Looking at the available storage in VM02 after a disk rescan shows our disk has transfered across:

Disk after moving to VM02

Finally, checking the contents of the 'E:' drive shows our test folder & file have made it across:

File contents after moving disk

And Get-CIDisk can be used to verify the disk attachments after moving disk01 to VM02:

1C:\> Get-CIDisk | ft -AutoSize
2
3Name        Href                                                               Description        Size   BusType     Storage                  AttachedTo
4----        ----                                                               -----------        ----   -------     -------                  ----------
5disk01-plat https://my.cloud.com/api/disk/a1b00fa4-3d84-4c75-bc76-7604b96cdcab Platinum test disk 10 GB  lsilogicsas Platinum Storage Profile vm02      
6disk02-silv https://my.cloud.com/api/disk/b02b50fd-1305-454d-923c-26ef9874a3fd Silver test disk   100 GB lsilogicsas Silver Storage Profile   vm01

Hopefully this gives a better idea of how CIDisk can be used to manage independent disks in a vCloud environment, it would be nice if VMware included the management functions in the UI, but for now at least you can use PowerShell to easily achieve the same results without having to write against the API directly.

As always, any comments / feedback greatly appreciated.

Jon