Quantcast
Channel: VMware Communities : All Content - vSphere Management SDK
Viewing all 1860 articles
Browse latest View live

FT Question

$
0
0
  1. Vmware.log and Vmware-snd.log will these log will be create both on primary and secondary VM.  What I understand is that if the Primary VM become Secondary all the logs goes to vmware-snd.log and if it became primary it will goes to Vmware.log am I right or wrong?  We have tested here we can see only one log file is created on each VM.  Primary VM has vmware.log and Secondary VM has vmware-snd.log and if the Secondayr VM become Primary it logs to vmware-snd.log .
  2. . Also  we were testing keeping the VMDK in the local  drive and trying to enable FT and it is failing saying that VMDK cannot be accessed. So i believe it can be different data store but not on the local drive.


 



Events for alarms that do not have an action specified

$
0
0

I am working on retrieving alarm events from vSphere using the web services sdk and am trying to understand the AlarmEvent DataObject and its subtypes.

 

I am especially interested in AlarmActionTriggeredEvent. From the API documentation, this seems to be the only subtype of AlarmEvent that gets created when an alarm is triggered. This could be used as an indication that an alarm was fired, provided there's an action specified for the alarm. However, most (all?) default alarms defined in the vSphere client don't have an associated action defined and this event doesn't get created in those cases.

 

Is there a way to get events generated when alarms that do not have actions defined on them get triggered? I noticed the following in the API docs:

 

When the conditions defined for the Alarm occur on the system, the Action specified for the alarm starts. The alarm also generates an Event that is posted to the Event history database. In addition, the action initiated by the Alarm might also post a second Event to the database, depending on the Action type.

Source

 

If I'm reading this right, there should be an event generated for an alarm regardless of whether the alarm has an action defined. How can I get that event?

To Enable Hot add memory/Hot plug CPU

$
0
0

 

Hi all,

 

 

I need to enable hot add memory/cpu to reconfigure the VM when it is running.

 

 

I'm able to do it by changing the setting  of the VM (Edit Setting ->Option->Advanced->Enable /Disable Memory/Cpu hot add).

 

 

But i  want to enable the Memory/cpu hot add with the help of WorkFlow/Java Code.Any reference code will be helpfull.

 

 

Note: I'm using vSphere webservice SDK to develop my application.

 

 

Thanks All,

 

 

Sanket

 

 

List Vms with Python

$
0
0

Does anyone have an example of a code snippet to get a list of all VMs in vCenter with Python?

PowerCLI Vmware.Vim.dll or SDK Vim25Service.dll for C# API programming?

$
0
0

The short version:

I'm trying to get started with C# API programming and I'm getting a bit confused with how I want to write my programs. What is the correct way? Can I substitute "using Vmware.Vim;" when I see an SDK example with "using Vim25Api;"?

 

The long version:

I see documentation online that uses the SDK that comes with PowerCLI which says to use the Vmware.Vim.dll. I have tried this and wrote a working test program similar to this one here:

 

c# - Which VMware API should I use? - Stack Overflow

 

I have also attempted to use the 5.0 SDK:

 

vSphere Management SDK for vSphere 5.5 - VMware Developer Center

 

I seemed to almost be successful getting that to work - I tired to follow these instructions here and change them a bit for VS2013:

 

https://geekseat.wordpress.com/2011/03/31/installing-vmware-sdk-with-visual-studio-2010-visual-studio-2010-express-workaround/

 

But I could not get the batch file to work so tried generated the dlls I thought were needed but had to change the path from what I found online here:

 

Where is VMware vSphere SDK C# samples required references for VimApi namespaced classes? - Stack Overflow

 

"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\sgen.exe"

"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\wsdl.exe"

"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc."

 

That ended up what seemed to be working (or mostly working) .dlls:

Vim25Service2013.dll

Vim25Service2013.XmlSerializers.dll

VimService2013.dll

VimService2013.XmlSerializers.dll

 

But I picked the AddVirutalNic.cs example to try and build - after adding the Vim25Service2013.dll as a reference VS2013 seemed to like "using Vim25Api;" but the project will still not build correctly citing quite a few errors. I never did get the batch file to work so I am not sure if the problem is I did not configure VS2013 correctly or if I needed to build a different dll or build the dlls differently. I wold be nice to have a definitive guide to configuring this

Enable VSAN Traffic for a vmkernel interface

$
0
0

Hi All,

I am using ReconfigureComputeResource_Task() for enabling the vsan traffic for the vmkernel interface. I am able to set the host system and the vmkernel interface, if we execute this task it’s returning as success but if we see in vSphere it’s still showing as disabled for the particular vnic.

PFB code.

               ClusterConfigSpecEx clusterConfigSpecEx = new ClusterConfigSpecEx();

               VsanHostConfigInfo[] hostSpecarr=new VsanHostConfigInfo[1];

                VsanHostConfigInfo hostSpec=vsanMgr.getConfig();

                hostSpec.setHostSystem(host.getMOR());

                VsanHostConfigInfoNetworkInfoPortConfig[] port =hostSpec.getNetworkInfo().getPort();

                VsanHostConfigInfoNetworkInfoPortConfig pConfig=new VsanHostConfigInfoNetworkInfoPortConfig();

                pConfig.setDevice(device);

              

                //pConfig.setIpConfig(new VsanHostIpConfig());

                List<VsanHostConfigInfoNetworkInfoPortConfig> configList=new ArrayList<VsanHostConfigInfoNetworkInfoPortConfig>();

                for(VsanHostConfigInfoNetworkInfoPortConfig p:port)

                {

                configList.add(p);

                }

                configList.add(pConfig);

                //hostSpec.setEnabled(true);

                VsanHostConfigInfoNetworkInfoPortConfig[] vsanHostConfigSpec=configList.toArray(new VsanHostConfigInfoNetworkInfoPortConfig[configList.size()]);

                //hostSpec.getNetworkInfo().setPort(vsanHostConfigSpec);

                VsanHostConfigInfoNetworkInfo vnetifo = new VsanHostConfigInfoNetworkInfo();

                vnetifo.setPort(vsanHostConfigSpec);

                hostSpec.setNetworkInfo(vnetifo);

                hostSpecarr[0]=hostSpec;

                clusterConfigSpecEx.setVsanHostConfigSpec(hostSpecarr);

               Task task=ccr.reconfigureComputeResource_Task(clusterConfigSpecEx, true);

Please help me on this.

Thanks,

Pushpa

Modifying UUID of an existing disk (VMDK) while adding it to a VM using ReconfigVM_Task API

$
0
0

Hi,

 

I am trying to add an existing VMDK to a virtual machine. The ReconfigVM_Task() API completes without issues and the virtual machine is added with the existing virtual disk as specified.

 

However, the UUID of the virtual disk clashes with the pre-existing virtual disk of the VM (The virtual disk being added to the VM is same as that of the currently available virtual disk). Even though the UUID value is specified for the new virtual disk, the API ReconfigVM_Task() appears to be reading it from the .vmdk file and using it instead of the new specified VirtualDiskFlatVer2BackingInfo.uuid.

 

I would like to specify new UUID for the virtual disk that is getting added and not to use the one that exists inside the .vmdk file.

 

Please advise me on this. I am using 4.1 SDK. The implementation works fine without issues as long as the pre-existing virtual disk UUID and the UUID of new virtual disk to be added to virtual machine are different;  otherwise there is a Question
asked on the virtual machine to complete the addition of virtual disk with duplicate UUID.


The modification of UUID of existing virtual disk works provided that the respective virtual machine is powered off. Thus the UUIDs are different and there was no issue observed while adding same disk to the vm.

 

Thanks,

Can I perform complete user management on a ESX Server using java webClient?

$
0
0

I am writing a JAVA application which will use the VMWare webservices to perform user management on ESX.

 

This user management should be able to

1) Create/Update/Delete/Query all users and groups.

2) Query all existing roles.

3) Query all existing objects like servers, pools and VMs.

4) Assign users/groups different roles on different objects. (basically create/update permissions)

 

I found a sample code within vSphere SDK to create user. But I am not able to find functions in VimPortType.java to query roles/groups/objects.

 

Also I did not find any method for creating permissions.

Can anybody help me here..?


ServiceContent / PropertyCollector errors, Invalid Cookie, Connection Refused

$
0
0


Howdy.  I'm trying to use web services ServiceContent and PropertyCollector in my vSphere Web Client application.  I've borrowed sample code from SimpleClient and PropertyCollector examples for my app. 


I pass in hard coded parameters for server URL, username and password to get the ServiceContent object.  However, when I call retrieveServiceContent() (see below), I get 'Invalid Cookie' error, although vimPort does return a non null serviceContent.


                serviceContent = vimPort.retrieveServiceContent(SVC_INST_REF);


Later on, I try to use this serviceContent object with PropertyCollector to retrieve a Host managed object reference.  This request fails on the _vimPort.retrievePropertiesEx() call with Connection Refused error, possibly due to the Cookie issue.  Any ideas?


-Eric


P.S. more code below:


private ServiceContent getServiceContent()

{

    /*

    

  • borrowed from SimpleClient example

     */

    

    // Server URL and credentials.

    String server = "100.123.111.222";

    String userName = "myuser";

    String password = "mypassword";

    String url = "https://" + server + "/sdk/vimService";  

    

    try

    {

        ManagedObjectReference SVC_INST_REF = new ManagedObjectReference();

        VimService vimService = null;

        VimPortType vimPort = null;

        ServiceContent serviceContent;

    

        HostnameVerifier hv = new HostnameVerifier() {

            public boolean verify(String urlHostName, SSLSession session) {

                return true;

            }

        };

        trustAll();

        HttpsURLConnection.setDefaultHostnameVerifier(hv);

 


        SVC_INST_REF.setType("ServiceInstance");
        SVC_INST_REF.setValue("ServiceInstance");
                
        vimService = new VimService();
        vimPort = vimService.getVimPort();
        Map<String, Object> ctxt = ((BindingProvider) vimPort).getRequestContext();
        
        ctxt.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
        ctxt.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
        
        serviceContent = vimPort.retrieveServiceContent(SVC_INST_REF);
        
        vimPort.login(serviceContent.getSessionManager(), userName, password, null);
        
        return serviceContent;
    }
    catch(Exception ex)
    {
        ex.printStackTrace();
        return null;
    }
}


 


public static List<ObjectContent> retrievePropertiesAllObjects(
        List<PropertyFilterSpec> listpfs, ServiceContent service)
        throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg {


    RetrieveOptions propObjectRetrieveOpts = new RetrieveOptions();


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


    ManagedObjectReference propCollectorRef = service.getPropertyCollector();


    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());
            }
        }
    }


    return listobjcontent;
}

Help with ServiceContent / PropertyCollector errors 'Invalid Cookie', 'Connection Refused'

$
0
0


Howdy.  I'm trying to use web services ServiceContent and PropertyCollector in my vSphere Web Client application.  I've borrowed sample code from SimpleClient and PropertyCollector examples for my app.


I pass in hard coded parameters for server URL, username and password to get the ServiceContent object.  However, when I call retrieveServiceContent() (see below), I get 'Invalid Cookie' error, although vimPort does return a non null serviceContent.


                serviceContent = vimPort.retrieveServiceContent(SVC_INST_REF);


Later on, I try to use this serviceContent object along with PropertyCollector to try to retrieve a Host reference by hostname, yet the call to _vimPort.retrievePropertiesEx() fails with 'Connection Refused' error, possibly due to the invalid cookie.


Any ideas?


-Eric


more code details below:


private ServiceContent getServiceContent()

