Blame SOURCES/kvm-vl-Clean-up-user-creatable-objects-when-exiting.patch

4a2fec
From 8f6dfc8d04aa713a8a6f1856a5c2fa68100ecd77 Mon Sep 17 00:00:00 2001
4a2fec
From: Eduardo Habkost <ehabkost@redhat.com>
4a2fec
Date: Thu, 19 Oct 2017 01:34:51 +0200
4a2fec
Subject: [PATCH 62/69] vl: Clean up user-creatable objects when exiting
4a2fec
MIME-Version: 1.0
4a2fec
Content-Type: text/plain; charset=UTF-8
4a2fec
Content-Transfer-Encoding: 8bit
4a2fec
4a2fec
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
4a2fec
Message-id: <20171019013453.21449-3-ehabkost@redhat.com>
4a2fec
Patchwork-id: 77368
4a2fec
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 2/4] vl: Clean up user-creatable objects when exiting
4a2fec
Bugzilla: 1460848
4a2fec
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
4a2fec
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
4a2fec
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
4a2fec
Delete all user-creatable objects in /objects when exiting QEMU, so they
4a2fec
can perform cleanup actions.
4a2fec
4a2fec
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
4a2fec
Message-Id: <20170824192315.5897-2-ehabkost@redhat.com>
4a2fec
Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4a2fec
Tested-by: Zack Cornelius <zack.cornelius@kove.net>
4a2fec
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
4a2fec
(cherry picked from commit 9d5139e543e8579aacd324193680c64fd1463d89)
4a2fec
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 include/qom/object_interfaces.h | 8 ++++++++
4a2fec
 qom/object_interfaces.c         | 5 +++++
4a2fec
 vl.c                            | 1 +
4a2fec
 3 files changed, 14 insertions(+)
4a2fec
4a2fec
diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h
4a2fec
index fdd7603..3f5f206 100644
4a2fec
--- a/include/qom/object_interfaces.h
4a2fec
+++ b/include/qom/object_interfaces.h
4a2fec
@@ -148,4 +148,12 @@ int user_creatable_add_opts_foreach(void *opaque,
4a2fec
  */
4a2fec
 void user_creatable_del(const char *id, Error **errp);
4a2fec
 
4a2fec
+/**
4a2fec
+ * user_creatable_cleanup:
4a2fec
+ *
4a2fec
+ * Delete all user-creatable objects and the user-creatable
4a2fec
+ * objects container.
4a2fec
+ */
4a2fec
+void user_creatable_cleanup(void);
4a2fec
+
4a2fec
 #endif
4a2fec
diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
4a2fec
index ff27e06..dbf8878 100644
4a2fec
--- a/qom/object_interfaces.c
4a2fec
+++ b/qom/object_interfaces.c
4a2fec
@@ -193,6 +193,11 @@ void user_creatable_del(const char *id, Error **errp)
4a2fec
     object_unparent(obj);
4a2fec
 }
4a2fec
 
4a2fec
+void user_creatable_cleanup(void)
4a2fec
+{
4a2fec
+    object_unparent(object_get_objects_root());
4a2fec
+}
4a2fec
+
4a2fec
 static void register_types(void)
4a2fec
 {
4a2fec
     static const TypeInfo uc_interface_info = {
4a2fec
diff --git a/vl.c b/vl.c
4a2fec
index 18b837c..55949e6 100644
4a2fec
--- a/vl.c
4a2fec
+++ b/vl.c
4a2fec
@@ -4814,6 +4814,7 @@ int main(int argc, char **argv, char **envp)
4a2fec
     audio_cleanup();
4a2fec
     monitor_cleanup();
4a2fec
     qemu_chr_cleanup();
4a2fec
+    user_creatable_cleanup();
4a2fec
     /* TODO: unref root container, check all devices are ok */
4a2fec
 
4a2fec
     return 0;
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec