Quantcast
Channel: VMware Communities : Discussion List - vSphere Management SDK

IVirtualMachineOperations.StartProgramInGuest returns -1073740791 instead of the new process id that has been started. Then all further calls fail with internal server error.

$
0
0

We are using vmware management SDK to start an executable on a remote machine managed in a vcenter.

While trying to start the process using "VMware.Interfaces.Operations.IVirtualMachineOperations.StartProgramInGuest" by passing the executable path, instead of receiving the id of the process that has been started, we are receiving -1073740791. And further call to list the running processes on the remote machine also fail with internal server error.

Can you mention why this is happening and the solution to avoid this ?


vSphere Management vs vSphere Automation sdk

$
0
0

Hi All,

I'm trying to write Backup & Restore module of VM using Java based sdk.

I explore lots of documents & finally get confused which SDK should use because there is lots of SDK available such as.

vSphere Management SDK , vSphere Automation sdk,  Virtual Disk Development Kit & etc.

Please, anyone guide me how to proceed with this.

Thanking You !

WinRM issues when using VCSA

$
0
0

I'm really hoping someone can give me some steer with this one, bear in mind I'm not a developer - I'm infrastructure.

We have a lot of automation scripts which run against our Windows based vCentre 6.0 servers.   We are looking at migfrating to VCSA 6.5, but during testing we have experienced the following error when pointing the scripts to the new vCentre appliance.

"WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet."

Our automation team have mentioned a couple of things to me

1. Powershell remoting needs to be made available on the VCSA

2. need to run the invoke-command

I believe the reason why we aren't facing problems on our Windows vCentre server is because we have powershell installed on the server, and WinRM and the invoke-command are using the powershell software and the windows RM service.    On the VCSA we have neither, clearly due to this being non-windows.

What options/workaround are available?

How to invoke scsi inquiry for non standard page for a SCSI LUN

$
0
0

VMware stores the VPD information in standard inquiry property for SCSI LUN. If we want to query other than standard data, is there a API or a way to do this?

 

Thanks

Guru

To fetch if a lun belongs to USB from MOB Query

$
0
0

Hi ,

 

We have a requirement of getting all the ScsiDisk luns , but we need to ignore the luns which are of USB type .

 

Can someone please help me how can I get the information from MOB .

 

--

Regards,

Shu

Retrieving physical disk/lun mapping to DataStore / RDM

$
0
0

Is it possible to find the DataStore or VM(RDM) to which a Physical Disk/Lun is mapped?

I could not find an applicable API for this.

 

I can enumerate the VM's and Datastores to find the associated disks, but that seems quite inefficient and was hoping for an alternative.

A general system error occurred: internal error

$
0
0

I am using RegisterVM_Task API to register Virtual Machines on VCenter 6.5 (managed ESXs are also 6.5).

However, at times, the RegisterVM_Task fails with SystemError and the message is: "A general system error occurred: internal error"

Following is a log snippet from vpxd log for one such failure:

 

2018-07-26T08:23:16.173Z error vpxd[7FDDBBA66700] [Originator@6876 sub=VmProv opID=14f2e116-01] Get exception while executing action vpx.vmprov.RegisterDestinationVm: N5Vmomi5Fault11SystemError9ExceptionE(vmodl.fault.SystemError)

--> [context]zKq7AVECAAAAAAHCfgAddnB4ZAAAJGcrbGlidm1hY29yZS5zbwAA9B4bAD5vGAHI5VR2cHhkAAHd51QBYRzLAR4C0AFza9EBqqTOATDHzgF9zM4BFdBzAYrFcwFB6nMBoLJzAQVQygH7UMoBiNl4ggZeBgFsaWJ2aW0tdHlwZXMuc28AAfzYdAEV0HMBisVzAUHqcwGCPXQAo7QjAIq3IwDbvysDRHQA

 

2018-07-26T08:23:16.233Z info vpxd[7FDDBBA66700] [Originator@6876 sub=Default opID=14f2e116-01] [VpxLRO] -- ERROR lro-549516 --  -- VmprovWorkflow: vmodl.fault.SystemError:

--> Result:

--> (vmodl.fault.SystemError) {

-->    faultCause = (vmodl.MethodFault) null,

-->    faultMessage = <unset>,

-->    reason = "internal error"

-->    msg = ""

--> }

--> Args:

-->

2018-07-26T08:23:16.233Z info vpxd[7FDDBBA66700] [Originator@6876 sub=vpxLro opID=14f2e116] [VpxLRO] -- FINISH task-2654

2018-07-26T08:23:16.233Z info vpxd[7FDDBBA66700] [Originator@6876 sub=Default opID=14f2e116] [VpxLRO] -- ERROR task-2654 -- group-v3 -- vim.Folder.registerVm: vmodl.fault.SystemError:

--> Result:

--> (vmodl.fault.SystemError) {

-->    faultCause = (vmodl.MethodFault) null,

-->    faultMessage = <unset>,

-->    reason = "internal error"

-->    msg = ""

--> }

--> Args:

-->

--> Arg path:

--> "[vsanDatastore] vsan-scale-vm9/vsan-scale-vm9.vmx"

--> Arg name:

--> "vsan-scale-vm9"

--> Arg asTemplate:

--> false

--> Arg pool:

--> 'vim.ResourcePool:resgroup-23'

--> Arg host:

-->

 

Please let me know if anybody else has seen this behavior and if there was any resolution.

Also let me know if looking at some other logs might help.

Instant clone pool creation fails

$
0
0

My Environment:

vCenter: 6.5U1 (build 7515524)

Horizon: 7.5.0 (I have 5 connection server 3 of then in domain domain1.com and two other in domain2.com)

 

I have a test server with ESXi 6.5 and local flash datastore (SSD).

 

Doing all by this instruction (I also read all Horizon documentation about instant clone) - VMware Horizon View 7: Instant Clone Desktop Pool [Part 8] - VirtuallyBoring

After finish pool creation master, I have this error:

 

in log files I only find this:

2018-08-06T13:27:06.361+03:00 DEBUG (1F58-09A8) <DesktopControlLdap> [DesktopTracker] Update pool from LDAP notification: cn=vdi_test04,ou=server groups,dc=vdi,dc=vmware,dc=int

2018-08-06T13:27:06.361+03:00 DEBUG (1F58-09A8) <DesktopControlLdap> [InformationBase] PoolInformation[cn=vdi_test04,ou=server groups,dc=vdi,dc=vmware,dc=int]::pae-VmProvEnabled is now false

2018-08-06T13:27:06.361+03:00 DEBUG (1F58-09A8) <DesktopControlLdap> [InformationBase] PoolInformation[cn=vdi_test04,ou=server groups,dc=vdi,dc=vmware,dc=int]::pae-VmProvError is now Initial publish failed: Unknown error, fault not set

2018-08-06T13:27:06.361+03:00 DEBUG (1F58-09A8) <DesktopControlLdap> [InformationBase] PoolInformation[cn=vdi_test04,ou=server groups,dc=vdi,dc=vmware,dc=int]::pae-VmProvErrorTime is now 1533551195

2018-08-06T13:27:06.361+03:00 DEBUG (1F58-09A8) <DesktopControlLdap> [InformationBase] PoolInformation[cn=vdi_test04,ou=server groups,dc=vdi,dc=vmware,dc=int]::pae-PendingParentImageState is now FAILED

2018-08-06T13:27:06.361+03:00 DEBUG (1F58-09A8) <DesktopControlLdap> [InformationBase] PoolInformation[cn=vdi_test04,ou=server groups,dc=vdi,dc=vmware,dc=int]::pae-NgvcPoolPendingOperation is now null

2018-08-06T13:27:06.361+03:00 DEBUG (1F58-09A8) <DesktopControlLdap> [InformationBase] PoolInformation[cn=vdi_test04,ou=server groups,dc=vdi,dc=vmware,dc=int]::pae-SVIVmOperationSchedule is now null

 

 

In Horizon 7.3.2 release notes found this:

Instant-clone operations fail with Horizon 7 version 7.3.1 or version 7.3 while connecting to vCenter Server in some situations. This failure can have significant consequences in production and is now handled gracefully in Horizon 7 version 7.3.2.

 

