cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sureshanaparti <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-8820: Support for VMware vCent...
Date Mon, 14 Sep 2015 10:01:18 GMT
Github user sureshanaparti commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/806#discussion_r39377834
  
    --- Diff: vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java ---
    @@ -577,41 +590,48 @@ public ManagedObjectReference getDecendentMoRef(ManagedObjectReference
root, Str
                 return null;
             }
     
    -        // Create PropertySpecs
    -        PropertySpec pSpec = new PropertySpec();
    -        pSpec.setType(type);
    -        pSpec.setAll(false);
    -        pSpec.getPathSet().add("name");
    -
    -        ObjectSpec oSpec = new ObjectSpec();
    -        oSpec.setObj(root);
    -        oSpec.setSkip(false);
    -        oSpec.getSelectSet().addAll(constructCompleteTraversalSpec());
    -
    -        PropertyFilterSpec spec = new PropertyFilterSpec();
    -        spec.getPropSet().add(pSpec);
    -        spec.getObjectSet().add(oSpec);
    -        List<PropertyFilterSpec> specArr = new ArrayList<PropertyFilterSpec>();
    -        specArr.add(spec);
    -
    -        List<ObjectContent> ocary = vimPort.retrieveProperties(getPropCol(), specArr);
    -
    -        if (ocary == null || ocary.size() == 0) {
    -            return null;
    -        }
    +        try {
    +            // Create PropertySpecs
    +            PropertySpec pSpec = new PropertySpec();
    +            pSpec.setType(type);
    +            pSpec.setAll(false);
    +            pSpec.getPathSet().add("name");
    +
    +            ObjectSpec oSpec = new ObjectSpec();
    +            oSpec.setObj(root);
    +            oSpec.setSkip(false);
    +            oSpec.getSelectSet().addAll(constructCompleteTraversalSpec());
    +
    +            PropertyFilterSpec spec = new PropertyFilterSpec();
    +            spec.getPropSet().add(pSpec);
    +            spec.getObjectSet().add(oSpec);
    +            List<PropertyFilterSpec> specArr = new ArrayList<PropertyFilterSpec>();
    +            specArr.add(spec);
    +
    +            ManagedObjectReference propCollector = getPropCol();
    +            List<ObjectContent> ocary = vimPort.retrieveProperties(propCollector,
specArr);
    +
    +            if (ocary == null || ocary.size() == 0) {
    +                return null;
    +            }
     
    -        // filter through retrieved objects to get the first match.
    -        for (ObjectContent oc : ocary) {
    -            ManagedObjectReference mor = oc.getObj();
    -            List<DynamicProperty> propary = oc.getPropSet();
    -            if (type == null || type.equals(mor.getType())) {
    -                if (propary.size() > 0) {
    -                    String propval = (String)propary.get(0).getVal();
    -                    if (propval != null && name.equalsIgnoreCase(propval))
    -                        return mor;
    +            // filter through retrieved objects to get the first match.
    +            for (ObjectContent oc : ocary) {
    +                ManagedObjectReference mor = oc.getObj();
    +                List<DynamicProperty> propary = oc.getPropSet();
    +                if (type == null || type.equals(mor.getType())) {
    +                    if (propary.size() > 0) {
    +                        String propval = (String)propary.get(0).getVal();
    +                        if (propval != null && name.equalsIgnoreCase(propval))
    +                            return mor;
    +                    }
                     }
                 }
    +        } catch (Exception e) {
    --- End diff --
    
    update the code to catch specific exceptions


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message