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

SOAP InvalidPropertyFault on vSphere 5.5

$
0
0

So I've been using the RetrieveProperties method of the PropertyCollector to collect data from my vSphere server. SOAP requests are generated and sent to the server and the responses are parsed and dealt with.

 

In 5.5, it seems that requesting for the VirtualMachine.runtime.faultToleranceState returns an InvalidPropertyFault. My exact soap request:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">

   <soapenv:Header/>

   <soapenv:Body>

      <urn:RetrieveProperties>

         <urn:_this type="PropertyCollector">propertyCollector</urn:_this>

         <specSet>

            <propSet>

               <type>VirtualMachine</type>

               <all>false</all>

               <pathSet>runtime.faultToleranceState</pathSet>

            </propSet>

            <objectSet>

               <obj type="VirtualMachine">vm-83</obj>

               <skip>false</skip>

            </objectSet>

         </specSet>

      </urn:RetrieveProperties>

   </soapenv:Body>

</soapenv:Envelope>

 

and error response:

 

<soapenv:Body>

<soapenv:Fault><faultcode>ServerFaultCode</faultcode><faultstring></faultstring><detail><InvalidPropertyFault xmlns="urn:vim25" xsi:type="InvalidProperty"><name>runtime.faultToleranceState</name></InvalidPropertyFault></detail></soapenv:Fault>

</soapenv:Body>

</soapenv:Envelope>

 

The confusing thing is, running the exact same request for a vSphere 5.0, I get a normal RetrievePropertiesResponse.

 

An identical phenomenon occurs for VirtualMachine.summary.storage.

 

PS. To debug, I attempted to request all the Properties by sending:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">

   <soapenv:Header/>

   <soapenv:Body>

      <urn:RetrieveProperties>

         <urn:_this type="PropertyCollector">propertyCollector</urn:_this>

         <specSet>

            <propSet>

               <type>VirtualMachine</type>

               <all>true</all>             

            </propSet>

            <objectSet>

               <obj type="VirtualMachine">vm-68</obj>

               <skip>false</skip>

            </objectSet>

         </specSet>

      </urn:RetrieveProperties>

   </soapenv:Body>

</soapenv:Envelope>

 

and the response does NOT contain an entry for runtime.faultToleranceState, for both vmware 5.0 and 5.5

 

Does anyone know what is going on?


How to uniquely identifying a ESXi Host under vCenter Server

$
0
0

What is the correct way to uniquely identifying a ESXi Host under vCenter Server?

 

