[libvirt] [PATCH] qemu: use target.port for isa-serial

Thilo Cestonaro posted 1 patch 6 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180409124155.21838-1-thilo.cestonaro@ts.fujitsu.com
Test syntax-check passed
src/qemu/qemu_command.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
[libvirt] [PATCH] qemu: use target.port for isa-serial
Posted by Thilo Cestonaro 6 years ago
A configured target.port is currently totaly ignored, while contsructing
qemu commandline, for all types of serial devices. This patch adds a -device
parameter "index" for the target model isa-serial.
This enables the user to specify which serial device will end in which ttySX
device.

Signed-off-by: Thilo Cestonaro <thilo.cestonaro@ts.fujitsu.com>
---
Forgot to sign off! Here with Signed-off-by.

 src/qemu/qemu_command.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 514c3ab2e..5f770404b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10291,6 +10291,22 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
                       virDomainChrSerialTargetModelTypeToString(serial->targetModel),
                       serial->info.alias, serial->info.alias);
 
+    switch ((virDomainChrSerialTargetModel) serial->targetModel) {
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL:
+        if (serial->target.port != -1)
+            virBufferAsprintf(&cmd, ",index=%d", serial->target.port);
+        break;
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE:
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL:
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL:
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY:
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE:
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE:
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST:
+        break;
+    }
+
     if (qemuBuildDeviceAddressStr(&cmd, def, &serial->info, qemuCaps) < 0)
         goto error;
 
-- 
2.15.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: use target.port for isa-serial
Posted by Daniel P. Berrangé 6 years ago
On Mon, Apr 09, 2018 at 02:41:55PM +0200, Thilo Cestonaro wrote:
> A configured target.port is currently totaly ignored, while contsructing
> qemu commandline, for all types of serial devices. This patch adds a -device
> parameter "index" for the target model isa-serial.
> This enables the user to specify which serial device will end in which ttySX
> device.
> 
> Signed-off-by: Thilo Cestonaro <thilo.cestonaro@ts.fujitsu.com>
> ---
> Forgot to sign off! Here with Signed-off-by.
> 
>  src/qemu/qemu_command.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)

We'd generally expect to see a change to tests/qemuxml2argvtest.c for
this. Either adding a new test data file, or updating existing data
files if they would cover it.

> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 514c3ab2e..5f770404b 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -10291,6 +10291,22 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
>                        virDomainChrSerialTargetModelTypeToString(serial->targetModel),
>                        serial->info.alias, serial->info.alias);
>  
> +    switch ((virDomainChrSerialTargetModel) serial->targetModel) {
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL:
> +        if (serial->target.port != -1)
> +            virBufferAsprintf(&cmd, ",index=%d", serial->target.port);
> +        break;
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE:
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL:
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL:
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY:
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE:
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE:
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST:
> +        break;
> +    }
> +
>      if (qemuBuildDeviceAddressStr(&cmd, def, &serial->info, qemuCaps) < 0)
>          goto error;
>  
> -- 
> 2.15.1
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: use target.port for isa-serial
Posted by thilo.cestonaro@ts.fujitsu.com 6 years ago
Hi!

> We'd generally expect to see a change to tests/qemuxml2argvtest.c for
> this. Either adding a new test data file, or updating existing data
> files if they would cover it.

Sorry! Updated my patch. Have I still missed something?
I checked the valgrind tests, but they don't fail because of my patch.
But the normal "unittest" tests pass.

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