Change in vdsm[master]: vm: Automatically add a serial port for a console device

vfeenstr at redhat.com vfeenstr at redhat.com
Fri Mar 21 11:20:41 UTC 2014


Vinzenz Feenstra has uploaded a new change for review.

Change subject: vm: Automatically add a serial port for a console device
......................................................................

vm: Automatically add a serial port for a console device

Without a serial device the console support does not work for
linux systems. We switch from virtio to serial and append a serial
port if a console device was defined.

Change-Id: Ifa7b02a7bcaad63017c35c811a194fa42e2b694f
Signed-off-by: Vinzenz Feenstra <vfeenstr at redhat.com>
---
M vdsm/vm.py
1 file changed, 14 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/25979/1

diff --git a/vdsm/vm.py b/vdsm/vm.py
index 9cb0e82..7ce7c59 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -1171,6 +1171,18 @@
         commandLine.appendChildWithArgs('qemu:arg', value='keyboard')
         self.dom.appendChild(commandLine)
 
+    def appendSerial(self):
+        """
+        Add a serial port for the console device if it exists
+        <serial type='pty'>
+            <target port='0'>
+        </serial>
+        """
+        if len(self._devices.getElementsByTagName('console')) == 1:
+            s = XMLElement('serial', type='pty')
+            s.appendChildWithArgs('target', port='0')
+            self._devices.appendChild(s)
+
     def appendGraphics(self):
         """
         Add graphics section to domain xml.
@@ -1888,7 +1900,7 @@
         </console>
         """
         m = self.createXmlElem('console', 'pty')
-        m.appendChildWithArgs('target', type='virtio', port='0')
+        m.appendChildWithArgs('target', type='serial', port='0')
         return m
 
 
@@ -3025,6 +3037,7 @@
             domxml.appendEmulator()
 
         self._appendDevices(domxml)
+        domxml.appendSerial()
 
         for drive in self._devices[DISK_DEVICES][:]:
             for leaseElement in drive.getLeasesXML():


-- 
To view, visit http://gerrit.ovirt.org/25979
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa7b02a7bcaad63017c35c811a194fa42e2b694f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr at redhat.com>


More information about the vdsm-patches mailing list