{

    /*

    

  • borrowed from SimpleClient example

     */

    

    // Server URL and credentials.

    String serverName = "10.128.111.222"; // args[0];

    String userName = "myuser"; // args[1];

    String password = "mypassword"; // args[2];

    String url = "https://" + serverName + "/sdk/vimService";  

    

    try

    {

        ManagedObjectReference SVC_INST_REF = new ManagedObjectReference();

        VimService vimService = null;

        VimPortType vimPort = null;

        ServiceContent serviceContent;

    

        HostnameVerifier hv = new HostnameVerifier() {

            public boolean verify(String urlHostName, SSLSession session) {

                return true;

            }

        };

        trustAll();

        HttpsURLConnection.setDefaultHostnameVerifier(hv);

 


        SVC_INST_REF.setType("ServiceInstance");
        SVC_INST_REF.setValue("ServiceInstance");
                
        vimService = new VimService();
        vimPort = vimService.getVimPort();
        Map<String, Object> ctxt = ((BindingProvider) vimPort).getRequestContext();
        
        ctxt.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
        ctxt.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);


/// ERROR here Invalid Cookie
        serviceContent = vimPort.retrieveServiceContent(SVC_INST_REF);
        
        vimPort.login(serviceContent.getSessionManager(), userName, password, null);
        
        return serviceContent;
    }
    catch(Exception ex)
    {
        ex.printStackTrace();
        return null;
    }
}


    public static List<ObjectContent> retrievePropertiesAllObjects(
            List<PropertyFilterSpec> listpfs, ServiceContent service)
            throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg {


       
        RetrieveOptions propObjectRetrieveOpts = new RetrieveOptions();


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


        ManagedObjectReference propCollectorRef = service.getPropertyCollector();


        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()) {
/// ERROR here connection refused
            rslts = _vimPort.continueRetrievePropertiesEx(propCollectorRef,
                    token);
            token = null;
            if (rslts != null) {
                token = rslts.getToken();
                if (rslts.getObjects() != null && !rslts.getObjects().isEmpty()) {
                    listobjcontent.addAll(rslts.getObjects());
                }
            }
        }


        _logger.info("ManagedObjectService::retrievePropertiesAllObjects, return listobjcontent " );
        return listobjcontent;
    }


 


 

"The thread has been deleted"

$
0
0


I've tried twice now to post a new thread, but each time it gets deleted.   What is going on?


-Eric

Web Services error with Web Client App

$
0
0


Howdy.  I'm trying to use web services ServiceContent and PropertyCollector in my vSphere Web Client application.  I've borrowed sample code from SimpleClient and PropertyCollector examples for my app.


I pass in hard coded parameters for server URL, username and password to get the ServiceContent object.  However, when I call retrieveServiceContent() (see below), I get 'Invalid Cookie' error, although vimPort does return a non null serviceContent.


                serviceContent = vimPort.retrieveServiceContent(SVC_INST_REF);


Later on, I try to use this serviceContent object along with PropertyCollector to try to retrieve a Host reference by hostname, yet the call to _vimPort.retrievePropertiesEx() fails with 'Connection Refused' error, possibly due to the invalid cookie.


Any ideas?


-Eric


more code details below:


private ServiceContent getServiceContent()

{

    /*

    

  • borrowed from SimpleClient example

     */

    

    // Server URL and credentials.

    String serverName = "10.128.111.222"; // args[0];

    String userName = "myuser"; // args[1];

    String password = "mypassword"; // args[2];

    String url = "https://" + serverName + "/sdk/vimService";  

    

    try

    {

        ManagedObjectReference SVC_INST_REF = new ManagedObjectReference();

        VimService vimService = null;

        VimPortType vimPort = null;

        ServiceContent serviceContent;

    

        HostnameVerifier hv = new HostnameVerifier() {

            public boolean verify(String urlHostName, SSLSession session) {

                return true;

            }

        };

        trustAll();

        HttpsURLConnection.setDefaultHostnameVerifier(hv);

 


        SVC_INST_REF.setType("ServiceInstance");
        SVC_INST_REF.setValue("ServiceInstance");
                
        vimService = new VimService();
        vimPort = vimService.getVimPort();
        Map<String, Object> ctxt = ((BindingProvider) vimPort).getRequestContext();
        
        ctxt.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
        ctxt.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);


/// ERROR here Invalid Cookie
        serviceContent = vimPort.retrieveServiceContent(SVC_INST_REF);
        
        vimPort.login(serviceContent.getSessionManager(), userName, password, null);
        
        return serviceContent;
    }
    catch(Exception ex)
    {
        ex.printStackTrace();
        return null;
    }
}


    public static List<ObjectContent> retrievePropertiesAllObjects(
            List<PropertyFilterSpec> listpfs, ServiceContent service)
            throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg {


       
        RetrieveOptions propObjectRetrieveOpts = new RetrieveOptions();


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


        ManagedObjectReference propCollectorRef = service.getPropertyCollector();


        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()) {
/// ERROR here connection refused
            rslts = _vimPort.continueRetrievePropertiesEx(propCollectorRef,
                    token);
            token = null;
            if (rslts != null) {
                token = rslts.getToken();
                if (rslts.getObjects() != null && !rslts.getObjects().isEmpty()) {
                    listobjcontent.addAll(rslts.getObjects());
                }
            }
        }


        _logger.info("ManagedObjectService::retrievePropertiesAllObjects, return listobjcontent " );
        return listobjcontent;
    }


 

