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 );
}
}
}
}
}
moved to the Orchestrator community (the other one focuses on Plugin development for vCO).
Cannot tell anything about the problem though
, so flash in my lab ...
Cheers,
Joerg
Is it possible to post vCO server.log file and specify the version of vCO and vCenter plugin if not the default one.
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
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 ?
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.
This the problem if vCO uses Inventory Service it doesn't work, if not it works...
So it's not useful :smileycry:
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 ?
