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

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



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


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