Each ESXi Host has a Hardware BIOS identification(UUID) assigned to it but for ESXi running on White box hardware(VMware KB:    ESX host's UUID is not unique) this UUID is not unique. MoRef id is another option but I am looking for some id which will not change even when the ESXi Host is removed and added back to vCenter Server.


Is there anything on ESXi Host similar to UUID which will be unique under vCenter even if the Host is White box hardware or is removed and added back to vCenter Server?


Thanks.

Error trying to Clone a VM

$
0
0

Hi,

 

I'm trying to use the vsphere 5.0 api to clone a VM that was created in the web client.

 

Here is my SOAP XML message:

 

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

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">

<SOAP-ENV:Body>

<CloneVM_Task xmlns="urn:vim25">

<_this type="VirtualMachine">vm-xxxxx</_this>

<folder>datacenter-xxxxx</folder>

<name>clone-test-1</name>

<spec>

  <location>

    <datastore>datastore-xxxxx</datastore>

    <pool>resgroup-xxxxx</pool>

  </location>

  <template>false</template>

  <powerOn>false</powerOn>

</spec>

</CloneVM_Task>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

 

 

but I am getting the error "The request refers to an unexpected or unknown type"

 

Here is the whole response in an array:

 

array(15) {

  'key' =>

  string(11) "task-xxxxxxx"

  'task' =>

  string(11) "task-xxxxxxx"

  'name' =>

  string(12) "CloneVM_Task"

  'descriptionId' =>

  string(20) "VirtualMachine.clone"

  'entity' =>

  string(8) "vm-xxxxx"

  'entityName' =>

  string(8) "xxxxxx"

  'state' =>

  string(5) "error"

  'cancelled' =>

  string(5) "false"

  'cancelable' =>

  string(4) "true"

  'error' =>

  array(2) {

    'fault' =>

    array(1) {

      'argument' =>

      string(22) "ManagedObjectReference"

    }

    'localizedMessage' =>

    string(52) "The request refers to an unexpected or unknown type."

  }

  'reason' =>

  array(1) {

    'userName' =>

    string(10) "myusername"

  }

  'queueTime' =>

  string(26) "xxxx"

  'startTime' =>

  string(27) "xxxx"

  'completeTime' =>

  string(26) "xxxx"

  'eventChainId' =>

  string(7) "xxxxxxx"

}

 

 

Thanks in advance for any help, it will be greatly appreciated!

Custom events not formatting correctly with WSSDK 5.1

$
0
0

Hello,

 

I'm registering an extension using the VMware vSphere Web Services SDK. The custom tasks and faults I've defined are displayed correctly on the VMware vSphere Client, as well as the vSphere Web Client. The events I defined used to be displayed correctly in both, but when I converted my code from the 5.0 release to 5.1, they are no longer being shown correctly.

 

Instead of seeing something like, "Type: info" and "Description: This is the full format message", the event now looks something like, "Type: XXX Company.Product.CustomEvent.category not found XXX" and "Description: event.Company.Product.CustomEvent.fullFormat (Company.Product.CustomEvent)".

 

The code to register the extension is similar to the following, with some parts omitted, since the tasks and faults are working OK:

 

import com.vmware.vim25.*;

 

public static final String EXTENSION_KEY = "Company.Product";
public static final String CUSTOM_EVENT = EXTENSION_KEY + ".CustomEvent";

 

Extension extension = new Extension();

 

ExtensionEventTypeInfo customEventInfo = new ExtensionEventTypeInfo();
customEventInfo.setEventID(CUSTOM_EVENT);
extension.getEventList().add(customEventInfo);

 

ExtensionResourceInfo customEventResourceInfo = new ExtensionResourceInfo();
customEventResourceInfo.setLocale("en");
customEventResourceInfo.setModule("event");

 

KeyValue customEventCategory = new KeyValue();
customEventCategory.setKey(CUSTOM_EVENT + ".category");
customEventCategory.setValue("info");
customEventResourceInfo.getData().add(customEventCategory);

 

KeyValue customEventLabel = new KeyValue();
customEventLabel.setKey(CUSTOM_EVENT + ".label");
customEventLabel.setValue("This is the label");
customEventResourceInfo.getData().add(customEventLabel);

 

KeyValue customEventSummary = new KeyValue();
customEventSummary.setKey(CUSTOM_EVENT + ".summary");
customEventSummary.setValue("This is the summary");
customEventResourceInfo.getData().add(customEventSummary);

 

KeyValue customEventFormat = new KeyValue();
customEventFormat.setKey(CUSTOM_EVENT + ".fullFormat");
customEventFormat.setValue("This is the full format message");
customEventResourceInfo.getData().add(customEventFormat);

 


The main difference between this and my previous version of the extension is the change to Lists that I need to retrieve before adding objects, instead of adding array of objects.

 

The code I use to create the events looks similar to:

 

ExtendedEvent event = new ExtendedEvent();
event.setEventTypeId(CUSTOM_EVENT);
event.setManagedObject(moRef);
event.setUserName(user);
event.setChainId(taskInfo.getEventChainId());
event.setKey(0);
event.setMessage("This is a non-localized message");
event.setCreatedTime(xmlGregCal);

 

vimPort.postEvent(eventManagerMOR, event, taskInfo);

 


This part of the code has also changed a little from the 5.0 version of the SDK to the 5.1 version, such as the use of XMLGregorianCalendar for the created time.

 

I've tried prefixing the keys for the resource information with "event." but this didn't fix the problem. I didn't have to change much to get the custom tasks and faults to work with 5.1, but that doesn't seem to be the case with events. Does anyone know what other changes need to be made for events to be displayed correctly?

 

Thanks,

WaitForUpdateEx with vSphere 5.5 host is not working as expected. (Returns VM properties though it is not modified/updated on vSphere)?

$
0
0

I am using vSphere WS SDK 5.5 with vSphere 5.5 (VMware ESXi 5.5.0 build-1331820).   The WaitForUpdateEx  method returns immediately though there is no change in specified properties.  The same logic or code works with ESXi 5.0 and 5.1 hosts.

The below is the sample code. It is "GetUpdates" sample code which I modified to get updates for any VM for hostname change. In this case, I expect "waitForUpdatesEx" should return me hostname change in first version, and later if it updated/modified. But the waitfordateEx returns the same hostname as modified property in few seconds (2-5 sec) without considering the wait timeout (300secs).

 

I am not sure whats going with vSphere 5.5 host, as the same code and logics works fine against vSphere 5.1 ESX host, and I get update only if it changed or otherwise no updates.

 

I did see release notes for WS SDK 5.5, not found any change in this API call/behavior. Please let me know if anyone has solution on this or happened to see the same problem.

 

 

// Updated  GetUpdates sample

public void getUpdates() throws RuntimeFaultFaultMsg, IOException, InvalidCollectorVersionFaultMsg, InvalidPropertyFaultMsg {  
    
        String[][] typeInfo = {new String[]{"VirtualMachine", "guest.hostName"}};
        List<PropertySpec> pSpecs = buildPropertySpecArray(typeInfo);
        List<ObjectSpec> oSpecs = new ArrayList<ObjectSpec>();
        ObjectSpec os = new ObjectSpec();
        os.setObj(rootRef);
        os.setSkip(Boolean.TRUE);
        os.getSelectSet().addAll(Arrays.asList(buildFullTraversal()));
        oSpecs.add(os);
        PropertyFilterSpec propertyFilterSpec = new PropertyFilterSpec();
        propertyFilterSpec.getPropSet().addAll(pSpecs);
        propertyFilterSpec.getObjectSet().addAll(oSpecs);
        ManagedObjectReference propFilter =
                vimPort.createFilter(propCollectorRef, propertyFilterSpec, false);

        BufferedReader console =
                new BufferedReader(new InputStreamReader(System.in));

        String version = "";
        long count = 0;
        do {
            WaitOptions opts = new WaitOptions();
            opts.setMaxWaitSeconds(300);
            UpdateSet update = vimPort.waitForUpdatesEx(propCollectorRef, version, opts);
            System.out.println("Current Time In Seconds----> " + System.currentTimeMillis()/1000);
            System.out.println("Data Version----> " + version);
            if (update != null && update.getFilterSet() != null) {
                handleUpdate(update);
                version = update.getVersion();
            } else {
                System.out.println("No update is present!");
            }
            System.out.println("");
            System.out.println("****************");
            System.out.println("");
            //System.out.println("Press <Enter> to check for updates");
            //System.out.println("Enter 'exit' <Enter> to exit the program");           
            //String line = console.readLine();
            //if (line != null && line.trim().equalsIgnoreCase("exit")) {
              //  break;
            //}
            // just to exit the loop after
            count++;
            if (count > 1000) {
             break;
            }
        } while (true);
        vimPort.destroyPropertyFilter(propFilter);
    }

 

Output against vSphere 5.5 host:

[There are 6 VMs on host, 3 are powered off. It return all 3 VM hostnames correctly in first version and null for others as expected, but again in next version it returns one of the VM hostname change thought it is not changed or no operation on the vm in this time]

 

 

 

-- VMware samples in Java --
Current Time In Seconds----> 1384885325
Data Version---->
Virtual Machine updates:
New Data:
  Property Name: guest.hostName,  Value :null
New Data:
  Property Name: guest.hostName,  Value :template
New Data:
  Property Name: guest.hostName,  Value :null
New Data:
  Property Name: guest.hostName,  Value :null
New Data:
  Property Name: guest.hostName,  Value :PCOIP-GP2
New Data:
  Property Name: guest.hostName,  Value :Win8EntBase51

****************

Current Time In Seconds----> 1384885333
Data Version----> 1
Virtual Machine updates:
Changed Data:
  Property Name: guest.hostName,  Value :PCOIP-GP2

****************

Current Time In Seconds----> 1384885333
Data Version----> 2
Virtual Machine updates:
Changed Data:
  Property Name: guest.hostName,  Value :PCOIP-GP2

****************

Current Time In Seconds----> 1384885335
Data Version----> 3
Virtual Machine updates:
Changed Data:
  Property Name: guest.hostName,  Value :template

****************

Current Time In Seconds----> 1384885335
Data Version----> 4
Virtual Machine updates:
Changed Data:
  Property Name: guest.hostName,  Value :template

****************

Current Time In Seconds----> 1384885336
Data Version----> 5
Virtual Machine updates:
Changed Data:
  Property Name: guest.hostName,  Value :Win8EntBase51

****************

Current Time In Seconds----> 1384885349
Data Version----> 6
Virtual Machine updates:
Changed Data:
  Property Name: guest.hostName,  Value :Win8EntBase51

****************

Current Time In Seconds----> 1384885363
Data Version----> 7
Virtual Machine updates:
Changed Data:
  Property Name: guest.hostName,  Value :PCOIP-GP2

****************

Current Time In Seconds----> 1384885363
Data Version----> 8
Virtual Machine updates:
Changed Data:
  Property Name: guest.hostName,  Value :PCOIP-GP2

****************

Unable to change the bios boot order using vsphere api

$
0
0

Hi,

 

I am unable to change the bios boot order of a virtual machine using vsphere API. I am using the following sample request to change the boot order but the changes does not seem to reflect. Current BIOS boot order has "Network Boot" as the first entry. Any idea if I am doing something here?

 

I also tried changing the vmx file but is also is not working. I added the following entries in the file.

bios.bootOrder = "hdd"

bios.hddOrder = "scsi0:0"

 

SOAP Request.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <soapenv:Header />

  <soapenv:Body>

    <urn:ReconfigVM_Task>

      <urn:_this type="VirtualMachine">vm-6466</urn:_this>

      <urn:spec>

        <urn:deviceChange>

          <!--Optional:-->

          <!--Optional:-->

          <device>

            <urn:key>0</urn:key>

          </device>

        </urn:deviceChange>

        <urn:bootOptions>

          <urn:bootOrder xsi:type="VirtualMachineBootOptionsBootableDiskDevice">

            <urn:deviceKey>2000</urn:deviceKey>

          </urn:bootOrder>

        </urn:bootOptions>

      </urn:spec>

    </urn:ReconfigVM_Task>

  </soapenv:Body>

</soapenv:Envelope>

 

The above request creates a task but when the virtual machine powers up again it again boots from network.

Query Performance Manager Data for CPU Usage Fails

$
0
0

I was trying to run the below SOAP request to get the Performance data, but for some reason I'm getting an error shown below. Any reason why this would happen?

I'm using ESXi 5.1


Request

POST /sdk HTTP/1.1

Host: 10.6.6.10

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

Content-Length: 635

Cookie: vmware_soap_session="5249778b-c80a-18b4-9881-5f8f3f5b2cae"

SOAPAction: "urn:internalvim25/5.1"

 

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <soapenv:Body>

    <QueryPerf xmlns="urn:vim25">

   <_this type="PerformanceManager">PerfMgr</_this>

   <querySpec>

    <entity type="HostSystem">ha-host</entity>

    <maxSample>1</maxSample>

    <metricId>

   <counterId>1</counterId>

   <instance></instance>

    </metricId>

    <intervalId>20</intervalId>

   </querySpec>

  </QueryPerf>

  </soapenv:Body>

</soapenv:Envelope>

 

Response

<?xml version="1.0" encoding="UTF-8"?>\n<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"\n xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:xsd="http://www.w3.org/2001/XMLSchema"\n xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\n<soapenv:Body>\n<soapenv:Fault><faultcode>ServerFaultCode</faultcode><faultstring>The object has already been deleted or has not been completely created</faultstring><detail><ManagedObjectNotFoundFault xmlns="urn:internalvim25" xsi:type="ManagedObjectNotFound"><obj type="PerformanceManager">PerfMgr</obj></ManagedObjectNotFoundFault></detail></soapenv:Fault>\n</soapenv:Body>\n</soapenv:Envelope>

Unable to query overallCpuUsage Counter (SDK Web Service) ?

$
0
0

Hi Folks,


I am working on a Monitor solution and came across a issue I'm struggling to resolve. Initially, the idea was to use Cacti to monitor ESX using SNMP. That SNMP part idea soon disappeared when I realised the favoured method for monitoring was the SDK webservice.

 

After installing cacti, and vcli and its dependencies I got hold of some scripts and gave them a whirl.  The datastore counters work fine, the VM counters wok fine, but the ESX host counters don't seem to be working.

 

When running the ESX script it errors on line 20 with

"Can't call method "summary" on an undefined value at <scriptPath>/esxistats_cpu.pl line 20 .


When I query VM using the same script with slight changes, it works fine.

overallCpuUsage:17

 

I tried researching the issue further and came across https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/index-properties.html which confirmed the paths I'm trying to query are correct.

 

If someone out there is reading this and understands why its happening or maybe even how to fix it, please let me know!

 

Many thanks in Avance

The ESX Script:

To Invoke use:  <pathToPerl>/perl <scriptPath>/esxistats_mem.pl --url https://<ESXServer>/sdk/webService --username <username> --password <password> --esxiname '<esxiname>'

#!/usr/bin/perl -w
use strict;
use warnings;
use VMware::VIRuntime;
use VMware::VILib;
$SIG{__DIE__} = sub{Util::disconnect()};
$Util::script_version = "1.0";
my %opts = (   esxiname => {      type => "=s",      help => "ESXi Name as it appears in vCenter",      required => 1,   },
);
Opts::add_options(%opts);
Opts::parse();
Opts::validate(\&validate);
Util::connect();
my $esxi = Vim::find_entity_view(view_type => 'HostSystem', filter => {name => Opts::get_option('esxiname')}, properties => ['summary']);
my $overallCpuUsage = $esxi->summary->quickStats->overallCpuUsage;
printf("overallCpuUsage:%d \n", $overallCpuUsage);
Util::disconnect();
sub validate { return 1; }


The VM Script

To Invoke use:  <pathToPerl>/perl <scriptPath>/esxistats_mem.pl --url https://<ESXServer>/sdk/webService --username <username> --password <password> --vmname '<vmname>'

#!/usr/bin/perl -w
use strict;
use warnings;
use VMware::VIRuntime;
use VMware::VILib;
$SIG{__DIE__} = sub{Util::disconnect()};
$Util::script_version = "1.0";
my %opts = (   vmname => {      type => "=s",      help => "VM Name as it appears in vCenter",      required => 1,   },
);
Opts::add_options(%opts);
Opts::parse();
Opts::validate(\&validate);
Util::connect();
my $vm = Vim::find_entity_view(view_type => 'VirtualMachine', filter => {name => Opts::get_option('vmname')}, properties => ['summary']);
my $overallCpuUsage = $vm->summary->quickStats->overallCpuUsage;
printf("overallCpuUsage:%d \n", $overallCpuUsage);
Util::disconnect();
sub validate { return 1; }

Datastore IOPs

$
0
0

Hi guys

 

If i wanted to use the webservice to query Datastore IOP's, what counter should i be targeting?

 

Sorry i should also mention that im trying to do this within perl sdk

 

Thanks

 

Vic

Getting ServerFaultCode exception when trying to get refrance to a VM

$
0
0

Hi.

 

I am using PHP 5 and its builtin SoapClient to connect to vCenter 5.5 web service. Login and log out functions are working but when call any FindBy methods I get the following exception:

 


SoapFault exception: [ServerFaultCode] The object has already been deleted or has not been completely created


I suspect this is not an issue with parameters but is a general issue with method calls. Please assist me to pass this part of my development.


Thanks in advance.

Powershell for CPU and memory usage

$
0
0

Hi All

 

I need to gendrated the CPU & Memory and disk usage report.csv

through script for remote VM's and servers

 

Powershell or Power CLI scripts required

How to find the disk type IDE or SCSI using Vsphere API ?

$
0
0

Hi i am using vsphere java api [VMware-vSphere-SDK-5.1.0-774886] i am implementing support for creating VM and attaching disk to VM while restore in esxi server 4.1,5.0,5.1 but i am not able to find disk type is IDE or SCSI while tacking snapshot.

Thanks in Advance.

A few problems with API

$
0
0

Hello.

 

I have a problem with getting reference to datastore and host. I could not find any method in SDK reference to find a datastore. How do I get a reference to a datastore? Also non of FineBy* fundcyion helped me to get a reference to a host. neither FindByIP nor FindByInventoryPath does not find my specific host. Another question is regarding OS customization via Api. CustomizationSpec class has a property called "encryptionkey". How should I fill it?

 

Best Regards.

C# Using Single SignOn (SSPI) for Virtual Center 2.5.0.119598

$
0
0

I am trying to use passthru authentication using SSPI to work in my c# application. Here is a snippet of the code I am trying to get to work.

 

returns a reference for VMware.Vim.SessionManager

 

VMware.Vim.VimClient vimClient = new VMware.Vim.VimClient();

vimClient.Connect("10.x.x.x", CommunicationProtocol.Https, 443);

 

ManagedObjectReference serviceInstance = new ManagedObjectReference();

serviceInstance.Type = "ServiceInstance";

serviceInstance.Value = "ServiceInstance";

 

SessionManager sm = new SessionManager(vimClient, serviceInstance);

sm.LoginBySSPI(ct_b64, null);

 

I get an exception when I try to call this method LoginBySSPI

 

I am not sure that this is the correct approach, but I really would like to be able to login using single signon in my c# code but not having much success.

This works fine using PowerShell but I want to be able to do this directly using c# without using PS Pipelines.

 

 

Any suggesstions welcome.

 

 

Thanks

VimClient.FindViewEntities Returning null after some amount of time

$
0
0

Hi All,

 

I am hosting a C# webservice in IIS that makes calls against our vsphere instance to perform certain functions.  One basic call is to get a list of all VMs.  Every so often, the webservice will get in some state in which the call returns null (we always have many VMs up):

 

List<EntityViewBase> views = c.FindEntityViews(typeof(VirtualMachine), null, null, null);
if (views== null) throw new Exception("List of VMs from VimClient.FindEntityViews is null!");

 

At this point, I believe that this occurs if the webservice has not been restarted or recycled in some time.  Most likely, I am storing the VimClient incorrectly.

 

I am caching the VimClient connection in the following way.  My reason for doing so is to save time on calls (it takes roughly 20 seconds to call VimClient.Connect() upon each webservice call if I don't do this).

 

1) Upon webservice startup, I call

private static VimClient _vsphereClientConnection = null;
_vsphereClientConnection = new VimClient();
ServiceContent sc = _vsphereClientConnection.Connect(vsphereServerURL);
UserSession us = _vsphereClientConnection.Login(vsphereUsername, vspherePassword);

 

2) I then grab this instance of VimClient whenever I need to perform a function against the vSphere instance

