[libvirt] [PATCH 21/34] Convert character devices over to use -device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The current character device syntax uses either

  -serial tty,path=/dev/ttyS2

Or

  -chardev tty,id=serial0,path=/dev/ttyS2 -serial chardev:serial0

With the new -device support, we now prefer

  -chardev file,id=serial0,path=/tmp/serial.log -device isa-serial,chardev=serial0

This patch changes the existing -chardev syntax to use this new
scheme, and fallbacks to the old plain -serial syntax for old
QEMU.

The monitor device changes to

  -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor

In addition, this patch adds --nodefaults, which kills off the
default serial, parallel, vga and nic devices. THis avoids the
need for us to explicitly turn each off
---
 src/qemu/qemu_conf.c                               |   97 +++++++++----------
 src/qemu/qemu_driver.c                             |    7 ++
 .../qemuxml2argv-channel-guestfwd.args             |    2 +-
 .../qemuxml2argv-console-compat-chardev.args       |    2 +-
 .../qemuxml2argv-parallel-tcp-chardev.args         |    2 +-
 .../qemuxml2argv-serial-dev-chardev.args           |    2 +-
 .../qemuxml2argv-serial-file-chardev.args          |    2 +-
 .../qemuxml2argv-serial-many-chardev.args          |    2 +-
 .../qemuxml2argv-serial-pty-chardev.args           |    2 +-
 .../qemuxml2argv-serial-tcp-chardev.args           |    2 +-
 .../qemuxml2argv-serial-tcp-telnet-chardev.args    |    2 +-
 .../qemuxml2argv-serial-udp-chardev.args           |    2 +-
 .../qemuxml2argv-serial-unix-chardev.args          |    2 +-
 .../qemuxml2argv-serial-vc-chardev.args            |    2 +-
 tests/qemuxml2argvtest.c                           |   29 +++---
 15 files changed, 81 insertions(+), 76 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 5dcd50f..eded887 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1592,6 +1592,9 @@ static char *qemuDiskDriveName(const virDomainDiskDefPtr disk)
         case VIR_DOMAIN_DISK_BUS_VIRTIO:
             ret = virAsprintf(&devname, "virtio%d", devid);
             break;
+        case VIR_DOMAIN_DISK_BUS_XEN:
+            ret = virAsprintf(&devname, "xenblk%d", devid);
+            break;
         default:
             qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
                              _("Unsupported disk name mapping for bus '%s'"),
