VSAN Part 12 – SPBM extensions in RVC

In the Virtual SAN (VSAN) beta refresh, we released a number of new Ruby vSphere Console (RVC) commands to examine the Storage Policy Based Management (SPBM) settings. For those of you who have been participating in the beta, you will know that to deploy a virtual machine on VSAN, you create a storage policy for the virtual machine, which may stipulate the number of mirror copies of the virtual machine disk (FailuresToTolerate) or indeed a stripe width for the VMDK. SPBM is the underlying technology which controls this aspect of VSAN. In this post, we can look at some of these new SPBM extensions in RVC.

Let’s first take a look at the SPBM extensions. There are 8 in total in RVC. The names are pretty self-explanatory:

spbm.check_compliance
spbm.profile_apply
spbm.device_add_disk
spbm.profile_create
spbm.device_change_storage_profile
spbm.profile_delete
spbm.namespace_change_storage_profile
spbm.vm_change_storage_profile

If you navigate to a virtual machine in RVC, you can then use these commands against the individual VMs and devices.

Warning: Some of the SPBM extensions did not work as expected with the beta refresh released of RVC (v1.3.2). We have a newer version of RVC (v1.3.3-1) available on the VSAN beta refresh download site in the form of an RPM. Download the package to your VCVA and update the version of RVC using the rpm -Uvh command.

With RVC version 1.3.3-1, you can then run SPBM commands successfully. Lets look at some examples:

/localhost/CH-Datacenter/vms> ls
0 Discovered virtual machine/
1 VMware vCenter Operations Manager: cpu 0.00/-0.00/normal, mem 0.00/-0.00/normal
2 win1: poweredOn
3 win2: poweredOn
4 win3: poweredOn
5 win4: poweredOn
6 win5: poweredOn
7 win6: poweredOn
8 vSphere Data Protection 5.5: poweredOn
/localhost/CH-Datacenter/vms> spbm.check_compliance 2
+-----------------+---------+------------+
| VM/Virtual Disk | Profile | Compliance |
+-----------------+---------+------------+
| win1            | FT=1    | compliant  |
|   Hard disk 1   | FT=1    | compliant  |
+-----------------+---------+------------+

Number of 'compliant' entities: 2
/localhost/CH-Datacenter/vms>

(Click & slide left to right to see the full text) The next step is to apply a new profile. The profiles can be found in ~/storage/vmprofiles. In this example, I have two profiles available:

/localhost/CH-Datacenter> ls storage/vmprofiles/
0 FT=1
1 FT=1, SW=2

I will now change the profile on one of my virtual machines from FT=1 (FailuresToTolerate=1) to FT=1, SW=2 (FailuresToTolerate=1 and StripeWidth=2) using the command spbm.vm_change_storage_profile as follows:

/localhost/CH-Datacenter/vms> ls
0 Discovered virtual machine/
1 VMware vCenter Operations Manager: cpu 0.00/-0.00/normal, mem 0.00/-0.00/normal
2 win1: poweredOn
3 win2: poweredOn
4 win3: poweredOn
5 win4: poweredOn
6 win5: poweredOn
7 win6: poweredOn
8 vSphere Data Protection 5.5: poweredOn
/localhost/CH-Datacenter/vms> spbm.vm_change_storage_profile 2 -p ~/storage/vmprofiles/FT=1,\ SW=2/
ReconfigVM win1: success
/localhost/CH-Datacenter/vms>

(Click & slide left to right to see the full text) Of course, the reconfiguration will take a little time. We can see that the Hard Disk belonging to the VM that we just modified the storage policy is now non-compliant by issuing the command spbm.check_compliance:

/localhost/CH-Datacenter/vms> spbm.check_compliance 2
+-----------------+------------+--------------+
| VM/Virtual Disk | Profile    | Compliance   |
+-----------------+------------+--------------+
| win1            | FT=1, SW=2 | compliant    |
|   Hard disk 1   | FT=1, SW=2 | nonCompliant |
+-----------------+------------+--------------+

Number of 'compliant' entities: 1
Number of 'nonCompliant' entities: 1
/localhost/CH-Datacenter/vms>

And of course we can use the very useful vsan.resync_dashboard command to see how much data is still synching while the reconfiguration is taking place:

/localhost/CH-Datacenter/computers> ls
0 CH-Cluster (cluster): cpu 86 GHz, memory 45 GB
/localhost/CH-Datacenter/computers> vsan.resync_dashboard 0
2013-12-12 16:56:58 +0000: Querying all VMs on VSAN ...
2013-12-12 16:56:58 +0000: Querying all objects in the system from 10.20.177.18 ...
2013-12-12 16:56:59 +0000: Got all the info, computing table ...
+------------------------------------------------------------------------------+-----------------+---------------+
| VM/Object                                                                    | Syncing objects | Bytes to sync |
+------------------------------------------------------------------------------+-----------------+---------------+
| win1                                                                         | 1               |               |
|    [vsanDatastore (1)] 9a3f9352-346a-f78d-3360-1cc1de253de4/win1-000001.vmdk |                 | 48.00 GB      |
+------------------------------------------------------------------------------+-----------------+---------------+
| Total                                                                        | 1               | 48.00 GB      |
+------------------------------------------------------------------------------+-----------------+---------------+
/localhost/CH-Datacenter/computers>

(Click & slide left to right to see the full text) You can repeatedly run this command and when the “Bytes To Sync” is 0, everything is synchronized. Some very useful commands I’m sure you will agree.

One final note – if you wish to use one of the SPBM commands which requires a ‘device’ as an argument, you must use the disk as found in ~/vms/device/…disk…

All my VSAN blog posts can be found here.