VMware Cloud Community
erki_marks
Contributor
Contributor

Vco script for setting virtual flash read cache not working

The following script locates vim hosts, virtual machines and tries to configure flash read cache for the virtual disks.

I can see completed "reconfigure virtual machine" tasks in the vsphere server but when I open virtual machine configuration, no changes are made regarding virtual flash read cache.

Could someone help me to figure out what the problem is?

var vimHosts = VcPlugin.getVimHosts();

System.log(vimHosts.length + " Vim hosts found");

for (var i = 0; i < vimHosts.length; i++)

{

  var vimHost = vimHosts[i];

  System.log("Vim host Id: '" + vimHost.id + "'");

  var vms = vimHost.getAllVirtualMachines();

  if (vms != null)

  {

  for (var j = 0; j < vms.length; j++)

  {

  var vm = vms[j];

  System.log("--- VM '" + vm.name + "'");

  for each (var device in vm.config.hardware.device)

  {

  if (device instanceof VcVirtualDisk)

  {

  System.log("      ---- Disk: '" + device.deviceInfo.label + "' '" + device.capacityInKB + "'");

  var vflashConfig = device.vFlashCacheConfigInfo;

  if (vflashConfig != null)

  {

  System.log("           ---- vFlash Module:'" + vflashConfig.vFlashModule + "'");

  System.log("           ---- vFlash Cache Mode:'" + vflashConfig.cacheMode + "'");

  System.log("           ---- vFlash Cache Consistency Type:'" + vflashConfig.cacheConsistencyType + "'");

  System.log("           ---- vFlash Blocksize:'" + vflashConfig.blockSizeInKB + "'");

  System.log("           ---- vFlash Reservation:'" + vflashConfig.reservationInMB + "'");

  }

  var spec = new VcVirtualMachineConfigSpec();

  spec.deviceChange = [];

  var VirtualDeviceConfigSpec = new VcVirtualDeviceConfigSpec();

  VirtualDeviceConfigSpec.operation = VcVirtualDeviceConfigSpecOperation.edit;

  var vflashConfigMod = new VcVirtualDiskVFlashCacheConfigInfo();

  vflashConfigMod.blockSizeInKB="4";

  if (device.capacityInKB < 204800)

  {

  var z =  device.capacityInKB / 1024;

  vflashConfigMod.reservationInMB=z;

  }

  else if (device.capacityInKB < 6291456)

  {

  vflashConfigMod.reservationInMB="180";

  }

  else

  {

  vflashConfigMod.reservationInMB="280";

  }

  vflashConfigMod.cacheConsistencyType="strong";

  vflashConfigMod.cacheMode="write_thru";

  vflashConfigMod.vFlashModule="vfc";

  device.vFlashCacheConfigInfo=vflashConfigMod;

  VirtualDeviceConfigSpec[0] = device;

  spec.deviceChange[0] = VirtualDeviceConfigSpec;

  task = vm.reconfigVM_Task( spec );

  }

  }

  }

  }

}

Reply
0 Kudos
8 Replies
tschoergez
Leadership
Leadership

moved to the Orchestrator community (the other one focuses on Plugin development for vCO).

Cannot tell anything about the problem though :disappointed_face: , so flash in my lab ...

Cheers,

Joerg

Reply
0 Kudos
dvatov
VMware Employee
VMware Employee

Is it possible to post vCO server.log file and specify the version of vCO and vCenter plugin if not the default one.

Reply
0 Kudos
erki_marks
Contributor
Contributor

vCO - VMware vCenter Orchestrator 5.5.0, default vCenter plugin

Reply
0 Kudos
admin
Immortal
Immortal

Hello Erki,

Could you please try with inventory service disabled and see if the problem persists?

Use of inventory service can be disabled in the technical preview build of VCO 5.5 update 1 by setting the value of the java system property "com.vmware.o11n.vim.useInventoryService" to "false" in vmo.properties and restarting the VCO server. The build can be found at:

https://communities.vmware.com/docs/DOC-25307

Let us know if this helps.

Best regards,

Victor Semionov

Reply
0 Kudos
trailx
Enthusiast
Enthusiast

Same problem for me. Works if I disable system property "com.vmware.o11n.vim.useInventoryService" but my vSphere Web Client is not updated...

Any workaround ?

--- If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!
Reply
0 Kudos
admin
Immortal
Immortal

AFAIK the web client retrieves data through inventory service only, so that may be the cause for it not being updated. Unfortunately I am not aware of a workaround.

Reply
0 Kudos
trailx
Enthusiast
Enthusiast

This the problem if vCO uses Inventory Service it doesn't work, if not it works...

So it's not useful :smileycry:

--- If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!
Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee

If I understood it properly there is a problem getting this data through the inventory service which means  the problem is on the vCenter side. You can do it with vCO without using the inventory service (which BTW was the default way in the vCO plug-in a while ago). So why not do it whith setting vCO not to use the inventory service ?

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos