VMware Cloud Community
sean_gadson
Enthusiast
Enthusiast

VcHostVStorageObjectManager

Hello,

we just upgraded to vSphere 6.5 and we need to update some deprecated code How do you get to the VcHostVStorageObjectManager scripting object in vRO?  as we want to take advanatge of the extend disk method there

5 Replies
eoinbyrne
Expert
Expert

Have you tried this?

var hostVStorObjManagers = Server.findAllForType("Vc:HostVStorageObjectManager");

The type is listed as a Finder type so that might return something if everything is configured..?

0 Kudos
sean_gadson
Enthusiast
Enthusiast

Hello,

I just tried that and it didnt return anything back

0 Kudos
eoinbyrne
Expert
Expert

Sorry, noticed a typo which might not be helping

var hostVStorObjManagers = Server.findAllForType("VC:HostVStorageObjectManager"); 

I muffed the "C" in the plugin prefix.... might not make any odds but worth a try

0 Kudos
eoinbyrne
Expert
Expert

Nah, ignore me, that won't work either

Looking at the plugin classes, the VcSDKConnection class has a "serviceInstance" member which refers to this type

vRO API Explorer by Dr Ruurd and Flores of ITQ - VcServiceInstance

If you get one of those it has a reference to VcServiceContent which contains the service you really want

vRO API Explorer by Dr Ruurd and Flores of ITQ - VcVStorageObjectManagerBase (this is the parent class of the type you began with - there are 2 implementations, 1 for the Host and one for the VCenter server)

Anyway, on our lab setup right now if I do this with a VM (VC 6.5 & vRO 7.5)

var servceInstance = vm.sdkConnection.serviceInstance;

System.log(serviceInstance);

The log just prints "undefined"

The types ARE documented in the vSphere API and MO lists but either my VC is not setup right or for some reason this is not an accessible service for now?

0 Kudos
iiliev
VMware Employee
VMware Employee

Hi,

Here is how you can get access to this object:

var moref = new VcManagedObjectReference("ServiceInstance", "ServiceInstance");

var serviceInstance = VcPlugin.convertToVimManagedObject(connection, moref);

var serviceContent = serviceInstance.retrieveServiceContent();

var soMgr = serviceContent.vStorageObjectManager;

// use it

System.log(soMgr);

The input parameter of this scripting code is the variable 'connection' of type VC:SdkConnection