[libvirt PATCH v2 26/44] Deprecate QEMU_CAPS_DEVICE_SPICEVMC

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

 



The (now assumed) QEMU_CAPS_CHARDEV_SPICEVMC is preferred.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c                     |  4 --
 src/qemu/qemu_capabilities.h                     |  2 +-
 src/qemu/qemu_command.c                          | 71 ++++++++----------------
 tests/qemuxml2argvdata/channel-spicevmc-old.args | 30 ----------
 tests/qemuxml2argvdata/channel-spicevmc-old.xml  | 35 ------------
 tests/qemuxml2argvtest.c                         |  4 --
 6 files changed, 25 insertions(+), 121 deletions(-)
 delete mode 100644 tests/qemuxml2argvdata/channel-spicevmc-old.args
 delete mode 100644 tests/qemuxml2argvdata/channel-spicevmc-old.xml

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index d123dfcef3..fca73cf9b1 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1025,7 +1025,6 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
     { "virtio-scsi-ccw", QEMU_CAPS_VIRTIO_SCSI },
     { "virtio-scsi-device", QEMU_CAPS_VIRTIO_SCSI },
     { "megasas", QEMU_CAPS_SCSI_MEGASAS },
-    { "spicevmc", QEMU_CAPS_DEVICE_SPICEVMC },
     { "qxl", QEMU_CAPS_DEVICE_QXL },
     { "sga", QEMU_CAPS_SGA },
     { "scsi-block", QEMU_CAPS_SCSI_BLOCK },
@@ -2100,9 +2099,6 @@ virQEMUCapsProbeQMPObjects(virQEMUCapsPtr qemuCaps,
         virStringListFreeCount(values, nvalues);
     }
 
-    /* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */
-    virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC);
-
     return 0;
 }
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 7a859cb2cc..83b2980180 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -127,7 +127,7 @@ typedef enum {
     /* 55 */
     QEMU_CAPS_CCID_PASSTHRU, /* -device ccid-card-passthru */
     X_QEMU_CAPS_CHARDEV_SPICEVMC, /* newer -chardev spicevmc */
-    QEMU_CAPS_DEVICE_SPICEVMC, /* older -device spicevmc*/
+    X_QEMU_CAPS_DEVICE_SPICEVMC, /* older -device spicevmc*/
     QEMU_CAPS_VIRTIO_TX_ALG, /* -device virtio-net-pci,tx=string */
     X_QEMU_CAPS_DEVICE_QXL_VGA, /* primary qxl device named qxl-vga? */
 
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c00f2c431f..03592a20ab 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5359,8 +5359,7 @@ qemuBuildMonitorCommandLine(virLogManagerPtr logManager,
 
 static char *
 qemuBuildVirtioSerialPortDevStr(const virDomainDef *def,
-                                virDomainChrDefPtr dev,
-                                virQEMUCapsPtr qemuCaps)
+                                virDomainChrDefPtr dev)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     const char *contAlias;
@@ -5370,13 +5369,7 @@ qemuBuildVirtioSerialPortDevStr(const virDomainDef *def,
         virBufferAddLit(&buf, "virtconsole");
         break;
     case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL:
-        /* Legacy syntax  '-device spicevmc' */
-        if (dev->source->type == VIR_DOMAIN_CHR_TYPE_SPICEVMC &&
-            virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC)) {
-            virBufferAddLit(&buf, "spicevmc");
-        } else {
-            virBufferAddLit(&buf, "virtserialport");
-        }
+        virBufferAddLit(&buf, "virtserialport");
         break;
     default:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -5414,19 +5407,13 @@ qemuBuildVirtioSerialPortDevStr(const virDomainDef *def,
         goto error;
     }
 
-    if (!(dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
-          dev->source->type == VIR_DOMAIN_CHR_TYPE_SPICEVMC &&
-          virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC))) {
-        virBufferAsprintf(&buf, ",chardev=char%s,id=%s",
-                          dev->info.alias, dev->info.alias);
-        if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
-            (dev->source->type == VIR_DOMAIN_CHR_TYPE_SPICEVMC ||
-             dev->target.name)) {
-            virBufferAsprintf(&buf, ",name=%s", dev->target.name
-                              ? dev->target.name : "com.redhat.spice.0");
-        }
-    } else {
-        virBufferAsprintf(&buf, ",id=%s", dev->info.alias);
+    virBufferAsprintf(&buf, ",chardev=char%s,id=%s",
+                      dev->info.alias, dev->info.alias);
+    if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
+        (dev->source->type == VIR_DOMAIN_CHR_TYPE_SPICEVMC ||
+         dev->target.name)) {
+        virBufferAsprintf(&buf, ",name=%s", dev->target.name
+                          ? dev->target.name : "com.redhat.spice.0");
     }
     if (virBufferCheckError(&buf) < 0)
         goto error;
@@ -9147,23 +9134,15 @@ qemuBuildChannelsCommandLine(virLogManagerPtr logManager,
             break;
 
         case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
-            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC) &&
-                channel->source->type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) {
-                /* spicevmc was originally introduced via a -device
-                 * with a backend internal to qemu; although we prefer
-                 * the newer -chardev interface.  */
-                ;
-            } else {
-                if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
-                                                      channel->source,
-                                                      channel->info.alias,
-                                                      qemuCaps, true,
-                                                      chardevStdioLogd)))
-                    return -1;
-                virCommandAddArg(cmd, "-chardev");
-                virCommandAddArg(cmd, devstr);
-                VIR_FREE(devstr);
-            }
+            if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
+                                                  channel->source,
+                                                  channel->info.alias,
+                                                  qemuCaps, true,
+                                                  chardevStdioLogd)))
+                return -1;
+            virCommandAddArg(cmd, "-chardev");
+            virCommandAddArg(cmd, devstr);
+            VIR_FREE(devstr);
 
             if (qemuBuildChrDeviceCommandLine(cmd, def, channel, qemuCaps) < 0)
                 return -1;
