[libvirt] [PATCH 4/5] qemu: reject parallel ports for s390 archs

Pino Toscano posted 5 patches 7 years, 8 months ago
[libvirt] [PATCH 4/5] qemu: reject parallel ports for s390 archs
Posted by Pino Toscano 7 years, 8 months ago
They are simply not supported on those architectures.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1487499

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
---
 src/qemu/qemu_domain.c                             |  9 ++++++++-
 .../qemuxml2argv-s390-no-parallel.xml              | 22 ++++++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  4 ++++
 3 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-no-parallel.xml

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0b8a66307..6f1b453b2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3292,11 +3292,18 @@ qemuDomainChrSourceDefValidate(const virDomainChrSourceDef *def)
 
 static int
 qemuDomainChrDefValidate(const virDomainChrDef *dev,
-                         const virDomainDef *def ATTRIBUTE_UNUSED)
+                         const virDomainDef *def)
 {
     if (qemuDomainChrSourceDefValidate(dev->source) < 0)
         return -1;
 
+    if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL &&
+        ARCH_IS_S390(def->os.arch)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("parallel ports are not supported"));
+            return -1;
+    }
+
     return 0;
 }
 
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-no-parallel.xml b/tests/qemuxml2argvdata/qemuxml2argv-s390-no-parallel.xml
new file mode 100644
index 000000000..5e6a23fe9
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-no-parallel.xml
@@ -0,0 +1,22 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch="s390x" machine="s390-ccw-virtio">hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='virtio'/>
+    </disk>
+    <parallel type='pty'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 3f7d1db3e..e9748bf1a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1947,6 +1947,10 @@ mymain(void)
             QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_VIRTIO_CCW,
             QEMU_CAPS_VIRTIO_S390);
+    DO_TEST_PARSE_ERROR("s390-no-parallel",
+            QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_VIRTIO_CCW,
+            QEMU_CAPS_VIRTIO_S390);
 
     DO_TEST("ppc-dtb",
             QEMU_CAPS_KVM,
-- 
2.13.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 4/5] qemu: reject parallel ports for s390 archs
Posted by Thomas Huth 7 years, 8 months ago
On 07.09.2017 14:19, Pino Toscano wrote:
> They are simply not supported on those architectures.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1487499
> 
> Signed-off-by: Pino Toscano <ptoscano@redhat.com>
> ---
>  src/qemu/qemu_domain.c                             |  9 ++++++++-
>  .../qemuxml2argv-s390-no-parallel.xml              | 22 ++++++++++++++++++++++
>  tests/qemuxml2argvtest.c                           |  4 ++++
>  3 files changed, 34 insertions(+), 1 deletion(-)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-no-parallel.xml
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 0b8a66307..6f1b453b2 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -3292,11 +3292,18 @@ qemuDomainChrSourceDefValidate(const virDomainChrSourceDef *def)
>  
>  static int
>  qemuDomainChrDefValidate(const virDomainChrDef *dev,
> -                         const virDomainDef *def ATTRIBUTE_UNUSED)
> +                         const virDomainDef *def)
>  {
>      if (qemuDomainChrSourceDefValidate(dev->source) < 0)
>          return -1;
>  
> +    if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL &&
> +        ARCH_IS_S390(def->os.arch)) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("parallel ports are not supported"));
> +            return -1;
> +    }
> +
>      return 0;
>  }
>  
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-no-parallel.xml b/tests/qemuxml2argvdata/qemuxml2argv-s390-no-parallel.xml
> new file mode 100644
> index 000000000..5e6a23fe9
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-no-parallel.xml
> @@ -0,0 +1,22 @@
> +<domain type='qemu'>
> +  <name>QEMUGuest1</name>
> +  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
> +  <memory unit='KiB'>219100</memory>
> +  <currentMemory unit='KiB'>219100</currentMemory>
> +  <vcpu placement='static'>1</vcpu>
> +  <os>
> +    <type arch="s390x" machine="s390-ccw-virtio">hvm</type>
> +    <boot dev='hd'/>
> +  </os>
> +  <clock offset='utc'/>
> +  <devices>
> +    <emulator>/usr/bin/qemu-system-s390x</emulator>
> +    <disk type='block' device='disk'>
> +      <driver name='qemu' type='raw'/>
> +      <source dev='/dev/HostVG/QEMUGuest1'/>
> +      <target dev='hda' bus='virtio'/>
> +    </disk>
> +    <parallel type='pty'/>
> +    <memballoon model='none'/>
> +  </devices>
> +</domain>
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index 3f7d1db3e..e9748bf1a 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -1947,6 +1947,10 @@ mymain(void)
>              QEMU_CAPS_NODEFCONFIG,
>              QEMU_CAPS_VIRTIO_CCW,
>              QEMU_CAPS_VIRTIO_S390);
> +    DO_TEST_PARSE_ERROR("s390-no-parallel",
> +            QEMU_CAPS_NODEFCONFIG,
> +            QEMU_CAPS_VIRTIO_CCW,
> +            QEMU_CAPS_VIRTIO_S390);
>  
>      DO_TEST("ppc-dtb",
>              QEMU_CAPS_KVM,
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>

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