render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c480ed
From 799c9dd37390878a54be303b3e3e27445049bf2b Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <799c9dd37390878a54be303b3e3e27445049bf2b@dist-git>
c480ed
From: Michal Privoznik <mprivozn@redhat.com>
c480ed
Date: Thu, 27 Jun 2019 15:18:16 +0200
c480ed
Subject: [PATCH] Revert "virStateDriver - Separate AutoStart from Initialize"
c480ed
MIME-Version: 1.0
c480ed
Content-Type: text/plain; charset=UTF-8
c480ed
Content-Transfer-Encoding: 8bit
c480ed
c480ed
This reverts commit cefb97fb815c81fc882da752f45effd23bcb9b4b.
c480ed
c480ed
The stateAutoStart callback will be removed in the next commit.
c480ed
Therefore move autostarting of domains, networks and storage
c480ed
pools back into stateInitialize callbacks.
c480ed
c480ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
(cherry picked from commit fc380c2e018ae15347d4c281a7e74896c48cac4a)
c480ed
c480ed
https://bugzilla.redhat.com/show_bug.cgi?id=1685151
c480ed
c480ed
The difference to the upstream commit is uml driver change. In
c480ed
upstream, the uml driver was dropped, but it's still kept around
c480ed
in downstream.
c480ed
c480ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c480ed
Message-Id: <a8e69f65b397c81c2a68597cca6c8ac04df24153.1561641375.git.mprivozn@redhat.com>
c480ed
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
c480ed
---
c480ed
 src/libxl/libxl_driver.c     | 14 +++-----------
c480ed
 src/lxc/lxc_driver.c         | 16 ++--------------
c480ed
 src/network/bridge_driver.c  | 22 ++++------------------
c480ed
 src/qemu/qemu_driver.c       | 17 ++---------------
c480ed
 src/storage/storage_driver.c | 19 ++-----------------
c480ed
 src/uml/uml_driver.c         | 17 ++---------------
c480ed
 6 files changed, 15 insertions(+), 90 deletions(-)
c480ed
c480ed
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
c480ed
index 5a5e792957..99bb010af4 100644
c480ed
--- a/src/libxl/libxl_driver.c
c480ed
+++ b/src/libxl/libxl_driver.c
c480ed
@@ -773,6 +773,9 @@ libxlStateInitialize(bool privileged,
c480ed
                                        NULL, NULL) < 0)
c480ed
         goto error;
c480ed
 
c480ed
+    virDomainObjListForEach(libxl_driver->domains, libxlAutostartDomain,
c480ed
+                            libxl_driver);
c480ed
+
c480ed
     virDomainObjListForEach(libxl_driver->domains, libxlDomainManagedSaveLoad,
c480ed
                             libxl_driver);
c480ed
 
c480ed
@@ -784,16 +787,6 @@ libxlStateInitialize(bool privileged,
c480ed
     return -1;
c480ed
 }
c480ed
 
c480ed
-static void
c480ed
-libxlStateAutoStart(void)
c480ed
-{
c480ed
-    if (!libxl_driver)
c480ed
-        return;
c480ed
-
c480ed
-    virDomainObjListForEach(libxl_driver->domains, libxlAutostartDomain,
c480ed
-                            libxl_driver);
c480ed
-}
c480ed
-
c480ed
 static int
c480ed
 libxlStateReload(void)
c480ed
 {
c480ed
@@ -6479,7 +6472,6 @@ static virConnectDriver libxlConnectDriver = {
c480ed
 static virStateDriver libxlStateDriver = {
c480ed
     .name = "LIBXL",
c480ed
     .stateInitialize = libxlStateInitialize,
c480ed
-    .stateAutoStart = libxlStateAutoStart,
c480ed
     .stateCleanup = libxlStateCleanup,
c480ed
     .stateReload = libxlStateReload,
c480ed
 };
c480ed
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
c480ed
index f9794e0655..527fa72083 100644
c480ed
--- a/src/lxc/lxc_driver.c
c480ed
+++ b/src/lxc/lxc_driver.c
c480ed
@@ -1646,6 +1646,8 @@ static int lxcStateInitialize(bool privileged,
c480ed
                                        NULL, NULL) < 0)
c480ed
         goto cleanup;
c480ed
 
c480ed
+    virLXCProcessAutostartAll(lxc_driver);
c480ed
+
c480ed
     virObjectUnref(caps);
c480ed
     return 0;
c480ed
 
c480ed
@@ -1655,19 +1657,6 @@ static int lxcStateInitialize(bool privileged,
c480ed
     return -1;
c480ed
 }
c480ed
 
c480ed
-/**
c480ed
- * lxcStateAutoStart:
c480ed
- *
c480ed
- * Function to autostart the LXC daemons
c480ed
- */
c480ed
-static void lxcStateAutoStart(void)
c480ed
-{
c480ed
-    if (!lxc_driver)
c480ed
-        return;
c480ed
-
c480ed
-    virLXCProcessAutostartAll(lxc_driver);
c480ed
-}
c480ed
-
c480ed
 static void lxcNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque)
