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 Thu, 17 Nov 2016 03:02:55 GMT
Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1545#discussion_r88378691
  
    --- Diff: plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
---
    @@ -1209,25 +1209,95 @@ public String toString() {
             }
         }
     
    -    public static class VirtioSerialDef {
    -        private final String _name;
    -        private String _path;
    +    public static class ChannelDef {
    +        enum ChannelType {
    +            UNIX("unix"), SERIAL("serial");
    +            String type;
     
    -        public VirtioSerialDef(String name, String path) {
    -            _name = name;
    -            _path = path;
    +            ChannelType(String type) {
    +                this.type = type;
    +            }
    +
    +            @Override
    +            public String toString() {
    +                return this.type;
    +            }
    +        }
    +
    +        enum ChannelState {
    +            DISCONNECTED("disconnected"), CONNECTED("connected");
    +            String type;
    +
    +            ChannelState(String type) {
    +                this.type = type;
    +            }
    +
    +            @Override
    +            public String toString() {
    +                return type;
    +            }
    +        }
    +
    +        private String name;
    +        private String path;
    +        private ChannelType type;
    +        private ChannelState state;
    +
    +        public ChannelDef(String name, ChannelType type) {
    +            this.name = name;
    +            this.type = type;
    +        }
    +
    +        public ChannelDef(String name, ChannelType type, String path) {
    +            this.name = name;
    +            this.path = path;
    +            this.type = type;
    +        }
    +
    +        public ChannelDef(String name, ChannelType type, ChannelState state) {
    +            this.name = name;
    +            this.state = state;
    +            this.type = type;
    +        }
    +
    +        public ChannelDef(String name, ChannelType type, ChannelState state, String path)
{
    +            this.name = name;
    +            this.path = path;
    +            this.state = state;
    +            this.type = type;
    +        }
    +
    +        public ChannelType getChannelType() {
    +            return type;
    +        }
    +
    +        public ChannelState getChannelState() {
    +            return state;
    +        }
    +
    +        public String getName() {
    +            return name;
    +        }
    +
    +        public String getPath() {
    +            return path;
             }
     
             @Override
             public String toString() {
                 StringBuilder virtioSerialBuilder = new StringBuilder();
    -            if (_path == null) {
    -                _path = "/var/lib/libvirt/qemu";
    +            virtioSerialBuilder.append("<channel type='" + type.toString() + "'>\n");
    +            if (path == null) {
    +                virtioSerialBuilder.append("<source mode='bind'/>\n");
    +            } else {
    +                virtioSerialBuilder.append("<source mode='bind' path='" + path + "'/>\n");
                 }
    -            virtioSerialBuilder.append("<channel type='unix'>\n");
    -            virtioSerialBuilder.append("<source mode='bind' path='" + _path + "/"
+ _name + ".agent'/>\n");
    -            virtioSerialBuilder.append("<target type='virtio' name='" + _name + ".vport'/>\n");
                 virtioSerialBuilder.append("<address type='virtio-serial'/>\n");
    +            if (state == null) {
    +                virtioSerialBuilder.append("<target type='virtio' name='" + name +
"'/>\n");
    +            } else {
    +                virtioSerialBuilder.append("<target type='virtio' name='" + name +
"' state='" + state.toString() + "'/>\n");
    +            }
    --- End diff --
    
    @wido have you had a chance to review this comment?


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