incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [5/29] git commit: refs/heads/ui-multiple-nics - Summary: KVM - Add virtio-serial device to libvirt xml for system vms
Date Wed, 06 Mar 2013 18:00:04 GMT
Summary: KVM - Add virtio-serial device to libvirt xml for system vms

Detail: This device can be used for remotely controlling the system vms through
a local socket on the host. We will attempt to replace the KVM patchdisk with
it. Tested, successfully deploys VM, and if system vm has proper driver it
will create a /dev/vport0p1 device within the VM. We will be updating the
system VM in 4.2/5.0 and will support this.

Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1362527352 -0700


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

Branch: refs/heads/ui-multiple-nics
Commit: d81f7156dca5000e0e14a4a402c4e03a86ebbe2d
Parents: 3375737
Author: Marcus Sorensen <marcus@betterservers.com>
Authored: Tue Mar 5 16:49:12 2013 -0700
Committer: Marcus Sorensen <marcus@betterservers.com>
Committed: Tue Mar 5 16:49:12 2013 -0700

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java     |    6 +++
 .../hypervisor/kvm/resource/LibvirtVMDef.java      |   25 +++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d81f7156/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 5a96c36..3c848de 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -188,6 +188,7 @@ import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InputDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.hostNicType;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SerialDef;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.VirtioSerialDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.TermPolicy;
 import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk;
 import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk.PhysicalDiskFormat;
@@ -3053,6 +3054,11 @@ ServerResource {
         SerialDef serial = new SerialDef("pty", null, (short) 0);
         devices.addDevice(serial);
 
+        if (vmTO.getType() != VirtualMachine.Type.User) {
+            VirtioSerialDef vserial = new VirtioSerialDef(vmTO.getName(), null);
+            devices.addDevice(vserial);
+        }
+
         ConsoleDef console = new ConsoleDef("pty", null, null, (short) 0);
         devices.addDevice(console);
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d81f7156/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index 5ab3770..fc3b5f6 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@ -846,6 +846,31 @@ public class LibvirtVMDef {
         }
     }
 
+    public static class VirtioSerialDef {
+        private final String _name;
+        private String _path;
+
+        public VirtioSerialDef(String name, String path) {
+            _name = name;
+            _path = path;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder virtioSerialBuilder = new StringBuilder();
+            if(_path == null) {
+                _path = "/var/lib/libvirt/qemu";
+            }
+            virtioSerialBuilder.append("<channel type='unix'>\n");
+            virtioSerialBuilder.append("<source mode='bind' path='" + _path
+                                        + "/" + _name + ".agent'/>\n");
+            virtioSerialBuilder.append("<target type='virtio' name='org.qemu.guest_agent.0'/>\n");
+            virtioSerialBuilder.append("<address type='virtio-serial' controller='0' bus='0'
port='1'/>\n");
+            virtioSerialBuilder.append("</channel>\n");
+            return virtioSerialBuilder.toString();
+        }
+    }
+
     public static class GraphicDef {
         private final String _type;
         private short _port = -2;


Mime
View raw message