cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jburwell <...@git.apache.org>
Subject [GitHub] cloudstack pull request #1545: CLOUDSTACK-8715: Add channel to Instances for...
Date Wed, 10 Aug 2016 14:01:23 GMT
Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1545#discussion_r74249341
  
    --- Diff: plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
---
    @@ -171,6 +174,25 @@ public boolean parseDomainXML(String domXML) {
                     interfaces.add(def);
                 }
     
    +            NodeList ports = devices.getElementsByTagName("channel");
    +            for (int i = 0; i < ports.getLength(); i++) {
    +                Element channel = (Element)ports.item(i);
    +
    +                String type = channel.getAttribute("type");
    +                String path = getAttrValue("source", "path", channel);
    +                String name = getAttrValue("target", "name", channel);
    +                String state = getAttrValue("target", "state", channel);
    +
    +                ChannelDef def = null;
    +                if (Strings.isNullOrEmpty(state)) {
    +                    def = new ChannelDef(name, ChannelDef.ChannelType.valueOf(type.toUpperCase()),
path);
    +                } else {
    +                    def = new ChannelDef(name, ChannelDef.ChannelType.valueOf(type.toUpperCase()),
ChannelDef.ChannelState.valueOf(state.toUpperCase()), path);
    --- End diff --
    
    What if ``state`` is ``null``?  While it likely shouldn't happen, malformed XML could
cause an NPE which will not be helpful to operators or developers trying to debug the issue.
 Consider adding a ``checkState(StringUtils.isNoneBlank(state), "<explanation of unexpected
condition>")`` on line 185.


---
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