Upgraded from 7.3.1 to 7.5.0 but this doesn't helped.

 

Googl doesn't helped at all.... :-/

 

Will be grateful for any clues where to look the issue.


Custom Task - setTaskState to error - problem setting MethodFault

$
0
0

Hi I've found this question in lots of places, but it never seems to be answered.  I'm optimistic...

 

I am using custom tasks, and am able to set the progress, and the state to "TaskInfoState.SUCCESS" without any problems.

But if something goes wrong during my task, I want to set the task state to "error" - and add a message why.

 

so I use vimPort.setTaskState(taskInfo.getTask(), TaskInfoState.ERROR, null, taskMethodFault);

 

My taskMethodFault is a LocalizedMethodFault -

It expects a MethodFault, and a localized Message -

 

The MethodFault expects a FaultCause which is a LocalizedMethodFault - which then expects a never ending number of Faults...

 

Here's what the soap exception says:

com.sun.xml.internal.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: required tag not seen while processing MethodFault at line 1, column 374 while parsing property "faultCause" of static type MethodFault while parsing serialized DataObject of type vmodl.MethodFault at line 1, column 367 while processing MethodFault at line 1, column 355 while parsing property "faultCause" of static type MethodFault while parsing serialized DataObject of type vmodl.MethodFault at line 1, column 348 while processing MethodFault at line 1, column 341 while parsing call information for method SetTaskState at line 1, column 110 while parsing SOAP body at line 1, column 102 while parsing SOAP envelope at line 1, column 38 while parsing HTTP request for method setState on object of type vim.Task at line 1, column 0 Please see the server log to find more detail regarding exact cause of the failure.

 

So can someone please publish some sample code which lets you set a task state to TaskInfoState.ERROR that works?  I can't image that it could be so difficult.

 

thanks

Cathy

Group level roles not propagating to user

$
0
0

We are implementing RBAC in our plugin where,

I am using vSphere 6.5 and accessing roles from API's instead UI.

I am having a user group with an admin role assigned to it in my vCenter.

I have added a user to this user-group, however, the admin role is not getting propagated to the user, instead,

it requires to assign the admin role to this user individually in order to reflect the admin role.

 

Query:-

Does this behavior is expected or am I missing any step here in between.?

 

 

 

 

 

 

 

I am using VMWare API retrieveEntityPermissions to retrieve permission list as follows:-

permissionList = vmConnection.getVimPort().retrieveEntityPermissions(vmConnection.getServiceContent().getAuthorizationManager(), mobEntity, true);

 

In the permissionList response, I am checking principal field to check against my logged in user ID to filter and retrieve the permission as follows in debug mode

 

 

 

 

 

 

Above code is working fine as long as the role is assigned to the user individually  when I removed the role from the user and assigned to a Group as explained in the query, this is not working

i am not getting permissionList containing principal field matching to my logged in user.

Performance manager query (QueryPerf) not returning performance counter values

$
0
0

We have a single vcenter out of a larger set that is not returning any performance counter values for any of its virtual machines.  There are VMs on the vcenter that do have the proper tools installed that should allow us to get this information.  We do not receive any errors when trying to make the query, but nothing is returned - when logging into the vcenter web client, we can see up-to-date performance data for these VMs.

 

Code Sample:

def get_test_data():

        global perf_counter_id_to_obj, perf_metrics_id_objects

 

 

        counter_ids = [2, 3, 4, 24, 25, 26, 125, 126, 127, 143, 144, 145]

 

 

        perf_metrics_id_objects = [factory.PerfMetricId(counterId=id,

                                                        instance="*")

                                   for id in counter_ids]

 

 

        start_time = datetime.now() - timedelta(minutes=5)

        end_time = datetime.now()

 

 

        logger.info("Finding vm by uuid")

        vm_found_with_uuid = client.service.FindByUuid(service_content.searchIndex,

                                                       datacenter=None,

                                                       uuid=<uuid>,

                                                       vmSearch=True,

                                                       instanceUuid=True)

        logger.info(f"VM found with uuid: {vm_found_with_uuid}")

 

 

 

 

 

        logger.info(f"Getting query spec for {vm_found_with_uuid}")

        perf_query_list = factory.PerfQuerySpec(maxSample=1,

                                                entity=vm_found_with_uuid,

                                                intervalId=300,

                                                startTime=start_time,

                                                endTime=end_time,

                                                format='csv',

                                                metricId=perf_metrics_id_objects)

        logger.info(f"Query spec for {vm_found_with_uuid}: {perf_query_list}")

 

 

        perf_query_props = client.service.QueryPerf(service_content.perfManager, [perf_query_list])

        logger.info(f"Perf query props (results) are: {perf_query_props}")

References to "factory" and "client" are how we interact with a SOAP API (given a wsdl file) using the python package `zeep`.

 

This code returns values in the variable perf_query_props for all of our other vcenters.  We have found that when only passing the "entity" parameter into QueryPerf, we receive daily performance data for each day over the past year (ending two days before the current date).  Furthermore, when we pass "entity" and "intervalId=20", we get up-to-date raw streaming data.  Why can't we get 5 minute intervals?

Read Tags from a VirtualMachine

$
0
0

How to get tags from a virtual machine in the example below:

 

 

// Get reference to the PropertyCollector

propertyCollector = serviceContent.getPropertyCollector();

 

// Create a new ManagedObjectReference to get

rootFolder = serviceContent.getRootFolder();

 


viewMgrRef = serviceContent.getViewManager();

 

propColl = serviceContent.getPropertyCollector();

 

vmList = new ArrayList<String>();

 

vmList.add("ManagedEntity");

 

cViewRef = vimPort.createContainerView(viewMgrRef, serviceContent.getRootFolder(), vmList, true );    

 

 

// Create an ObjectSpec to define the beginning of the traversal

// We are traversing the root folder, so set the obj property to it

objectSpec = new ObjectSpec();

 

objectSpec.setObj(cViewRef);

 

objectSpec.setSkip(true);

 

tSpec = new TraversalSpec();

 

tSpec.setName("traverseEntities");

 

tSpec.setPath("view");

 

tSpec.setSkip(false);

 

tSpec.setType("ContainerView");

 

objectSpec.getSelectSet().add(tSpec);

 

 

// Create a PropertySpec to specify the properties we want.

propertySpec = new PropertySpec();

 

propertySpec.setType("VirtualMachine");

 

propertySpec.setAll(true);

 

 

// Create a PropertyFilterSpec and add the ObjectSpec and

// PropertySpec to it.  As above, the getter methods will automatically

// initialize the lists

propertyFilterSpec = new PropertyFilterSpec();

 

propertyFilterSpec.getObjectSet().add(objectSpec);

 

propertyFilterSpec.getPropSet().add(propertySpec);

 

 

// The RetrievePropertiesEx method takes a list of PropertyFilterSpec, so we need

// to create a list and add our propertyFilterSpec to it

propertyFilterSpecList = new ArrayList<PropertyFilterSpec>();

 

propertyFilterSpecList.add(propertyFilterSpec);

 

// Although the RetrieveOptions parameter is optional, in Java we must pass

// something in.  A null will give us an exception, so we must pass in an empty

// RetrieveOptions object

retrieveOptions = new RetrieveOptions();

 

// Finally, make the call and get the results

result = vimPort.retrievePropertiesEx(propertyCollector, propertyFilterSpecList, retrieveOptions);

 

 

if (result != null) {

 

     for (ObjectContent objectContent : result.getObjects()) {

 

          properties = objectContent.getPropSet();

 

          for (DynamicProperty property : properties) {

 

               out.println(property.getName() + ": " + property.getVal());

 

               if ("tag".equals(property.getName())) {

 

                    tags = (ArrayOfTag) property.getVal();

 

                    out.println("TAGS .... " +tags.getTag().size());

               }

          }

     }

}

 

 

Output:

 

tag: com.vmware.vim25.ArrayOfTag@15b079f

 

TAGS .... 0

 

Problem: size is always 0 even we have tagged the VMs.

 