public static VimClient VSphereClientConnection
{
 get
{
 Initialize.waitForInitialization(0);
 return _vsphereClientConnection;
}
}

where Initialize.waitForInitialization() checks whether VimClient has finished connecting to vSphere.

 

 

Am I caching this connection improperly?  Is there a better way to do this/a way to do it at all?  Or perhaps I am making a wrong assumption about why FindEntityViews is returning null.

I was thinking that in the property VSphereClientConnection, I could detect whether the connection has timed out in some way and re-connect it, but that is not ideal because then the user would have to wait for initialization again.  I'm also not sure how to check whether the service is in a bad state without making a call that I know does not work in these 'bad' states.

 

 

Thanks,

Jason


Enabling Trace logging for SFCB service

$
0
0

Hi,

 

I am looking for a method to enable trace logging for SFCB service.

I need to trace the input parameters being passed from SFCB to my CIM Provider.

 

I have referred SBLIM site and added traceFile attribute in /etc/sfcb/sfcb.cfg file and restarted SFCB service, but still I couldn't get log file populated.

Could you please let me know the correct procedure for logging.

 

Thanks,

Arun

Custom Events using VIJAVA

$
0
0

I am creating one custom event using VIJAVA APIs.

While posting that event, I want to change the source of that event or the message of that event.

 

 

