VMware {code} Community
Virtualiser
Contributor
Contributor

SDk and Licensing Hosts.. source returned not working - help!

Further on from previous thread: , still trying to get SDK licensing to work.

using VimService.ConfigureLicenceSource to set up the licence source as you would in VC by entering name of Licence Server. I use a property collection to get back the "source" attribute from LicenceManager managed object. This works fine and LicenceServerSource.licenceServer is returned as . however this does not work in the call. This doesnt work either in VC. The only thing that works is the IP address. Where does the LicenceManager mor get its info from? I could set up a local licenceserversource variable to the IP address of the VC server (where the LM is runing) but dont want to do this, want the code to work and get the source.

Any ideas as to what should be returned and why is returned and why it doesnt work?

Thanks.

Tags (2)
0 Kudos
6 Replies
ssurana
VMware Employee
VMware Employee

Hi,

I tried to re-create the scenario that you are faced with and I was able to nail down the probable cause of error. Please verify the following items in your setup and see if that resolves your problem:

1. Verify that the fully qualified name of the machine running the Virtual Center and License Server maps to the correct IP address.

2. Verify that the above fully qualified name is resolvable from the ESX host for which you want to set up the License Server. You can simply go to the console of the ESX and try running "ping " and verify that you are able to connect to the Virtual Center machine using the fully qualified name.

I suspect most probably you would find the error in the point#2 above, and after correcting which your script should work as desired.

Please do the above and do post your observations.

Hope the above helps.

~ Sidharth

Virtualiser
Contributor
Contributor

Definately DNS issues... sorted it last night and the code now works to set Licence Source, Set ESXfull and enable VMotion Smiley Happy

Not sure why the DNS was not working.. .possibly cache issues as this is dev rig and have had several sESX ervers of same name with different IP addresses that have been built and rebuilt.

Thanks for your help.

0 Kudos
Schorschi
Expert
Expert

Post the code? Sounds like a great illustrative example of how to do non-traversal property collection?

0 Kudos
Virtualiser
Contributor
Contributor

Hi,

I have a written a little function that I call to do non-traversal property retrieval. Its in a class, the class constructor I pass in in VimService and ServiceContent references which are then stroed locally (_svc, _sic).

Hope this helps you out...

V.

Called as follows - e.g. in this case getting summary info from a ClusterComputeResource

// my class containing function below

Attribute attrib = new Attribute(_service, _sic);

// the attribute I want back

string[] attributes = { "summary" };

// the call returning array of dynamic properties

DynamicProperty[] dProps = attrib.Get(mObjCluster, "ClusterComputeResource", attributes);

// casting the return value to the type of property we asked for.

if (dProps != null)

{

ComputeResourceSummary res = (ComputeResourceSummary)dProps[0].val;

//

// Get list of attributes from known object

// Does not include traversal spec

// Pass in mObj :: Managed Object Reference

// type :: String with type of object mObj is, e.g. "Datacenter"

// attribs :: String array of attributes to fetch

// Returns Dymamic Property array. Cast to expected object type in calling function

//

public DynamicProperty[] Get(ManagedObjectReference mObj, string type, string[] attribs)

{

try

{

ObjectSpec oSpec = new ObjectSpec();

oSpec.obj = mObj;

oSpec.skip = false;

PropertySpec pSpec = new PropertySpec();

pSpec.type = type;

pSpec.all = false;

pSpec.pathSet = attribs;

PropertyFilterSpec pfSpec = new PropertyFilterSpec();

pfSpec.propSet = new PropertySpec[] { pSpec };

pfSpec.objectSet = new ObjectSpec[] ;

ObjectContent[] ocColl = this._svc.RetrieveProperties(

this._sic.propertyCollector, new PropertyFilterSpec[] );

if (ocColl != null)

{

// found the property looking for

DynamicProperty[] dProps = ocColl[0].propSet;

return dProps;

}

return null;

}

catch (Exception e)

{

Console.WriteLine("Attribute.Get FAILED::" + e.Message);

return null;

}

}

0 Kudos
Schorschi
Expert
Expert

Yes! This is a big help! THANKS!

0 Kudos
sanjaya621
Contributor
Contributor

Hi ,

can anyone send me complete C# code for reading License information of VMWare Vcenter.I tried with SDK sample and those were not worked.

Thanks

0 Kudos