]> xenbits.xensource.com Git - libvirt.git/commitdiff
Revert "virStateDriver - Separate AutoStart from Initialize"
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 1 Mar 2019 14:16:45 +0000 (15:16 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 6 Mar 2019 09:20:31 +0000 (10:20 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=1685151

This reverts commit cefb97fb815c81fc882da752f45effd23bcb9b4b.

The stateAutoStart callback will be removed in the next commit.
Therefore move autostarting of domains, networks and storage
pools back into stateInitialize callbacks.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/libxl/libxl_driver.c
src/lxc/lxc_driver.c
src/network/bridge_driver.c
src/qemu/qemu_driver.c
src/storage/storage_driver.c

index 31b842aeee73584c9285016f0ac49a09e6492498..a9edc8211d9a660c96c5a7d6f3a39c514c853feb 100644 (file)
@@ -779,6 +779,9 @@ libxlStateInitialize(bool privileged,
                                        NULL, NULL) < 0)
         goto error;
 
+    virDomainObjListForEach(libxl_driver->domains, libxlAutostartDomain,
+                            libxl_driver);
+
     virDomainObjListForEach(libxl_driver->domains, libxlDomainManagedSaveLoad,
                             libxl_driver);
 
@@ -790,16 +793,6 @@ libxlStateInitialize(bool privileged,
     return -1;
 }
 
-static void
-libxlStateAutoStart(void)
-{
-    if (!libxl_driver)
-        return;
-
-    virDomainObjListForEach(libxl_driver->domains, libxlAutostartDomain,
-                            libxl_driver);
-}
-
 static int
 libxlStateReload(void)
 {
@@ -6611,7 +6604,6 @@ static virConnectDriver libxlConnectDriver = {
 static virStateDriver libxlStateDriver = {
     .name = "LIBXL",
     .stateInitialize = libxlStateInitialize,
-    .stateAutoStart = libxlStateAutoStart,
     .stateCleanup = libxlStateCleanup,
     .stateReload = libxlStateReload,
 };
index 516a6b4de3810a131d905cb453b43d768bed4752..b1ef221c5c095dad6f2d51c0152e16d1dd974dae 100644 (file)
@@ -1632,6 +1632,8 @@ static int lxcStateInitialize(bool privileged,
                                        NULL, NULL) < 0)
         goto cleanup;
 
+    virLXCProcessAutostartAll(lxc_driver);
+
     virObjectUnref(caps);
     return 0;
 
@@ -1641,19 +1643,6 @@ static int lxcStateInitialize(bool privileged,
     return -1;
 }
 
-/**
- * lxcStateAutoStart:
- *
- * Function to autostart the LXC daemons
- */
-static void lxcStateAutoStart(void)
-{
-    if (!lxc_driver)
-        return;
-
-    virLXCProcessAutostartAll(lxc_driver);
-}
-
 static void lxcNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque)
 {
     virLXCDriverPtr driver = opaque;
@@ -5502,7 +5491,6 @@ static virConnectDriver lxcConnectDriver = {
 static virStateDriver lxcStateDriver = {
     .name = LXC_DRIVER_NAME,
     .stateInitialize = lxcStateInitialize,
-    .stateAutoStart = lxcStateAutoStart,
     .stateCleanup = lxcStateCleanup,
     .stateReload = lxcStateReload,
 };
index b3ca5b8a158a69d1cf08e6236ae0c5b599312e85..c3e1381124121f534a743c6bbe57693872976739 100644 (file)
@@ -660,6 +660,10 @@ networkStateInitialize(bool privileged,
     networkReloadFirewallRules(network_driver, true);
     networkRefreshDaemons(network_driver);
 
+    virNetworkObjListForEach(network_driver->networks,
+                             networkAutostartConfig,
+                             network_driver);
+
     network_driver->networkEventState = virObjectEventStateNew();
 
 #ifdef WITH_FIREWALLD
@@ -699,23 +703,6 @@ networkStateInitialize(bool privileged,
 }
 
 
-/**
- * networkStateAutoStart:
- *
- * Function to AutoStart the bridge configs
- */
-static void
-networkStateAutoStart(void)
-{
-    if (!network_driver)
-        return;
-
-    virNetworkObjListForEach(network_driver->networks,
-                             networkAutostartConfig,
-                             network_driver);
-}
-
-
 /**
  * networkStateReload:
  *
@@ -5652,7 +5639,6 @@ static virConnectDriver networkConnectDriver = {
 static virStateDriver networkStateDriver = {
     .name = "bridge",
     .stateInitialize  = networkStateInitialize,
-    .stateAutoStart  = networkStateAutoStart,
     .stateCleanup = networkStateCleanup,
     .stateReload = networkStateReload,
 };
index 36426cd65a408ae7c8b3a9436cbe488426c4ac45..043cb817d2df17c13a0d5e58895374c7e37ddc06 100644 (file)
@@ -914,6 +914,8 @@ qemuStateInitialize(bool privileged,
 
     qemuProcessReconnectAll(qemu_driver);
 
+    qemuAutostartDomains(qemu_driver);
+
     return 0;
 
  error:
@@ -924,20 +926,6 @@ qemuStateInitialize(bool privileged,
     return -1;
 }
 
-/**
- * qemuStateAutoStart:
- *
- * Function to auto start the QEMU daemons
- */
-static void
-qemuStateAutoStart(void)
-{
-    if (!qemu_driver)
-        return;
-
-    qemuAutostartDomains(qemu_driver);
-}
-
 static void qemuNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque)
 {
     virQEMUDriverPtr driver = opaque;
@@ -22672,7 +22660,6 @@ static virConnectDriver qemuConnectDriver = {
 static virStateDriver qemuStateDriver = {
     .name = QEMU_DRIVER_NAME,
     .stateInitialize = qemuStateInitialize,
-    .stateAutoStart = qemuStateAutoStart,
     .stateCleanup = qemuStateCleanup,
     .stateReload = qemuStateReload,
     .stateStop = qemuStateStop,
index 34634e97d935c71e141f1f6ed9d27452d9999d0e..98be43400554d572b7c31d18c9348e5943ab9a3c 100644 (file)
@@ -294,6 +294,8 @@ storageStateInitialize(bool privileged,
 
     storagePoolUpdateAllState();
 
+    storageDriverAutostart();
+
     driver->storageEventState = virObjectEventStateNew();
 
     storageDriverUnlock();
@@ -306,22 +308,6 @@ storageStateInitialize(bool privileged,
     return -1;
 }
 
-/**
- * storageStateAutoStart:
- *
- * Function to auto start the storage driver
- */
-static void
-storageStateAutoStart(void)
-{
-    if (!driver)
-        return;
-
-    storageDriverLock();
-    storageDriverAutostart();
-    storageDriverUnlock();
-}
-
 /**
  * storageStateReload:
  *
@@ -2832,7 +2818,6 @@ static virConnectDriver storageConnectDriver = {
 static virStateDriver stateDriver = {
     .name = "storage",
     .stateInitialize = storageStateInitialize,
-    .stateAutoStart = storageStateAutoStart,
     .stateCleanup = storageStateCleanup,
     .stateReload = storageStateReload,
 };