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
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
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.
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.
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.
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
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.
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?
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.
(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
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?
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.
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.
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)
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
Hi,
How get VM's disk size using storage url or disk path ?
does VMware API has this feature ?
Hi,
Can someone help me in connecting to vCenter server and retrieve only Cluster related events using VI Java API?
Using below snippet I'm able to retrieve Cluster details of my interest say name etc... but I really want to retrieve the details when a cluster is added/removed from vCenter server.
ServiceInstance si = new ServiceInstance(new URL("myhost"), "username", "password", true);
Folder rootFolder = si.getRootFolder();
String name = rootFolder.getName();
System.out.println("root:" + name);
ManagedEntity[] mes1 = new InventoryNavigator(rootFolder).searchManagedEntities("ClusterComputeResource");
Area of Interest
============
1. A Cluster newly added to a datacenter I would like to retrieve this event from vCenter using VI Java API?
2. A Cluster removed from a datacenter, I would like to retrieve this event from vCenter using VI Java API?
Thanks,
Phaneendra.
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.
Finding an easier way of managing alarms within vCenter has been bugging me for a while. I know there are the following VMware KBs to help:
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.
I am customizing an existing vm with Linux OS cloned by VC with VMWare SDK. In the customization, I want to set the host name of that vm in the form of FQDN. I can successfully set the host name as “host1” for example. When I power on that vm , I can see that the host name “host1” is set in the file /etc/hostname. However, when I set the host name as “host1.company1.com” for example, I came across the following error message:
“A specified parameter was not correct. spec.identity.hostName”.
The snip of the code :
CustomizationFixedName fixedHostName = new CustomizationFixedName(); CustomizationLinuxPrep custLinuxPrep = new CustomizationLinuxPrep(); fixedHostName.setName(“host1.company1.com”);//for exmple custLinuxPrep.setHostName(fixedHostName); custLinuxPrep.setDomain(“company1.com”);… CustomizationSpec customsSpec = new CustomizationSpec();… customsSpec.setIdentity(custLinuxPrep);…service.customizeVMTask(vmMOR, customsSpec);
Really appreciated for your help!