Cannot Set BIOS Boot Order Using VIM25 API From C#

$
0
0

(I did find a reference to a similar post about this from 2013 but no answers AFAICT and no code https://code.vmware.com/forums/2416/vsphere-management-sdk#463881|2319617)

I am using the C# (targetting 4.5 .NET) bindings for the VIM25 API and I am trying to set the boot order.

The code snippet is:

cfgSpec.bootOptions = new VirtualMachineBootOptions();
cfgSpec.bootOptions.bootOrder = new VirtualMachineBootOptionsBootableDevice[1];
cfgSpec.bootOptions.bootOrder[0] = new VirtualMachineBootOptionsBootableCdromDevice();
tmor = Service.ReconfigVM_Task(vmRef, cfgSpec);

The ReconfigVM_Tasl fails with an error about incorrect paramter.

The VM in question does have a CD/DVD device attached on IDE 1:0 and the ISO image has been attached via another API call.

Looking for any ideas why this would be the case?

Thanks

"Cannot compute changes for disk " error for disk attached after first snapshot

$
0
0

Hi,

I 'm facing this error when we call queryChangedDiskAreas with changeID as '*' for a disk attached to a VM (which already had a snapshot and then deleted).

 

Steps:

Vm has one disk D1. Take snapshot and note ChangeID1 for D1.

Delete snapshot.

Attach new disk D2.

Take snapshot.

call queryChangedDiskAreas with changeID as 'ChangeID1 '  for D1. Returns success

call queryChangedDiskAreas with changeID as '*'  for  D2. Returns Unable to retrieve queryChangedDiskAreas : FileFault Exception

 

New disk D2 , had CBT enabled when it was created.

Here is error in ESX hostd.log

2018-09-20T11:05:02.724Z [53EC2B70 error 'Vmsvc.vm:/vmfs/volumes/9baf0124-30ff66fd/TestVM/TestVM.vmx' opID=48545664-e3 user=vpxuser] Cannot compute changes for disk /vmfs/volumes/9baf0124-30ff66fd/TestVM/TestVM_1-000002.vmdk: Unknown change epoch.

 

Is this known issue?

How to find management IP(s) of ESXi host from VcHostSystem (vRO 7.3 and vSphere 6.0)

$
0
0

I am trying to find the ESXi host to which a virtual machine is registered. From the vm I am able to find the host (VcHostSystem) in vRO. Searching the API it would appear that I need HostVirtualNicManagerNicType (vSphere 6.0 Documentation Center). The code below allows me to iterate over the virtual NICs and includes IP address information but I haven't figured out how to definitively determine which interface(s), and therefore which IP(s), are designated for ESXi management.

 

var          EsxiHostConfigNetworkdVnic = vm.runtime.host.config.network.vnic
System.log( "EsxiHostConfigNetworkdVnic.length = " + EsxiHostConfigNetworkdVnic.length )

for( var VnicIndex = 0 , VnicLength = EsxiHostConfigNetworkdVnic.length ; VnicIndex < VnicLength ; VnicIndex++ ){
System.log( "EsxiHostConfigNetworkdVnic[" + VnicIndex + "] = " + EsxiHostConfigNetworkdVnic[ VnicIndex ] )
}

 

Thanks in advance.

 

P.S. I hope I got the correct forum.


How to upload a ovf template to vCenter in URL ?

$
0
0

In vcenter, when you try to import a ovf, u can input the url, then , let vcenter do the download work, but, I can not find a way to do it via SDK,  anyone knows how?

 

thanks.

ESXi host local Disk IO performance data fetching through API

$
0
0

Suppose I do not have vROPS involved, could I get the following average/Peak disk bandwidth and IOPS performance data for every ESXi host with specifc time slot through vCenter API or PowerCLI ?

Disk Read bandwidth (KB/s)
Disk Write bandwidth (KB/s)
DiskIopsRead (request/s)
DiskIOpsWrite(request/s)

Setting environment for vsphere-automation-sdk-python on Red Hat 7.3

$
0
0

Hi,

I tried to setup environment for python3.5 according to https://github.com/vmware/vsphere-automation-sdk-python. When I run

pip install --upgrade --force-reinstall -r requirements.txt --extra-index-url file:///root/vsphere-automation-sdk-python/lib

I get the following error in both general python environment and in virtual  defined in /root/vsphere-automation-sdk-python/:

Collecting twisted>=16.0.0 (from vapi-runtime==2.9.0->vapi-client-bindings==1.4.0->-r requirements.txt (line 5))
  Url 'file:///root/vsphere-automation-sdk-python/lib/twisted/' is ignored: it is neither a file nor a directory.
  Could not find a version that satisfies the requirement twisted>=16.0.0 (from vapi-runtime==2.9.0->vapi-client-bindings==1.4.0->-r requirements.txt (line 5)) (from versions: )
No matching distribution found for twisted>=16.0.0 (from vapi-runtime==2.9.0->vapi-client-bindings==1.4.0->-r requirements.txt (line 5)

I downloaded twisted tarball and installed it using "python setup.py install" in both general  and virtual envoironment in lib/python3.5/site_packages/Twisted-18.9.0-py3.5-linux-x86_64.egg.

But this didn't help because is searched lib/twisted. Can somebody advice please what to do? Thanks in advance

Collecting twisted>=16.0.0 (from vapi-runtime==2.9.0->vapi-client-bindings==1.4.0->-r requirements.txt (line 5))
  Url 'file:///root/vsphere-automation-sdk-python/lib/twisted/' is ignored: it is neither a file nor a directory.
  Could not find a version that satisfies the requirement twisted>=16.0.0 (from vapi-runtime==2.9.0->vapi-client-bindings==1.4.0->-r requirements.txt (line 5)) (from versions: )
No matching distribution found for twisted>=16.0.0 (from vapi-runtime==2.9.0->vapi-client-bindings==1.4.0->-r requirements.txt (line 5)

How to saving/export VM's configuration?

$
0
0

I have a requirement to create a new VM(different location) using exactly the same configurations as of existing VM. I have copy of its virtual disks and so I am only interested in VM's configurations. If possible I want to store the existing VM's configurations information in my database and later use it for re-creating new VM.

I can use VirtualMachineConfigInfo data object to get all VM's configurations, but there are too many properties.

 

I have following questions:

  1. What are the minimum set of VM's configuration that is needed to re-create a VM ? Or do I need all the properties?

  2. Is a there way to export VM's configuration which I can use to re-create the VM later?

 

Thanks.  

VMware SDK with Java 10

$
0
0

Has anyone tried using the VMware SDK with Java 10? The samples work fine with Java 1.7 and 1.8 but i have challenges with 10.0.2 and 11.0.13. 

Connection to vCenter fails with the following exception:

javax.xml.ws.soap.SOAPFaultException: javax.xml.stream.XMLStreamException: javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed:

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils.createSystemException(MethodMarshallerUtils.java:1326)
at org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils.demarshalFaultResponse(MethodMarshallerUtils.java:1052)
at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMethodMarshaller.demarshalFaultResponse(DocLitWrappedMethodMarshaller.java:659)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.getFaultResponse(JAXWSProxyHandler.java:578)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.createResponse(JAXWSProxyHandler.java:520)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:386)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:171)
at com.sun.proxy.$Proxy11.retrieveServiceContent(Unknown Source)
at Vm25Connection.getEsxConnection(Vm25Connection.java:81)

Any help/tips much appreciated. 

Incorrect VirtualDisk.NumberWriteAveraged from QueryAvailableMetric

$
0
0

I've recently been looking over some of the data collected by QueryAvailablePerfMetrics, and I came across some inconsistent data regarding the Disk Write IO metrics, specifically for Virtual Disks - "virtualdisk.numberwriteaveraged.average"

 

 

I'm seeing values 50-100x what I see in vCenter - I see around 120 max in the performance graph for virtual disks (customized to show number write average) when doing a test of writing from /dev/random to a file, but the API reports 12000+ (not exactly 100x). Interestingly enough, when I do a iostat on the VM and monitor write rate, I don't see it going past 30, which makes me wonder what these numbers mean.

 

 

I'm calling the API (https://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.PerformanceManager.html#queryAvailableMetric) using entity = a VM MOR, start time = current time - 1hr, end time = 1hr, interval = PerformanceManagerSummary::getRefreshRate (https://www.vmware.com/support/developer/converter-sdk/conv61_apireference/vim.PerformanceManager.ProviderSummary.html#refreshRate)

 

 

 

Am I calling the API wrong? Or just misunderstanding the metrics?

Determining capacity of PCIeSSDs that are PassthruActive

$
0
0

Hi everyone!

 

I have some PCIeSSDs that are being used as DirectPath I/O devices for my VMs.

 

While they are in this configuration there doesn't seem to be any way (at the vSphere-level) to determine storage information like their capacity or their storage adapter name. I feel like I've exhausted every path in the MOB and can't find anything beyond their bus location and their PCI class ID.

 

Is there something I am missing? Or is this just what happens when these devices are configured for DirectPath I/O?

 

Thanks in advance for any guidance ya'll can provide!


VirtualDisk VDiskId always null

$
0
0

I'm trying to use the VcenterVStorageObjectManager ExtendDisk_Task operation to extend a virtual machine's virtual disk to 30GB, but for the VirtualDisk device it seems that the VDiskId property is always returned as null no matter which VM or disk try it on. I'm not sure why that is, we are running 6.5 on all hosts and VCSA and all VMs are VM version 13. The code seems pretty straightforward if I could figure out why VDiskId doesn't seem to be populating. Does anyone have any ideas? Useful information on using the virtual disk manager seems pretty scarce from what I can find searching

 

VcenterVStorageObjectManager vDiskMan = (VcenterVStorageObjectManager)vimClient.GetView(vimClient.ServiceContent.VStorageObjectManager, null);
VirtualDevice[] devices = vm.Config.Hardware.Device;
VirtualDisk vd = null;                
foreach (VirtualDevice device in devices)
{     device.DeviceInfo.Label.Equals("Hard disk 1"))     {          vd = (VirtualDisk)device;          VirtualDiskFlatVer2BackingInfo backInfo = (VirtualDiskFlatVer2BackingInfo)vd.Backing;          //vd.VDiskId always reports null          vDiskMan.ExtendDisk_Task(vd.VDiskId, backInfo.Datastore, 30720);     }
}

Questions on Virtual Disk's UUID

$
0
0

Hi all,

 

The API reference does not have much description about Virtual Disk UUID and so I would like to ask couple of questions.

I am referring to the UUID we can retrieve from Virtual Disk's BackingInfo (virtualmachine.config.hardware.device[xxxx].backing.uuid)

 

1. Is this UUID unique within the vCenter Server?

2. If a disk is detached from the one VM and then attached to another VM, is this UUID guaranteed to remain the same? Assuming that the Virtual Disk's vmdk files were not altered.

 

Thanks.

Find associated datastore from VM C# sdk

$
0
0

Hi,

 

Is anyone able to tell me how to find all Vm details from the VM name in c# using VMWare.Vim.dll ?

I found how to find host but not datastore for example.

I searched in all properties of VM and datastore but could not find how to see the relationship between them.

 

My code for VM and how to link it to vmware host :

 

System.Net.ServicePointManager.ServerCertificateValidationCallback += (se, cert, chain, sslerror) => { return true; };

VimClient vimClient = new VimClientImpl();

ServiceContent vimServiceContent = new ServiceContent();

string sViServer = "<ViServerIPAddress>";

string sUsername = "<AdminVsphere>";

string sPassword = "<Password>";

vimClient.Connect("https://" + sViServer + "/sdk");

vimClient.Login(sUsername, sPassword);

 

 

vimServiceContent = vimClient.ServiceContent;

NameValueCollection filter = new NameValueCollection();

IList<VMware.Vim.EntityViewBase> vmList = vimClient.FindEntityViews(typeof(VirtualMachine), null, filter, null);

foreach (VirtualMachine vm in vmList)

{

Console.WriteLine(vm.Name);

VMware.Vim.CustomFieldValue[]  VmValues = vm.Value;

foreach (VMware.Vim.CustomFieldValue VmValue in VmValues)

{

Console.WriteLine(VmValue.Key.ToString());

}

HostSystem host = (HostSystem)vimClient.GetView(vm.Runtime.Host, null);

Console.WriteLine(host.Name);

ManagedObjectReference[] DsList = vm.Datastore;

foreach (ManagedObjectReference Ds in DsList)

{

Console.WriteLine(Ds.Type);

Console.WriteLine(Ds.Value);

}

}

 

For Datastores, i have this :

 

IList<VMware.Vim.EntityViewBase> DatastoreList = vimClient.FindEntityViews(typeof(Datastore), null, filter, null);

foreach (Datastore Datastore in DatastoreList)

{

Console.WriteLine(Datastore.Name);

Console.WriteLine(Datastore.Value);

ManagedObjectReference[] Vms = Datastore.Vm;

foreach (ManagedObjectReference Vm in Vms)

{

Console.WriteLine(Vm.Type);

Console.WriteLine(Vm.Value);

}

DatastoreHostMount[] Hosts = Datastore.Host;

foreach (DatastoreHostMount host in Hosts)

{

Console.WriteLine(host.Key);

}

}

 

But no value permits me to link an existing datastore to an existing VM.

 

Could you help me plz ?

Fred

How to find datastore of a VM from VM Name - VMWare.Vim.dll - C#

$
0
0

Hi,

Is there anyone that can tell me how to find vm details from the VM Name in C# ?

I tried using VMWare.Vim.dll but could not link existing datastore properties to an existing VM.

For VM, i could link the host of the VM with the following code but no more :

System.Net.ServicePointManager.ServerCertificateValidationCallback += (se, cert, chain, sslerror) => { return true; };

VimClient vimClient = new VimClientImpl();

ServiceContent vimServiceContent = new ServiceContent();

string sViServer = "<VcenterIpAddress>";

string sUsername = "<VcenterAdminLogin>";

string sPassword = "<VcenterAdminPasswd>";

vimClient.Connect("https://" + sViServer + "/sdk");

vimClient.Login(sUsername, sPassword);

 

vimServiceContent = vimClient.ServiceContent;

NameValueCollection filter = new NameValueCollection();

IList<VMware.Vim.EntityViewBase> vmList = vimClient.FindEntityViews(typeof(VirtualMachine), null, filter, null);

foreach (VirtualMachine vm in vmList)

{

Console.WriteLine(vm.Name);

VMware.Vim.CustomFieldValue[]  VmValues = vm.Value;

foreach (VMware.Vim.CustomFieldValue VmValue in VmValues)

{

Console.WriteLine(VmValue.Key.ToString());

}

HostSystem host = (HostSystem)vimClient.GetView(vm.Runtime.Host, null);

Console.WriteLine(host.Name);

ManagedObjectReference[] DsList = vm.Datastore;

foreach (ManagedObjectReference Ds in DsList)

{

Console.WriteLine(Ds.Type);

Console.WriteLine(Ds.Value);

}

 

}

For Datastore, i have the following code but no link between the two parts of code :

IList<VMware.Vim.EntityViewBase> DatastoreList = vimClient.FindEntityViews(typeof(Datastore), null, filter, null);

foreach (Datastore Datastore in DatastoreList)

{

Console.WriteLine(Datastore.Name);

Console.WriteLine(Datastore.Value);

ManagedObjectReference[] Vms = Datastore.Vm;

foreach (ManagedObjectReference Vm in Vms)

{

Console.WriteLine(Vm.Type);

Console.WriteLine(Vm.Value);

}

DatastoreHostMount[] Hosts = Datastore.Host;

foreach (DatastoreHostMount host in Hosts)

{

Console.WriteLine(host.Key);

}

}

If no solution i'll use a powercli script, but i would like to have all in c#.

Could you help me plz ?

Fred

System.Net.ServicePointManager.ServerCertificateValidationCallback += (se, cert, chain, sslerror) => { return true; };
VimClient vimClient = new VimClientImpl();
ServiceContent vimServiceContent = new ServiceContent();
string sViServer = "192.168.15.12";
string sUsername = "administrator@vsphere.local";
string sPassword = "Fr4eder2.";
vimClient.Connect("https://" + sViServer + "/sdk");
vimClient.Login(sUsername, sPassword);
 
vimServiceContent = vimClient.ServiceContent;
NameValueCollection filter = new NameValueCollection();
IList<VMware.Vim.EntityViewBase> vmList = vimClient.FindEntityViews(typeof(VirtualMachine), null, filter, null);
foreach (VirtualMachine vm in vmList)
{
Console.WriteLine(vm.Name);
VMware.Vim.CustomFieldValue[]  VmValues = vm.Value;
foreach (VMware.Vim.CustomFieldValue VmValue in VmValues)
{
Console.WriteLine(VmValue.Key.ToString());
}
HostSystem host = (HostSystem)vimClient.GetView(vm.Runtime.Host, null);
Console.WriteLine(host.Name);
ManagedObjectReference[] DsList = vm.Datastore;
foreach (ManagedObjectReference Ds in DsList)
{
Console.WriteLine(Ds.Type);
Console.WriteLine(Ds.Value);
}
 
}

Vsphere Automation rest API

$
0
0
Is there a way to fetch permissions or roles defined vsphere client through Vsphere Automation rest API

why CustomizationIPSettings not setNicSettingMap method?

$
0
0

vsphere web service sdk 6.7 

public static CustomizationSpec createCustomizations(){

        CustomizationSpec spec=new CustomizationSpec();

        

        //创建文件类型windows

        CustomizationWinOptions options = new CustomizationWinOptions();

        options.setChangeSID(true);

        options.setDeleteAccounts(false);

        

        spec.setOptions(options);

        //创建应答文件

        CustomizationSysprep sysprep=new CustomizationSysprep();

        //

        

        

        CustomizationGuiUnattended unattended=new CustomizationGuiUnattended();

        unattended.setTimeZone(4);

        unattended.setAutoLogon(false);

        unattended.setAutoLogonCount(0);

        sysprep.setGuiUnattended(unattended);

 

        CustomizationUserData userData=new CustomizationUserData();

        userData.setFullName("viuxan.com");

        userData.setOrgName("vixuan.com");

        

        CustomizationVirtualMachineName virtualMachineName=new CustomizationVirtualMachineName();

        userData.setComputerName(virtualMachineName);

        userData.setProductId("HWRFF-2FFYX-XFXP2-DYFC3-BX3B7");

        sysprep.setUserData(userData);

 

        CustomizationIdentification identification=new CustomizationIdentification();

        identification.setJoinWorkgroup("WORKGROUP");

        sysprep.setIdentification(identification);

 

        spec.setIdentity(sysprep);

 

        CustomizationGlobalIPSettings globalIPSettings=new CustomizationGlobalIPSettings();

        spec.setGlobalIPSettings(globalIPSettings);

 

        //设置IP地址

        CustomizationAdapterMapping[] adapterMappings =new  CustomizationAdapterMapping[1];

        CustomizationIPSettings ipSetting=new CustomizationIPSettings();

        //重新设置自定义规范 IP 地址

        //设置dns

        String[] dnss=new String[1];

        dnss[0]="8.8.8.8";

        //ipSetting.setDnsServerList(dnss);

        //设置gateway

        String[] gateways=new String[1];

        gateways[0]="192.168.0.1";

        ipSetting.setGateway(gateways);

        

        //设置子网掩码

        String subnetMask="255.255.255.0";

        ipSetting.setSubnetMask(subnetMask);

        // 设置IP地址

        CustomizationFixedIp ip=new CustomizationFixedIp();

        ip.setIpAddress("192.168.0.111");

    

        ipSetting.setIp(ip);

 

        CustomizationAdapterMapping adapter=new CustomizationAdapterMapping();

        adapter.setAdapter(ipSetting);

        adapterMappings[0]=adapter;

 

        spec.setNicSettingMap(adapterMappings);

        

        CustomizationSpecItem customizationSpecItem=new CustomizationSpecItem();

        customizationSpecItem.setSpec(spec);

        CustomizationSpecInfo info=new CustomizationSpecInfo();

        info.setName("123456");

        info.setDescription("123456");

        customizationSpecItem.setInfo(info);

        

 

 

        return spec;

    }

 

error:

The method setNicSettingMap(CustomizationAdapterMapping[]) is undefined for the type CustomizationSpec!

public static CustomizationSpec createCustomizations(){
        CustomizationSpec spec=new CustomizationSpec();
        
        //创建文件类型windows
        CustomizationWinOptions options = new CustomizationWinOptions();
        options.setChangeSID(true);
        options.setDeleteAccounts(false);
        
        spec.setOptions(options);
        //创建应答文件
        CustomizationSysprep sysprep=new CustomizationSysprep();
        //
        
        
        CustomizationGuiUnattended unattended=new CustomizationGuiUnattended();
        unattended.setTimeZone(4);
        unattended.setAutoLogon(false);
        unattended.setAutoLogonCount(0);
        sysprep.setGuiUnattended(unattended);
 
        CustomizationUserData userData=new CustomizationUserData();
        userData.setFullName("viuxan.com");
        userData.setOrgName("vixuan.com");
        
        CustomizationVirtualMachineName virtualMachineName=new CustomizationVirtualMachineName();
        userData.setComputerName(virtualMachineName);
        userData.setProductId("HWRFF-2FFYX-XFXP2-DYFC3-BX3B7");
        sysprep.setUserData(userData);
 
        CustomizationIdentification identification=new CustomizationIdentification();
        identification.setJoinWorkgroup("WORKGROUP");
        sysprep.setIdentification(identification);
 
        spec.setIdentity(sysprep);
 
        CustomizationGlobalIPSettings globalIPSettings=new CustomizationGlobalIPSettings();
        spec.setGlobalIPSettings(globalIPSettings);
 
        //设置IP地址
        CustomizationAdapterMapping[] adapterMappings =new  CustomizationAdapterMapping[1];
        CustomizationIPSettings ipSetting=new CustomizationIPSettings();
        //重新设置自定义规范 IP 地址
        //设置dns
        String[] dnss=new String[1];
        dnss[0]="8.8.8.8";
        //ipSetting.setDnsServerList(dnss);
        //设置gateway
        String[] gateways=new String[1];
        gateways[0]="192.168.0.1";
        ipSetting.setGateway(gateways);
        
        //设置子网掩码
        String subnetMask="255.255.255.0";
        ipSetting.setSubnetMask(subnetMask);
        // 设置IP地址
        CustomizationFixedIp ip=new CustomizationFixedIp();
        ip.setIpAddress("192.168.0.111");
    
        ipSetting.setIp(ip);
 
        CustomizationAdapterMapping adapter=new CustomizationAdapterMapping();
        adapter.setAdapter(ipSetting);
        adapterMappings[0]=adapter;
 
        spec.setNicSettingMap(adapterMappings);
        
        CustomizationSpecItem customizationSpecItem=new CustomizationSpecItem();
        customizationSpecItem.setSpec(spec);
        CustomizationSpecInfo info=new CustomizationSpecInfo();
        info.setName("123456");
        info.setDescription("123456");
        customizationSpecItem.setInfo(info);
        
 
 
        return spec;
    }

Issue with Remote Console over API after upgrade from vCenter 6.5U1 to vCenter 6.5U2

$
0
0

Hi,

We have issue with opening Remote Console over API after upgrade vCenter to 6.5 U2e from 6.5 U1g. On vCenter 6.5 U1g everything worked fine. Remote Console works fine from vCenter server 6.5 U2e over vphere web client at this time but over API not. Does anybody know if there is any new changes in API?

There is shown some unknow "clientId" in log file (vsphere_client_virgo.log).

#########################################

root@vcenter [ /var/log/vmware/vsphere-client/logs ]# tail -f vsphere_client_virgo.log
[
[2019-04-12T11:37:34.946Z] [INFO ] http-bio-9443-exec-2         70012361 ###### ###### com.vmware.vise.util.session.SessionUtil                          Generated hashed session id: 101340
[2019-04-12T11:37:35.285Z] [ERROR] http-bio-9443-exec-2          o.a.c.c.C.[.[localhost].[/vsphere-client].[AuthdAdapter]          Servlet.service() for servlet [AuthdAdapter] in context with path [/vsphere-client] threw exception java.lang.RuntimeException: java.lang.IllegalStateException: There's no clientId in the session
    at com.vmware.vise.vim.commons.mks.tomcat.TomcatAuthdAdapterServlet.doGet(TomcatAuthdAdapterServlet.java:142)

###########################################

 

Thanks

Ondrej


How do get maxTotalLatency data

$
0
0

Hi

 

I have managed two ESXi on my VCenter, and there are some virtual machines on these two ESXi.

 

i used vijava.jar monitoring VCenter.

 

1.png

 

I need the data marked in the image above.

 

How should i get this value?

 

Thank you

Can anyone explain why Performance Metric Keys differ in Deployments

$
0
0

In the process of monitoring Datastores, we track the total Read and Write latency of Datastores.

 

Historically speaking, we would use performance metric keys 182 and 183.

 

Based on a bit of code that queries all the performance keys and spits them out to console, I can see the following in one environment:

 

182: datastore, totalReadLatency

183: datastore, totalWriteLatency

 

However, when I go into another vSphere/ESXi environment, I see this:

 

339: datastore, totalReadLatency

340: datastore, totalWriteLatency

 

The performance metric keys are very different.

 

I'm just trying to understand why or how this happened with the deployments.  I've modified our tool to pull the ID to value pairing to use the right one dynamically, but it is a head scratcher as to how this happened in the first place.

 

Honestly, I'm just looking to see if anyone has encountered something like this to put a rationale or explanation to it.

InstanceUUID details

$
0
0

I've referred below articles in order to determine how to prevent this issue. According to those articles, the VM property value named "instanceUUID" is the easiest way to uniquely identify a VM in globally. I also checked those instanceUUID values in VM's which are reported duplicate bios.UUID. Even though bios.UUID's duplicated instanceUUID was not duplicated. But I did not find any KB, article or forum related to feeding the data to a CMDB system using instanceUUID values.

 

Uniquely Identifying Virtual Machines in vSphere and vCloud Part 1: Overview

https://blogs.vmware.com/vsphere/2012/02/uniquely-identifying-virtual-machines-in-vsphere-and-vcloud-part-1-overview.html

 

Uniquely Identifying Virtual Machines in vSphere and vCloud Part 2: Technical

https://blogs.vmware.com/vsphere/2012/02/uniquely-identifying-virtual-machines-in-vsphere-and-vcloud-part-2-technical.html

 

In 2017 he wrote an update to address cross vCenter vMotion:

Uniquely identifying VMs in vSphere Part 3: Enhanced Linked Mode & Cross VC-vMotion

https://www.virtuallyghetto.com/2017/07/uniquely-identifying-vms-in-vsphere-part-3-enhanced-linked-mode-cross-vc-vmotion.html

 

Can anyone please advise us how can we pull those instanceUUID details via vCenter? Is there any other method to extract instanceUUID details from guest OS level? Or any other ways rather than PowerShell.?

VMWare VSphere SDK 6.7 - MOB - VpxSettings and LicenseManager

$
0
0

Hi All,

I am trying to access , ServiceContent  = > LicenseManager  = > licensedEdition property .

Have generated the files using wsdl available in SDK .

Neither the LicenseMAnager class is present in vim25 folder nor as an entry in DynamicData .java

Also the same with ServiceContent => VpxSetting => setting ["VirtualCenter.FQDN"]

Neither the VPxSetting class is present in vim25 folder nor as an entry in DynamicData .java\

HAve tried accessing the same using OptionValue as well, but not helping.

 

Any help is highly appreciated.

Thank you.

config.vpxd.stats.collectPreAggregatedIntervalFactor parameter not present in vcenter 6.5 and 6.7.

$
0
0

Hi,

 

There is a parameter config.vpxd.stats.collectPreAggregatedIntervalFactor parameter that needs to be set so that collection gets completed within 5 minutes.

This parameter was present for 5.5 and 6.0 but is removed for 6.5 and 6.7.

Because of this for our application collection is not completing in 5 minutes.

Any other variable or parameter is there for this functionality to continue, in case this variable is deprecated.

 

Thanks

Abhishek P.

Tracking vmotions externally

$
0
0

So, I need to track where some of my vms move around to for Oracle compliance.  I was scraping syslog with Splunk or plain old syslog, but that broke with the 6.7u3 update so I'm trying to find a better way to do it.  I was thinking about creating a custom alarm that sends an e-mail or runs a script but I am not sure the best way to do that, so I have questions:

 

1) For the 'run a script' option, where does it run and with what arguments?

 

2) What target type (Datacenter I think) and condition would best catch all vmotions?

 

I realize this is probably an odd request, so if anyone has any insight into other ways to track it, I'm all ears.

 

Thanks.

VMware remote plugin vCenter support matrix

$
0
0

Hi There,

are there any official document or files for vmware remote plugin vCenter support matrix?

it means the remote plugin is supported from which vCenter version.  I saw there is an remote plugin sample in 6.7u2 (\vSphere\6.7U2\Dec17\vsphere-client-sdk-6.7.0.30000-11233122\html-client-sdk\samples\remote-plugin-sample). it is the lowest support version? does it support previous version before 6.7u2?

Looking forward to your reply. Thanks in advance!


The verification of VimPortType.cloneSession() failed even with a new clone ticket

$
0
0

We have a critical problem when using the new vSphere authentication in our remote plugin server, the below steps of new authentication approach are following the remote plugin sample from the SDK 6.7u3:

  1. Firstly, clone a ticket by sending a REST request ‘/vcenter/session/clone-ticket’ to the vsphere-ui service with vcenterGuid, vmware-api-session-id and vmware-gateway-url.
  2. Then construct a SOAP request to obtain a regular session ID from the Web Services API by using the cloneSession() operation on the VimPort(com.vmware.vim25.VimPortType.cloneSession(), our vim25 version is 6.7-7970399).

The issue is, if the first user with a session id passed the new authentication(step1 & step2), the other users with their new session ids would be failed to pass the verification of step 2 - clone session for VimPort(step 1 still passed), and the error stack like this(attached our log file):

Do anyone have the suggestions for resolving this issue? Appreciate that

Take the VMware Developer Survey for a Chance to Win a Sonos Move

$
0
0

Hello everyone, VMware is conducting our annual Developer Survey and we want to hear from YOU so we can assess and improve our developer program to better serve your needs. PLUS, we will be giving away a new Sonos Move smart speaker to one lucky participant! To take the survey, visit the link below:

http://www.vmware.com/go/developer-survey-2019

Thank you!

Windows vSphere Client (HTML5) service fails to start

$
0
0

My situation is 6.5 upgrade to 6.7u3

Symptoms

Accessing the vSphere Client (HTML5) of vCenter server in browser is failed with error message:

503 Service Unavailable (Failed to connect to endpoint: [class Vmacore::Http::LocalServiceSpec:0x0000025c4df77820] _serverNamespace = /ui action = Allow _port = 5091)

Services status in vCenter server with command "service-control --status --all" shows the "vsphere-ui" service in STOPPED status.

the vsphere_client_virgo.log file, you see entries similar to:

[2020-01-30T01:30:37.230+08:00] [INFO ] cm-catalog-manager-pool-46    com.vmware.vise.vim.lookup.LsCatalogManager                       Time to load properties (ms)C:\ProgramData\VMware\vCenterServer\cfg\vsphere-ui\cmCatalog\com.vmware.cis.cs.eam.zip:US: 2

[2020-01-30T01:30:37.931+08:00] [ERROR] SimpleAsyncTaskExecutor-1     com.vmware.vise.extensionfw.ExtensionManager                      Error retrieving deployment data for the plugin package at C:\ProgramData\VMware\vCenterServer\runtime\vsphere-ui\plugin-packages\vsphere-client

[2020-01-30T01:30:37.942+08:00] [ERROR] SimpleAsyncTaskExecutor-1     com.vmware.vise.util.concurrent.WorkerThread                      SimpleAsyncTaskExecutor-1 terminated with exception:  java.lang.NoClassDefFoundError: java/util/concurrent/ExecutorCompletionService

at com.vmware.vise.extensionfw.impl.PackagesDeployer.<init>(PackagesDeployer.java:160)

at com.vmware.vise.extensionfw.impl.PackagesDeployer.deploy(PackagesDeployer.java:143)

at com.vmware.vise.extensionfw.ExtensionManager.addPluginPackages(ExtensionManager.java:520)

at com.vmware.vise.extensionfw.impl.ExtensionServiceImpl.addPluginPackages(ExtensionServiceImpl.java:164)

at com.vmware.vise.extensionfw.impl.CorePluginsDeploymentActivator.deployPluginsFromDir(CorePluginsDeploymentActivator.java:156)

at com.vmware.vise.extensionfw.impl.CorePluginsDeploymentActivator.deployInternal(CorePluginsDeploymentActivator.java:102)

at com.vmware.vise.extensionfw.impl.CorePluginsDeploymentActivator.access$000(CorePluginsDeploymentActivator.java:27)

at com.vmware.vise.extensionfw.impl.CorePluginsDeploymentActivator$1.run(CorePluginsDeploymentActivator.java:61)

at java.lang.Thread.run(Thread.java:748)

Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [java.util.concurrent.ExecutorCompletionService]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.

at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1370)

