2nd Day Action to Limit IOPS on disks

Hello everyone,

I’ve didn’t write any posts for a really long time. This short article will be about vRO workflow used for 2nd-day actions in vRA to limit IOPS on disks.

vRO Part:

First, we need to create our vRO script:

var devices = vm.config.hardware.device;
var disks = new Array();

for (i=0;i<devices.length;i++) { if(devices[i].DeviceInfo.Label.indexOf(‘Hard disk’)>=0){
disks.push(devices[i]);
}

}
for each (disk in disks){
System.log("Current IOPS limit for disk – "+disk.DeviceInfo.Label+ " is " + disk.storageIOAllocation.limit);
var newVMSpec = new VcVirtualMachineConfigSpec() ;
var newDiskSpec = new VcVirtualDeviceConfigSpec() ;
disk.storageIOAllocation.limit = newIOLimit;
System.log("New IOPS limit for disk – "+disk.DeviceInfo.Label+ " is " + disk.storageIOAllocation.limit);
newDiskSpec.device = disk;
newDiskSpec.operation=VcVirtualDeviceConfigSpecOperation.edit;
var deviceChange = new Array();
deviceChange.push(newDiskSpec);
newVMSpec.deviceChange = deviceChange;
vm.reconfigVM_Task(newVMSpec);
}

Set Input  Parameters:

  1. vm – VC:VirtualMachine
  2. newIOLimit- number

In here this IOPS limit will apply for all Disks on the VM.

vRA part:

  1. Go to design tab XaaS-Resource Actions and create new one
  2. Choose Required Workflow from the Orchestrator
  3. input parameter VM:
  4. Choose the proper Name . also you can choose Criterias – only exact Buiseness Group for example.
  5. Customize the input view for the end user. For numbers I prefer to use Sliders (as they look awesome!) dont forget to add constraints
  6. Publish the Action:
  7. Go To Entitlements and assign it to the business group:
  8. Go to your items and click actions: you should be able to see it:
  9. We check the request status:
  10. vRO workflow run successfully:
  11. We check vCenter:

 

Now we can let users choose the IOPS of their VM’s HDDs.

Hope it was interesting for you!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.