@@ -58,6 +58,7 @@ typedef struct VMIntrospection {
GSource *unhook_timer;
uint32_t unhook_timeout;
bool async_unhook;
+ bool unhook_on_shutdown;
int reconnect_time;
@@ -203,6 +204,20 @@ static void prop_set_async_unhook(Object *obj, bool value, Error **errp)
i->async_unhook = value;
}
+static bool prop_get_unhook_on_shutdown(Object *obj, Error **errp)
+{
+ VMIntrospection *i = VM_INTROSPECTION(obj);
+
+ return i->unhook_on_shutdown;
+}
+
+static void prop_set_unhook_on_shutdown(Object *obj, bool value, Error **errp)
+{
+ VMIntrospection *i = VM_INTROSPECTION(obj);
+
+ i->unhook_on_shutdown = value;
+}
+
static void prop_get_uint32(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
@@ -285,6 +300,11 @@ static void instance_init(Object *obj)
prop_get_async_unhook,
prop_set_async_unhook, NULL);
+ i->unhook_on_shutdown = true;
+ object_property_add_bool(obj, "unhook_on_shutdown",
+ prop_get_unhook_on_shutdown,
+ prop_set_unhook_on_shutdown, NULL);
+
vmstate_register(NULL, 0, &vmstate_introspection, i);
}
@@ -801,6 +821,11 @@ static bool intercept_action(VMIntrospection *i,
}
switch (action) {
+ case VMI_INTERCEPT_SHUTDOWN:
+ if (!i->unhook_on_shutdown) {
+ return false;
+ }
+ break;
case VMI_INTERCEPT_FORCE_RESET:
disconnect_and_unhook_kvmi(i);
return false;
Some introspection tools can detect when the guest is shutting down. This new option, 'unhook_on_shutdown' controls if QEMU will notify the introspection tool on a shutdown command at its level. Signed-off-by: Adalbert Lazăr <alazar@bitdefender.com> --- accel/kvm/vmi.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)