at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1220)

at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1182)

at org.eclipse.equinox.servletbridge.FrameworkLauncher$ChildFirstURLClassLoader.loadClass0(FrameworkLauncher.java:1051)

at org.eclipse.equinox.servletbridge.FrameworkLauncher$ChildFirstURLClassLoader.loadClass(FrameworkLauncher.java:1036)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:371)

at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:364)

at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:161)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

... 9 common frames omitted

Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [java.util.concurrent.ExecutorCompletionService]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.

at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1380)

at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1368)

... 18 common frames omitted

What is the difference between Vsphere Management SDK and Automation SDK?

$
0
0
What is the difference between Vsphere Management SDK and Automation SDK?

Are there any maven repositories for vim25

$
0
0

Hi,

 

Anyone knows which maven repository to use inorder to include vim25 jar the local project?

Thanks in advance.

Account lockout on vsphere web client and ssh

$
0
0

Hello friends:

 

 

I have the following concern: I have a stand alone esxi version 6.7 server; I had to manage via ssh on the server to set up a trust relationship, and after a while the session ended. When trying to enter the esphere vsphere client via web, it does not allow me to authenticate. The ssh services are still activated on the esxi server, but it also won't let me log in there. The portal and the ssh client only tells me that the username or password is wrong. Can someone tell me why this happens?

