cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelv...@apache.org
Subject git commit: updated refs/heads/4.2-forward to 687e87f
Date Tue, 27 Aug 2013 22:17:25 GMT
Updated Branches:
  refs/heads/4.2-forward 8e350cb29 -> 687e87faa


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/687e87fa
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/687e87fa
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/687e87fa

Branch: refs/heads/4.2-forward
Commit: 687e87faa7a2d828fa428ac0b013e0c1de361bdc
Parents: 8e350cb
Author: Kelven Yang <kelveny@gmail.com>
Authored: Tue Aug 27 15:04:17 2013 -0700
Committer: Kelven Yang <kelveny@gmail.com>
Committed: Tue Aug 27 15:04:31 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/687e87fa/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 c0ef217..49a340c 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;
 


Mime
View raw message