Re: [PATCH 03/14] qemu: Introduce qemuDomainChrDefPostParse()

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

 



On Wed, Nov 15, 2017 at 12:50:06PM +0100, Andrea Bolognani wrote:
> Having a separate function for char device handling is better than
> adding even more code to qemuDomainDeviceDefPostParse().
> 
> Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
> ---
>  src/qemu/qemu_domain.c | 25 ++++++++++++++++++-------
>  1 file changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index cc7596bad..2d5eee01e 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -4036,6 +4036,19 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
>      return 0;
>  }
>  
> +static int
> +qemuDomainChrDefPostParse(virDomainChrDefPtr chr,
> +                          const virDomainDef *def)
> +{
> +    /* set the default console type for S390 arches */
> +    if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
> +        chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE &&
> +        ARCH_IS_S390(def->os.arch)) {
> +        chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO;
> +    }
> +
> +    return 0;
> +}
>  
>  static int
>  qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
> @@ -4096,13 +4109,6 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
>          }
>      }
>  
> -    /* set the default console type for S390 arches */
> -    if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
> -        dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
> -        dev->data.chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE &&
> -        ARCH_IS_S390(def->os.arch))
> -        dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO;
> -

You've missed the following condition that clears auto generated unix
socket path, it is also for char devices.

>      /* clear auto generated unix socket path for inactive definitions */
>      if ((parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
>          dev->type == VIR_DOMAIN_DEVICE_CHR) {
> @@ -4154,6 +4160,11 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
>          qemuDomainShmemDefPostParse(dev->data.shmem) < 0)
>          goto cleanup;
>  
> +    if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
> +        qemuDomainChrDefPostParse(dev->data.chr, def) < 0) {
> +        goto cleanup;
> +    }
> +

Is there any specific reason why did you move it to a different place?

Pavel

Attachment: signature.asc
Description: PGP signature

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