@@ -10183,8 +10162,7 @@ qemuBuildParallelChrDeviceStr(char **deviceStr,
 static int
 qemuBuildChannelChrDeviceStr(char **deviceStr,
                              const virDomainDef *def,
-                             virDomainChrDefPtr chr,
-                             virQEMUCapsPtr qemuCaps)
+                             virDomainChrDefPtr chr)
 {
     int ret = -1;
     char *addr = NULL;
@@ -10205,7 +10183,7 @@ qemuBuildChannelChrDeviceStr(char **deviceStr,
         break;
 
     case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
-        if (!(*deviceStr = qemuBuildVirtioSerialPortDevStr(def, chr, qemuCaps)))
+        if (!(*deviceStr = qemuBuildVirtioSerialPortDevStr(def, chr)))
             goto cleanup;
         break;
 
@@ -10224,8 +10202,7 @@ qemuBuildChannelChrDeviceStr(char **deviceStr,
 static int
 qemuBuildConsoleChrDeviceStr(char **deviceStr,
                              const virDomainDef *def,
-                             virDomainChrDefPtr chr,
-                             virQEMUCapsPtr qemuCaps)
+                             virDomainChrDefPtr chr)
 {
     int ret = -1;
 
@@ -10237,7 +10214,7 @@ qemuBuildConsoleChrDeviceStr(char **deviceStr,
         break;
 
     case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO:
-        if (!(*deviceStr = qemuBuildVirtioSerialPortDevStr(def, chr, qemuCaps)))
+        if (!(*deviceStr = qemuBuildVirtioSerialPortDevStr(def, chr)))
             goto cleanup;
         break;
 
@@ -10279,11 +10256,11 @@ qemuBuildChrDeviceStr(char **deviceStr,
         break;
 
     case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL:
-        ret = qemuBuildChannelChrDeviceStr(deviceStr, vmdef, chr, qemuCaps);
+        ret = qemuBuildChannelChrDeviceStr(deviceStr, vmdef, chr);
         break;
 
     case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE:
-        ret = qemuBuildConsoleChrDeviceStr(deviceStr, vmdef, chr, qemuCaps);
+        ret = qemuBuildConsoleChrDeviceStr(deviceStr, vmdef, chr);
         break;
 
     case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST:
diff --git a/tests/qemuxml2argvdata/channel-spicevmc-old.args b/tests/qemuxml2argvdata/channel-spicevmc-old.args
deleted file mode 100644
index 852c8699ea..0000000000
--- a/tests/qemuxml2argvdata/channel-spicevmc-old.args
+++ /dev/null
@@ -1,30 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/home/test \
-USER=test \
-LOGNAME=test \
-QEMU_AUDIO_DRV=spice \
-/usr/bin/qemu-system-i686 \
--name QEMUGuest1 \
--S \
--M pc \
--m 214 \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
-server,nowait \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-acpi \
--boot c \
--device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \
--usb \
--drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
--device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--device spicevmc,bus=virtio-serial1.0,nr=3,id=channel0 \
--spice port=5903,tls-port=5904,addr=127.0.0.1,x509-dir=/etc/pki/libvirt-spice,\
-tls-channel=main \
--vga cirrus \
--device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/channel-spicevmc-old.xml b/tests/qemuxml2argvdata/channel-spicevmc-old.xml
deleted file mode 100644
index 95d0c20647..0000000000
--- a/tests/qemuxml2argvdata/channel-spicevmc-old.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory unit='KiB'>219136</memory>
-  <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
-  <os>
-    <type arch='i686' machine='pc'>hvm</type>
-    <boot dev='hd'/>
-  </os>
-  <clock offset='utc'/>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>destroy</on_crash>
-  <devices>
-    <emulator>/usr/bin/qemu-system-i686</emulator>
-    <disk type='block' device='disk'>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='ide'/>
-      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
-    </disk>
-    <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
-    <controller type='virtio-serial' index='1'>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
-    </controller>
-    <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'>
-      <channel name='main' mode='secure'/>
-    </graphics>
-    <channel type='spicevmc'>
-      <target type='virtio' name='com.redhat.spice.0'/>
-      <address type='virtio-serial' controller='1' bus='0' port='3'/>
-    </channel>
-    <memballoon model='virtio'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 8c78a9a972..2c3eca9548 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1336,10 +1336,6 @@ mymain(void)
     DO_TEST("channel-spicevmc",
             QEMU_CAPS_SPICE,
             QEMU_CAPS_DEVICE_CIRRUS_VGA);
-    DO_TEST("channel-spicevmc-old",
-            QEMU_CAPS_SPICE,
-            QEMU_CAPS_DEVICE_SPICEVMC,
-            QEMU_CAPS_DEVICE_CIRRUS_VGA);
     DO_TEST("channel-virtio-default",
             QEMU_CAPS_SPICE,
             NONE);
-- 
2.16.1

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

  Powered by Linux