I can change the message using following code but web client is not showing my custom event.

 

 

 

  ManagedObjectReference eventManager = serviceContent.getEventManager();

  ExtendedEvent myEvent = new ExtendedEvent();

                GregorianCalendar cal = (GregorianCalendar) Calendar.getInstance();

  myEvent.setCreatedTime(DatatypeFactory.newInstance().newXMLGregorianCalendar(cal));

  String userName = "vcenter.service.instance.user";

  myEvent.setUserName(userName);

  myEvent.setMessage("Trial Event message" + id);

  myEvent.setEventTypeId("Module-1");

  myEvent.setManagedObject(serviceContent.getRootFolder());

  myEvent.setFullFormattedMessage("FullFormat: Module-1 Trial Event message " + id);

  vimPort.postEvent(eventManager, myEvent,null);

 

 

 

 

 

 

 

 

But I can't see my event in web client, I don't know what I am missing here?

Any help would be appreciated.

Thanks in advance.

 

 

Regards,

Bhushan

Defining Custom Events in vCenter for a plugin

$
0
0

Hi,

I've already asked about this, but I guess my question got lost or was too complicated - so I'll try again.

We have a WebClient plugin, which is installed and registered on the vCenter, and we want to

define custom events for it.

 

During the registration, I define the following:

 

