cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [37/40] git commit: refs/heads/master - Some cosmetic changes to VmwareClient private methods.
Date Tue, 05 Mar 2013 02:09:46 GMT
Some cosmetic changes to VmwareClient private methods.

Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/737dac2e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/737dac2e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/737dac2e

Branch: refs/heads/master
Commit: 737dac2e65a86d84e513e436fd6f487eda5352b4
Parents: 801e526
Author: Min Chen <min.chen@citrix.com>
Authored: Thu Feb 28 15:42:56 2013 -0800
Committer: Min Chen <min.chen@citrix.com>
Committed: Thu Feb 28 15:42:56 2013 -0800

----------------------------------------------------------------------
 .../cloud/hypervisor/vmware/util/VmwareClient.java |   19 +++++++--------
 1 files changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/737dac2e/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
index fc307f8..344fbdd 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
@@ -194,7 +194,7 @@ public class VmwareClient {
     public Object getDynamicProperty(ManagedObjectReference mor, String propertyName) throws
Exception {
         List<String> props = new ArrayList<String>();
         props.add(propertyName);
-        List<ObjectContent> objContent = this.getObjectProperties(mor, props);
+        List<ObjectContent> objContent = this.retrieveMoRefProperties(mor, props);
 
         Object propertyValue = null;
         if (objContent != null && objContent.size() > 0) {
@@ -224,7 +224,7 @@ public class VmwareClient {
         return propertyValue;
     }
 
-    private List<ObjectContent> getObjectProperties(ManagedObjectReference mObj, List<String>
props) throws Exception {
+    private List<ObjectContent> retrieveMoRefProperties(ManagedObjectReference mObj,
List<String> props) throws Exception {
         PropertySpec pSpec = new PropertySpec();
         pSpec.setAll(false);
         pSpec.setType(mObj.getType());
@@ -380,23 +380,21 @@ public class VmwareClient {
      * @return An array of SelectionSpec covering VM, Host, Resource pool,
      * Cluster Compute Resource and Datastore.
      */
-    private List<SelectionSpec> buildFullTraversal() {
-       // Terminal traversal specs
-
-       // RP -> VM
+    private List<SelectionSpec> constructCompleteTraversalSpec() {
+       // ResourcePools to VM: RP -> VM
        TraversalSpec rpToVm = new TraversalSpec();
        rpToVm.setName("rpToVm");
        rpToVm.setType("ResourcePool");
        rpToVm.setPath("vm");
        rpToVm.setSkip(Boolean.FALSE);
 
-       // vApp -> VM
+       // VirtualApp to VM: vApp -> VM
        TraversalSpec vAppToVM = new TraversalSpec();
        vAppToVM.setName("vAppToVM");
        vAppToVM.setType("VirtualApp");
        vAppToVM.setPath("vm");
 
-       // HostSystem -> VM
+       // Host to VM: HostSystem -> VM
        TraversalSpec hToVm = new TraversalSpec();
        hToVm.setType("HostSystem");
        hToVm.setPath("vm");
@@ -404,7 +402,7 @@ public class VmwareClient {
        hToVm.getSelectSet().add(getSelectionSpec("VisitFolders"));
        hToVm.setSkip(Boolean.FALSE);
 
-       // DC -> DS
+       // DataCenter to DataStore: DC -> DS
        TraversalSpec dcToDs = new TraversalSpec();
        dcToDs.setType("Datacenter");
        dcToDs.setPath("datastore");
@@ -513,7 +511,7 @@ public class VmwareClient {
         ObjectSpec oSpec = new ObjectSpec();
         oSpec.setObj(root);
         oSpec.setSkip(false);
-        oSpec.getSelectSet().addAll(buildFullTraversal());
+        oSpec.getSelectSet().addAll(constructCompleteTraversalSpec());
 
         PropertyFilterSpec spec = new PropertyFilterSpec();
         spec.getPropSet().add(pSpec);
@@ -527,6 +525,7 @@ public class VmwareClient {
             return null;
         }
 
+        // filter through retrieved objects to get the first match.
         for (ObjectContent oc : ocary) {
             ManagedObjectReference mor = oc.getObj();
             List<DynamicProperty> propary = oc.getPropSet();


Mime
View raw message