Cannot extract VMs from VRealize with Api WeB

$
0
0

Hello,

I have a PowerShell script that uses the Web API to extract data from host, cluster and VMs on VRealize but since I installed version 6.7 of VSphere, I have data from host, cluster but not those of Vms. I don't know if the metrics have changed but it doesn't work anymore. Can someone help me.
Thank you !


VM Folder Name

Session not Authenticated - Client received SOAP Fault from server

$
0
0

Hello, 

I am attempting to retrieve HostSystem and VirtualMachine data with the web services API after using the vimport.login() method. I seem to be logging in just fine and retrieving the ServiceContent without error but when I make my API call to retrieve data, I receive the following error

Client received SOAP Fault from server: The session is not authenticated. Please see the server log to find more detail regarding the exact cause of the failure. 

I tried looking through the logs but did not find anything associated with that error. I was initially suspecting that I needed to add a cookie. I found an example in the web services guide for retrieving a cookie from the response headers from the RequestContext as shown below but no "Set-cookie" header exists

requestContext = ((BindingProvider) vimPort).getResponseContext();
headers = (Map<String, Object>) requestContext.get(MessageContext.HTTP_RESPONSE_HEADERS);
List cookies = (List) headers.get("Set-cookie");

Any help would be great!

Getting Properties from a ManagedObjectReference