ExtensionEventTypeInfo.eventID="com.acme.myplugin.event.1234"

ExtensionEventTypeInfo.eventTypeSchema="<EventType><eventTypeID>com.acme.myplugin.event.1234</eventTypeID><description>my description</description><arguments><argument><name>var1</name><type>string</type></argument></arguments></EventType>

 

I can see this definition in the MOB, but I would like to define other properties as well, for example

the values which are set in EventDescriptionEventDetail, like

category = "info"

fullFormat = "This is a test event, and was sent with the value: {var1}"

description = "This is the description of the test event 1234";

 

So that when I send

a custom event like this:

KeyAnyValue kav1 = new KeyAnyValue();

kav1.setKey("com.acme.myplugin.event.1234.var1");

kav1.setValue("testValue");

EventEx vcEvent = new EventEx();

vcEvent.setEventTypeID("com.acme.myplugin.event.1234");

vcEvent.setChainId(0);

vcEvent.setKey(0);

vcEvent.setUserName(userName);

vcEvent.setCreatedTime(xmlValue);

vcEvent.getArguments().add(kav1);

 

_vimport.postEvent(eventManagerMOR, vcEvent, null);

 

I would hope (but it doesn't work) to see an Event in the Event Manager

having the Category of "info" , and the formatted String;

"This was a test event, and was sent with the value: testValue"

 

 

-- So to make it short, my question is, where  and how can I define the missing EventDescriptionEventDetail information?

I would like to be able to define it when registering the rest of the event information at installation time.

Is this possible?

 

please Help!

Cathy

vSphere API for VM's Virtual Disk Read & Write Rate for Historical Data

$
0
0

Folks,

 

I have a quick question on VM Disk Performance metric. I need to know the last "x" days (for an example 7 days) of Virtual Disk's Read Rate and Write Rate and need to figure out the Max of each metric.


However, when we look into the Performance UI, we can only see Real Time chart for Virtual Disk. For Disk, we see the custom but when you select the Custom, you can only get to see the "Usage" but not the individual Read and Write Rate.


So my question is, can I use any internal or public exposed API to get the past metric for Individual disk's Read and Write Rate?

I am just hoping that when we can see the Read and Write Rate for individual VM disk, there must be a way to also capture the Max value of these metric over a span of time.


Another approach is, when we look at the Per VM usage and Read and Write Rate, it is not exactly the addition of the two metric. What is the calculation here?

Posting Alarm based on custom event

$
0
0

Hi All,

 

 

 

I am creating one custom event based on which I am trying to raise a VCenter alarm on web client.

Sometimes I am able to see the alarm but sometimes It is giving error as -

 

 

    

         Failed to post VMware Alarm. REASON: A specified parameter was not correct. 

 

 

 

Does anyone have any idea why this is happening ?

Any help would be appreciated.

 

 

 

 

Thanks and Regards,

Bhushan

Viewing all 1375 articles
Browse latest View live


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