[PATCH 18/24] qemu: Retire 'ivshmem' device

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

 



The device was removed in qemu-4.0 and is superseded by 'ivshmem-plain'
and 'ivshmem-doorbell'.

Always report error when the old version is used and drop the irrelevant
tests.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_command.c            | 40 +---------------
 src/qemu/qemu_hotplug.c            | 14 +-----
 src/qemu/qemu_migration.c          |  5 --
 src/qemu/qemu_validate.c           | 10 ++--
 tests/qemuxml2argvdata/shmem.args  | 43 -----------------
 tests/qemuxml2argvdata/shmem.err   |  1 -
 tests/qemuxml2argvdata/shmem.xml   | 56 ----------------------
 tests/qemuxml2argvtest.c           |  2 -
 tests/qemuxml2xmloutdata/shmem.xml | 74 ------------------------------
 tests/qemuxml2xmltest.c            |  1 -
 10 files changed, 5 insertions(+), 241 deletions(-)
 delete mode 100644 tests/qemuxml2argvdata/shmem.args
 delete mode 100644 tests/qemuxml2argvdata/shmem.err
 delete mode 100644 tests/qemuxml2argvdata/shmem.xml
 delete mode 100644 tests/qemuxml2xmloutdata/shmem.xml

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 77c5335bde..9a6840e870 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8873,44 +8873,6 @@ qemuBuildSmartcardCommandLine(virCommand *cmd,
 }


-static virJSONValue *
-qemuBuildShmemDevLegacyProps(virDomainDef *def,
-                             virDomainShmemDef *shmem)
-{
-    g_autoptr(virJSONValue) props = NULL;
-    g_autofree char *size = NULL;
-    const char *shm = NULL;
-    g_autofree char *chardev = NULL;
-
-    /* while this would result in a type error with newer qemus, the 'ivshmem'
-     * device was removed in qemu-4.0, so for the sake of not changing the
-     * commandline we do this hack */
-    size = g_strdup_printf("%llum", shmem->size >> 20);
-
-    if (shmem->server.enabled)
-        chardev = g_strdup_printf("char%s", shmem->info.alias);
-    else
-        shm = shmem->name;
-
-    if (virJSONValueObjectAdd(&props,
-                              "s:driver", "ivshmem",
-                              "s:id", shmem->info.alias,
-                              "s:size", size,
-                              "S:shm", shm,
-                              "S:chardev", chardev,
-                              "B:msi", shmem->msi.enabled,
-                              "p:vectors", shmem->msi.vectors,
-                              "T:ioeventfd", shmem->msi.ioeventfd,
-                              NULL) < 0)
-        return NULL;
-
-    if (qemuBuildDeviceAddressProps(props, def, &shmem->info) < 0)
-        return NULL;
-
-    return g_steal_pointer(&props);
-}
-
-
 virJSONValue *
 qemuBuildShmemDevProps(virDomainDef *def,
                        virDomainShmemDef *shmem)
