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@xxxxxxxxxx> --- src/libxl/libxl_driver.c | 14 +++----------- src/lxc/lxc_driver.c | 28 ++++++++-------------------- src/network/bridge_driver.c | 22 ++++------------------ src/qemu/qemu_driver.c | 17 ++--------------- src/storage/storage_driver.c | 19 ++----------------- 5 files changed, 19 insertions(+), 81 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 31b842aeee..a9edc8211d 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -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, }; diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 516a6b4de3..b1ef221c5c 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1632,26 +1632,15 @@ static int lxcStateInitialize(bool privileged, NULL, NULL) < 0) goto cleanup; - virObjectUnref(caps); - return 0; - - cleanup: - virObjectUnref(caps); - lxcStateCleanup(); - return -1; -} - -/** - * lxcStateAutoStart: - * - * Function to autostart the LXC daemons - */ -static void lxcStateAutoStart(void) -{ - if (!lxc_driver) - return; - virLXCProcessAutostartAll(lxc_driver); + + virObjectUnref(caps); + return 0; + + cleanup: + virObjectUnref(caps); + lxcStateCleanup(); + return -1; } static void lxcNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque) @@ -5502,7 +5491,6 @@ static virConnectDriver lxcConnectDriver = { static virStateDriver lxcStateDriver = { .name = LXC_DRIVER_NAME, .stateInitialize = lxcStateInitialize, - .stateAutoStart = lxcStateAutoStart, .stateCleanup = lxcStateCleanup, .stateReload = lxcStateReload, }; diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index b3ca5b8a15..c3e1381124 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -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, }; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 36426cd65a..043cb817d2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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, diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 34634e97d9..98be434005 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -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, }; -- 2.19.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list