Re: [PATCH v2 12/21] qemu: Validate target model for serial devices

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

 



On Tue, Nov 21, 2017 at 05:42:22PM +0100, Andrea Bolognani wrote:
> Target model and target type must agree for the configuration

s/agree/correspond/

> to make sense, so check that's actually the case and error out
> otherwise.
> 
> Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
> ---
>  src/libvirt_private.syms |  2 ++
>  src/qemu/qemu_domain.c   | 37 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 39 insertions(+)
> 
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index d3ca6b2ec..0fb7d0e81 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -209,6 +209,8 @@ virDomainChrGetDomainPtrs;
>  virDomainChrInsertPreAlloced;
>  virDomainChrPreAlloc;
>  virDomainChrRemove;
> +virDomainChrSerialTargetModelTypeFromString;
> +virDomainChrSerialTargetModelTypeToString;
>  virDomainChrSerialTargetTypeFromString;
>  virDomainChrSerialTargetTypeToString;
>  virDomainChrSourceDefClear;
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 32cb62fb9..06ce382fa 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -3538,6 +3538,43 @@ qemuDomainChrTargetDefValidate(const virDomainDef *def,
>          case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST:
>              break;
>          }
> +
> +        /* Validate target model */
> +        switch ((virDomainChrSerialTargetModel) chr->targetModel) {
> +        case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL:
> +            if (chr->targetType != VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA) {
> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                               _("Target model '%s' requires "
> +                                 "target type 'isa'"),

I'm not sure that using the 'isa' directly is a good choice.
Currently the target type is 'isa-serial' and following patch renames
it to 'isa'.

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