@@ -9014,7 +8976,7 @@ qemuBuildShmemCommandLine(virCommand *cmd,

     switch (shmem->model) {
     case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM:
-        devProps = qemuBuildShmemDevLegacyProps(def, shmem);
+        /* unreachable, rejected by validation */
         break;

     case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_PLAIN:
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 2e3c99760d..f3f0e23fa7 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2817,19 +2817,7 @@ qemuDomainAttachShmemDevice(virDomainObj *vm,
     qemuDomainObjPrivate *priv = vm->privateData;
     virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_SHMEM, { .shmem = shmem } };

-    switch (shmem->model) {
-    case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_PLAIN:
-    case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_DOORBELL:
-        break;
-
-    case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM:
-        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
-                       _("live attach of shmem model '%1$s' is not supported"),
-                       virDomainShmemModelTypeToString(shmem->model));
-        G_GNUC_FALLTHROUGH;
-    case VIR_DOMAIN_SHMEM_MODEL_LAST:
-        return -1;
-    }
+    /* validation ensures that the legacy 'ivshmem' device is rejected */

     qemuAssignDeviceShmemAlias(vm->def, shmem, -1);

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index d21551ab07..9b490a130d 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1503,11 +1503,6 @@ qemuMigrationSrcIsAllowed(virDomainObj *vm,
         for (i = 0; i < vm->def->nshmems; i++) {
             virDomainShmemDef *shmem = vm->def->shmems[i];

-            if (shmem->model == VIR_DOMAIN_SHMEM_MODEL_IVSHMEM) {
-                virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                               _("migration with legacy shmem device is not supported"));
-                return false;
-            }
             if (shmem->role != VIR_DOMAIN_SHMEM_ROLE_MASTER) {
                 virReportError(VIR_ERR_OPERATION_INVALID,
                                _("shmem device '%1$s' cannot be migrated, only shmem with role='%2$s' can be migrated"),
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index de3aebb439..7fb104f238 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -5097,13 +5097,9 @@ qemuValidateDomainDeviceDefShmem(virDomainShmemDef *shmem,
 {
     switch (shmem->model) {
     case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM:
-        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IVSHMEM)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("ivshmem device is not supported "
-                             "with this QEMU binary"));
-            return -1;
-        }
-        break;
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("ivshmem device is no longer supported"));
+        return -1;

     case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_PLAIN:
         if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IVSHMEM_PLAIN)) {
diff --git a/tests/qemuxml2argvdata/shmem.args b/tests/qemuxml2argvdata/shmem.args
deleted file mode 100644
index 1ca9a3354f..0000000000
--- a/tests/qemuxml2argvdata/shmem.args
+++ /dev/null
@@ -1,43 +0,0 @@
-LC_ALL=C \
-PATH=/bin \
-HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
-USER=test \
-LOGNAME=test \
-XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
-XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
-XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-/usr/bin/qemu-system-x86_64 \
--name guest=QEMUGuest1,debug-threads=on \
--S \
--object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes \
--machine pc,usb=off,dump-guest-core=off \
--accel tcg \
--m size=219136k \
--overcommit mem-lock=off \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--no-acpi \
--boot strict=on \
--usb \
--audiodev '{"id":"audio1","driver":"none"}' \
--device ivshmem,id=shmem0,size=4m,shm=shmem0,bus=pci.0,addr=0x2 \
--device ivshmem,id=shmem1,size=128m,shm=shmem1,bus=pci.0,addr=0x3 \
--device ivshmem,id=shmem2,size=256m,shm=shmem2,bus=pci.0,addr=0x4 \
--device ivshmem,id=shmem3,size=512m,chardev=charshmem3,bus=pci.0,addr=0x5 \
--chardev socket,id=charshmem3,path=/var/lib/libvirt/shmem-shmem3-sock \
--device ivshmem,id=shmem4,size=1024m,chardev=charshmem4,bus=pci.0,addr=0x6 \
--chardev socket,id=charshmem4,path=/tmp/shmem4-sock \
--device ivshmem,id=shmem5,size=2048m,chardev=charshmem5,msi=on,ioeventfd=off,bus=pci.0,addr=0x7 \
--chardev socket,id=charshmem5,path=/tmp/shmem5-sock \
--device ivshmem,id=shmem6,size=4096m,chardev=charshmem6,msi=on,vectors=16,bus=pci.0,addr=0x8 \
--chardev socket,id=charshmem6,path=/tmp/shmem6-sock \
--device ivshmem,id=shmem7,size=8192m,chardev=charshmem7,msi=on,vectors=32,ioeventfd=on,bus=pci.0,addr=0x9 \
--chardev socket,id=charshmem7,path=/tmp/shmem7-sock \
--msg timestamp=on
diff --git a/tests/qemuxml2argvdata/shmem.err b/tests/qemuxml2argvdata/shmem.err
deleted file mode 100644
index b9e128edf3..0000000000
--- a/tests/qemuxml2argvdata/shmem.err
+++ /dev/null
@@ -1 +0,0 @@
-unsupported configuration: ivshmem device is not supported with this QEMU binary
diff --git a/tests/qemuxml2argvdata/shmem.xml b/tests/qemuxml2argvdata/shmem.xml
deleted file mode 100644
index b6dfe291df..0000000000
--- a/tests/qemuxml2argvdata/shmem.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory unit='KiB'>219136</memory>
-  <currentMemory unit='KiB'>219136</currentMemory>
-  <vcpu placement='static'>1</vcpu>
-  <os>
-    <type arch='x86_64' 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-x86_64</emulator>
-    <controller type='usb' index='0'/>
-    <controller type='pci' index='0' model='pci-root'/>
-    <input type='mouse' bus='ps2'/>
-    <input type='keyboard' bus='ps2'/>
-    <memballoon model='none'/>
-    <shmem name='shmem0'/>
-    <shmem name='shmem1'>
-      <size unit='M'>128</size>
-    </shmem>
-    <shmem name='shmem2'>
-      <size unit='M'>256</size>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
-    </shmem>
-    <shmem name='shmem3'>
-      <model type='ivshmem'/>
-      <size unit='M'>512</size>
-      <server/>
-    </shmem>
-    <shmem name='shmem4'>
-      <size unit='M'>1024</size>
-      <server path='/tmp/shmem4-sock'/>
-    </shmem>
-    <shmem name='shmem5'>
-      <size unit='M'>2048</size>
-      <server path='/tmp/shmem5-sock'/>
-      <msi ioeventfd='off'/>
-    </shmem>
-    <shmem name='shmem6'>
-      <model type='ivshmem'/>
-      <size unit='M'>4096</size>
-      <server path='/tmp/shmem6-sock'/>
-      <msi vectors='16'/>
-    </shmem>
-    <shmem name='shmem7'>
-      <size unit='M'>8192</size>
-      <server path='/tmp/shmem7-sock'/>
-      <msi vectors='32' ioeventfd='on'/>
-    </shmem>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index beaeaf02ad..e45f3828c8 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2404,8 +2404,6 @@ mymain(void)
     DO_TEST_CAPS_ARCH_VER_FULL("fips-enabled", "x86_64", "5.1.0", ARG_FLAGS, FLAG_FIPS_HOST);
     DO_TEST_CAPS_ARCH_LATEST_FULL("fips-enabled", "x86_64", ARG_FLAGS, FLAG_FIPS_HOST);

-    DO_TEST("shmem", QEMU_CAPS_DEVICE_IVSHMEM);
-    DO_TEST_PARSE_ERROR_NOCAPS("shmem");
     DO_TEST_CAPS_LATEST("shmem-plain-doorbell");
     DO_TEST_CAPS_LATEST_FAILURE("shmem-invalid-size");
     DO_TEST_CAPS_LATEST_FAILURE("shmem-invalid-address");
diff --git a/tests/qemuxml2xmloutdata/shmem.xml b/tests/qemuxml2xmloutdata/shmem.xml
deleted file mode 100644
index bdd273de17..0000000000
--- a/tests/qemuxml2xmloutdata/shmem.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory unit='KiB'>219136</memory>
-  <currentMemory unit='KiB'>219136</currentMemory>
-  <vcpu placement='static'>1</vcpu>
-  <os>
-    <type arch='x86_64' 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-x86_64</emulator>
-    <controller type='usb' index='0'>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
-    </controller>
-    <controller type='pci' index='0' model='pci-root'/>
-    <input type='mouse' bus='ps2'/>
-    <input type='keyboard' bus='ps2'/>
-    <audio id='1' type='none'/>
-    <memballoon model='none'/>
-    <shmem name='shmem0'>
-      <model type='ivshmem'/>
-      <size unit='M'>4</size>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
-    </shmem>
-    <shmem name='shmem1'>
-      <model type='ivshmem'/>
-      <size unit='M'>128</size>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
-    </shmem>
-    <shmem name='shmem2'>
-      <model type='ivshmem'/>
-      <size unit='M'>256</size>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
-    </shmem>
-    <shmem name='shmem3'>
-      <model type='ivshmem'/>
-      <size unit='M'>512</size>
-      <server/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
-    </shmem>
-    <shmem name='shmem4'>
-      <model type='ivshmem'/>
-      <size unit='M'>1024</size>
-      <server path='/tmp/shmem4-sock'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
-    </shmem>
-    <shmem name='shmem5'>
-      <model type='ivshmem'/>
-      <size unit='M'>2048</size>
-      <server path='/tmp/shmem5-sock'/>
-      <msi ioeventfd='off'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
-    </shmem>
-    <shmem name='shmem6'>
-      <model type='ivshmem'/>
-      <size unit='M'>4096</size>
-      <server path='/tmp/shmem6-sock'/>
-      <msi vectors='16'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
-    </shmem>
-    <shmem name='shmem7'>
-      <model type='ivshmem'/>
-      <size unit='M'>8192</size>
-      <server path='/tmp/shmem7-sock'/>
-      <msi vectors='32' ioeventfd='on'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
-    </shmem>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index bbecaa3064..0471a0cceb 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -896,7 +896,6 @@ mymain(void)

     DO_TEST_CAPS_LATEST("tap-vhost");
     DO_TEST_CAPS_LATEST("tap-vhost-incorrect");
-    DO_TEST("shmem", QEMU_CAPS_DEVICE_IVSHMEM);
     DO_TEST_CAPS_LATEST("shmem-plain-doorbell");
     DO_TEST_CAPS_LATEST("smbios");
     DO_TEST_CAPS_LATEST("smbios-multiple-type2");
-- 
2.41.0




[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