$
0
0

I am trying to figure out how to get a subset of properties from a ManagedObjectReference to HostSystem.

 

My current use case is that I am using a property collector to retrieve all VirtualMachines. One of the properties I am retrieving is the host property for the VirtualMachine. All I want to get is the name of the host that the VirtualMachine belongs to.

 

If anyone knows how I can do this in Java that would be a huge help!

How to map VirtualMachine virtualDisk metric instance id like scsi0:0 to VirtualDisk object.

$
0
0

I am querying virtual machine and its virtual disk..later getting virtual disk metrics for VM but I am having problem in mapping between VirtualDisk objectId and Virtual machine virtualDisk metric instance id.

When I am getting VirtualDisk from VirtualMachine..I can see its object id something like "20-2000" but metric instance id is like scsi0:0.

So need help regarding above.

 

Thanks.

Find hostsystem by findbyip

$
0
0

Hello,

how to retrieve the information about hostsystem object  by using searchindex.findbyip for ipv6,

Findbyip works fine for ipv4. Is there any workaround to ger hostsystem object by using ipv6 address.

Please do provide answer.

Thanks,

Kedarnath

### Not able to capture VMware event Lost network connectivity for DVSPort

$
0
0

I tried the following code. I am able to see the event in vSphere but not able to capture with code.
I am able to see the descriptions related to event on this particular vCenter. To my un
derstanding this vCenter should capture those events.
When i checked the ouput at the sametime.
I don't have any event related to DVPorts.
Please suggest what might have caused this not to capture and how to go about this.
Any configuration at the vCenter causing this because i am able capture for other vCenter.