Different VPD serial number when using MSCS for pRDM

$
0
0

Hi,

 

I am trying to set up a SQL cluster across boxes using VSphere 5.5 update2 and Windows Server 2012 R2. Following supported and recommended configuration but have hit a blocker. The RDMs are presented to the two guests (powered off). When brought online, the disks are configured and can be used by both hosts respectively. No apparent issues. However, when run the failover cluster validation, the VPD serial number is different on the guests. The page 83h UUID is the same but the serial number is different. I believe this is the 80h page information. Can this be changed? Why is it different for the same LUN presented as shared storage. The LUN ID is the same on each host. Failover cluster sees them as different disks as a result. Any help would be greatly appreciated.

 

Thanks

 

Jonathan

How to retrieve ESX IP address from Vcenter

$
0
0


Hi all


Is there a way can retrieve ESX IP address directly from SDK? We can get it by resolve hostname (dnsconfig.hostname), but it may fail sometime.


I also find +host.config.network.pnic.spec.ip +but its description says  The IP configuration on the physical network adapter (applies only to a hosted network adapter). The data object will be NULL on an ESX Server system.   


So, would this ip be possible to get from vcenter directly?


thanks


Jerry   
 

vSphere VSAN Api's - broken in 5.5?

$
0
0

Hi there,

 

Playing around in the vSphere APIs, specifically under the a Hosts config.vsanHostConfig path.

 

Here is some background

 

  • I have 3 separate environments all running vSphere 5.5 ( ESXi hosts all running VMware ESXi 5.5.0 build-1746018, vCenter's running latest build)
  • None of the environments have ever had any configuration done for vSAN
  • Environment 1 has 3 hosts
  • Environment 2 has 2 hosts
  • Environment 3 has 1 host

 

Looking in the MOB at the HostSystems config path

  • Hosts in Environment 1 & 2 all show an entry for vsanHostConfig of 'vsanHostConfig'
    • Clicking this entry, hostSystem (of type ManagedObjectReference) has a value of ha-host
    • Clicking this entry results in a 404 page
  • Hosts in Environment 3 show an unset value for the vsanHostConfig property under the hosts config path

 

Now, I would expect all hosts to have a value of unset, since no configuration has ever gone on for vSAN. Why are there mixed values?

  1. Why is there a value of ha-host in use? This is an invalid entry and doesn't follow the schema of the HostSystem type (e.g. host-123)
  2. For hosts in environment 1 and 2 it is possible to get a result of False for the Enabled property under the vsanHostConfig path. Compared to the host in environment 3, where you cannot since the propertypath is 'unset' -  this is confusing. This implies there is configuration for vsan which has not been enabled, whereas with host in environment 3 there is no configuration
  3. Environment 2 (as outlined above) is a fresh install that I did yesterday, so a complete fresh build of Windows host, vCenter server and a physical ESXi server has resulted in the problem occurring.

 

I believe all hosts should have their value for the vsanHostConfig object under Host\config should be unset if there is no configuration and that this is a bug in vSphere. Anyone else seen this?

 

Message was edited by: Paul E Davey


ServiceContent / PropertyCollector errors, Invalid Cookie, Connection Refused

$
0
0


Howdy.  I'm trying to use web services ServiceContent and PropertyCollector in my vSphere Web Client application.  I've borrowed sample code from SimpleClient and PropertyCollector examples for my app.


I pass in hard coded parameters for server URL, username and password to get the ServiceContent object.  However, when I call retrieveServiceContent() (see below), I get 'Invalid Cookie' error, although vimPort does return a non null serviceContent.


                serviceContent = vimPort.retrieveServiceContent(SVC_INST_REF);


Later on, I try to use this serviceContent object along with PropertyCollector to try to retrieve a Host reference by hostname, yet the call to _vimPort.retrievePropertiesEx() fails with 'Connection Refused' error, possibly due to the invalid cookie.


Any ideas?


-Eric


more code details below:


private ServiceContent getServiceContent()

{

    /*

    

  • borrowed from SimpleClient example

     */

    

    // Server URL and credentials.

    String serverName = "10.128.111.222"; // args[0];

    String userName = "myuser"; // args[1];

    String password = "mypassword"; // args[2];

    String url = "https://" + serverName + "/sdk/vimService";  

    

    try

    {

        ManagedObjectReference SVC_INST_REF = new ManagedObjectReference();

        VimService vimService = null;

        VimPortType vimPort = null;

        ServiceContent serviceContent;

    

        HostnameVerifier hv = new HostnameVerifier() {

            public boolean verify(String urlHostName, SSLSession session) {

                return true;

            }

        };

        trustAll();

        HttpsURLConnection.setDefaultHostnameVerifier(hv);

 


        SVC_INST_REF.setType("ServiceInstance");
        SVC_INST_REF.setValue("ServiceInstance");
                
        vimService = new VimService();
        vimPort = vimService.getVimPort();
        Map<String, Object> ctxt = ((BindingProvider) vimPort).getRequestContext();
        
        ctxt.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
        ctxt.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);


/// ERROR here Invalid Cookie
        serviceContent = vimPort.retrieveServiceContent(SVC_INST_REF);
        
        vimPort.login(serviceContent.getSessionManager(), userName, password, null);
        
        return serviceContent;
    }
    catch(Exception ex)
    {
        ex.printStackTrace();
        return null;
    }
}


    public static List<ObjectContent> retrievePropertiesAllObjects(
            List<PropertyFilterSpec> listpfs, ServiceContent service)
            throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg {


       
        RetrieveOptions propObjectRetrieveOpts = new RetrieveOptions();


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


        ManagedObjectReference propCollectorRef = service.getPropertyCollector();


        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()) {
/// ERROR here connection refused
            rslts = _vimPort.continueRetrievePropertiesEx(propCollectorRef,
                    token);
            token = null;
            if (rslts != null) {
                token = rslts.getToken();
                if (rslts.getObjects() != null && !rslts.getObjects().isEmpty()) {
                    listobjcontent.addAll(rslts.getObjects());
                }
            }
        }


        _logger.info("ManagedObjectService::retrievePropertiesAllObjects, return listobjcontent " );
        return listobjcontent;
    }


 