@@ -1991,43 +1994,42 @@ qemuBuildHostNetStr(virConnectPtr conn,
 /* This function outputs a -chardev command line option which describes only the
  * host side of the character device */
 static void qemudBuildCommandLineChrDevChardevStr(virDomainChrDefPtr dev,
-                                                  const char *const id,
                                                   virBufferPtr buf)
 {
     bool telnet;
     switch(dev->type) {
     case VIR_DOMAIN_CHR_TYPE_NULL:
-        virBufferVSprintf(buf, "null,id=%s", id);
+        virBufferVSprintf(buf, "null,id=%s", dev->info.alias);
         break;
 
     case VIR_DOMAIN_CHR_TYPE_VC:
-        virBufferVSprintf(buf, "vc,id=%s", id);
+        virBufferVSprintf(buf, "vc,id=%s", dev->info.alias);
         break;
 
     case VIR_DOMAIN_CHR_TYPE_PTY:
-        virBufferVSprintf(buf, "pty,id=%s", id);
+        virBufferVSprintf(buf, "pty,id=%s", dev->info.alias);
         break;
 
     case VIR_DOMAIN_CHR_TYPE_DEV:
-        virBufferVSprintf(buf, "tty,id=%s,path=%s", id, dev->data.file.path);
+        virBufferVSprintf(buf, "tty,id=%s,path=%s", dev->info.alias, dev->data.file.path);
         break;
 
     case VIR_DOMAIN_CHR_TYPE_FILE:
-        virBufferVSprintf(buf, "file,id=%s,path=%s", id, dev->data.file.path);
+        virBufferVSprintf(buf, "file,id=%s,path=%s", dev->info.alias, dev->data.file.path);
         break;
 
     case VIR_DOMAIN_CHR_TYPE_PIPE:
-        virBufferVSprintf(buf, "pipe,id=%s,path=%s", id, dev->data.file.path);
+        virBufferVSprintf(buf, "pipe,id=%s,path=%s", dev->info.alias, dev->data.file.path);
         break;
 
     case VIR_DOMAIN_CHR_TYPE_STDIO:
-        virBufferVSprintf(buf, "stdio,id=%s", id);
+        virBufferVSprintf(buf, "stdio,id=%s", dev->info.alias);
         break;
 
     case VIR_DOMAIN_CHR_TYPE_UDP:
         virBufferVSprintf(buf,
                           "udp,id=%s,host=%s,port=%s,localaddr=%s,localport=%s",
-                          id,
+                          dev->info.alias,
                           dev->data.udp.connectHost,
                           dev->data.udp.connectService,
                           dev->data.udp.bindHost,
@@ -2038,7 +2040,7 @@ static void qemudBuildCommandLineChrDevChardevStr(virDomainChrDefPtr dev,
         telnet = dev->data.tcp.protocol == VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET;
         virBufferVSprintf(buf,
                           "socket,id=%s,host=%s,port=%s%s%s",
-                          id,
+                          dev->info.alias,
                           dev->data.tcp.host,
                           dev->data.tcp.service,
                           telnet ? ",telnet" : "",
@@ -2048,7 +2050,7 @@ static void qemudBuildCommandLineChrDevChardevStr(virDomainChrDefPtr dev,
     case VIR_DOMAIN_CHR_TYPE_UNIX:
         virBufferVSprintf(buf,
                           "socket,id=%s,path=%s%s",
-                          id,
+                          dev->info.alias,
                           dev->data.nix.path,
                           dev->data.nix.listen ? ",server,nowait" : "");
         break;
@@ -2490,7 +2492,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
 
         /* Use -chardev if it's available */
         if (qemuCmdFlags & QEMUD_CMD_FLAG_CHARDEV) {
-            qemudBuildCommandLineChrDevChardevStr(monitor_chr, "monitor", &buf);
+            qemudBuildCommandLineChrDevChardevStr(monitor_chr, &buf);
             if (virBufferError(&buf)) {
                 virBufferFreeAndReset(&buf);
                 goto no_memory;
@@ -2499,26 +2501,32 @@ int qemudBuildCommandLine(virConnectPtr conn,
             ADD_ARG_LIT("-chardev");
             ADD_ARG(virBufferContentAndReset(&buf));
 
-            if (monitor_json)
-                virBufferAddLit(&buf, "control,");
+            virBufferVSprintf(&buf, "chardev=%s", monitor_chr->info.alias);
 
-            virBufferAddLit(&buf, "chardev:monitor");
-        }
+            if (virBufferError(&buf)) {
+                virBufferFreeAndReset(&buf);
+                goto no_memory;
+            }
 
-        else {
+            ADD_ARG_LIT("-mon");
+            if (monitor_json)
+                ADD_ARG_LIT("chardev=monitor,mode=control");
+            else
+                ADD_ARG_LIT("chardev=monitor,mode=readline");
+        } else {
             if (monitor_json)
                 virBufferAddLit(&buf, "control,");
 
             qemudBuildCommandLineChrDevStr(monitor_chr, &buf);
-        }
 
-        if (virBufferError(&buf)) {
-            virBufferFreeAndReset(&buf);
-            goto no_memory;
-        }
+            if (virBufferError(&buf)) {
+                virBufferFreeAndReset(&buf);
+                goto no_memory;
+            }
 
-        ADD_ARG_LIT("-monitor");
-        ADD_ARG(virBufferContentAndReset(&buf));
+            ADD_ARG_LIT("-monitor");
+            ADD_ARG(virBufferContentAndReset(&buf));
+        }
     }
 
     if (def->localtime)
@@ -2781,14 +2789,10 @@ int qemudBuildCommandLine(virConnectPtr conn,
             virBuffer buf = VIR_BUFFER_INITIALIZER;
             virDomainChrDefPtr serial = def->serials[i];
 
-            /* Use -chardev if it's available */
-            if (qemuCmdFlags & QEMUD_CMD_FLAG_CHARDEV) {
-                char id[16];
-
-                if (snprintf(id, sizeof(id), "serial%i", i) > sizeof(id))
-                    goto error;
-
-                qemudBuildCommandLineChrDevChardevStr(serial, id, &buf);
+            /* Use -chardev with -device if they are available */
+            if ((qemuCmdFlags & QEMUD_CMD_FLAG_CHARDEV) &&
+                (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE)) {
+                qemudBuildCommandLineChrDevChardevStr(serial, &buf);
                 if (virBufferError(&buf)) {
                     virBufferFreeAndReset(&buf);
                     goto no_memory;
@@ -2797,13 +2801,13 @@ int qemudBuildCommandLine(virConnectPtr conn,
                 ADD_ARG_LIT("-chardev");
                 ADD_ARG(virBufferContentAndReset(&buf));
 
-                virBufferVSprintf(&buf, "chardev:%s", id);
+                virBufferVSprintf(&buf, "isa-serial,chardev=%s", serial->info.alias);
                 if (virBufferError(&buf)) {
                     virBufferFreeAndReset(&buf);
                     goto no_memory;
                 }
 
-                ADD_ARG_LIT("-serial");
+                ADD_ARG_LIT("-device");
                 ADD_ARG(virBufferContentAndReset(&buf));
             }
 
@@ -2831,14 +2835,10 @@ int qemudBuildCommandLine(virConnectPtr conn,
             virBuffer buf = VIR_BUFFER_INITIALIZER;
             virDomainChrDefPtr parallel = def->parallels[i];
 
-            /* Use -chardev if it's available */
-            if (qemuCmdFlags & QEMUD_CMD_FLAG_CHARDEV) {
-                char id[16];
-
-                if (snprintf(id, sizeof(id), "parallel%i", i) > sizeof(id))
-                    goto error;
-
-                qemudBuildCommandLineChrDevChardevStr(parallel, id, &buf);
+            /* Use -chardev with -device if they are available */
+            if ((qemuCmdFlags & QEMUD_CMD_FLAG_CHARDEV) &&
+                (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE)) {
+                qemudBuildCommandLineChrDevChardevStr(parallel, &buf);
                 if (virBufferError(&buf)) {
                     virBufferFreeAndReset(&buf);
                     goto no_memory;
@@ -2847,13 +2847,13 @@ int qemudBuildCommandLine(virConnectPtr conn,
                 ADD_ARG_LIT("-chardev");
                 ADD_ARG(virBufferContentAndReset(&buf));
 
-                virBufferVSprintf(&buf, "chardev:%s", id);
+                virBufferVSprintf(&buf, "isa-parallel,chardev=%s", parallel->info.alias);
                 if (virBufferError(&buf)) {
                     virBufferFreeAndReset(&buf);
                     goto no_memory;
                 }
 
-                ADD_ARG_LIT("-parallel");
+                ADD_ARG_LIT("-device");
                 ADD_ARG(virBufferContentAndReset(&buf));
             }
 
@@ -2872,13 +2872,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
 
     for (i = 0 ; i < def->nchannels ; i++) {
         virBuffer buf = VIR_BUFFER_INITIALIZER;
-        char id[16];
-
         virDomainChrDefPtr channel = def->channels[i];
 
-        if (snprintf(id, sizeof(id), "channel%i", i) > sizeof(id))
-            goto error;
-
         switch(channel->targetType) {
         case VIR_DOMAIN_CHR_TARGET_TYPE_GUESTFWD:
             if (!(qemuCmdFlags & QEMUD_CMD_FLAG_CHARDEV)) {
@@ -2887,7 +2882,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
                 goto error;
             }
 
-            qemudBuildCommandLineChrDevChardevStr(channel, id, &buf);
+            qemudBuildCommandLineChrDevChardevStr(channel, &buf);
             if (virBufferError(&buf)) {
                 virBufferFreeAndReset(&buf);
                 goto no_memory;
@@ -2900,7 +2895,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
             int port = virSocketGetPort(channel->target.addr);
 
             virBufferVSprintf(&buf, "user,guestfwd=tcp:%s:%i-chardev:%s",
-                              addr, port, id);
+                              addr, port, channel->info.alias);
 
             VIR_FREE(addr);
 
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 37b2730..6aabe3e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -207,6 +207,11 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
         goto error;
     }
 
+    if (!(priv->monConfig->info.alias = strdup("monitor"))) {
+        virReportOOMError(NULL);
+        goto error;
+    }
+
     if (!(monitorpath =
           virXPathString(NULL, "string(./monitor[1]/@path)", ctxt))) {
         qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
@@ -269,6 +274,8 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
     return 0;
 
 error:
+    virDomainChrDefFree(priv->monConfig);
+    priv->monConfig = NULL;
     VIR_FREE(nodes);
     return -1;
 }
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-guestfwd.args b/tests/qemuxml2argvdata/qemuxml2argv-channel-guestfwd.args
index deaff92..c3148df 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-channel-guestfwd.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-guestfwd.args
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -monitor chardev:monitor -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -chardev pipe,id=channel0,path=/tmp/guestfwd -net user,guestfwd=tcp:10.0.2.1:4600-chardev:channel0 -usb
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev pipe,id=channel0,path=/tmp/guestfwd -net user,guestfwd=tcp:10.0.2.1:4600-chardev:channel0 -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-chardev.args b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-chardev.args
index fbb94f4..81ca364 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-chardev.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-chardev.args
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -monitor chardev:monitor -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -chardev pty,id=serial0 -serial chardev:serial0 -parallel none -usb
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp-chardev.args b/tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp-chardev.args
index 45d1759..1961948 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp-chardev.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-parallel-tcp-chardev.args
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -monitor chardev:monitor -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -chardev socket,id=parallel0,host=127.0.0.1,port=9999,server,nowait -parallel chardev:parallel0 -usb
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev socket,id=parallel0,host=127.0.0.1,port=9999,server,nowait -device isa-parallel,chardev=parallel0 -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev.args b/tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev.args
index 3036f13..d166f48 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-dev-chardev.args
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -monitor chardev:monitor -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -chardev tty,id=serial0,path=/dev/ttyS2 -serial chardev:serial0 -parallel none -usb
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev tty,id=serial0,path=/dev/ttyS2 -device isa-serial,chardev=serial0 -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.args b/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.args
index 1dcec2b..b039bdf 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.args
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -monitor chardev:monitor -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -chardev file,id=serial0,path=/tmp/serial.log -serial chardev:serial0 -parallel none -usb
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev file,id=serial0,path=/tmp/serial.log -device isa-serial,chardev=serial0 -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-many-chardev.args b/tests/qemuxml2argvdata/qemuxml2argv-serial-many-chardev.args
index dd98fcb..419ea00 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-many-chardev.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-many-chardev.args
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -monitor chardev:monitor -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -chardev pty,id=serial0 -serial chardev:serial0 -chardev file,id=serial1,path=/tmp/serial.log -serial chardev:serial1 -parallel none -usb
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -chardev file,id=serial1,path=/tmp/serial.log -device isa-serial,chardev=serial1 -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-pty-chardev.args b/tests/qemuxml2argvdata/qemuxml2argv-serial-pty-chardev.args
index fbb94f4..81ca364 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-pty-chardev.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-pty-chardev.args
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -monitor chardev:monitor -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -chardev pty,id=serial0 -serial chardev:serial0 -parallel none -usb
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-chardev.args b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-chardev.args
index 50cfeb0..526af51 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-chardev.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-chardev.args
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -monitor chardev:monitor -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -chardev socket,id=serial0,host=127.0.0.1,port=9999 -serial chardev:serial0 -parallel none -usb
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev socket,id=serial0,host=127.0.0.1,port=9999 -device isa-serial,chardev=serial0 -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet-chardev.args b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet-chardev.args
index 86fa8af..842261b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet-chardev.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet-chardev.args
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -monitor chardev:monitor -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -chardev socket,id=serial0,host=127.0.0.1,port=9999,telnet,server,nowait -serial chardev:serial0 -parallel none -usb
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev socket,id=serial0,host=127.0.0.1,port=9999,telnet,server,nowait -device isa-serial,chardev=serial0 -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.args b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.args
index 45421a4..7d7d2a8 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.args
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -monitor chardev:monitor -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -chardev udp,id=serial0,host=127.0.0.1,port=9998,localaddr=127.0.0.1,localport=9999 -serial chardev:serial0 -parallel none -usb
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev udp,id=serial0,host=127.0.0.1,port=9998,localaddr=127.0.0.1,localport=9999 -device isa-serial,chardev=serial0 -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-unix-chardev.args b/tests/qemuxml2argvdata/qemuxml2argv-serial-unix-chardev.args
index f291156..b326238 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-unix-chardev.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-unix-chardev.args
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -monitor chardev:monitor -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -chardev socket,id=serial0,path=/tmp/serial.sock -serial chardev:serial0 -parallel none -usb
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev socket,id=serial0,path=/tmp/serial.sock -device isa-serial,chardev=serial0 -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-vc-chardev.args b/tests/qemuxml2argvdata/qemuxml2argv-serial-vc-chardev.args
index a200225..4c7e654 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-vc-chardev.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-vc-chardev.args
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -monitor chardev:monitor -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -chardev vc,id=serial0 -serial chardev:serial0 -parallel none -usb
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev vc,id=serial0 -device isa-serial,chardev=serial0 -usb
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 3b0aa2b..42d1579 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -48,9 +48,12 @@ static int testCompareXMLToArgvFiles(const char *xml,
     else
         vmdef->id = -1;
 
+    memset(&monitor_chr, 0, sizeof(monitor_chr));
     monitor_chr.type = VIR_DOMAIN_CHR_TYPE_UNIX;
     monitor_chr.data.nix.path = (char *)"/tmp/test-monitor";
     monitor_chr.data.nix.listen = 1;
+    if (!(monitor_chr.info.alias = strdup("monitor")))
+        goto fail;
 
     flags = QEMUD_CMD_FLAG_VNC_COLON |
         QEMUD_CMD_FLAG_NO_REBOOT |
@@ -273,19 +276,19 @@ mymain(int argc, char **argv)
     DO_TEST("parallel-tcp", 0);
     DO_TEST("console-compat", 0);
 
-    DO_TEST("serial-vc-chardev", QEMUD_CMD_FLAG_CHARDEV);
-    DO_TEST("serial-pty-chardev", QEMUD_CMD_FLAG_CHARDEV);
-    DO_TEST("serial-dev-chardev", QEMUD_CMD_FLAG_CHARDEV);
-    DO_TEST("serial-file-chardev", QEMUD_CMD_FLAG_CHARDEV);
-    DO_TEST("serial-unix-chardev", QEMUD_CMD_FLAG_CHARDEV);
-    DO_TEST("serial-tcp-chardev", QEMUD_CMD_FLAG_CHARDEV);
-    DO_TEST("serial-udp-chardev", QEMUD_CMD_FLAG_CHARDEV);
-    DO_TEST("serial-tcp-telnet-chardev", QEMUD_CMD_FLAG_CHARDEV);
-    DO_TEST("serial-many-chardev", QEMUD_CMD_FLAG_CHARDEV);
-    DO_TEST("parallel-tcp-chardev", QEMUD_CMD_FLAG_CHARDEV);
-    DO_TEST("console-compat-chardev", QEMUD_CMD_FLAG_CHARDEV);
-
-    DO_TEST("channel-guestfwd", QEMUD_CMD_FLAG_CHARDEV);
+    DO_TEST("serial-vc-chardev", QEMUD_CMD_FLAG_CHARDEV|QEMUD_CMD_FLAG_DEVICE);
+    DO_TEST("serial-pty-chardev", QEMUD_CMD_FLAG_CHARDEV|QEMUD_CMD_FLAG_DEVICE);
+    DO_TEST("serial-dev-chardev", QEMUD_CMD_FLAG_CHARDEV|QEMUD_CMD_FLAG_DEVICE);
+    DO_TEST("serial-file-chardev", QEMUD_CMD_FLAG_CHARDEV|QEMUD_CMD_FLAG_DEVICE);
+    DO_TEST("serial-unix-chardev", QEMUD_CMD_FLAG_CHARDEV|QEMUD_CMD_FLAG_DEVICE);
+    DO_TEST("serial-tcp-chardev", QEMUD_CMD_FLAG_CHARDEV|QEMUD_CMD_FLAG_DEVICE);
+    DO_TEST("serial-udp-chardev", QEMUD_CMD_FLAG_CHARDEV|QEMUD_CMD_FLAG_DEVICE);
+    DO_TEST("serial-tcp-telnet-chardev", QEMUD_CMD_FLAG_CHARDEV|QEMUD_CMD_FLAG_DEVICE);
+    DO_TEST("serial-many-chardev", QEMUD_CMD_FLAG_CHARDEV|QEMUD_CMD_FLAG_DEVICE);
+    DO_TEST("parallel-tcp-chardev", QEMUD_CMD_FLAG_CHARDEV|QEMUD_CMD_FLAG_DEVICE);
+    DO_TEST("console-compat-chardev", QEMUD_CMD_FLAG_CHARDEV|QEMUD_CMD_FLAG_DEVICE);
+
+    DO_TEST("channel-guestfwd", QEMUD_CMD_FLAG_CHARDEV|QEMUD_CMD_FLAG_DEVICE);
 
     DO_TEST("sound", 0);
 
-- 
1.6.5.2

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]