On 05/13/2015 03:37 AM, Peter Krempa wrote:
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(a)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.
hmm.. OK - should the similar call/check be made for NET as well in
a followup - even though qemuDomainObjCheckNetTaint is primarily if
a net->script exists and qemuDomainChangeNet would fail if the ->script
changed - if some other check is made in NetTaint in the future, then
we won't "miss" it.
I will add/squash the following into the patch (same as call in
qemuDomainAttachDeviceLive) :
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f922a28..a3c964f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8200,6 +8200,7 @@ qemuDomainUpdateDeviceLive(virConnectPtr conn,
switch ((virDomainDeviceType) dev->type) {
case VIR_DOMAIN_DEVICE_DISK:
+ qemuDomainObjCheckDiskTaint(driver, vm, dev->data.disk, -1);
ret = qemuDomainChangeDiskMediaLive(conn, vm, dev, driver, force);
break;
case VIR_DOMAIN_DEVICE_GRAPHICS:
John