Test Thread Ignore

$
0
0

Ignore.  Testing thread posting

Referencing NFS datastores from performance manager on hosts

$
0
0


I'm having an issue tieing together performance metrics from a host to the datastore they reference.


When calling QueryAvailablePerfMetric method against a host, it will return counters with an instance string referencing the object the counter is related to. Some of the counters are datastore usage counters - reads, writes, etc from this host.


For regular datastores, the instance string is the Managed Object ID of the datastore, so it's easy to find the datastore in question.


For NFS datastores, the instance string looks like a short UUID, which is only present in the datastore as the datastore summary, in the url field, as part of the path.


e.g. the Performance metric will reference instance string: instance string "5a04b3f6-8a1eb442"


The datastore url contains this string: /vmfs/volumes/5a04b3f6-8a1eb442


But, there is no way to go directly from the performance counters to the datastore, or vice versa.


You have to go through all datastores, find the URL for them all via the datastore summary, extract the last part of the URL, and see if that matches the performance counter instance string.


It seems like there should be a better way to tie together the performance counter to the datastore, but I cant see it.


Anyone have ideas?


 

Java Error while creating the virtual machine

$
0
0

Hi,

I am trying to create a VirtualMachine with vim25.jar, when i got below error

Exception in thread "main" javax.xml.ws.soap.SOAPFaultException:

Required property device is missing from data object of type VirtualDeviceConfigSpec

 

 

while parsing serialized DataObject of type vim.vm.device.VirtualDeviceSpec

at line 1, column 1659

 

 

while parsing property "deviceChange" of static type ArrayOfVirtualDeviceConfigSpec

 

 

while parsing serialized DataObject of type vim.vm.ConfigSpec

at line 1, column 164

 

 

while parsing call information for method CreateVM_Task

at line 1, column 94

 

 

while parsing SOAP body

at line 1, column 86

 

 