package vmware2020;

 

import java.io.File;

import java.io.FileOutputStream;

import java.net.MalformedURLException;

import java.net.URL;

import java.rmi.ConnectException;

import java.rmi.RemoteException;

import java.util.Calendar;

import java.util.Date;

import java.util.HashMap;

 

import com.vmware.vim25.Event;

import com.vmware.vim25.EventFilterSpec;

import com.vmware.vim25.EventFilterSpecByEntity;

import com.vmware.vim25.EventFilterSpecByTime;

import com.vmware.vim25.EventFilterSpecRecursionOption;

import com.vmware.vim25.InvalidLogin;

import com.vmware.vim25.mo.EventManager;

import com.vmware.vim25.mo.ServiceInstance;

import com.vmware.vim25.mo.StoragePod;

 

//java -cp cim-2.0.0.jar:dom4j-2.1.1.jar:jaxb-api-2.3.1.jar:vijava-55b20130927_c04.jar:vmware2020.jar vmware2020.VmwareEvents <IPADDRESS> <USERNAME> <PASSWORD> '443' 'true' -23 HOUR true

 

 

public class VmwareEvents {

    ServiceInstance serviceInstance;

    VmwareServiceApiServiceImpl vmwareServiceApiServiceImpl;

    HashMap<String, StoragePod> dsMap = new HashMap<>();

    HashMap<String, String> dsSpodMap = new HashMap<>();

 

    public static void main(String[] args) throws RemoteException, Exception {

        VmwareEvents auth = new VmwareEvents();

        String ipAddress = args[0];

        String userName = args[1];

        String password = args[2];

        int port = Integer.parseInt(args[3]);

        String isSecure = args[4];

        boolean secure = (isSecure.equalsIgnoreCase("true")) ? true : false;

        int option = Integer.parseInt(args[5]);

        String calendarTag = args[6];

        String endTimeFlag = args[7];

        auth.go(getServiceInstance(ipAddress, userName, password, port, secure), option, calendarTag, endTimeFlag);

    }

 

