You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ke...@apache.org on 2013/09/05 00:42:31 UTC
[22/27] git commit: updated refs/heads/master to ae23144
CLOUDSTACK-4529: use property collector to collect all information in one round
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e2cd2164
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e2cd2164
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e2cd2164
Branch: refs/heads/master
Commit: e2cd2164d75d132c3b8e9538f8d16e81a80f647b
Parents: e929b4c
Author: Kelven Yang <ke...@gmail.com>
Authored: Tue Aug 27 15:04:17 2013 -0700
Committer: Kelven Yang <ke...@gmail.com>
Committed: Wed Sep 4 14:49:46 2013 -0700
----------------------------------------------------------------------
.../src/com/cloud/hypervisor/vmware/mo/HostMO.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2cd2164/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
index 1cc0e79..c49f9a6 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java
@@ -35,6 +35,7 @@ import com.vmware.vim25.AboutInfo;
import com.vmware.vim25.AlreadyExistsFaultMsg;
import com.vmware.vim25.ClusterDasConfigInfo;
import com.vmware.vim25.ComputeResourceSummary;
+import com.vmware.vim25.CustomFieldStringValue;
import com.vmware.vim25.DatastoreSummary;
import com.vmware.vim25.DynamicProperty;
import com.vmware.vim25.HostConfigManager;
@@ -577,8 +578,14 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
}
public HashMap<String, Integer> getVmVncPortsOnHost() throws Exception {
+
+ int key = getCustomFieldKey("VirtualMachine", CustomFieldConstants.CLOUD_VM_INTERNAL_NAME);
+ if(key == 0) {
+ s_logger.warn("Custom field " + CustomFieldConstants.CLOUD_VM_INTERNAL_NAME + " is not registered ?!");
+ }
+
ObjectContent[] ocs = getVmPropertiesOnHyperHost(
- new String[] { "name", "config.extraConfig[\"RemoteDisplay.vnc.port\"]" }
+ new String[] { "name", "config.extraConfig[\"RemoteDisplay.vnc.port\"]", "value[" + key + "]" }
);
HashMap<String, Integer> portInfo = new HashMap<String, Integer>();
@@ -592,14 +599,15 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost {
for(DynamicProperty objProp : objProps) {
if(objProp.getName().equals("name")) {
vmName = (String)objProp.getVal();
+ } else if(objProp.getName().startsWith("value[")) {
+ if(objProp.getVal() != null)
+ vmInternalCSName = ((CustomFieldStringValue)objProp.getVal()).getValue();
} else {
OptionValue optValue = (OptionValue)objProp.getVal();
value = (String)optValue.getValue();
}
}
- VirtualMachineMO vmMo = new VirtualMachineMO(_context, oc.getObj());
- // Check if vmMo has the custom property CLOUD_VM_INTERNAL_NAME set.
- vmInternalCSName = vmMo.getCustomFieldValue(CustomFieldConstants.CLOUD_VM_INTERNAL_NAME);
+
if (vmInternalCSName != null && isUserVMInternalCSName(vmInternalCSName))
vmName = vmInternalCSName;