[libvirt] [PATCH] qemu: taint domain if virDomainQemuAgentCommand API is used

Pavel Hrdina posted 1 patch 6 years, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/6a2adca00d0138fb7abef647d086a131c76f35f2.1510677018.git.phrdina@redhat.com
src/conf/domain_conf.c | 3 ++-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_driver.c | 2 ++
3 files changed, 5 insertions(+), 1 deletion(-)
[libvirt] [PATCH] qemu: taint domain if virDomainQemuAgentCommand API is used
Posted by Pavel Hrdina 6 years, 5 months ago
This is similar to the virDomainQemuMonitorCommand API, it can change
the domain state in a way that libvirt may not understand.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 src/conf/domain_conf.c | 3 ++-
 src/conf/domain_conf.h | 1 +
 src/qemu/qemu_driver.c | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fffcc8e9da..55b3cb2430 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -100,7 +100,8 @@ VIR_ENUM_IMPL(virDomainTaint, VIR_DOMAIN_TAINT_LAST,
               "host-cpu",
               "hook-script",
               "cdrom-passthrough",
-              "custom-dtb");
+              "custom-dtb",
+              "custom-ga-command");
 
 VIR_ENUM_IMPL(virDomainVirt, VIR_DOMAIN_VIRT_LAST,
               "none",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e3f060b122..af5e379468 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2444,6 +2444,7 @@ typedef enum {
     VIR_DOMAIN_TAINT_HOOK,             /* Domain (possibly) changed via hook script */
     VIR_DOMAIN_TAINT_CDROM_PASSTHROUGH,/* CDROM passthrough */
     VIR_DOMAIN_TAINT_CUSTOM_DTB,       /* Custom device tree blob was specified */
+    VIR_DOMAIN_TAINT_CUSTOM_GA_COMMAND, /* Custom guest agent command */
 
     VIR_DOMAIN_TAINT_LAST
 } virDomainTaintFlags;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6132bc4a9a..3a0e3b6cec 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18737,6 +18737,8 @@ qemuDomainQemuAgentCommand(virDomainPtr domain,
     if (!qemuDomainAgentAvailable(vm, true))
         goto endjob;
 
+    qemuDomainObjTaint(driver, vm, VIR_DOMAIN_TAINT_CUSTOM_GA_COMMAND, NULL);
+
     agent = qemuDomainObjEnterAgent(vm);
     ret = qemuAgentArbitraryCommand(agent, cmd, &result, timeout);
     qemuDomainObjExitAgent(vm, agent);
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: taint domain if virDomainQemuAgentCommand API is used
Posted by Martin Kletzander 6 years, 5 months ago
On Tue, Nov 14, 2017 at 05:30:26PM +0100, Pavel Hrdina wrote:
>This is similar to the virDomainQemuMonitorCommand API, it can change
>the domain state in a way that libvirt may not understand.
>
>Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
>---

ACK--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list