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

Re: [libvirt] [PATCH] Taint domains using cdrom-passthrough



On Tue, May 12, 2015 at 16:03:33 -0400, John Ferlan wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=976387
> 
> For a domain configured using the host cdrom, we should taint the domain
> due to problems encountered when the host and guest try to control the tray.
> 
> Signed-off-by: John Ferlan <jferlan redhat com>
> ---
>  src/conf/domain_conf.c | 3 ++-
>  src/conf/domain_conf.h | 1 +
>  src/qemu/qemu_domain.c | 6 ++++++
>  3 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index add857c..a67e200 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -101,7 +101,8 @@ VIR_ENUM_IMPL(virDomainTaint, VIR_DOMAIN_TAINT_LAST,
>                "disk-probing",
>                "external-launch",
>                "host-cpu",
> -              "hook-script");
> +              "hook-script",
> +              "cdrom-passthrough");
>  
>  VIR_ENUM_IMPL(virDomainVirt, VIR_DOMAIN_VIRT_LAST,
>                "qemu",
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 2cd105a7..0867e8b 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -2280,6 +2280,7 @@ typedef enum {
>      VIR_DOMAIN_TAINT_EXTERNAL_LAUNCH,  /* Externally launched guest domain */
>      VIR_DOMAIN_TAINT_HOST_CPU,         /* Host CPU passthrough in use */
>      VIR_DOMAIN_TAINT_HOOK,             /* Domain (possibly) changed via hook script */
> +    VIR_DOMAIN_TAINT_CDROM_PASSTHROUGH,/* CDROM passthrough */
>  
>      VIR_DOMAIN_TAINT_LAST
>  } virDomainTaintFlags;
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index fa8229f..b66ee89 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -2031,6 +2031,12 @@ void qemuDomainObjCheckDiskTaint(virQEMUDriverPtr driver,
>          qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HIGH_PRIVILEGES,
>                             logFD);
>  
> +    if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM &&
> +        virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_BLOCK &&
> +        disk->src->path)
> +        qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_CDROM_PASSTHROUGH,
> +                           logFD);
> +

This won't be enough currently since you can change the media in the
CDROM so that it becomes a passthrough device later in it's lifecycle.

You'll need to call qemuDomainObjCheckDiskTaint in
qemuDomainUpdateDeviceLive too once you'll be using it to mark those.


Peter

Attachment: signature.asc
Description: Digital signature


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