mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
Get rid of compiler warnings in vmware-base
This commit is contained in:
parent
86124138a1
commit
b20add810e
@ -299,7 +299,7 @@ public class ClusterMO extends BaseMO implements VmwareHypervisorHost {
|
|||||||
|
|
||||||
ManagedObjectReference morDs = null;
|
ManagedObjectReference morDs = null;
|
||||||
ManagedObjectReference morDsFirst = null;
|
ManagedObjectReference morDsFirst = null;
|
||||||
List<ManagedObjectReference> hosts = (List<ManagedObjectReference>)_context.getVimClient().getDynamicProperty(_mor, "host");
|
List<ManagedObjectReference> hosts = _context.getVimClient().getDynamicProperty(_mor, "host");
|
||||||
if (hosts != null && hosts.size() > 0) {
|
if (hosts != null && hosts.size() > 0) {
|
||||||
for (ManagedObjectReference morHost : hosts) {
|
for (ManagedObjectReference morHost : hosts) {
|
||||||
HostMO hostMo = new HostMO(_context, morHost);
|
HostMO hostMo = new HostMO(_context, morHost);
|
||||||
@ -332,7 +332,7 @@ public class ClusterMO extends BaseMO implements VmwareHypervisorHost {
|
|||||||
if (s_logger.isTraceEnabled())
|
if (s_logger.isTraceEnabled())
|
||||||
s_logger.trace("vCenter API trace - unmountDatastore(). target MOR: " + _mor.getValue() + ", poolUuid: " + poolUuid);
|
s_logger.trace("vCenter API trace - unmountDatastore(). target MOR: " + _mor.getValue() + ", poolUuid: " + poolUuid);
|
||||||
|
|
||||||
List<ManagedObjectReference> hosts = (List<ManagedObjectReference>)_context.getVimClient().getDynamicProperty(_mor, "host");
|
List<ManagedObjectReference> hosts = _context.getVimClient().getDynamicProperty(_mor, "host");
|
||||||
if (hosts != null && hosts.size() > 0) {
|
if (hosts != null && hosts.size() > 0) {
|
||||||
for (ManagedObjectReference morHost : hosts) {
|
for (ManagedObjectReference morHost : hosts) {
|
||||||
HostMO hostMo = new HostMO(_context, morHost);
|
HostMO hostMo = new HostMO(_context, morHost);
|
||||||
@ -480,7 +480,7 @@ public class ClusterMO extends BaseMO implements VmwareHypervisorHost {
|
|||||||
|
|
||||||
// TODO, need to use traversal to optimize retrieve of
|
// TODO, need to use traversal to optimize retrieve of
|
||||||
int cpuNumInCpuThreads = 1;
|
int cpuNumInCpuThreads = 1;
|
||||||
List<ManagedObjectReference> hosts = (List<ManagedObjectReference>)_context.getVimClient().getDynamicProperty(_mor, "host");
|
List<ManagedObjectReference> hosts = _context.getVimClient().getDynamicProperty(_mor, "host");
|
||||||
if (hosts != null && hosts.size() > 0) {
|
if (hosts != null && hosts.size() > 0) {
|
||||||
for (ManagedObjectReference morHost : hosts) {
|
for (ManagedObjectReference morHost : hosts) {
|
||||||
HostMO hostMo = new HostMO(_context, morHost);
|
HostMO hostMo = new HostMO(_context, morHost);
|
||||||
@ -505,7 +505,7 @@ public class ClusterMO extends BaseMO implements VmwareHypervisorHost {
|
|||||||
if (s_logger.isTraceEnabled())
|
if (s_logger.isTraceEnabled())
|
||||||
s_logger.trace("vCenter API trace - getHyperHostNetworkSummary(). target MOR: " + _mor.getValue() + ", mgmtPortgroup: " + esxServiceConsolePort);
|
s_logger.trace("vCenter API trace - getHyperHostNetworkSummary(). target MOR: " + _mor.getValue() + ", mgmtPortgroup: " + esxServiceConsolePort);
|
||||||
|
|
||||||
List<ManagedObjectReference> hosts = (List<ManagedObjectReference>)_context.getVimClient().getDynamicProperty(_mor, "host");
|
List<ManagedObjectReference> hosts = _context.getVimClient().getDynamicProperty(_mor, "host");
|
||||||
if (hosts != null && hosts.size() > 0) {
|
if (hosts != null && hosts.size() > 0) {
|
||||||
VmwareHypervisorHostNetworkSummary summary = new HostMO(_context, hosts.get(0)).getHyperHostNetworkSummary(esxServiceConsolePort);
|
VmwareHypervisorHostNetworkSummary summary = new HostMO(_context, hosts.get(0)).getHyperHostNetworkSummary(esxServiceConsolePort);
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ public class CustomFieldsManagerMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<CustomFieldDef> getFields() throws Exception {
|
public List<CustomFieldDef> getFields() throws Exception {
|
||||||
return (List<CustomFieldDef>)_context.getVimClient().getDynamicProperty(getMor(), "field");
|
return _context.getVimClient().getDynamicProperty(getMor(), "field");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -34,6 +34,7 @@ import com.vmware.vim25.VMwareDVSPvlanMapEntry;
|
|||||||
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
||||||
|
|
||||||
public class DistributedVirtualSwitchMO extends BaseMO {
|
public class DistributedVirtualSwitchMO extends BaseMO {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static final Logger s_logger = Logger.getLogger(DistributedVirtualSwitchMO.class);
|
private static final Logger s_logger = Logger.getLogger(DistributedVirtualSwitchMO.class);
|
||||||
|
|
||||||
public DistributedVirtualSwitchMO(VmwareContext context, ManagedObjectReference morDvs) {
|
public DistributedVirtualSwitchMO(VmwareContext context, ManagedObjectReference morDvs) {
|
||||||
@ -62,7 +63,7 @@ public class DistributedVirtualSwitchMO extends BaseMO {
|
|||||||
public TaskInfo updateVMWareDVSwitchGetTask(ManagedObjectReference dvSwitchMor, VMwareDVSConfigSpec dvsSpec) throws Exception {
|
public TaskInfo updateVMWareDVSwitchGetTask(ManagedObjectReference dvSwitchMor, VMwareDVSConfigSpec dvsSpec) throws Exception {
|
||||||
ManagedObjectReference task = _context.getService().reconfigureDvsTask(dvSwitchMor, dvsSpec);
|
ManagedObjectReference task = _context.getService().reconfigureDvsTask(dvSwitchMor, dvsSpec);
|
||||||
TaskInfo info = (TaskInfo)(_context.getVimClient().getDynamicProperty(task, "info"));
|
TaskInfo info = (TaskInfo)(_context.getVimClient().getDynamicProperty(task, "info"));
|
||||||
boolean waitvalue = _context.getVimClient().waitForTask(task);
|
_context.getVimClient().waitForTask(task);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -181,7 +181,7 @@ public class HostDatastoreSystemMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<ManagedObjectReference> getDatastores() throws Exception {
|
public List<ManagedObjectReference> getDatastores() throws Exception {
|
||||||
return (List<ManagedObjectReference>)_context.getVimClient().getDynamicProperty(_mor, "datastore");
|
return _context.getVimClient().getDynamicProperty(_mor, "datastore");
|
||||||
}
|
}
|
||||||
|
|
||||||
public DatastoreInfo getDatastoreInfo(ManagedObjectReference morDatastore) throws Exception {
|
public DatastoreInfo getDatastoreInfo(ManagedObjectReference morDatastore) throws Exception {
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import com.vmware.vim25.ManagedObjectReference;
|
|||||||
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
||||||
|
|
||||||
public class HostFirewallSystemMO extends BaseMO {
|
public class HostFirewallSystemMO extends BaseMO {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static final Logger s_logger = Logger.getLogger(HostFirewallSystemMO.class);
|
private static final Logger s_logger = Logger.getLogger(HostFirewallSystemMO.class);
|
||||||
|
|
||||||
public HostFirewallSystemMO(VmwareContext context, ManagedObjectReference morFirewallSystem) {
|
public HostFirewallSystemMO(VmwareContext context, ManagedObjectReference morFirewallSystem) {
|
||||||
|
|||||||
@ -91,11 +91,11 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<VirtualNicManagerNetConfig> getHostVirtualNicManagerNetConfig() throws Exception {
|
public List<VirtualNicManagerNetConfig> getHostVirtualNicManagerNetConfig() throws Exception {
|
||||||
return (List<VirtualNicManagerNetConfig>)_context.getVimClient().getDynamicProperty(_mor, "config.virtualNicManagerInfo.netConfig");
|
return _context.getVimClient().getDynamicProperty(_mor, "config.virtualNicManagerInfo.netConfig");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<HostIpRouteEntry> getHostIpRouteEntries() throws Exception {
|
public List<HostIpRouteEntry> getHostIpRouteEntries() throws Exception {
|
||||||
return (List<HostIpRouteEntry>)_context.getVimClient().getDynamicProperty(_mor, "config.network.routeTableInfo.ipRoute");
|
return _context.getVimClient().getDynamicProperty(_mor, "config.network.routeTableInfo.ipRoute");
|
||||||
}
|
}
|
||||||
|
|
||||||
public HostListSummaryQuickStats getHostQuickStats() throws Exception {
|
public HostListSummaryQuickStats getHostQuickStats() throws Exception {
|
||||||
@ -222,7 +222,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ManagedObjectReference[] getHostLocalDatastore() throws Exception {
|
public ManagedObjectReference[] getHostLocalDatastore() throws Exception {
|
||||||
List<ManagedObjectReference> datastores = (List<ManagedObjectReference>)_context.getVimClient().getDynamicProperty(_mor, "datastore");
|
List<ManagedObjectReference> datastores = _context.getVimClient().getDynamicProperty(_mor, "datastore");
|
||||||
List<ManagedObjectReference> l = new ArrayList<ManagedObjectReference>();
|
List<ManagedObjectReference> l = new ArrayList<ManagedObjectReference>();
|
||||||
if (datastores != null) {
|
if (datastores != null) {
|
||||||
for (ManagedObjectReference mor : datastores) {
|
for (ManagedObjectReference mor : datastores) {
|
||||||
@ -235,7 +235,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public HostVirtualSwitch getHostVirtualSwitchByName(String name) throws Exception {
|
public HostVirtualSwitch getHostVirtualSwitchByName(String name) throws Exception {
|
||||||
List<HostVirtualSwitch> switches = (List<HostVirtualSwitch>)_context.getVimClient().getDynamicProperty(_mor, "config.network.vswitch");
|
List<HostVirtualSwitch> switches = _context.getVimClient().getDynamicProperty(_mor, "config.network.vswitch");
|
||||||
|
|
||||||
if (switches != null) {
|
if (switches != null) {
|
||||||
for (HostVirtualSwitch vswitch : switches) {
|
for (HostVirtualSwitch vswitch : switches) {
|
||||||
@ -247,7 +247,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<HostVirtualSwitch> getHostVirtualSwitch() throws Exception {
|
public List<HostVirtualSwitch> getHostVirtualSwitch() throws Exception {
|
||||||
return (List<HostVirtualSwitch>)_context.getVimClient().getDynamicProperty(_mor, "config.network.vswitch");
|
return _context.getVimClient().getDynamicProperty(_mor, "config.network.vswitch");
|
||||||
}
|
}
|
||||||
|
|
||||||
public AboutInfo getHostAboutInfo() throws Exception {
|
public AboutInfo getHostAboutInfo() throws Exception {
|
||||||
@ -326,7 +326,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
|
|||||||
assert (nicType != null);
|
assert (nicType != null);
|
||||||
|
|
||||||
List<VirtualNicManagerNetConfig> netConfigs =
|
List<VirtualNicManagerNetConfig> netConfigs =
|
||||||
(List<VirtualNicManagerNetConfig>)_context.getVimClient().getDynamicProperty(_mor, "config.virtualNicManagerInfo.netConfig");
|
_context.getVimClient().getDynamicProperty(_mor, "config.virtualNicManagerInfo.netConfig");
|
||||||
|
|
||||||
if (netConfigs != null) {
|
if (netConfigs != null) {
|
||||||
for (VirtualNicManagerNetConfig netConfig : netConfigs) {
|
for (VirtualNicManagerNetConfig netConfig : netConfigs) {
|
||||||
@ -450,7 +450,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
|
|||||||
public List<ManagedObjectReference> getVmMorsOnNetwork(String portGroupName) throws Exception {
|
public List<ManagedObjectReference> getVmMorsOnNetwork(String portGroupName) throws Exception {
|
||||||
ManagedObjectReference morNetwork = getNetworkMor(portGroupName);
|
ManagedObjectReference morNetwork = getNetworkMor(portGroupName);
|
||||||
if (morNetwork != null)
|
if (morNetwork != null)
|
||||||
return (List<ManagedObjectReference>)_context.getVimClient().getDynamicProperty(morNetwork, "vm");
|
return _context.getVimClient().getDynamicProperty(morNetwork, "vm");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -905,9 +905,9 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
|
|||||||
|
|
||||||
VmwareHypervisorHostNetworkSummary summary = new VmwareHypervisorHostNetworkSummary();
|
VmwareHypervisorHostNetworkSummary summary = new VmwareHypervisorHostNetworkSummary();
|
||||||
|
|
||||||
if (this.getHostType() == VmwareHostType.ESXi) {
|
if (getHostType() == VmwareHostType.ESXi) {
|
||||||
List<VirtualNicManagerNetConfig> netConfigs =
|
List<VirtualNicManagerNetConfig> netConfigs =
|
||||||
(List<VirtualNicManagerNetConfig>)_context.getVimClient().getDynamicProperty(_mor, "config.virtualNicManagerInfo.netConfig");
|
_context.getVimClient().getDynamicProperty(_mor, "config.virtualNicManagerInfo.netConfig");
|
||||||
assert (netConfigs != null);
|
assert (netConfigs != null);
|
||||||
|
|
||||||
for (VirtualNicManagerNetConfig netConfig : netConfigs) {
|
for (VirtualNicManagerNetConfig netConfig : netConfigs) {
|
||||||
@ -927,7 +927,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// try with ESX path
|
// try with ESX path
|
||||||
List<HostVirtualNic> hostVNics = (List<HostVirtualNic>)_context.getVimClient().getDynamicProperty(_mor, "config.network.consoleVnic");
|
List<HostVirtualNic> hostVNics = _context.getVimClient().getDynamicProperty(_mor, "config.network.consoleVnic");
|
||||||
|
|
||||||
if (hostVNics != null) {
|
if (hostVNics != null) {
|
||||||
for (HostVirtualNic vnic : hostVNics) {
|
for (HostVirtualNic vnic : hostVNics) {
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import com.vmware.vim25.ManagedObjectReference;
|
|||||||
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
||||||
|
|
||||||
public class HostNetworkSystemMO extends BaseMO {
|
public class HostNetworkSystemMO extends BaseMO {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static final Logger s_logger = Logger.getLogger(HostNetworkSystemMO.class);
|
private static final Logger s_logger = Logger.getLogger(HostNetworkSystemMO.class);
|
||||||
|
|
||||||
public HostNetworkSystemMO(VmwareContext context, ManagedObjectReference morNetworkSystem) {
|
public HostNetworkSystemMO(VmwareContext context, ManagedObjectReference morNetworkSystem) {
|
||||||
|
|||||||
@ -981,7 +981,7 @@ public class HypervisorHostHelper {
|
|||||||
try {
|
try {
|
||||||
if (lock.lock(DEFAULT_LOCK_TIMEOUT_SECONDS)) {
|
if (lock.lock(DEFAULT_LOCK_TIMEOUT_SECONDS)) {
|
||||||
try {
|
try {
|
||||||
List<ManagedObjectReference> hosts = (List<ManagedObjectReference>)hostMo.getContext().getVimClient().getDynamicProperty(morParent, "host");
|
List<ManagedObjectReference> hosts = hostMo.getContext().getVimClient().getDynamicProperty(morParent, "host");
|
||||||
if (hosts != null) {
|
if (hosts != null) {
|
||||||
for (ManagedObjectReference otherHost : hosts) {
|
for (ManagedObjectReference otherHost : hosts) {
|
||||||
if (!otherHost.getValue().equals(hostMo.getMor().getValue())) {
|
if (!otherHost.getValue().equals(hostMo.getMor().getValue())) {
|
||||||
|
|||||||
@ -30,10 +30,8 @@ import com.cloud.hypervisor.vmware.util.VmwareContext;
|
|||||||
|
|
||||||
public class LicenseAssignmentManagerMO extends BaseMO {
|
public class LicenseAssignmentManagerMO extends BaseMO {
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static final Logger s_logger = Logger.getLogger(LicenseAssignmentManagerMO.class);
|
private static final Logger s_logger = Logger.getLogger(LicenseAssignmentManagerMO.class);
|
||||||
private static final String LICENSE_INFO_PRODUCT_VERSION = "ProductVersion";
|
|
||||||
private static final String LICENSE_INFO_PRODUCT_NAME = "ProductName";
|
|
||||||
private static final String LICENSE_INFO_NAME = "Name";
|
|
||||||
private static final String LICENSE_INFO_FEATURE = "feature";
|
private static final String LICENSE_INFO_FEATURE = "feature";
|
||||||
|
|
||||||
public LicenseAssignmentManagerMO(VmwareContext context, ManagedObjectReference mor) {
|
public LicenseAssignmentManagerMO(VmwareContext context, ManagedObjectReference mor) {
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import com.cloud.hypervisor.vmware.util.VmwareContext;
|
|||||||
|
|
||||||
public class LicenseManagerMO extends BaseMO {
|
public class LicenseManagerMO extends BaseMO {
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static final Logger s_logger = Logger.getLogger(LicenseManagerMO.class);
|
private static final Logger s_logger = Logger.getLogger(LicenseManagerMO.class);
|
||||||
private ManagedObjectReference _licenseAssignmentManager = null;
|
private ManagedObjectReference _licenseAssignmentManager = null;
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,6 @@ public class NetworkMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<ManagedObjectReference> getVMsOnNetwork() throws Exception {
|
public List<ManagedObjectReference> getVMsOnNetwork() throws Exception {
|
||||||
return (List<ManagedObjectReference>)_context.getVimClient().getDynamicProperty(_mor, "vm");
|
return _context.getVimClient().getDynamicProperty(_mor, "vm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -114,10 +114,10 @@ public class PerfManagerMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<PerfCounterInfo> getCounterInfo() throws Exception {
|
public List<PerfCounterInfo> getCounterInfo() throws Exception {
|
||||||
return (List<PerfCounterInfo>)_context.getVimClient().getDynamicProperty(_mor, "perfCounter");
|
return _context.getVimClient().getDynamicProperty(_mor, "perfCounter");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PerfInterval> getIntervalInfo() throws Exception {
|
public List<PerfInterval> getIntervalInfo() throws Exception {
|
||||||
return (List<PerfInterval>)_context.getVimClient().getDynamicProperty(_mor, "historicalInterval");
|
return _context.getVimClient().getDynamicProperty(_mor, "historicalInterval");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import com.vmware.vim25.VirtualDiskSpec;
|
|||||||
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
||||||
|
|
||||||
public class VirtualDiskManagerMO extends BaseMO {
|
public class VirtualDiskManagerMO extends BaseMO {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static final Logger s_logger = Logger.getLogger(VirtualDiskManagerMO.class);
|
private static final Logger s_logger = Logger.getLogger(VirtualDiskManagerMO.class);
|
||||||
|
|
||||||
public VirtualDiskManagerMO(VmwareContext context) {
|
public VirtualDiskManagerMO(VmwareContext context) {
|
||||||
|
|||||||
@ -811,13 +811,13 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
String vmxPathTokens[] = vmxFilePath.split("\\[|\\]|/");
|
String vmxPathTokens[] = vmxFilePath.split("\\[|\\]|/");
|
||||||
|
|
||||||
StringBuffer sb = new StringBuffer("https://" + _context.getServerAddress() + "/folder/");
|
StringBuffer sb = new StringBuffer("https://" + _context.getServerAddress() + "/folder/");
|
||||||
sb.append(URLEncoder.encode(vmxPathTokens[2].trim()));
|
sb.append(URLEncoder.encode(vmxPathTokens[2].trim(), "UTF-8"));
|
||||||
sb.append("/");
|
sb.append("/");
|
||||||
sb.append(URLEncoder.encode(vmxPathTokens[3].trim()));
|
sb.append(URLEncoder.encode(vmxPathTokens[3].trim(), "UTF-8"));
|
||||||
sb.append("?dcPath=");
|
sb.append("?dcPath=");
|
||||||
sb.append(URLEncoder.encode(dcInfo.second()));
|
sb.append(URLEncoder.encode(dcInfo.second(), "UTF-8"));
|
||||||
sb.append("&dsName=");
|
sb.append("&dsName=");
|
||||||
sb.append(URLEncoder.encode(vmxPathTokens[1].trim()));
|
sb.append(URLEncoder.encode(vmxPathTokens[1].trim(), "UTF-8"));
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
@ -1796,7 +1796,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getScsiDeviceControllerKey() throws Exception {
|
public int getScsiDeviceControllerKey() throws Exception {
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
|
|
||||||
if (devices != null && devices.size() > 0) {
|
if (devices != null && devices.size() > 0) {
|
||||||
for (VirtualDevice device : devices) {
|
for (VirtualDevice device : devices) {
|
||||||
@ -1811,7 +1811,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getScsiDeviceControllerKeyNoException() throws Exception {
|
public int getScsiDeviceControllerKeyNoException() throws Exception {
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
|
|
||||||
if (devices != null && devices.size() > 0) {
|
if (devices != null && devices.size() > 0) {
|
||||||
for (VirtualDevice device : devices) {
|
for (VirtualDevice device : devices) {
|
||||||
@ -1847,7 +1847,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
|
|
||||||
// return pair of VirtualDisk and disk device bus name(ide0:0, etc)
|
// return pair of VirtualDisk and disk device bus name(ide0:0, etc)
|
||||||
public Pair<VirtualDisk, String> getDiskDevice(String vmdkDatastorePath, boolean matchExactly) throws Exception {
|
public Pair<VirtualDisk, String> getDiskDevice(String vmdkDatastorePath, boolean matchExactly) throws Exception {
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
|
|
||||||
s_logger.info("Look for disk device info from volume : " + vmdkDatastorePath);
|
s_logger.info("Look for disk device info from volume : " + vmdkDatastorePath);
|
||||||
DatastoreFile dsSrcFile = new DatastoreFile(vmdkDatastorePath);
|
DatastoreFile dsSrcFile = new DatastoreFile(vmdkDatastorePath);
|
||||||
@ -1893,7 +1893,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getDiskCurrentTopBackingFileInChain(String deviceBusName) throws Exception {
|
public String getDiskCurrentTopBackingFileInChain(String deviceBusName) throws Exception {
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
if (devices != null && devices.size() > 0) {
|
if (devices != null && devices.size() > 0) {
|
||||||
for (VirtualDevice device : devices) {
|
for (VirtualDevice device : devices) {
|
||||||
if (device instanceof VirtualDisk) {
|
if (device instanceof VirtualDisk) {
|
||||||
@ -1915,7 +1915,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public VirtualDisk getDiskDeviceByDeviceBusName(String deviceBusName) throws Exception {
|
public VirtualDisk getDiskDeviceByDeviceBusName(String deviceBusName) throws Exception {
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
|
|
||||||
if (devices != null && devices.size() > 0) {
|
if (devices != null && devices.size() > 0) {
|
||||||
for (VirtualDevice device : devices) {
|
for (VirtualDevice device : devices) {
|
||||||
@ -1933,7 +1933,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
public VirtualMachineDiskInfoBuilder getDiskInfoBuilder() throws Exception {
|
public VirtualMachineDiskInfoBuilder getDiskInfoBuilder() throws Exception {
|
||||||
VirtualMachineDiskInfoBuilder builder = new VirtualMachineDiskInfoBuilder();
|
VirtualMachineDiskInfoBuilder builder = new VirtualMachineDiskInfoBuilder();
|
||||||
|
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
|
|
||||||
if (devices != null && devices.size() > 0) {
|
if (devices != null && devices.size() > 0) {
|
||||||
for (VirtualDevice device : devices) {
|
for (VirtualDevice device : devices) {
|
||||||
@ -2049,7 +2049,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
public List<VirtualDisk> getVirtualDisks() throws Exception {
|
public List<VirtualDisk> getVirtualDisks() throws Exception {
|
||||||
List<VirtualDisk> virtualDisks = new ArrayList<VirtualDisk>();
|
List<VirtualDisk> virtualDisks = new ArrayList<VirtualDisk>();
|
||||||
|
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
|
|
||||||
for (VirtualDevice device : devices) {
|
for (VirtualDevice device : devices) {
|
||||||
if (device instanceof VirtualDisk) {
|
if (device instanceof VirtualDisk) {
|
||||||
@ -2061,7 +2061,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> detachAllDisksExcept(String vmdkBaseName, String deviceBusName) throws Exception {
|
public List<String> detachAllDisksExcept(String vmdkBaseName, String deviceBusName) throws Exception {
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
|
|
||||||
VirtualMachineConfigSpec reConfigSpec = new VirtualMachineConfigSpec();
|
VirtualMachineConfigSpec reConfigSpec = new VirtualMachineConfigSpec();
|
||||||
List<String> detachedDiskFiles = new ArrayList<String>();
|
List<String> detachedDiskFiles = new ArrayList<String>();
|
||||||
@ -2105,12 +2105,12 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<VirtualDevice> getAllDeviceList() throws Exception {
|
public List<VirtualDevice> getAllDeviceList() throws Exception {
|
||||||
return (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
return _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
}
|
}
|
||||||
|
|
||||||
public VirtualDisk[] getAllDiskDevice() throws Exception {
|
public VirtualDisk[] getAllDiskDevice() throws Exception {
|
||||||
List<VirtualDisk> deviceList = new ArrayList<VirtualDisk>();
|
List<VirtualDisk> deviceList = new ArrayList<VirtualDisk>();
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
if (devices != null && devices.size() > 0) {
|
if (devices != null && devices.size() > 0) {
|
||||||
for (VirtualDevice device : devices) {
|
for (VirtualDevice device : devices) {
|
||||||
if (device instanceof VirtualDisk) {
|
if (device instanceof VirtualDisk) {
|
||||||
@ -2163,7 +2163,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int tryGetIDEDeviceControllerKey() throws Exception {
|
public int tryGetIDEDeviceControllerKey() throws Exception {
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
|
|
||||||
if (devices != null && devices.size() > 0) {
|
if (devices != null && devices.size() > 0) {
|
||||||
for (VirtualDevice device : devices) {
|
for (VirtualDevice device : devices) {
|
||||||
@ -2177,7 +2177,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getIDEDeviceControllerKey() throws Exception {
|
public int getIDEDeviceControllerKey() throws Exception {
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
|
|
||||||
if (devices != null && devices.size() > 0) {
|
if (devices != null && devices.size() > 0) {
|
||||||
for (VirtualDevice device : devices) {
|
for (VirtualDevice device : devices) {
|
||||||
@ -2197,7 +2197,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public VirtualDevice getIsoDevice() throws Exception {
|
public VirtualDevice getIsoDevice() throws Exception {
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
if (devices != null && devices.size() > 0) {
|
if (devices != null && devices.size() > 0) {
|
||||||
for (VirtualDevice device : devices) {
|
for (VirtualDevice device : devices) {
|
||||||
if (device instanceof VirtualCdrom) {
|
if (device instanceof VirtualCdrom) {
|
||||||
@ -2209,7 +2209,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getPCIDeviceControllerKey() throws Exception {
|
public int getPCIDeviceControllerKey() throws Exception {
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
|
|
||||||
if (devices != null && devices.size() > 0) {
|
if (devices != null && devices.size() > 0) {
|
||||||
for (VirtualDevice device : devices) {
|
for (VirtualDevice device : devices) {
|
||||||
@ -2229,7 +2229,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getNextDeviceNumber(int controllerKey) throws Exception {
|
public int getNextDeviceNumber(int controllerKey) throws Exception {
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
|
|
||||||
int deviceNumber = -1;
|
int deviceNumber = -1;
|
||||||
if (devices != null && devices.size() > 0) {
|
if (devices != null && devices.size() > 0) {
|
||||||
@ -2245,7 +2245,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<VirtualDevice> getNicDevices(boolean sorted) throws Exception {
|
private List<VirtualDevice> getNicDevices(boolean sorted) throws Exception {
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
|
|
||||||
List<VirtualDevice> nics = new ArrayList<VirtualDevice>();
|
List<VirtualDevice> nics = new ArrayList<VirtualDevice>();
|
||||||
if (devices != null) {
|
if (devices != null) {
|
||||||
@ -2325,7 +2325,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
|
|
||||||
List<VirtualDevice> returnList = new ArrayList<VirtualDevice>();
|
List<VirtualDevice> returnList = new ArrayList<VirtualDevice>();
|
||||||
|
|
||||||
List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
|
||||||
|
|
||||||
if (devices != null) {
|
if (devices != null) {
|
||||||
for (VirtualDevice device : devices) {
|
for (VirtualDevice device : devices) {
|
||||||
@ -2346,7 +2346,6 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean unmountToolsInstaller() throws Exception {
|
public boolean unmountToolsInstaller() throws Exception {
|
||||||
int i = 1;
|
|
||||||
// Monitor VM questions
|
// Monitor VM questions
|
||||||
final Boolean[] flags = {false};
|
final Boolean[] flags = {false};
|
||||||
final VirtualMachineMO vmMo = this;
|
final VirtualMachineMO vmMo = this;
|
||||||
|
|||||||
@ -27,8 +27,8 @@ import javax.net.ssl.HostnameVerifier;
|
|||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
import javax.net.ssl.SSLSession;
|
import javax.net.ssl.SSLSession;
|
||||||
import javax.xml.ws.BindingProvider;
|
import javax.xml.ws.BindingProvider;
|
||||||
import javax.xml.ws.handler.MessageContext;
|
|
||||||
import javax.xml.ws.WebServiceException;
|
import javax.xml.ws.WebServiceException;
|
||||||
|
import javax.xml.ws.handler.MessageContext;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
@ -144,6 +144,7 @@ public class VmwareClient {
|
|||||||
ServiceContent serviceContent = vimPort.retrieveServiceContent(svcInstRef);
|
ServiceContent serviceContent = vimPort.retrieveServiceContent(svcInstRef);
|
||||||
|
|
||||||
// Extract a cookie. See vmware sample program com.vmware.httpfileaccess.GetVMFiles
|
// Extract a cookie. See vmware sample program com.vmware.httpfileaccess.GetVMFiles
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
Map<String, List<String>> headers = (Map<String, List<String>>)((BindingProvider)vimPort).getResponseContext().get(MessageContext.HTTP_RESPONSE_HEADERS);
|
Map<String, List<String>> headers = (Map<String, List<String>>)((BindingProvider)vimPort).getResponseContext().get(MessageContext.HTTP_RESPONSE_HEADERS);
|
||||||
List<String> cookies = headers.get("Set-cookie");
|
List<String> cookies = headers.get("Set-cookie");
|
||||||
String cookieValue = cookies.get(0);
|
String cookieValue = cookies.get(0);
|
||||||
@ -256,17 +257,18 @@ public class VmwareClient {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
* in case of error.
|
* in case of error.
|
||||||
*/
|
*/
|
||||||
public Object getDynamicProperty(ManagedObjectReference mor, String propertyName) throws Exception {
|
@SuppressWarnings("unchecked")
|
||||||
|
public <T> T getDynamicProperty(ManagedObjectReference mor, String propertyName) throws Exception {
|
||||||
List<String> props = new ArrayList<String>();
|
List<String> props = new ArrayList<String>();
|
||||||
props.add(propertyName);
|
props.add(propertyName);
|
||||||
List<ObjectContent> objContent = retrieveMoRefProperties(mor, props);
|
List<ObjectContent> objContent = retrieveMoRefProperties(mor, props);
|
||||||
|
|
||||||
Object propertyValue = null;
|
T propertyValue = null;
|
||||||
if (objContent != null && objContent.size() > 0) {
|
if (objContent != null && objContent.size() > 0) {
|
||||||
List<DynamicProperty> dynamicProperty = objContent.get(0).getPropSet();
|
List<DynamicProperty> dynamicProperty = objContent.get(0).getPropSet();
|
||||||
if (dynamicProperty != null && dynamicProperty.size() > 0) {
|
if (dynamicProperty != null && dynamicProperty.size() > 0) {
|
||||||
DynamicProperty dp = dynamicProperty.get(0);
|
DynamicProperty dp = dynamicProperty.get(0);
|
||||||
propertyValue = dp.getVal();
|
propertyValue = (T)dp.getVal();
|
||||||
/*
|
/*
|
||||||
* If object is ArrayOfXXX object, then get the XXX[] by
|
* If object is ArrayOfXXX object, then get the XXX[] by
|
||||||
* invoking getXXX() on the object.
|
* invoking getXXX() on the object.
|
||||||
@ -274,13 +276,13 @@ public class VmwareClient {
|
|||||||
* ArrayOfManagedObjectReference.getManagedObjectReference()
|
* ArrayOfManagedObjectReference.getManagedObjectReference()
|
||||||
* returns ManagedObjectReference[] array.
|
* returns ManagedObjectReference[] array.
|
||||||
*/
|
*/
|
||||||
Class dpCls = propertyValue.getClass();
|
Class<? extends Object> dpCls = propertyValue.getClass();
|
||||||
String dynamicPropertyName = dpCls.getName();
|
String dynamicPropertyName = dpCls.getName();
|
||||||
if (dynamicPropertyName.indexOf("ArrayOf") != -1) {
|
if (dynamicPropertyName.indexOf("ArrayOf") != -1) {
|
||||||
String methodName = "get" + dynamicPropertyName.substring(dynamicPropertyName.indexOf("ArrayOf") + "ArrayOf".length(), dynamicPropertyName.length());
|
String methodName = "get" + dynamicPropertyName.substring(dynamicPropertyName.indexOf("ArrayOf") + "ArrayOf".length(), dynamicPropertyName.length());
|
||||||
|
|
||||||
Method getMorMethod = dpCls.getDeclaredMethod(methodName, null);
|
Method getMorMethod = dpCls.getDeclaredMethod(methodName, (Class<?>)null);
|
||||||
propertyValue = getMorMethod.invoke(propertyValue, (Object[])null);
|
propertyValue = (T)getMorMethod.invoke(propertyValue, (Object[])null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
@ -375,7 +376,7 @@ public class VmwareContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uploadVmdkFile(String httpMethod, String urlString, String localFileName, long totalBytesUpdated, ActionDelegate progressUpdater) throws Exception {
|
public void uploadVmdkFile(String httpMethod, String urlString, String localFileName, long totalBytesUpdated, ActionDelegate<Long> progressUpdater) throws Exception {
|
||||||
|
|
||||||
HttpURLConnection conn = getRawHTTPConnection(urlString);
|
HttpURLConnection conn = getRawHTTPConnection(urlString);
|
||||||
|
|
||||||
@ -418,7 +419,7 @@ public class VmwareContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long downloadVmdkFile(String urlString, String localFileName, long totalBytesDownloaded, ActionDelegate progressUpdater) throws Exception {
|
public long downloadVmdkFile(String urlString, String localFileName, long totalBytesDownloaded, ActionDelegate<Long> progressUpdater) throws Exception {
|
||||||
HttpURLConnection conn = getRawHTTPConnection(urlString);
|
HttpURLConnection conn = getRawHTTPConnection(urlString);
|
||||||
|
|
||||||
String cookie = _vimClient.getServiceCookie();
|
String cookie = _vimClient.getServiceCookie();
|
||||||
@ -583,8 +584,12 @@ public class VmwareContext {
|
|||||||
sb.append(_serverAddress);
|
sb.append(_serverAddress);
|
||||||
sb.append("/folder/");
|
sb.append("/folder/");
|
||||||
sb.append(relativePath);
|
sb.append(relativePath);
|
||||||
sb.append("?dcPath=").append(URLEncoder.encode(dcName)).append("&dsName=");
|
try {
|
||||||
sb.append(URLEncoder.encode(datastoreName));
|
sb.append("?dcPath=").append(URLEncoder.encode(dcName, "UTF-8"));
|
||||||
|
sb.append("&dsName=").append(URLEncoder.encode(datastoreName, "UTF-8"));
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
s_logger.error("Unable to encode URL. dcPath : " + dcName + ", dsName :" + datastoreName, e);
|
||||||
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -134,41 +134,6 @@ public class VmwareContextPool {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getIdleCheckContexts(List<VmwareContext> l, int batchSize) {
|
|
||||||
synchronized (this) {
|
|
||||||
for (Map.Entry<String, List<VmwareContext>> entry : _pool.entrySet()) {
|
|
||||||
if (entry.getValue() != null) {
|
|
||||||
int count = 0;
|
|
||||||
while (entry.getValue().size() > 0 && count < batchSize) {
|
|
||||||
VmwareContext context = entry.getValue().remove(0);
|
|
||||||
context.setPoolInfo(this, entry.getKey());
|
|
||||||
l.add(context);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doIdleCheck() {
|
|
||||||
List<VmwareContext> l = new ArrayList<VmwareContext>();
|
|
||||||
int batchSize = (int)(_idleCheckIntervalMs / 1000); // calculate batch size at 1 request/sec rate
|
|
||||||
getIdleCheckContexts(l, batchSize);
|
|
||||||
|
|
||||||
for (VmwareContext context : l) {
|
|
||||||
try {
|
|
||||||
context.idleCheck();
|
|
||||||
|
|
||||||
if (s_logger.isTraceEnabled())
|
|
||||||
s_logger.trace("Recyle context after idle check");
|
|
||||||
returnContext(context);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
s_logger.warn("Exception caught during VmwareContext idle check, close and discard the context", e);
|
|
||||||
context.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getKeepAliveCheckContexts(List<VmwareContext> l, int batchSize) {
|
private void getKeepAliveCheckContexts(List<VmwareContext> l, int batchSize) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
int size = Math.min(_outstandingRegistry.size(), batchSize);
|
int size = Math.min(_outstandingRegistry.size(), batchSize);
|
||||||
|
|||||||
@ -71,6 +71,7 @@ import com.cloud.utils.Ternary;
|
|||||||
import com.cloud.utils.exception.ExceptionUtil;
|
import com.cloud.utils.exception.ExceptionUtil;
|
||||||
|
|
||||||
public class VmwareHelper {
|
public class VmwareHelper {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static final Logger s_logger = Logger.getLogger(VmwareHelper.class);
|
private static final Logger s_logger = Logger.getLogger(VmwareHelper.class);
|
||||||
|
|
||||||
public static boolean isReservedScsiDeviceNumber(int deviceNumber) {
|
public static boolean isReservedScsiDeviceNumber(int deviceNumber) {
|
||||||
@ -325,6 +326,7 @@ public class VmwareHelper {
|
|||||||
return disk;
|
return disk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, int controllerKey, Pair<String, ManagedObjectReference>[] vmdkDatastorePathChain,
|
public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, int controllerKey, Pair<String, ManagedObjectReference>[] vmdkDatastorePathChain,
|
||||||
int deviceNumber, int contextNumber) throws Exception {
|
int deviceNumber, int contextNumber) throws Exception {
|
||||||
|
|
||||||
@ -385,6 +387,7 @@ public class VmwareHelper {
|
|||||||
backingInfo.setParent(parentBacking);
|
backingInfo.setParent(parentBacking);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private static void setParentBackingInfo(VirtualDiskFlatVer2BackingInfo backingInfo, Pair<String, ManagedObjectReference>[] parentDatastorePathList) {
|
private static void setParentBackingInfo(VirtualDiskFlatVer2BackingInfo backingInfo, Pair<String, ManagedObjectReference>[] parentDatastorePathList) {
|
||||||
|
|
||||||
VirtualDiskFlatVer2BackingInfo parentBacking = new VirtualDiskFlatVer2BackingInfo();
|
VirtualDiskFlatVer2BackingInfo parentBacking = new VirtualDiskFlatVer2BackingInfo();
|
||||||
@ -640,10 +643,10 @@ public class VmwareHelper {
|
|||||||
//TODO: in vim 5.1, exceptions do not have a base exception class, MethodFault becomes a FaultInfo that we can only get
|
//TODO: in vim 5.1, exceptions do not have a base exception class, MethodFault becomes a FaultInfo that we can only get
|
||||||
// from individual exception through getFaultInfo, so we have to use reflection here to get MethodFault information.
|
// from individual exception through getFaultInfo, so we have to use reflection here to get MethodFault information.
|
||||||
try {
|
try {
|
||||||
Class cls = e.getClass();
|
Class<? extends Throwable> cls = e.getClass();
|
||||||
Method mth = cls.getDeclaredMethod("getFaultInfo", null);
|
Method mth = cls.getDeclaredMethod("getFaultInfo", (Class<?>)null);
|
||||||
if (mth != null) {
|
if (mth != null) {
|
||||||
Object fault = mth.invoke(e, null);
|
Object fault = mth.invoke(e, (Object[])null);
|
||||||
if (fault instanceof MethodFault) {
|
if (fault instanceof MethodFault) {
|
||||||
final StringWriter writer = new StringWriter();
|
final StringWriter writer = new StringWriter();
|
||||||
writer.append("Exception: " + fault.getClass().getName() + "\n");
|
writer.append("Exception: " + fault.getClass().getName() + "\n");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user