c480ed
 {
c480ed
     virLXCDriverPtr driver = opaque;
c480ed
@@ -5550,7 +5539,6 @@ static virConnectDriver lxcConnectDriver = {
c480ed
 static virStateDriver lxcStateDriver = {
c480ed
     .name = LXC_DRIVER_NAME,
c480ed
     .stateInitialize = lxcStateInitialize,
c480ed
-    .stateAutoStart = lxcStateAutoStart,
c480ed
     .stateCleanup = lxcStateCleanup,
c480ed
     .stateReload = lxcStateReload,
c480ed
 };
c480ed
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
c480ed
index d153a8cdb6..a60d7db685 100644
c480ed
--- a/src/network/bridge_driver.c
c480ed
+++ b/src/network/bridge_driver.c
c480ed
@@ -755,6 +755,10 @@ networkStateInitialize(bool privileged,
c480ed
     networkReloadFirewallRules(network_driver);
c480ed
     networkRefreshDaemons(network_driver);
c480ed
 
c480ed
+    virNetworkObjListForEach(network_driver->networks,
c480ed
+                             networkAutostartConfig,
c480ed
+                             network_driver);
c480ed
+
c480ed
     network_driver->networkEventState = virObjectEventStateNew();
c480ed
 
c480ed
 #ifdef WITH_FIREWALLD
c480ed
@@ -794,23 +798,6 @@ networkStateInitialize(bool privileged,
c480ed
 }
c480ed
 
c480ed
 
c480ed
-/**
c480ed
- * networkStateAutoStart:
c480ed
- *
c480ed
- * Function to AutoStart the bridge configs
c480ed
- */
c480ed
-static void
c480ed
-networkStateAutoStart(void)
c480ed
-{
c480ed
-    if (!network_driver)
c480ed
-        return;
c480ed
-
c480ed
-    virNetworkObjListForEach(network_driver->networks,
c480ed
-                             networkAutostartConfig,
c480ed
-                             network_driver);
c480ed
-}
c480ed
-
c480ed
-
c480ed
 /**
c480ed
  * networkStateReload:
c480ed
  *
c480ed
@@ -5616,7 +5603,6 @@ static virConnectDriver networkConnectDriver = {
c480ed
 static virStateDriver networkStateDriver = {
c480ed
     .name = "bridge",
c480ed
     .stateInitialize  = networkStateInitialize,
c480ed
-    .stateAutoStart  = networkStateAutoStart,
c480ed
     .stateCleanup = networkStateCleanup,
c480ed
     .stateReload = networkStateReload,
c480ed
 };
c480ed
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
c480ed
index 2da87992fd..056d324a62 100644
c480ed
--- a/src/qemu/qemu_driver.c
c480ed
+++ b/src/qemu/qemu_driver.c
c480ed
@@ -911,6 +911,8 @@ qemuStateInitialize(bool privileged,
c480ed
 
c480ed
     qemuProcessReconnectAll(qemu_driver);
c480ed
 
c480ed
+    qemuAutostartDomains(qemu_driver);
c480ed
+
c480ed
     return 0;
c480ed
 
c480ed
  error:
c480ed
@@ -921,20 +923,6 @@ qemuStateInitialize(bool privileged,
c480ed
     return -1;
c480ed
 }
c480ed
 
c480ed
-/**
c480ed
- * qemuStateAutoStart:
c480ed
- *
c480ed
- * Function to auto start the QEMU daemons
c480ed
- */
c480ed
-static void
c480ed
-qemuStateAutoStart(void)
c480ed
-{
c480ed
-    if (!qemu_driver)
c480ed
-        return;
c480ed
-
c480ed
-    qemuAutostartDomains(qemu_driver);
c480ed
-}
c480ed
-
c480ed
 static void qemuNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque)
c480ed
 {
c480ed
     virQEMUDriverPtr driver = opaque;
c480ed
@@ -21846,7 +21834,6 @@ static virConnectDriver qemuConnectDriver = {
c480ed
 static virStateDriver qemuStateDriver = {
c480ed
     .name = QEMU_DRIVER_NAME,
c480ed
     .stateInitialize = qemuStateInitialize,
c480ed
-    .stateAutoStart = qemuStateAutoStart,
c480ed
     .stateCleanup = qemuStateCleanup,
c480ed
     .stateReload = qemuStateReload,
c480ed
     .stateStop = qemuStateStop,
c480ed
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
c480ed
index 254818e308..f61fb074e6 100644
c480ed
--- a/src/storage/storage_driver.c
c480ed
+++ b/src/storage/storage_driver.c
c480ed
@@ -291,6 +291,8 @@ storageStateInitialize(bool privileged,
c480ed
 
c480ed
     storagePoolUpdateAllState();
c480ed
 
c480ed
+    storageDriverAutostart();
c480ed
+
c480ed
     driver->storageEventState = virObjectEventStateNew();
c480ed
 
c480ed
     storageDriverUnlock();
c480ed
@@ -307,22 +309,6 @@ storageStateInitialize(bool privileged,
c480ed
     goto cleanup;
c480ed
 }
c480ed
 
c480ed
-/**
c480ed
- * storageStateAutoStart:
c480ed
- *
c480ed
- * Function to auto start the storage driver
c480ed
- */
c480ed
-static void
c480ed
-storageStateAutoStart(void)
c480ed
-{
c480ed
-    if (!driver)
c480ed
-        return;
c480ed
-
c480ed
-    storageDriverLock();
c480ed
-    storageDriverAutostart();
c480ed
-    storageDriverUnlock();
c480ed
-}
c480ed
-
c480ed
 /**
c480ed
  * storageStateReload:
c480ed
  *
c480ed
@@ -2843,7 +2829,6 @@ static virConnectDriver storageConnectDriver = {
c480ed
 static virStateDriver stateDriver = {
c480ed
     .name = "storage",
c480ed
     .stateInitialize = storageStateInitialize,
c480ed
-    .stateAutoStart = storageStateAutoStart,
c480ed
     .stateCleanup = storageStateCleanup,
c480ed
     .stateReload = storageStateReload,
c480ed
 };
c480ed
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
c480ed
index c77988f01e..296adf55d1 100644
c480ed
--- a/src/uml/uml_driver.c
c480ed
+++ b/src/uml/uml_driver.c
c480ed
@@ -575,6 +575,8 @@ umlStateInitialize(bool privileged,
c480ed
 
c480ed
     umlDriverUnlock(uml_driver);
c480ed
 
c480ed
+    umlAutostartConfigs(uml_driver);
c480ed
+
c480ed
     VIR_FREE(userdir);
c480ed
 
c480ed
     return 0;
c480ed
@@ -590,20 +592,6 @@ umlStateInitialize(bool privileged,
c480ed
     return -1;
c480ed
 }
c480ed
 
c480ed
-/**
c480ed
- * umlStateAutoStart:
c480ed
- *
c480ed
- * Function to autostart the Uml daemons
c480ed
- */
c480ed
-static void
c480ed
-umlStateAutoStart(void)
c480ed
-{
c480ed
-    if (!uml_driver)
c480ed
-        return;
c480ed
-
c480ed
-    umlAutostartConfigs(uml_driver);
c480ed
-}
c480ed
-
c480ed
 static void umlNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque)
c480ed
 {
c480ed
     struct uml_driver *driver = opaque;
c480ed
@@ -2826,7 +2814,6 @@ static virConnectDriver umlConnectDriver = {
c480ed
 static virStateDriver umlStateDriver = {
c480ed
     .name = "UML",
c480ed
     .stateInitialize = umlStateInitialize,
c480ed
-    .stateAutoStart = umlStateAutoStart,
c480ed
     .stateCleanup = umlStateCleanup,
c480ed
     .stateReload = umlStateReload,
c480ed
 };
c480ed
-- 
c480ed
2.22.0
c480ed