2011-10-26 00:37:27 PDT
Hi Steve
I am trying to collect all the Details of a VCenter 4.1.0 having 20 ESX and 160 VMs.
First, I connected to VCenter
then, Extracted the Folders/Data Centers
then For each DataCenter, extracted the ESX/Clusters
then for each ESX/Cluster, extracted the VMs and its Details.
NO Threads, a sequential logic one by one.
Scary thing is we are NOT getting the response from the Server for some of the SOAP requests
Here is the Log
----------------------
java.lang.RuntimeException: java.rmi.RemoteException: WSClient.invoke()# SOAP Req Retry MAX attempts reached#VI SDK invoke exception. ### Failed to Parse SOAP RES:
for REQ
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><RetrieveProperties xmlns="urn:vim25"><_this type="PropertyCollector">propertyCollector</_this><specSet><propSet><type>HostSystem</type><all>false</all><pathSet>runtime</pathSet></propSet><objectSet><obj type="HostSystem">host-1393</obj><skip>false</skip></objectSet></specSet></RetrieveProperties></soapenv:Body></soapenv:Envelope>
at com.vmware.vim25.mo.ManagedObject.retrieveObjectProperties(ManagedObject.java:166)
at com.vmware.vim25.mo.ManagedObject.getCurrentProperty(ManagedObject.java:187)
at com.vmware.vim25.mo.HostSystem.getRuntime(HostSystem.java:91)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.buildHostDevice(VMwareMgntServiceImpl.java:488)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.buildCluster(VMwareMgntServiceImpl.java:1459)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.getNestedFolderResources(VMwareMgntServiceImpl.java:993)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.getAllDataCentersGivenByVC(VMwareMgntServiceImpl.java:958)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.getVCenter(VMwareMgntServiceImpl.java:859)
at com.netenrich.neprobe.cmd.HypervisorInventoryCmdImpl.executeCommand(HypervisorInventoryCmdImpl.java:105)
at com.netenrich.discovery.discover.parser.NEProbeCmdHandelr.run(NEProbeCmdHandelr.java:88)
Caused by: java.rmi.RemoteException: WSClient.invoke()# SOAP Req Retry MAX attempts reached#VI SDK invoke exception. ### Failed to Parse SOAP RES:
for REQ
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><RetrieveProperties xmlns="urn:vim25"><_this type="PropertyCollector">propertyCollector</_this><specSet><propSet><type>HostSystem</type><all>false</all><pathSet>runtime</pathSet></propSet><objectSet><obj type="HostSystem">host-1393</obj><skip>false</skip></objectSet></specSet></RetrieveProperties></soapenv:Body></soapenv:Envelope>
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:138)
at com.vmware.vim25.ws.VimStub.retrieveProperties(VimStub.java:77)
at com.vmware.vim25.mo.PropertyCollector.retrieveProperties(PropertyCollector.java:107)
at com.vmware.vim25.mo.ManagedObject.retrieveObjectProperties(ManagedObject.java:155)
... 9 more
Oct 26, 2011 6:15:05 AM com.netenrich.vi.vmware.VMwareMgntServiceImpl buildHostDevice
SEVERE: Not able to get the HOST NIC config
java.lang.RuntimeException: java.rmi.RemoteException: WSClient.invoke()# SOAP Req Retry MAX attempts reached#VI SDK invoke exception. ### Failed to Parse SOAP RES:
for REQ
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><RetrieveProperties xmlns="urn:vim25"><_this type="PropertyCollector">propertyCollector</_this><specSet><propSet><type>HostNetworkSystem</type><all>false</all><pathSet>networkInfo</pathSet></propSet><objectSet><obj type="HostNetworkSystem">networkSystem-1393</obj><skip>false</skip></objectSet></specSet></RetrieveProperties></soapenv:Body></soapenv:Envelope>
at com.vmware.vim25.mo.ManagedObject.retrieveObjectProperties(ManagedObject.java:166)
at com.vmware.vim25.mo.ManagedObject.getCurrentProperty(ManagedObject.java:187)
at com.vmware.vim25.mo.HostNetworkSystem.getNetworkInfo(HostNetworkSystem.java:76)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.buildHostDevice(VMwareMgntServiceImpl.java:496)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.buildCluster(VMwareMgntServiceImpl.java:1459)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.getNestedFolderResources(VMwareMgntServiceImpl.java:993)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.getAllDataCentersGivenByVC(VMwareMgntServiceImpl.java:958)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.getVCenter(VMwareMgntServiceImpl.java:859)
at com.netenrich.neprobe.cmd.HypervisorInventoryCmdImpl.executeCommand(HypervisorInventoryCmdImpl.java:105)
at com.netenrich.discovery.discover.parser.NEProbeCmdHandelr.run(NEProbeCmdHandelr.java:88)
Caused by: java.rmi.RemoteException: WSClient.invoke()# SOAP Req Retry MAX attempts reached#VI SDK invoke exception. ### Failed to Parse SOAP RES:
for REQ
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><RetrieveProperties xmlns="urn:vim25"><_this type="PropertyCollector">propertyCollector</_this><specSet><propSet><type>HostNetworkSystem</type><all>false</all><pathSet>networkInfo</pathSet></propSet><objectSet><obj type="HostNetworkSystem">networkSystem-1393</obj><skip>false</skip></objectSet></specSet></RetrieveProperties></soapenv:Body></soapenv:Envelope>
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:138)
at com.vmware.vim25.ws.VimStub.retrieveProperties(VimStub.java:77)
at com.vmware.vim25.mo.PropertyCollector.retrieveProperties(PropertyCollector.java:107)
at com.vmware.vim25.mo.ManagedObject.retrieveObjectProperties(ManagedObject.java:155)
... 9 more
Oct 26, 2011 6:18:29 AM com.netenrich.vi.vmware.VMwareMgntServiceImpl buildHostDevice
SEVERE: Not able to get the HOST LIC config
java.lang.RuntimeException: java.rmi.RemoteException: WSClient.invoke()# SOAP Req Retry MAX attempts reached#VI SDK invoke exception. ### Failed to Parse SOAP RES:
for REQ
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><RetrieveProperties xmlns="urn:vim25"><_this type="PropertyCollector">propertyCollector</_this><specSet><propSet><type>LicenseManager</type><all>false</all><pathSet>licenses</pathSet></propSet><objectSet><obj type="LicenseManager">LicenseManager</obj><skip>false</skip></objectSet></specSet></RetrieveProperties></soapenv:Body></soapenv:Envelope>
at com.vmware.vim25.mo.ManagedObject.retrieveObjectProperties(ManagedObject.java:166)
at com.vmware.vim25.mo.ManagedObject.getCurrentProperty(ManagedObject.java:187)
at com.vmware.vim25.mo.LicenseManager.getLicenses(LicenseManager.java:69)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.buildHostDevice(VMwareMgntServiceImpl.java:515)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.buildCluster(VMwareMgntServiceImpl.java:1459)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.getNestedFolderResources(VMwareMgntServiceImpl.java:993)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.getAllDataCentersGivenByVC(VMwareMgntServiceImpl.java:958)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.getVCenter(VMwareMgntServiceImpl.java:859)
at com.netenrich.neprobe.cmd.HypervisorInventoryCmdImpl.executeCommand(HypervisorInventoryCmdImpl.java:105)
at com.netenrich.discovery.discover.parser.NEProbeCmdHandelr.run(NEProbeCmdHandelr.java:88)
Caused by: java.rmi.RemoteException: WSClient.invoke()# SOAP Req Retry MAX attempts reached#VI SDK invoke exception. ### Failed to Parse SOAP RES:
for REQ
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><RetrieveProperties xmlns="urn:vim25"><_this type="PropertyCollector">propertyCollector</_this><specSet><propSet><type>LicenseManager</type><all>false</all><pathSet>licenses</pathSet></propSet><objectSet><obj type="LicenseManager">LicenseManager</obj><skip>false</skip></objectSet></specSet></RetrieveProperties></soapenv:Body></soapenv:Envelope>
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:138)
at com.vmware.vim25.ws.VimStub.retrieveProperties(VimStub.java:77)
at com.vmware.vim25.mo.PropertyCollector.retrieveProperties(PropertyCollector.java:107)
at com.vmware.vim25.mo.ManagedObject.retrieveObjectProperties(ManagedObject.java:155)
... 9 more
Oct 26, 2011 6:21:55 AM com.netenrich.vi.vmware.VMwareMgntServiceImpl buildHostDevice
SEVERE: Not able to collect the BIOS details
Oct 26, 2011 6:25:17 AM com.netenrich.vi.vmware.VMwareMgntServiceImpl getNestedFolderResources
SEVERE: Not able to collect the Data Centers.
java.lang.RuntimeException: java.rmi.RemoteException: WSClient.invoke()# SOAP Req Retry MAX attempts reached#VI SDK invoke exception. ### Failed to Parse SOAP RES:
for REQ
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><RetrieveProperties xmlns="urn:vim25"><_this type="PropertyCollector">propertyCollector</_this><specSet><propSet><type>HostSystem</type><all>false</all><pathSet>vm</pathSet></propSet><objectSet><obj type="HostSystem">host-1393</obj><skip>false</skip></objectSet></specSet></RetrieveProperties></soapenv:Body></soapenv:Envelope>
at com.vmware.vim25.mo.ManagedObject.retrieveObjectProperties(ManagedObject.java:166)
at com.vmware.vim25.mo.ManagedObject.getCurrentProperty(ManagedObject.java:187)
at com.vmware.vim25.mo.ManagedObject.getManagedObjects(ManagedObject.java:229)
at com.vmware.vim25.mo.ManagedObject.getManagedObjects(ManagedObject.java:276)
at com.vmware.vim25.mo.ManagedObject.getVms(ManagedObject.java:306)
at com.vmware.vim25.mo.HostSystem.getVms(HostSystem.java:106)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.buildHostDevice(VMwareMgntServiceImpl.java:557)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.buildCluster(VMwareMgntServiceImpl.java:1459)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.getNestedFolderResources(VMwareMgntServiceImpl.java:993)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.getAllDataCentersGivenByVC(VMwareMgntServiceImpl.java:958)
at com.netenrich.vi.vmware.VMwareMgntServiceImpl.getVCenter(VMwareMgntServiceImpl.java:859)
at com.netenrich.neprobe.cmd.HypervisorInventoryCmdImpl.executeCommand(HypervisorInventoryCmdImpl.java:105)
at com.netenrich.discovery.discover.parser.NEProbeCmdHandelr.run(NEProbeCmdHandelr.java:88)
Caused by: java.rmi.RemoteException: WSClient.invoke()# SOAP Req Retry MAX attempts reached#VI SDK invoke exception. ### Failed to Parse SOAP RES:
for REQ
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><RetrieveProperties xmlns="urn:vim25"><_this type="PropertyCollector">propertyCollector</_this><specSet><propSet><type>HostSystem</type><all>false</all><pathSet>vm</pathSet></propSet><objectSet><obj type="HostSystem">host-1393</obj><skip>false</skip></objectSet></specSet></RetrieveProperties></soapenv:Body></soapenv:Envelope>
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:138)
at com.vmware.vim25.ws.VimStub.retrieveProperties(VimStub.java:77)
at com.vmware.vim25.mo.PropertyCollector.retrieveProperties(PropertyCollector.java:107)
at com.vmware.vim25.mo.ManagedObject.retrieveObjectProperties(ManagedObject.java:155)
... 12 more
-----------------------------------------------------------------------------------------------------------------------------------
Here is the Piece of code
=========================================
try {
VMwareHostDevice dev = new VMwareHostDevice();
dev.setHostname(host.getName());
dev.setName(host.getHostNetworkSystem().getDnsConfig().getHostName());
dev.setMor(host.getMOR().getType());
dev.setMoId(host.getMOR().getVal());
dev.setDomain(host.getHostNetworkSystem().getDnsConfig().getDomainName());
try {
dev.setOsType(host.getConfig().getProduct().getFullName());
} catch (Exception e) {
// ignore
//java.rmi.RemoteException: VI SDK invoke exception:org.dom4j.DocumentException
}
try {
dev.setVcIP(host.getSummary().managementServerIp == null ? this.ipAddr: host.getSummary().managementServerIp);
} catch (Exception e) {
if(this.isSupervisor()) {
dev.setVcIP(this.ipAddr);
}
}
dev.setMgntIP(hostIPAddr);
try {
HostConfigSummary conf = host.getSummary().getConfig();
dev.setvMotion(conf.isVmotionEnabled());
dev.setFtm(conf.faultToleranceEnabled);
} catch (Exception e) {
log.log(Level.SEVERE, "Not able to get the HOST config", e);
}
try {
HostHardwareSummary hw = host.getSummary().getHardware();
dev.setNics((short) hw.numNics);
dev.setvProc(hw.getNumCpuCores());
dev.setCsock(hw.getNumCpuCores());
dev.setUuid(hw.getUuid());
dev.setVendor(hw.getVendor());
dev.setnCpu(hw.getNumCpuPkgs());
dev.setnCpuCores(hw.getNumCpuCores());
dev.setCpuSpeed(Integer.toString(hw.getCpuMhz()));
try {
dev.setnCpuCores(hw.getNumCpuCores()/hw.getNumCpuPkgs());
} catch (Exception e) {
//ignore
}
dev.setProcessor(hw.getCpuModel().trim());
dev.setModel(hw.getModel());
dev.setState(host.getOverallStatus().name());
dev.setBootimeMillis(host.getRuntime().getBootTime().getTimeInMillis());
dev.setMemory(hw.getMemorySize()/(1024 * 1024));
} catch (Exception e) {
log.log(Level.SEVERE, "Not able to get the HOST H/W config", e);
}
List<VINIC> _vnic = new ArrayList<VINIC>();
try {
PhysicalNic[] nic = host.getHostNetworkSystem().getNetworkInfo().getPnic();
if(nic != null) {
for (int j = 0; j < nic.length; j++) {
PhysicalNic info = nic[j];
VINIC _hd = new VINIC(info.getMac(), info.getDevice(), info.getDriver() ,
new String[] { info.getSpec().ip.ipAddress}, 0 );
_vnic.add(_hd);
}
dev.setNic(_vnic);
}
// Power state
dev.setPowerStatus(host.getRuntime().getPowerState().name());
} catch (Exception e) {
log.log(Level.SEVERE, "Not able to get the HOST NIC config", e);
}
try {
if(si.getLicenseManager() != null) {
for (int ii = 0; ii < si.getLicenseManager().getLicenses().length; ii++) {
LicenseManagerLicenseInfo lic = si.getLicenseManager().getLicenses()[ii];
KeyAnyValue[] kvs = lic.getProperties();
if(kvs != null) {
for (int j = 0; j < kvs.length; j++) {
KeyAnyValue kv = kvs[j];
if(kv.key.equalsIgnoreCase("ProductName")) {
dev.setLicName(kv.getValue().toString());
} else if(kv.key.equalsIgnoreCase("ProductVersion")) {
dev.setLicVer(kv.getValue().toString());
} else if(kv.key.equalsIgnoreCase("evaluation")) {
dev.setLicEval(kv.getValue().toString());
} else if(kv.key.equalsIgnoreCase("expirationDate")) {
dev.setLicExp(((Calendar)kv.getValue()).getTime().toGMTString());
} else if(kv.key.equalsIgnoreCase("system_time")) {
dev.setSystime(((Calendar)kv.getValue()).getTime().toGMTString());
} else if(kv.key.equalsIgnoreCase("feature")){
KeyValue _kv = (KeyValue) kv.getValue();
dev.getLicFeature().put(_kv.getKey(), _kv.getValue());
}
}
}
}
}
} catch (Exception e) {
log.log(Level.SEVERE, "Not able to get the HOST LIC config", e);
}
// BIOS
try {
HostBIOSInfo bios = host.getHardware().getBiosInfo();
BIOSModule mod = new BIOSModule();
mod.setBiosVendor("VMware");
mod.setReleaseDate(bios.getReleaseDate().getTime().toGMTString());
mod.setSysVer(bios.getBiosVersion());
dev.setBios(mod);
} catch (Exception e) {
log.log(Level.SEVERE, "Not able to collect the BIOS details");
}
// Extract all the Resourve Pools and attached VMs
// First get all the VMs
VirtualMachine[] vms = host.getVms();
if(vms.length > 0) {
for(int v = 0; v < vms.length; v++) {
VirtualMachine vm = vms[v];
ResourcePool rp = vm.getResourcePool();
// VMs belongs to a Resource pool
if(rp != null && !rp.getName().equalsIgnoreCase("Resources")) {
VMwareResourcePool vrp = this.buildResourcePool(rp);
if(dev.getRpools().get(vrp.getName()) == null) {
// Add the VM to the Resource Pool
vrp.getVms().add(this.buildVMwareDevice(vm, dev));
// Add the Resource pool to Host
dev.getRpools().put(vrp.getName(), vrp);
log.log(Level.SEVERE, "ADDED the ResourcePool: " + vrp.getName());
} else {
dev.getRpools().get(vrp.getName()).getVms().add(this.buildVMwareDevice(vm, dev));
}
} else {
// Add the VM directly to the Host
dev.getVms().add(this.buildVMwareDevice(vm, dev));
}
log.log(Level.SEVERE, "ADDED the VM: " + vm.getName());
// Collect the Datastores
Datastore[] dss = vm.getDatastores();
for (int j = 0; j < dss.length; j++) {
DatastoreInfo info = dss[j].getInfo();
String dssUUID = null;
if(info instanceof VmfsDatastoreInfo) {
VmfsDatastoreInfo vdinfo = (VmfsDatastoreInfo) info;
dssUUID = vdinfo.getVmfs().getUuid();
}
DataStoreModule _ds = new DataStoreModule(info.getName(),
dss[j].getMOR().getType(), dss[j].getMOR().getVal(),
info.getMaxFileSize(),
info.getFreeSpace(), info.getTimestamp().getTimeInMillis(), dssUUID);
dev.getDataStore().put(_ds.getName(), _ds);
}
}
}
=========================================