VMware {code} Community
Virtualiser
Contributor
Contributor

VI3 SDK C# Cant get LicenseSource??

Hmmm....

Struggling with this SDK I must admit... (long time since did C++/MFC/openGL type stuff) managed to programmatically add a datacenter and a standalone host.. now trying to set up licencing for the host as would normally do through configuration licences in VC... in the call ConfigureLicenceSource... how do you get the source...? in the MOB, can navigate to Retrieve Service Content, then select LicenceManager... can see source... which when clicked on has for source.. but how do you reference it to pass into Configurelicencesource?

service.ConfigureLicenseSource(sic.licenseManager, mObjHost, );

service.SetLicenseEdition(sic.licenseManager, mObjHost, "esxFull");

service.EnableFeature(sic.licenseManager, mObjHost, "vmotion");

Thanks in advance for any help...

Reply
0 Kudos
2 Replies
Virtualiser
Contributor
Contributor

Got further.... didnt realise had to do property collection stuff just to get the source... seems daft when source is part of licence manager which is first arg anyway of ConfigureLicenseSource!!!

Anyway... this is the snippet I have so far.. below... but comes back with Licence Server not available??? Using the MOB, source has value of "27000 @ localhost".

When I try this in VC itself comes up with same result... I normally use IP address of licence server here and works fine. Any ideas?

// do simple prop collection (no traversal) to get source info from mObj for LicenceManager

ObjectSpec oSpec = new ObjectSpec(); // Object Specification used in this search.

oSpec.obj = _sic.licenseManager; // Start point is mObj for LicenceManager

oSpec.skip = false; // dont skip the start point

PropertySpec pSpec = new PropertySpec();

pSpec.type = "LicenseManager";

pSpec.all = false;

pSpec.pathSet = new string[] { "source" };

PropertyFilterSpec pfSpec = new PropertyFilterSpec(); // Construct the property filter spec

pfSpec.propSet = new PropertySpec[] ;

pfSpec.objectSet = new ObjectSpec[] ;

ObjectContent[] ocColl = _service.RetrieveProperties(

_sic.propertyCollector, new PropertyFilterSpec[] );

if (ocColl != null)

{

// found the property looking for

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

if (dProps != null)

{

service.ConfigureLicenseSource(sic.licenseManager, mObjHost, (LicenseServerSource)dProps[0].val);

service.SetLicenseEdition(sic.licenseManager, mObjHost, "esxFull");

service.EnableFeature(sic.licenseManager, mObjHost, "vmotion");

}

}

Reply
0 Kudos
ssurana
VMware Employee
VMware Employee

Kindly refer to the thread http://communities.vmware.com/message/832012 for the follow up response on this thread.

Reply
0 Kudos