while parsing SOAP envelope

at line 1, column 22

 

 

while parsing HTTP request for method createVm

on object of type vim.Folder

at line 1, column 0

  at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)

  at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:119)

  at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)

  at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)

  at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:129)

  at $Proxy35.createVMTask(Unknown Source)

  at com.ericsson.jcat.rdav.vmware.objectTypes.VirtualMachine.createVirtualMachine(VirtualMachine.java:308)

  at com.ericsson.jcat.rdav.vmware.objectTypes.VirtualMachine.main(VirtualMachine.java:634)

 

Above error is coming after the connection has been established successfully. excactly in this command.

ManagedObjectReference taskmor = vimPort.createVMTask(vmFolderMor, vmConfigSpec, resourcepoolmor, hostmor);

I was running the VMcreate.java sample file. below part is the vm create method:

void createVirtualMachine() throws RemoteException, RuntimeFaultFaultMsg, InvalidPropertyFaultMsg,

            InvalidCollectorVersionFaultMsg, OutOfBoundsFaultMsg, DuplicateNameFaultMsg, VmConfigFaultFaultMsg,

            InsufficientResourcesFaultFaultMsg, AlreadyExistsFaultMsg, InvalidDatastoreFaultMsg, FileFaultFaultMsg,

            InvalidStateFaultMsg, InvalidNameFaultMsg, TaskInProgressFaultMsg {

 

 

        ManagedObjectReference dcmor = getMOREFsInContainerByType(serviceContent.getRootFolder(), "Datacenter").get(dataCenterName);

 

 

        if (dcmor == null) {

            System.out.println("Datacenter " + dataCenterName + " not found.");

            return;

        }

        ManagedObjectReference hostmor = getMOREFsInContainerByType(dcmor, "HostSystem").get(hostname);

        if (hostmor == null) {

            System.out.println("Host " + hostname + " not found");

            return;

        }

 

 

        ManagedObjectReference crmor = (ManagedObjectReference) getMOREFs.entityProps(hostmor,

                                                                                      new String[] { "parent" }).get("parent");

        if (crmor == null) {

            System.out.println("No Compute Resource Found On Specified Host");

            return;

        }

 

 

        ManagedObjectReference resourcepoolmor = (ManagedObjectReference) getMOREFs.entityProps(crmor,

                                                                                                new String[] { "resourcePool" }).get("resourcePool");

        ManagedObjectReference vmFolderMor = (ManagedObjectReference) getMOREFs.entityProps(dcmor,

                                                                                            new String[] { "vmFolder" }).get("vmFolder");

 

 

        VirtualMachineConfigSpec vmConfigSpec = createVmConfigSpec(virtualMachineName, dataStore, diskSize, crmor,

                                                                   hostmor);

 

 

        vmConfigSpec.setName(virtualMachineName);

        vmConfigSpec.setAnnotation("VirtualMachine Annotation");

        vmConfigSpec.setMemoryMB(new Long(vmMemory));

        vmConfigSpec.setNumCPUs(numCpus);

        vmConfigSpec.setGuestId(guestOsId);

 

 

        ManagedObjectReference taskmor = vimPort.createVMTask(vmFolderMor, vmConfigSpec, resourcepoolmor, hostmor);

        if (getTaskResultAfterDone(taskmor)) {

            System.out.printf("Success: Creating VM  - [ %s ] %n", virtualMachineName);

        } else {

            String msg = "Failure: Creating [ " + virtualMachineName + "] VM";

            throw new RuntimeException(msg);

        }

        ManagedObjectReference vmMor = (ManagedObjectReference) getMOREFs.entityProps(taskmor,

                                                                                      new String[] { "info.result" }).get("info.result");

        System.out.println("Powering on the newly created VM " + virtualMachineName);

        // Start the Newly Created VM.

        powerOnVM(vmMor);

    }

 

 

any suggestions or ideas?

Metadata file in "AppUtil.dll' could not be found

$
0
0

HI,

Getting following error while trying to build VmWare application.

 

Error 60 Metadata file 'C:\SDK\vsphere-ws\dotnet\cs\samples\AppUtil\bin\Debug\AppUtil.dll' could not be found

 

Pl Help

 

thanks

Viewing all 1860 articles
Browse latest View live


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