render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c480ed
From 8069bb50b2548acd3f2176499ede205e6099c067 Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <8069bb50b2548acd3f2176499ede205e6099c067@dist-git>
c480ed
From: Michal Privoznik <mprivozn@redhat.com>
c480ed
Date: Thu, 27 Jun 2019 15:18:17 +0200
c480ed
Subject: [PATCH] Revert "Separate out StateAutoStart from StateInitialize"
c480ed
MIME-Version: 1.0
c480ed
Content-Type: text/plain; charset=UTF-8
c480ed
Content-Transfer-Encoding: 8bit
c480ed
c480ed
This reverts commit e4a969092bda5b3b952963fdf6658895165040b7.
c480ed
c480ed
Now that drivers may call virConnectOpen() on secondary drivers, it
c480ed
doesn't make much sense to have autostart separated from driver
c480ed
initialization callback. In fact, it creates a problem because one
c480ed
driver during its initialization might try to fetch an object from
c480ed
another driver but since the object is yet to be autostarted the fetch
c480ed
fails. This has been observed in reality: qemu driver performs
c480ed
qemuProcessReconnect() during qemu's stateInitialize phase which may
c480ed
call virDomainDiskTranslateSourcePool() which connects to the storage
c480ed
driver to look up the volume. But the storage driver did not autostart
c480ed
its pools yet therefore volume lookup fails and the domain is killed.
c480ed
c480ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
(cherry picked from commit 07a9c8bae8b80ef1650e6d05869cbf55c6aea837)
c480ed
c480ed
https://bugzilla.redhat.com/show_bug.cgi?id=1685151
c480ed
c480ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c480ed
Message-Id: <4ed5f8f4edd0053cc14f4bb579a945b606b36f5a.1561641375.git.mprivozn@redhat.com>
c480ed
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
c480ed
---
c480ed
 src/driver-state.h |  4 ----
c480ed
 src/libvirt.c      | 14 +-------------
c480ed
 2 files changed, 1 insertion(+), 17 deletions(-)
c480ed
c480ed
diff --git a/src/driver-state.h b/src/driver-state.h
c480ed
index 1cb3e4faf3..e1e060bcc5 100644
c480ed
--- a/src/driver-state.h
c480ed
+++ b/src/driver-state.h
c480ed
@@ -30,9 +30,6 @@ typedef int
c480ed
                          virStateInhibitCallback callback,
c480ed
                          void *opaque);
c480ed
 
c480ed
-typedef void
c480ed
-(*virDrvStateAutoStart)(void);
c480ed
-
c480ed
 typedef int
c480ed
 (*virDrvStateCleanup)(void);
c480ed
 
c480ed
@@ -48,7 +45,6 @@ typedef virStateDriver *virStateDriverPtr;
c480ed
 struct _virStateDriver {
c480ed
     const char *name;
c480ed
     virDrvStateInitialize stateInitialize;
c480ed
-    virDrvStateAutoStart stateAutoStart;
c480ed
     virDrvStateCleanup stateCleanup;
c480ed
     virDrvStateReload stateReload;
c480ed
     virDrvStateStop stateStop;
c480ed
diff --git a/src/libvirt.c b/src/libvirt.c
c480ed
index 52f4dd2808..c9e5f47fd4 100644
c480ed
--- a/src/libvirt.c
c480ed
+++ b/src/libvirt.c
c480ed
@@ -637,11 +637,7 @@ virRegisterStateDriver(virStateDriverPtr driver)
c480ed
  * @callback: callback to invoke to inhibit shutdown of the daemon
c480ed
  * @opaque: data to pass to @callback
c480ed
  *
c480ed
- * Initialize all virtualization drivers. Accomplished in two phases,
c480ed
- * the first being state and structure initialization followed by any
c480ed
- * auto start supported by the driver.  This is done to ensure dependencies
c480ed
- * that some drivers may have on another driver having been initialized
c480ed
- * will exist, such as the storage driver's need to use the secret driver.
c480ed
+ * Initialize all virtualization drivers.
c480ed
  *
c480ed
  * Returns 0 if all succeed, -1 upon any failure.
c480ed
  */
c480ed
@@ -669,14 +665,6 @@ virStateInitialize(bool privileged,
c480ed
             }
c480ed
         }
c480ed
     }
c480ed
-
c480ed
-    for (i = 0; i < virStateDriverTabCount; i++) {
c480ed
-        if (virStateDriverTab[i]->stateAutoStart) {
c480ed
-            VIR_DEBUG("Running global auto start for %s state driver",
c480ed
-                      virStateDriverTab[i]->name);
c480ed
-            virStateDriverTab[i]->stateAutoStart();
c480ed
-        }
c480ed
-    }
c480ed
     return 0;
c480ed
 }
c480ed
 
c480ed
-- 
c480ed
2.22.0
c480ed