    private void go(ServiceInstance serviceInstance, int option, String calendarTag, String endTimeFlag) {

        File file = null;

        try {

            this.serviceInstance = serviceInstance;

            String fileName = "vcenter_events_";

        

 

            StringBuffer bf = new StringBuffer();

            EventManager evtManager = this.serviceInstance.getEventManager();

            Event[] events = null;

            if (evtManager != null) {

                EventFilterSpec fSpec = new EventFilterSpec();

                // fSpec.setCategory(null);

                // Need to filter with Time

                EventFilterSpecByTime fTime = new EventFilterSpecByTime();

                // begin time = lastpooled time from if nul api get time

 

                Calendar time = this.serviceInstance.getServerClock();

                System.out.println("TIME: "+time);

                Calendar beginTime = (Calendar) this.serviceInstance.currentTime();

//                System.out.println("BEGIN TIME: "+beginTime);

                Calendar endTime = (Calendar) this.serviceInstance.currentTime();

//                System.out.println("END TIME: "+endTime);

            

//                java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=true,

//                lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT+00:00",offset=0,

//                dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,

//                ERA=1,YEAR=2020,MONTH=7,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=5,

//                DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=7,MINUTE=41,SECOND=36,MILLISECOND=916,

//                ZONE_OFFSET=0,DST_OFFSET=0]

            

//                Date date = time.getTime();

//            

//                time.getTimeZone();

//                time.getFirstDayOfWeek();

//                time.getMinimalDaysInFirstWeek();

//            

//            

//                int ERA = time.ERA;

//                int YEAR = time.YEAR;

//                int MONTH = time.MONTH;

//            

//                int WEEK_OF_YEAR = time.WEEK_OF_YEAR;

//                int WEEK_OF_MONTH = time.WEEK_OF_MONTH;

//            

//                int DAY_OF_MONTH = time.DAY_OF_MONTH;

//                int DAY_OF_YEAR = time.DAY_OF_YEAR;

//                int DAY_OF_WEEK = time.DAY_OF_WEEK;

//                int DAY_OF_WEEK_IN_MONTH = time.DAY_OF_WEEK_IN_MONTH;

//            

//                int AM_PM = time.AM_PM;

//                int HOUR = time.HOUR;

//                int HOUR_OF_DAY = time.HOUR_OF_DAY;

//                int MINUTE = time.MINUTE;

//                int SECOND = time.MILLISECOND;

//                int MILLISECOND = time.MILLISECOND;

//                int ZONE_OFFSET = time.ZONE_OFFSET;

//                int DST_OFFSET = time.DST_OFFSET;

            

            

                System.out.println("OPTION: [" + option + "]");

            

                if (calendarTag.equalsIgnoreCase("YEAR")) {

                    beginTime.add(Calendar.YEAR, option);

                } else if (calendarTag.equalsIgnoreCase("MONTH")) {

                    beginTime.add(Calendar.MONTH, option);

                } else if (calendarTag.equalsIgnoreCase("HOUR")) {

                    beginTime.add(Calendar.HOUR, option);

                } else if (calendarTag.equalsIgnoreCase("DAY_OF_WEEK_IN_MONTH")) {

                    beginTime.add(Calendar.DAY_OF_WEEK_IN_MONTH, option);

                } else if (calendarTag.equalsIgnoreCase("DAY_OF_MONTH")) {

                    beginTime.add(Calendar.DAY_OF_MONTH, option);

                }  else if (calendarTag.equalsIgnoreCase("FRIDAY")) {

                    beginTime.add(Calendar.FRIDAY, option);

                }

 

        

                System.out.println("Begin Time " + beginTime.getTime());

                System.out.println("End Time " + endTime.getTime());

                String bt = beginTime.getTime().toString().replaceAll(" ", "_");

                String et = endTime.getTime().toString().replaceAll(" ", "_");

                bt = bt.replaceAll(":", "_");

                et = et.replaceAll(":", "_");

                 file = new File(fileName+bt+"_"+et+"_END_TIME_IS_"+endTimeFlag+".txt");

            

                fTime.setBeginTime(beginTime);

                if (endTimeFlag.equalsIgnoreCase("true")) {

                    fTime.setEndTime(endTime);

                }

                fSpec.setTime(fTime);

 

                // Need to filter with Entity

                EventFilterSpecByEntity entityFilter = new EventFilterSpecByEntity();

                entityFilter.setEntity(this.serviceInstance.getRootFolder().getMOR());

                entityFilter.setRecursion(EventFilterSpecRecursionOption.all);

                fSpec.setEntity(entityFilter);

 

                // Updating with latest time stamp every time

                // VMwareMonitorCacheProvider.addEventLastPolledTimeMap(device.getUniqueId(),

                // entityUuid, api.getCurrentServerTime());

                bf.append(

                        "Name                                                   FullFormatName                                              EventTypeId           \n");

 

                events = evtManager.queryEvents(fSpec);

                System.out.println(evtManager.getLatestEvent().fullFormattedMessage);

                if (events != null) {

                    System.out.println(events.length);

                    for (Event event : events) {

                        if (event instanceof com.vmware.vim25.AlarmStatusChangedEvent) {

                            com.vmware.vim25.AlarmStatusChangedEvent e = (com.vmware.vim25.AlarmStatusChangedEvent) event;

                            bf.append("\t" + e.getClass().getSimpleName() + "   " + "\t" + e.getFullFormattedMessage()

                                    + "\n");

                        } else if (event instanceof com.vmware.vim25.EventEx) {

                            com.vmware.vim25.EventEx e = (com.vmware.vim25.EventEx) event;

                            bf.append("\t" + e.getClass().getSimpleName() + "   " + "\t" + e.getFullFormattedMessage()

                                    + "\t" + e.getEventTypeId() + "\n");

                        } else if (event instanceof com.vmware.vim25.ExtendedEvent) {

                            com.vmware.vim25.ExtendedEvent e = (com.vmware.vim25.ExtendedEvent) event;

                            bf.append("\t" + e.getClass().getSimpleName() + "   " + "\t" + e.getFullFormattedMessage()

                                    + "\t" + e.getEventTypeId() + "\n");

                        } else {

                            bf.append("\t" + event.getClass().getSimpleName() + "   " + "\t"

                                    + event.getFullFormattedMessage() + "\n");

                        }

                    }

                }

            }

 

            byte[] bytes = bf.toString().getBytes();

            try (FileOutputStream fos = new FileOutputStream(file)) {

                fos.write(bytes);

                fos.flush();

            }

 

            if (this.serviceInstance != null) {

                this.serviceInstance.getServerConnection().logout();

            }

        } catch (Exception e) {

            e.printStackTrace();

        }

    }

 

    private static ServiceInstance getServiceInstance(String ipAddress, String userName, String password, int port,

            boolean secure) {

        String apiEndPoint = null;

        URL url = null;

 

        // Create a new ServiceInstance for this API call

        ServiceInstance serviceInstance = null;

 

        try {

            apiEndPoint = secure ? "https://" + ipAddress + ":" + port + "/sdk"

                    : "http://" + ipAddress + ":" + port + "/sdk";

            try {

                url = new URL(apiEndPoint);

            } catch (Exception e) {

                System.out.println(apiEndPoint);

                System.out.println(url);

                e.printStackTrace();

            }

 

            serviceInstance = new ServiceInstance(url, userName, password, true);

 

        } catch (InvalidLogin ile) {

            System.out.println("InvalidLogin");

            ile.printStackTrace();

        } catch (RemoteException re) {

            if (re instanceof InvalidLogin) {

                System.out.println("InvalidLogin2");

            }

 

            if (re instanceof ConnectException) {

                System.out.println("ConnectException");

            }

 

            re.printStackTrace();

        } catch (MalformedURLException me) {

            System.out.println("MalformedURLException");

            me.printStackTrace();

        } catch (Exception e) {

            System.out.println("Exception");

            e.printStackTrace();

        }

        return serviceInstance;

    }

 

    public void logout() throws Exception {

        if (serviceInstance != null) {

            try {

                serviceInstance.getServerConnection().logout();

            } catch (Exception e) {

                e.printStackTrace();

            }

        }

    }

 

}

Query information from VCenter / Host / VMs

$
0
0

Hello friends, are you okay?

I am working on a system that will read information from VCenter / Host / VMs. I identified some existing APIs, they are the API Rest and SOAP (vimService). However, I am not able to consult the same information displayed in Vsphere. The rest API returns data very superficially, while the SOAP API vimService can only obtain results by consulting the Host.

Is there a way to use the same API / Service that Vsphere uses?




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