Quantcast
Channel: VMware Communities : Discussion List - vSphere Management SDK
Viewing all 1375 articles
Browse latest View live

vSphere API to fetch datastore is taking huge time.

$
0
0

Hi below is snippet of code. The last line of the code(which is bold) is call multiple times. Its performance bottle neck for us. Can you suggest ways to improve it?

This code is eventually use to fetch datastore information.

 

//input parameters: user name - user name on Vsphere

     password - password of user

     hostname - hostname of system.

 

 

//create connection to ESX.

//create service refernce

ManagedObjectReference _svcRef = new ManagedObjectReference();

        _svcRef.setType("ServiceInstance");

        _svcRef.set_value("ServiceInstance");

 

 

VimServiceLocator _locator = new VimServiceLocator();

            _locator.setMaintainSession(true);

VimPortType   _service = _locator.getVimPort(new URL(urlStr));

 

 

ServiceContent  _sic = _service.retrieveServiceContent(_svcRef);

ManagedObjectReference   _propCol = _sic.getPropertyCollector();

ManagedObjectReference   _rootFolder = _sic.getRootFolder();

 

 

            if (_sic.getSessionManager() != null) {

                _service.login(_sic.getSessionManager(), username, password, null);

//Create connection to ESX host  - end

//The above menthod is called once during the class instantion.(aka constructor

 

 

//this line is call mutiple times to fetch datastore object.

//customer has reported a performance issue with this code. When datastore number is around 100 , it takes around 1+ hour to fetch details.

_service.findByDnsName(_sic.getSearchIndex(),null,hostname,false);


Unable to install Windows Server 2012 - HAL_INITIALIZATION_FAILED

$
0
0

Hello.

 

We are unable to install Windows Server 2012 on our vSphere. Error is "HAL_INITIALIZATION_FAILED"

Screen Attached.

 

Could you help me ?

 

Best Regards

Don

vSphere Web Service SDK Setting Up Problem

$
0
0

Hello everyone,

 

I have a problem while setting up for vSphere Web Service Development. I use Windows and tried to execute the SimpleClient sample with the prompt (followed every step in vSphere Documentation until I should run the SimpleClient sample to test if everything works allright).  After excecuting I get this message in the prompt:

 

Unbenannt.JPG

 

Does someone know how I can fix the problem?

 

Best regards

Get every vm inside folder

$
0
0

Hello.

 

Im trying to locate a folder on my vCenter, and then list all the VM's thats inside that folder.

 

I took some code from the SimpleClient, however the recurse are really hard to understand for me.

 

I managed to modify the code, to find the folder "MKN".

 

Now all i need to do is to loop through every object/vm inside the folder. (Theres only gonna be VM's inside the folder.)

And this is the part where im stuck.

 

How can i define the path "MKN" is on, and then get all its content and loop through?

 

 

my code:

 

public void GetPowerStatus(string vName)
        {

            #region defines
            // Create a Filter Spec to Retrieve Contents for...

            TraversalSpec rpToVm = new TraversalSpec();
            rpToVm.name = "rpToVm";
            rpToVm.type = "ResourcePool";
            rpToVm.path = "vm";
            rpToVm.skip = false;


            // Recurse through all ResourcePools

            TraversalSpec rpToRp = new TraversalSpec();
            rpToRp.name = "rpToRp";
            rpToRp.type = "ResourcePool";
            rpToRp.path = "resourcePool";
            rpToRp.skip = false;

            rpToRp.selectSet = new SelectionSpec[] { new SelectionSpec(), new SelectionSpec() };
            rpToRp.selectSet[0].name = "rpToRp";
            rpToRp.selectSet[1].name = "rpToVm";


            // Traversal through ResourcePool branch
            TraversalSpec crToRp = new TraversalSpec();
            crToRp.name = "crToRp";
            crToRp.type = "ComputeResource";
            crToRp.path = "resourcePool";
            crToRp.skip = false;
            crToRp.selectSet = new SelectionSpec[] { new SelectionSpec(), new SelectionSpec() };
            crToRp.selectSet[0].name = "rpToRp";
            crToRp.selectSet[1].name = "rpToVm";


            // Traversal through host branch
            TraversalSpec crToH = new TraversalSpec();
            crToH.name = "crToH";
            crToH.type = "ComputeResource";
            crToH.path = "host";
            crToH.skip = false;


            // Traversal through hostFolder branch
            TraversalSpec dcToHf = new TraversalSpec();
            dcToHf.name = "dcToHf";
            dcToHf.type = "Datacenter";
            dcToHf.path = "hostFolder";
            dcToHf.skip = false;
            dcToHf.selectSet = new SelectionSpec[] { new SelectionSpec() };
            dcToHf.selectSet[0].name = "visitFolders";


            // Traversal through vmFolder branch
            TraversalSpec dcToVmf = new TraversalSpec();
            dcToVmf.name = "dcToVmf";
            dcToVmf.type = "Datacenter";
            dcToVmf.path = "vmFolder";
            dcToVmf.skip = false;
            dcToVmf.selectSet = new SelectionSpec[] { new SelectionSpec() };
            dcToVmf.selectSet[0].name = "visitFolders";


            // Recurse through all Hosts
            TraversalSpec HToVm = new TraversalSpec();
            HToVm.name = "HToVm";
            HToVm.type = "HostSystem";
            HToVm.path = "vm";
            HToVm.skip = false;
            HToVm.selectSet = new SelectionSpec[] { new SelectionSpec() };
            HToVm.selectSet[0].name = "visitFolders";


            // Recurse thriugh the folders
            TraversalSpec visitFolders = new TraversalSpec();
            visitFolders.name = "visitFolders";
            visitFolders.type = "Folder";
            visitFolders.path = "childEntity";
            visitFolders.skip = false;
            visitFolders.selectSet = new SelectionSpec[] { new SelectionSpec(), new SelectionSpec(), new SelectionSpec(), new SelectionSpec(), new SelectionSpec(), new SelectionSpec(), new SelectionSpec() };
            visitFolders.selectSet[0].name = "visitFolders";
            visitFolders.selectSet[1].name = "dcToHf";
            visitFolders.selectSet[2].name = "dcToVmf";
            visitFolders.selectSet[3].name = "crToH";
            visitFolders.selectSet[4].name = "crToRp";
            visitFolders.selectSet[5].name = "HToVm";
            visitFolders.selectSet[6].name = "rpToVm";
            SelectionSpec[] selectionSpecs = new SelectionSpec[] { visitFolders, dcToVmf, dcToHf, crToH, crToRp, rpToRp, HToVm, rpToVm };

            PropertySpec[] propspecary = new PropertySpec[] { new PropertySpec() };
            propspecary[0].all = false;
            propspecary[0].allSpecified = true;
            propspecary[0].pathSet = new string[] { "name" };
            propspecary[0].type = "ManagedEntity";

            PropertyFilterSpec spec = new PropertyFilterSpec();
            spec.propSet = propspecary;
            spec.objectSet = new ObjectSpec[] { new ObjectSpec() };
            spec.objectSet[0].obj = rootFolder;
            spec.objectSet[0].skip = false;
            spec.objectSet[0].selectSet = selectionSpecs;

            // Recursively get all ManagedEntity ManagedObjectReferences
            // and the "name" property for all ManagedEntities retrieved
            ObjectContent[] ocary =
               service.RetrieveProperties(
                  propCol, new PropertyFilterSpec[] { spec }
               );

            #endregion defines

 


            ObjectContent oc = null;
            ManagedObjectReference mor = null;
            DynamicProperty[] pcary = null;
            DynamicProperty pc = null;

            for (int oci = 0; oci < ocary.Length; oci++)
            {
                oc = ocary[oci];
                pcary = oc.propSet;
                mor = oc.obj;

                /*ListBox1.Items.Add("Object Type : " + mor.type);
                ListBox1.Items.Add("Reference Value : " + mor.Value);*/

                foreach (DynamicProperty value in pcary)
                {
                   
                    //ListBox1.Items.Add(value.val.ToString());
                    if (value.val.ToString() == "MKN")
                    {
                        ListBox1.Items.Add(value.name.ToString());
                        ListBox1.Items.Add(value.val.ToString());
                    }
                }
                /*if (pcary != null)
                {
                    for (int pci = 0; pci < pcary.Length; pci++)
                    {
                        pc = pcary[pci];
                        if (pc != null)
                        {
                            if (!pc.val.GetType().IsArray)
                            {
                                ListBox1.Items.Add(pc.val.ToString());
                            }
                        }
                    }
                }*/

            }
        }

SRM 5.0 API - Unable to Initiate Recovery Plan.

$
0
0

Forgive me if this is posted in the wrong forum but there doesn't appear to be one specifically for the SRM API.

 

So I've downloaded the WSDL files and compiled them to a C# dll and been able to successfully import them into a project. Using some of the example code in the SDK I was able to connect and retrieve Recovery Plans from my SRM instance but I was unable to initate a test or the actual plan itself. The error given in the vSphere client is "Unable to start the requested operation. Another operation might be in progress".

 

Checking the SRM logs I found this:

 

2012-01-19T14:31:39.502+11:00 [01708 verbose 'ExtApiSoapAdapter.HTTPService'] User agent is 'Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.1)'
2012-01-19T14:31:39.720+11:00 [01708 verbose 'ExtApiSoapAdapter.HTTPService'] HTTP Response: Complete (processed 515 bytes)
2012-01-19T14:31:39.720+11:00 [01708 verbose 'ExtApiSoapAdapter.HTTPService'] User agent is 'Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.1)'
2012-01-19T14:31:39.939+11:00 [02976 verbose 'ExtApiSoapAdapter.HTTPService'] HTTP Response: Complete (processed 675 bytes)
2012-01-19T14:31:39.939+11:00 [02976 verbose 'ExtApiSoapAdapter.HTTPService'] User agent is 'Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.1)'
2012-01-19T14:31:40.157+11:00 [02976 verbose 'ExtApiSoapAdapter.HTTPService'] HTTP Response: Complete (processed 675 bytes)
2012-01-19T14:31:40.157+11:00 [04744 verbose 'ExtApiSoapAdapter.HTTPService'] User agent is 'Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.1)'
2012-01-19T14:31:40.360+11:00 [03568 info 'Recovery' opID=2d41a360] Starting test workflow for plan 0B462228 'Recovery.' (perform sync)
2012-01-19T14:31:40.360+11:00 [03568 verbose 'PropertyProvider' opID=2d41a360] RecordOp ASSIGN: task, recovery-plan-3147
2012-01-19T14:31:40.360+11:00 [03568 info 'DrTask' opID=2d41a360] Starting task 'dr.recovery.RecoveryManager.test23'
2012-01-19T14:31:40.360+11:00 [04744 verbose 'ExtApiSoapAdapter.HTTPService'] HTTP Response: Complete (processed 399 bytes)
2012-01-19T14:31:40.360+11:00 [02976 info 'Recovery' ctxID=6f54b0ee opID=2d41a360] Running test workflow; plan id: recovery-plan-3147
2012-01-19T14:31:40.360+11:00 [02976 info 'Recovery' ctxID=6f54b0ee opID=2d41a360] Plan found, plan id: recovery-plan-3147, name: Recovery.
2012-01-19T14:31:40.360+11:00 [02976 error 'Recovery' ctxID=6f54b0ee opID=2d41a360] Plan recovery-plan-3147 is in an incorrect state, cannot run test workflow (current state: readySending)
2012-01-19T14:31:40.360+11:00 [02976 error 'Recovery' ctxID=6f54b0ee opID=2d41a360] Plan 'Recovery.' failed: (dr.recovery.fault.InvalidRecoveryState) {
[#10] -->    dynamicType = <unset>,
[#10] -->    faultCause = (vmodl.MethodFault) null,
[#10] -->    fromState = "readySending",
[#10] -->    toState = "testInProgress",
[#10] -->    msg = "",
[#10] --> }
2012-01-19T14:31:40.360+11:00 [02976 trivia 'Recovery' ctxID=6f54b0ee opID=2d41a360] Clearing recovery task dr.recovery.RecoveryManager.test23
2012-01-19T14:31:40.360+11:00 [02976 verbose 'PropertyProvider' ctxID=6f54b0ee opID=2d41a360] RecordOp ASSIGN: task, recovery-plan-3147
2012-01-19T14:31:40.360+11:00 [02976 verbose 'PropertyProvider' ctxID=6f54b0ee opID=2d41a360] RecordOp ASSIGN: info.stateInfo.state, recovery-plan-3147
2012-01-19T14:31:40.360+11:00 [02976 verbose 'PropertyProvider' ctxID=6f54b0ee opID=2d41a360] RecordOp ASSIGN: info.stateInfo.cancelingOperation, recovery-plan-3147
2012-01-19T14:31:40.360+11:00 [02976 verbose 'PropertyProvider' ctxID=6f54b0ee opID=2d41a360] RecordOp ASSIGN: info.stateInfo.waitingForUserInput, recovery-plan-3147
2012-01-19T14:31:40.360+11:00 [02976 info 'DrTask' ctxID=6f54b0ee opID=2d41a360] Task 'dr.recovery.RecoveryManager.test23' failed with error: (dr.recovery.fault.InvalidRecoveryState) {
[#10] -->    dynamicType = <unset>,
[#10] -->    faultCause = (vmodl.MethodFault) null,
[#10] -->    fromState = "readySending",
[#10] -->    toState = "testInProgress",
[#10] -->    msg = "",
[#10] --> }
2012-01-19T14:31:40.360+11:00 [02976 verbose 'PropertyProvider' ctxID=6f54b0ee opID=2d41a360] RecordOp ASSIGN: info.error, dr.recovery.RecoveryManager.test23
2012-01-19T14:31:40.360+11:00 [02976 info 'DrTask' ctxID=6f54b0ee opID=2d41a360] Work for task 'dr.recovery.RecoveryManager.test23' completed - new state 'error'
2012-01-19T14:31:40.360+11:00 [02976 verbose 'PropertyProvider' ctxID=6f54b0ee opID=2d41a360] RecordOp ASSIGN: info.state, dr.recovery.RecoveryManager.test23
2012-01-19T14:31:40.360+11:00 [02976 verbose 'PropertyProvider' ctxID=6f54b0ee opID=2d41a360] RecordOp ASSIGN: info.completeTime, dr.recovery.RecoveryManager.test23
2012-01-19T14:31:40.360+11:00 [02976 verbose 'PropertyProvider' ctxID=6f54b0ee] RecordOp ASSIGN: info.progress, dr.recovery.RecoveryManager.test23
2012-01-19T14:31:40.360+11:00 [02976 verbose 'DrTask' opID=2d41a360] Starting VC task 'com.vmware.vcDr.dr.recovery.RecoveryManager.test'
2012-01-19T14:31:40.376+11:00 [00428 verbose 'RecoveryVMODL' ctxID=6f54b0ee opID=7ba5054a] RemotePlanUpdated: [remote recovery-plan-3145]
2012-01-19T14:31:40.376+11:00 [00428 info 'RecoveryVMODL' ctxID=6f54b0ee opID=7ba5054a] RemotePlanUpdated: Updating existing plan
2012-01-19T14:31:40.376+11:00 [00428 trivia 'Folders' ctxID=6f54b0ee opID=7ba5054a] No rename involved in reconfigure of plan Recovery.
2012-01-19T14:31:40.376+11:00 [00428 verbose 'Recovery' ctxID=6f54b0ee opID=7ba5054a] Sync: reflected update:  Local versions: (1,1) Remote versions: (1,0).
2012-01-19T14:31:40.376+11:00 [00428 verbose 'Recovery' ctxID=6f54b0ee opID=7ba5054a] UpdateFromRemoteDelta[recovery-plan-3147] Not a peer update, ignoring delta
2012-01-19T14:31:40.391+11:00 [04748 verbose 'DrTask' opID=2d41a360] Created VC task 'com.vmware.vcDr.dr.recovery.RecoveryManager.test:task-109'
2012-01-19T14:31:40.391+11:00 [00428 verbose 'DrTask' opID=2d41a360] Failing task 'com.vmware.vcDr.dr.recovery.RecoveryManager.test:task-109'
2012-01-19T14:31:40.391+11:00 [04748 warning 'DrTask'] SetProgress failed for task 'com.vmware.vcDr.dr.recovery.RecoveryManager.test:task-109': (vim.fault.InvalidState) {
-->    dynamicType = <unset>,
-->    faultCause = (vmodl.MethodFault) null,
-->    msg = "The operation is not allowed in the current state.",
--> }
Now I watched that field in the database (pdr_planproperties table, state column) and when I initiated the plan through there this column didn't change at all throughout the process. I did notice that there were 2 ways of invoking the plan (the old 1.0 API way and the 5.0 way) however I've tried both and they give the same result.
Here's my code for reference:
          
            ServiceRef = new ManagedObjectReference();
            ServiceRef.type = "SrmServiceInstance";
            ServiceRef.Value = "SrmServiceInstance";
            Service = new SrmService();
            Service.Url = "https://core-srm01:9007";
            Service.Timeout = 600000;
            Service.CookieContainer = new CookieContainer();
            ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(CertOverride);
            ServiceInstanceContent = Service.RetrieveContent(ServiceRef);
            Service.SrmLoginLocale(ServiceRef, "Administrator", "Password01", null);
            ManagedObjectReference[] Plans = Service.ListPlans(ServiceInstanceContent.recovery);
            foreach (ManagedObjectReference Ref in Plans)
            {
                SrmRecoveryPlanInfo Plan = Service.RecoveryPlanGetInfo(Ref);
                textBox1.Text += (Plan.name + " " + Plan.description + " " + Plan.state);
            }
            SrmRecoveryPlanInfo InitiatePlan = Service.RecoveryPlanGetInfo(Plans[0]);
            InitiatePlan.state = SrmRecoveryPlanRecoveryState.protecting;
            //Service.Start(Plans[0], SrmRecoveryPlanRecoveryMode.test);
            Service.RecoveryPlanStart(ServiceInstanceContent.srmApi, InitiatePlan.name, SrmApiRecoveryMode.test);
With all this in mind I've got the feeling that there's a bug in the SRM API which tries to set the state causing the process to fail. If there's another way to initiate the plan I'll give that a go but as of yet I've been unable to find one.
Thanks for your help with this!

How to get information about free space on disk volume in special cases

$
0
0

Hello,

 

if there are on ESX server disk volumes located on classical hard disk, i can get information about its free space.

Firstly grab infromation about disk volume from HostSystem:

config.fileSystemVolume.mountInfo[1].mountInfo.path = /vmfs/volumes/****-d58381ae-f066-****

config.fileSystemVolume.mountInfo[1].mountInfo.accessMode = readWrite

config.fileSystemVolume.mountInfo[1].mountInfo.accessible = True

config.fileSystemVolume.mountInfo[1].mountInfo.accessibleSpecified = True

config.fileSystemVolume.mountInfo[1].volume.blockSizeMb = 1

config.fileSystemVolume.mountInfo[1].volume.maxBlocks = 262144

config.fileSystemVolume.mountInfo[1].volume.majorVersion = 3

config.fileSystemVolume.mountInfo[1].volume.version = 3.31

config.fileSystemVolume.mountInfo[1].volume.vmfsUpgradable = True

config.fileSystemVolume.mountInfo[1].volume.type = VMFS

config.fileSystemVolume.mountInfo[1].volume.name = esx-01:Local Storage1

config.fileSystemVolume.mountInfo[1].volume.capacity = 576330924032

 

 

and then i can pair the info (by name or path/url) to the information from Datastore:

summary.name = esx-01:Local Storage1

summary.url = ds:///vmfs/volumes/****-d58381ae-f066-****/

summary.capacity = 576330924032

summary.freeSpace = 183247044608

summary.uncommitted = 381901037568

summary.uncommittedSpecified = True

summary.accessible = True

summary.multipleHostAccess = False

summary.multipleHostAccessSpecified = True

summary.type = VMFS

 

It workgs great.

 

But there are also in HostSytem some disk volumes, which are not located in datastore:

 

config.fileSystemVolume.mountInfo[6].mountInfo.path = /vmfs/volumes/****-dc485912-cdbe-****

config.fileSystemVolume.mountInfo[6].mountInfo.accessMode = readOnly

config.fileSystemVolume.mountInfo[6].mountInfo.accessible = True

config.fileSystemVolume.mountInfo[6].mountInfo.accessibleSpecified = True

config.fileSystemVolume.mountInfo[6].volume.type = other

config.fileSystemVolume.mountInfo[6].volume.capacity = 299712512

 

Is possible locate information about free space for such disk volumes elsewhere?

 

Regards,

Ferda

Can I invoke a specific method instead of a "*_Task" like operation when create a task action

$
0
0

MethodAction action = new MethodAction();

action.setName("PowerOffVM_Task");

 

Can I invoke my own method instead of "PowerOffVM_Task"?

Unable to register a VM using rbvmomi and RegisterVM_Task

$
0
0

It doesn't seem to matter how I construct the datastore path, nothing works.

 

/Users/matt/.rvm/gems/ruby-1.9.2-p320@veewee/gems/rbvmomi-1.6.0/lib/rbvmomi/vim/Task.rb:11:in `wait_for_completion': InvalidDatastorePath: Invalid datastore path '[EMC-0156-1013]'. (RbVmomi::Fault)

  from register.rb:15:in `<main>'

 

Here is where I try to register the VM...

 

vm = dc.vmFolder.RegisterVM_Task(:path => '[EMC-0156-1013] rbvmomi_test/rbvmomi_test.vmx',

                                 :asTemplate => false,

                                 :pool => dc.vmFolder._connection.rootFolder.childEntity[0].hostFolder.childEntity[0].resourcePool)

 

I can test the location of the file and that returns true...

 

ds = dc.find_datastore('EMC-0156-1013')

puts ds.exists?('rbvmomi_test/rbvmomi_test.vmx') # => true

 

Any insight on how to construct the path would be awesome.


Login Issues

$
0
0

We are having some troubles logging to the MOB.  It wont accept any credentials.  Is there a setting somewhere I missed to allow this feature?  We are using credentials that are admins in vCenter as well as local admins on the server running vCenter, but we cant get logged into the MOB.           We are using 5.1          

problem getting Hostsystem properties using C /gsoap2.8

$
0
0

actually with the below code, i receive a SOAP_OK for the soap call of RetrieveProperties, but the returnval turns out to be empty, what is the problem???

i paste the xml recieved in bottom too

 

please help

 

struct vim25__ObjectContent retrieveHostSystemProperties(struct soap* soap, const char* url, struct vim25__ServiceContent* serviceContent){

  struct vim25__RetrievePropertiesRequestType propReq;

  struct _vim25__RetrievePropertiesResponse propRes;

  struct vim25__ObjectSpec objSpec;

  struct vim25__PropertySpec propSpec;

  struct vim25__ObjectContent objContent;

  struct vim25__PropertyFilterSpec propFilterSpec;

  struct vim25__DynamicProperty dynamicProperty;

 

 

  //----------start assign objSpec-----------------------------

  objSpec.dynamicType="";

  objSpec.__sizeselectSet=0;

  objSpec.skip=malloc(sizeof(enum xsd__boolean));

  objSpec.obj=serviceContent->rootFolder;

  objSpec.__sizedynamicProperty=0;

  objSpec.dynamicProperty=malloc(sizeof(struct vim25__DynamicProperty));

  objSpec.dynamicProperty="";

  //----------end assign objSpec-----------------------------

 

  //----------start assign propSpec-----------------------------

  propSpec.__sizepathSet=1;

  char* propName ="name";

  propSpec.pathSet=&propName;

  propSpec.all=(enum xsd__boolean*)xsd__boolean__false_;

  propSpec.type="HostSystem";

  propSpec.__sizedynamicProperty=0;

  propSpec.dynamicProperty=malloc(sizeof(struct vim25__DynamicProperty));

  propSpec.dynamicProperty="";

  propSpec.dynamicType="";

  //----------end assign propSpec-----------------------------

 

  //----------start assign propFilterSpec-----------------------------

  propFilterSpec.dynamicType="";

  propFilterSpec.__sizepropSet=1;

  propFilterSpec.propSet=&propSpec;

  propFilterSpec.__sizeobjectSet =1;

  propFilterSpec.objectSet=&objSpec;

  propFilterSpec.__sizedynamicProperty=0;

  propFilterSpec.dynamicProperty=malloc(sizeof(struct vim25__DynamicProperty));

  propFilterSpec.dynamicProperty="";

  //----------end assign propFilterSpec-----------------------------

 

 

 

  //----------finish assign all Spec, pack the request-----------

 

  propReq._USCOREthis=serviceContent->propertyCollector;

  propReq.__sizespecSet=1;

  propReq.specSet=&propFilterSpec;

 

  if(soap_call___vim25__RetrieveProperties(soap, url,"", &propReq, &propRes)==SOAP_OK){

  printf("Retrieve Properties Successful: \n");

  int i;

  int j;

  for (i=0; i < propRes.__sizereturnval; i++){

  objContent = propRes.returnval[i];

  printf("Object Type: %s",objContent.obj->type);

  printf(" (%d properties)\n ",objContent.__sizepropSet);

  for (j=0; j < objContent.__sizepropSet; j++){

  dynamicProperty = objContent.propSet[j];

 

  if ( dynamicProperty.name == "name" ){

  _XML name = dynamicProperty.val;

  printf( " Name: %s\n", name);

  }

           

            }

          

        }     

 

  return propRes.returnval[0];

  }

  else{

  printf("Retrieve Properties fail\n");

  soap_print_fault(soap,stderr);

  exit(1);

  }

}

 

 

HTTP/1.1 200 OK

Date: Wed, 26 Jun 2013 09:49:58 GMT

Cache-Control: no-cache

Connection: Keep-Alive

Content-Type: text/xml; charset=utf-8

Content-Length: 402

 

 

<?xml version="1.0" encoding="UTF-8"?>

<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>

<RetrievePropertiesResponse xmlns="urn:vim25"></RetrievePropertiesResponse>

</soapenv:Body>

</soapenv:Envelope>

Different VMtool versions on same host and both are guestToolsCurrent

$
0
0

When using Powercli to do some reporting on the VMtools versions I see something curious (for me)

Two machines on the SAME host have different readings for

 

 

New-VIProperty -Name ToolsVersion -ObjectType VirtualMachine -ValueFromExtensionProperty "Config.tools.ToolsVersion" -Force

New-VIProperty -Name ToolsVersionStatus -ObjectType VirtualMachine -ValueFromExtensionProperty "Guest.ToolsVersionStatus" -Force

get-vmhost -name vmXXXX.loods.local | get-vm | Select Name, Version, ToolsVersion, ToolsVersionStatus | ft

 

Lync2013 DIR2                                                         v9                                    9221 guestToolsCurrent

Lync2013 DIR1                                                         v9                                    8300 guestToolsCurrent

 

When I look in the about screen on the server itself both report 9.0.5 build 1065307. So according to the version in the about screen the versions are the same.

 

Please tell me , whats going on?

 

Best regards,

Gert

 

 

PowerCLI G:\Powershell\powercli> Get-PowerCLIVersion

  VMware vSphere PowerCLI 5.1 Release 2 build 1012425

  VMWare AutoDeploy PowerCLI Component 5.1 build 768137

  VMWare ImageBuilder PowerCLI Component 5.1 build 768137

  VMware License PowerCLI Component 5.1 build 669840

  VMware VDS PowerCLI Component 5.1 build 1012428

  VMware vSphere PowerCLI Component 5.1 build 1012428

Issue with retrieveProperties

$
0
0

Hi,

 

I am using VMWare SDK Web Service API to monitor and collect the performance statistics. I am trying to retrieve performance statistics (Historical Intervals) from vCenter. Here is the piece of code for this.

 

private ObjectContent[] getManagerContents(PropertySpec propertySpec, ManagedObjectReference ref) throws Exception

    {

        PropertySpec[] propspecary = new PropertySpec[]{ propertySpec };

 

 

        PropertyFilterSpec spec = new PropertyFilterSpec();

        spec.setPropSet(propspecary);

        spec.setObjectSet(new ObjectSpec[]{new ObjectSpec()});

        spec.getObjectSet(0).setObj(ref);

        spec.getObjectSet(0).setSkip(new Boolean(false));

        return cb.getConnection().getService().retrieveProperties(cb.getConnection().getServiceContent().getPropertyCollector(), new PropertyFilterSpec[]{spec});

   }

 

The above method works most of the time, but some times returns blank ObjectContent. I would like to know in which case it will return blank array of ObjectContent.

 

Any help would be greatly appreciated.

 

Thanks,

vpshere5 sdk: building vim25 dlls with VS2010 fails

$
0
0

I am trying to build sdk dlls with VS2010. Following part works for building vim dlls

 

D:\vsphere5 sdk\SDK\vsphere-ws\dotnet\cs>wsdl /n:VimApi /o:VimService.cs ..\..\wsdl\vim\vim.wsdl ..\..\wsdl\vim\vimService.wsdl

D:\vsphere5 sdk\SDK\vsphere-ws\dotnet\cs>csc /t:library /out:VimService2010.dll VimService.cs

D:\vsphere5 sdk\SDK\vsphere-ws\dotnet\cs>sgen /p VimService2010.dll

However following command to build vim25 dlls fails

 

D:\vsphere5 sdk\SDK\vsphere-ws\dotnet\cs>wsdl /v /n:Vim25Api /o:Vim25Service.cs ..\..\wsdl\vim25\vim.wsdl ..\..\wsdl\vim25\vimService.wsdl
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation. All rights reserved.
Error: Could not find a part of the path 'd:\vsphere5%20sdk\sdk\vsphere-ws\wsdl\vim25\query-messagetypes.xsd'.

If you would like more help, please type "wsdl /?".

 

Can somebody help me get rid of this error?

 

Thanks,

Vivek.

duplicate TraversalSpec name (get MORef of host by its name)

$
0
0

Hi all,

I am new to VMware and I was trying to understand and play with the Java SDK . th eSDK has getVMByVMname(string vmName) method that includes  getVMTraversalSpec() method and retrievePropertiesAllObjects

(  List<PropertyFilterSpec> listpfs) that work just fine for the virtual machine. Now the problem arises when I try to make my own code that gets getHostByHostname(String hostName) method which includes getHostTraversalSpec() and  retrievePropertiesAllObjects (  List<PropertyFilterSpec> listpfs). It keeps giving me the "duplicate TraversalSpec name" error. The error comes at the fourth line of retrievePropertiesAllObjects(List<PropertyFilterSpec> listpfs) function

RetrieveResult rslts = vimPort.retrievePropertiesEx(  propCollectorRef, listpfs, propObjectRetrieveOpts);

. could somebody please help me? It has taken me days to try to make it work but I still get the same error.

 

 

the host code is just a slight variation of the Vmcode given in the SDK. The code is given below

 

/**

  *

  * @return TraversalSpec specification to get to the VirtualMachine managed

  *         object.

  */

  private static TraversalSpec getVMTraversalSpec() {

  // Create a traversal spec that starts from the 'root' objects

  // and traverses the inventory tree to get to the VirtualMachines.

  // Build the traversal specs bottoms up

 

 

  // Traversal to get to the VM in a VApp

  TraversalSpec vAppToVM = new TraversalSpec();

  vAppToVM.setName("vAppToVM");

  vAppToVM.setType("VirtualApp");

  vAppToVM.setPath("vm");

 

 

  // Traversal spec for VApp to VApp

  TraversalSpec vAppToVApp = new TraversalSpec();

  vAppToVApp.setName("vAppToVApp");

  vAppToVApp.setType("VirtualApp");

  vAppToVApp.setPath("resourcePool");

  // SelectionSpec for VApp to VApp recursion

  SelectionSpec vAppRecursion = new SelectionSpec();

  vAppRecursion.setName("vAppToVApp");

  // SelectionSpec to get to a VM in the VApp

  SelectionSpec vmInVApp = new SelectionSpec();

  vmInVApp.setName("vAppToVM");

  // SelectionSpec for both VApp to VApp and VApp to VM

  List<SelectionSpec> vAppToVMSS = new ArrayList<SelectionSpec>();

  vAppToVMSS.add(vAppRecursion);

  vAppToVMSS.add(vmInVApp);

  vAppToVApp.getSelectSet().addAll(vAppToVMSS);

 

 

  // This SelectionSpec is used for recursion for Folder recursion

  SelectionSpec sSpec = new SelectionSpec();

  sSpec.setName("VisitFolders");

 

 

  // Traversal to get to the vmFolder from DataCenter

  TraversalSpec dataCenterToVMFolder = new TraversalSpec();

  dataCenterToVMFolder.setName("DataCenterToVMFolder");

  dataCenterToVMFolder.setType("Datacenter");

  dataCenterToVMFolder.setPath("vmFolder");

  dataCenterToVMFolder.setSkip(false);

  dataCenterToVMFolder.getSelectSet().add(sSpec);

 

 

  // TraversalSpec to get to the DataCenter from rootFolder

  TraversalSpec traversalSpec = new TraversalSpec();

  traversalSpec.setName("VisitFolders");

  traversalSpec.setType("Folder");

  traversalSpec.setPath("childEntity");

  traversalSpec.setSkip(false);

  List<SelectionSpec> sSpecArr = new ArrayList<SelectionSpec>();

  sSpecArr.add(sSpec);

  sSpecArr.add(dataCenterToVMFolder);

  sSpecArr.add(vAppToVM);

  sSpecArr.add(vAppToVApp);

  traversalSpec.getSelectSet().addAll(sSpecArr);

  return traversalSpec;

  }

  private static TraversalSpec getHostTraversalSpec() {

  // Create a traversal spec that starts from the 'root' objects

  // and traverses the inventory tree to get to the VirtualMachines.

  // Build the traversal specs bottoms up

 

 

  // Traversal to get to the Host a VApp

  TraversalSpec vAppToHost = new TraversalSpec();

  vAppToHost.setName("vAppToHost");

  vAppToHost.setType("VirtualApp");

  vAppToHost.setPath("host");

 

 

  // Traversal spec for VApp to VApp

  TraversalSpec vAppToVApp = new TraversalSpec();

  vAppToVApp.setName("vAppToVApp");

  vAppToVApp.setType("VirtualApp");

  vAppToVApp.setPath("resourcePool");

  // SelectionSpec for VApp to VApp recursion

  SelectionSpec vAppRecursion = new SelectionSpec();

  vAppRecursion.setName("vAppToVApp");

  // SelectionSpec to get to a Host in the VApp

  SelectionSpec hostInVApp = new SelectionSpec();

  hostInVApp.setName("vAppToHost");

  // SelectionSpec for both VApp to VApp and VApp to Host

  List<SelectionSpec> vAppToHosts = new ArrayList<SelectionSpec>();

  vAppToHosts.add(vAppRecursion);

  vAppToHosts.add(hostInVApp);

  vAppToVApp.getSelectSet().addAll(vAppToHosts);

  // Traversal to get to the host from ComputeResource

        TraversalSpec computeResourceToHostSystem = new TraversalSpec();

        computeResourceToHostSystem.setName("computeResourceToHostSystem");

        computeResourceToHostSystem.setType("ComputeResource");

        computeResourceToHostSystem.setPath("host");

        computeResourceToHostSystem.setSkip(false);

     // This SelectionSpec is used for recursion for Folder recursion

        SelectionSpec sSpec = new SelectionSpec();

        sSpec.setName("VisitFolders");

       // SelectionSpec sSpec1 = new SelectionSpec();

       // sSpec1.setName("VisitFolders");

        //SelectionSpec[] sSpecs = new SelectionSpec[]{sSpec};

        List<SelectionSpec> sSpecs = new ArrayList<SelectionSpec>();

        computeResourceToHostSystem.getSelectSet().add(sSpec);//.setSelectSet(sSpecs);

  sSpecs.add(sSpec);

 

 

  // Traversal to get to the hostFolder from DataCenter

  TraversalSpec dataCenterToHostFolder = new TraversalSpec();

  dataCenterToHostFolder.setName("DataCenterToHostFolder");

  dataCenterToHostFolder.setType("Datacenter");

  dataCenterToHostFolder.setPath("hostFolder");

  dataCenterToHostFolder.setSkip(false);

  dataCenterToHostFolder.getSelectSet().add(sSpec);

  sSpecs.add(sSpec);

 

  // TraversalSpec to get to the DataCenter from rootFolder

  TraversalSpec traversalSpec = new TraversalSpec();

  traversalSpec.setName("VisitFolders");

  traversalSpec.setType("Folder");

  traversalSpec.setPath("childEntity");

  traversalSpec.setSkip(false);

  List<SelectionSpec> sSpecArr = new ArrayList<SelectionSpec>();

  sSpecArr.add(sSpec);

  sSpecArr.add(computeResourceToHostSystem);

  sSpecArr.add(dataCenterToHostFolder);

  sSpecArr.add(vAppToHost);

  sSpecArr.add(vAppToVApp);

  sSpecArr.add(vAppToVApp);

  traversalSpec.getSelectSet().addAll(sSpecArr);

  return traversalSpec;

  }

  /**

  * Get the MOR of the Virtual Machine by its name.

  *

  * @param vmName

  *            The name of the Virtual Machine

  * @return The Managed Object reference for this VM

  */

  private static ManagedObjectReference getVmByVMname(String vmName) {

  ManagedObjectReference retVal = null;

  ManagedObjectReference rootFolder = serviceContent.getRootFolder();

  try {

  TraversalSpec tSpec = getVMTraversalSpec();

  // Create Property Spec

  PropertySpec propertySpec = new PropertySpec();

  propertySpec.setAll(Boolean.FALSE);

  propertySpec.getPathSet().add("name");

  propertySpec.setType("VirtualMachine");

 

 

  // Now create Object Spec

  ObjectSpec objectSpec = new ObjectSpec();

  objectSpec.setObj(rootFolder);

  objectSpec.setSkip(Boolean.TRUE);

  objectSpec.getSelectSet().add(tSpec);

 

 

  // Create PropertyFilterSpec using the PropertySpec and ObjectPec

  // created above.

  PropertyFilterSpec propertyFilterSpec = new PropertyFilterSpec();

  propertyFilterSpec.getPropSet().add(propertySpec);

  propertyFilterSpec.getObjectSet().add(objectSpec);

 

 

  List<PropertyFilterSpec> listpfs = new ArrayList<PropertyFilterSpec>(

  1);

  listpfs.add(propertyFilterSpec);

  List<ObjectContent> listobjcont = retrievePropertiesAllObjects(listpfs);

 

 

  if (listobjcont != null) {

       for (ObjectContent oc : listobjcont) {

            ManagedObjectReference mr = oc.getObj();

            String vmnm = null;    

            List<DynamicProperty> dps = oc.getPropSet();

            if (dps != null) {    

            for (DynamicProperty dp : dps) {    

                 vmnm = (String) dp.getVal();         

            }         

       }

       if (vmnm != null && vmnm.equals(vmName)) {

            retVal = mr;

            break;

            }    

       }

      }

  } catch (SOAPFaultException sfe) {

  printSoapFaultException(sfe);

  } catch (Exception e) {

  e.printStackTrace();

  }

  return retVal;

  }

 

 

  //gets the host Managed object reference by its name

  private static ManagedObjectReference getHostByHostname(String hostName) { //getHostByName(string entityname)

  ManagedObjectReference retVal = null;

  ManagedObjectReference rootFolder = serviceContent.getRootFolder();

  try {

  TraversalSpec tSpec = getHostTraversalSpec();//getVMTraversalSpec();//

  // Create Property Spec

  PropertySpec propertySpec = new PropertySpec();

  propertySpec.setAll(Boolean.FALSE);

  propertySpec.getPathSet().add("name");//random guess ("resourcePool");

  propertySpec.setType("HostSystem");//propertySpec.setType("VirtualMachine");

 

 

  // Now create Object Spec

  ObjectSpec objectSpec = new ObjectSpec();

  objectSpec.setObj(rootFolder);

  objectSpec.setSkip(Boolean.TRUE);

  objectSpec.getSelectSet().add(tSpec);

 

 

  // Create PropertyFilterSpec using the PropertySpec and ObjectPec

  // created above.

  PropertyFilterSpec propertyFilterSpec = new PropertyFilterSpec();

  propertyFilterSpec.getPropSet().add(propertySpec);//propertyFilterSpec.setPropSet(propertySpecs);

  propertyFilterSpec.getObjectSet().add(objectSpec);//propertyFilterSpec.setObjectSet(objectSpecs);

 

 

  List<PropertyFilterSpec> listpfs = new ArrayList<PropertyFilterSpec>(1);

  listpfs.add(propertyFilterSpec);

  List<ObjectContent> listobjcont = retrievePropertiesAllObjects(listpfs);

  //PropertyFilterSpec[] propertyFilterSpecs = new PropertyFilterSpec[]{propertyFilterSpec};

  //ObjectContent[] oCont = vimPort.retrievePropertiesAllObjects(propCollectorRef, propertyFilterSpecs);

 

  if (listobjcont != null) {

  for (ObjectContent oc : listobjcont) {

  ManagedObjectReference mr = oc.getObj();

  String vmnm = null;

  List<DynamicProperty> dps = oc.getPropSet();

  if (dps != null) {

  for (DynamicProperty dp : dps) {

  vmnm = (String) dp.getVal();

  }

  }

  if (vmnm != null && vmnm.equals(hostName)) {

  retVal = mr;

  break;

  }

  }

  }

  } catch (SOAPFaultException sfe) {

  printSoapFaultException(sfe);

  } catch (Exception e) {

  e.printStackTrace();

  }

  return retVal;

  }

 

private static List<ObjectContent> retrievePropertiesAllObjects(

  List<PropertyFilterSpec> listpfs) throws Exception {

 

 

  RetrieveOptions propObjectRetrieveOpts = new RetrieveOptions();

 

 

  List<ObjectContent> listobjcontent = new ArrayList<ObjectContent>();

 

 

  try {

  RetrieveResult rslts = vimPort.retrievePropertiesEx(

  propCollectorRef, listpfs, propObjectRetrieveOpts);

  if (rslts != null && rslts.getObjects() != null

  && !rslts.getObjects().isEmpty()) {

  listobjcontent.addAll(rslts.getObjects());

  }

  String token = null;

  if (rslts != null && rslts.getToken() != null) {

  token = rslts.getToken();

  }

  while (token != null && !token.isEmpty()) {

  rslts = vimPort.continueRetrievePropertiesEx(propCollectorRef,

  token);

  token = null;

  if (rslts != null) {

  token = rslts.getToken();

  if (rslts.getObjects() != null

  && !rslts.getObjects().isEmpty()) {

  listobjcontent.addAll(rslts.getObjects());

  }

  }

  }

  } catch (SOAPFaultException sfe) {

  printSoapFaultException(sfe);

  } catch (Exception e) {

  System.out.println(" : Failed Getting Contents");

  e.printStackTrace();

  }

 

 

  return listobjcontent;

  }

Adding hosts against 5.1 now failing due to SSL requirements

$
0
0

I have some WebServices C# code that used to switch off the vCenter Server advanced setting client.VerifySLLCertificates (set to false) then use the .AddStandaloneHost_Task to add a host. This was against vSphere4 and worked no problem.

Now trying to do the same thing with 5.1, except that due to SSO, client.VerifySLLCertificates is set to true and greyed out. Using UpdateOptions to try to set this to false fails. Trying to add a host using .AddStandaloneHost_Task fails with SSLVerifyFault.

 

So how do I add a host now!? I dont want to go through replacing certificates at the point of setting up the infrastructure.

The PowerCLI equivilent command seems to have a force flag but need to get this done in in C# WebServices.

 

Basically need code equivalent of ticking the checkbox in the GUI when adding a host to say you verify the thumbprint.

 

All pointers gratefully received!

 

SF.


Which Api to use?Beginner

$
0
0

Hello and nice to meet you.

After reading http://stackoverflow.com/questions/5493697/which-vmware-api-should-i-use i'm not quit sure

if i have to use assembly Vmware.Vim or VimService51.

Of course vmware.vim uses the other assemblies  but for example vimclient class is something very helpful as i can understand.

And it only exists in vmware.vim.Moreover vimclient is not documented.

I want to say that vmware.vim uses some proxy like classes which call some other core components.Those classes

make the life of a developer easier but i'm not sure if they are documented or even if it's the right way to go.

I'm a totally beginner and i would like to begin the right way.

Thank you in advance!

 

ps:Why aren't things simplier vmware?A single assembly for example?

vmFolder Not listing all VMs

$
0
0

Hey Gang, this is my first post so please forgive me if I ask any obvious questions.  I'm currently developing an app that interfaces with a VC via the rbvmomi library (ruby), which uses the vsphere API.  I'm having a problem where I need to list all the available VMs, but the vmFolder API command is only returning less than half of what is actually there.  I double checked this using a vsphere client. 

 

Any ideas on what I could be doing wrong?  Are there multiple vmFolders that I have to look in or something?  Do the VMs have to be added in a special way to be visible via the API?

 

Here is the line of ruby code using rbvmomi:

 

dc.vmFolder.childEntity.size

 

=> 63

 

And I know I have 112 VMs set up.  dc is the datacenter variable, and I'm pretty sure that the rbvmomi framework is just using the API SDK.

 

Thanks in advance for your help!

 

-Dave

Browsing to https:///sdk gives blank page ?

$
0
0

We are running vCenter 5.1 (VCenter Server Appliance)  A programmer is attempting to utilize the API to pull information on ESXi hosts and VM's. When we point a web browser at https://<hostname>/sdk/ we get a blank page. I do get info if we browse to https://<hostname>/Folder/   and https://<hostname>/mob/

 

Anyone have thoughts as to what might be the problem? Searched around a lot an couldn't come up with an answer.  Since I am not a programmer, the docs on the API are a little vague to me.

 

Thanks,

 

Mike

Fault VimApi.InvalidArgument

$
0
0

Hello.I'm trying to run the example VMCreate2010 and i get this error.I'm using 5.1.

I have tried to pass useroptions[8] = newOptionSpec("VimApi", "String", 0, "version...", "vmx-07");

but i don't know what the api version should be.

Can you please help me?

Is any method really invoked when using CreateTaskAction and set a TaskTypeId

$
0
0

Hi All,

 

I'm trying to create a task to invoke my own method/script and hoping it can show in the task list.

 

I add the taskInfo when register the extension like:

 

       String myPkg = "com.myCompany.myProduct.myTask";

       String myTask = myPkg + "InvokeEXE";

       Extension myExt = new Extension();

       ManagedObjectReference extManager = new ManagedObjectReference();

       extManager = serviceContent.getExtensionManager();

    

       //Create ExtensionTaskTypeInfo

       ExtensionTaskTypeInfo etti = new ExtensionTaskTypeInfo();

       etti.setTaskID(myTask);

       myExt.getTaskList().add(etti);

      

       //Create ExtensionResourceInfo

       ExtensionResourceInfo eri = new ExtensionResourceInfo();

       eri.setLocale("en");

       eri.setModule("task");

       KeyValue key1 = new KeyValue();

       key1.setKey(myTask + ".lable");

       key1.setValue("My Task Lable");

       KeyValue key2 = new KeyValue();

       key2.setKey(myTask + ".summary");

       key2.setValue("My task summary");

       eri.getData().add(key1);

       eri.getData().add(key2);

       myExt.getResourceList().add(eri);

      

       //Create Description

       Description des = new Description();

       des.setLabel("My Company Product Lable");

       des.setSummary("My Company Product Summary");

       myExt.setDescription(des);

      

       //Other

       myExt.setKey(myPkg);

       myExt.setVersion("1.0.0");

      

       //Create Client Info

       ExtensionClientInfo eci = new ExtensionClientInfo();

       Description des1 = new Description();

       des1.setLabel("My Client Info Lable");

       des1.setSummary("My Client Info Summary");

       eci.setDescription(des1);

       eci.setCompany("IBM");

       eci.setType("win32");

       eci.setVersion("1.0.0");

       eci.setUrl("http://somewhere/something.zip");

       myExt.getClient().add(eci);

      

       GregorianCalendar gcal = new GregorianCalendar();

       gcal.setTime(new Date());

       myExt.setLastHeartbeatTime(DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal));

      

       vimPort.registerExtension(extManager, myExt);

 

And I create a custom task like:

 

      ManagedObjectReference clusterMor = new ManagedObjectReference();

      clusterMor.setType("ClusterComputeResource");

      clusterMor.setValue("domain-c23");

 

     CreateTaskAction action = new CreateTaskAction();

     action.setCancelable(true);

     action.setTaskTypeId("com.ibm.ivp.tool.InvokeEXE");

 

      GregorianCalendar gcal = new GregorianCalendar();

      gcal.add(Calendar.MINUTE, 30);

      XMLGregorianCalendar runTime = DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal);

      OnceTaskScheduler scheduler = new OnceTaskScheduler();

      scheduler.setRunAt(runTime);

 

     ScheduledTaskSpec scheduleSpec = new ScheduledTaskSpec();

     scheduleSpec.setName("ThisTaskName");

     scheduleSpec.setDescription("Create task to a cluster");

     scheduleSpec.setEnabled(true);

     scheduleSpec.setAction(action);

     scheduleSpec.setScheduler(scheduler);

 

 

     ManagedObjectReference scheduleMgr = new ManagedObjectReference();

     scheduleMgr = serviceContent.getScheduledTaskManager();

     ManagedObjectReference task = vimPort.createScheduledTask(scheduleMgr, clusterMor, scheduleSpec);

 

But I only got a "queued" task and nothing is invoked. So is there a method that really invoked by this task? If not, how can I do that?

 

Thanks in advance.

Viewing all 1375 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>