mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
Only let VM drivers block libvirtd timed shutdown
The only important state that should prevent libvirtd shutdown is from running VMs. Networks, host devices, network filters and storage pools are all long lived resources that have no significant in-memory state. They should not block shutdown.
This commit is contained in:
parent
8f9a69317d
commit
ae2163f852
@ -468,33 +468,6 @@ networkReload(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* networkActive:
|
||||
*
|
||||
* Checks if the QEmu daemon is active, i.e. has an active domain or
|
||||
* an active network
|
||||
*
|
||||
* Returns 1 if active, 0 otherwise
|
||||
*/
|
||||
static int
|
||||
networkActive(void) {
|
||||
unsigned int i;
|
||||
int active = 0;
|
||||
|
||||
if (!driverState)
|
||||
return 0;
|
||||
|
||||
networkDriverLock(driverState);
|
||||
for (i = 0 ; i < driverState->networks.count ; i++) {
|
||||
virNetworkObjPtr net = driverState->networks.objs[i];
|
||||
virNetworkObjLock(net);
|
||||
if (virNetworkObjIsActive(net))
|
||||
active = 1;
|
||||
virNetworkObjUnlock(net);
|
||||
}
|
||||
networkDriverUnlock(driverState);
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* networkShutdown:
|
||||
@ -3357,7 +3330,6 @@ static virStateDriver networkStateDriver = {
|
||||
.initialize = networkStartup,
|
||||
.cleanup = networkShutdown,
|
||||
.reload = networkReload,
|
||||
.active = networkActive,
|
||||
};
|
||||
|
||||
int networkRegister(void) {
|
||||
|
@ -736,13 +736,6 @@ static int halDeviceMonitorReload(void)
|
||||
}
|
||||
|
||||
|
||||
static int halDeviceMonitorActive(void)
|
||||
{
|
||||
/* Always ready to deal with a shutdown */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static virDrvOpenStatus halNodeDrvOpen(virConnectPtr conn,
|
||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||
unsigned int flags)
|
||||
@ -786,7 +779,6 @@ static virStateDriver halStateDriver = {
|
||||
.initialize = halDeviceMonitorStartup, /* 0.5.0 */
|
||||
.cleanup = halDeviceMonitorShutdown, /* 0.5.0 */
|
||||
.reload = halDeviceMonitorReload, /* 0.5.0 */
|
||||
.active = halDeviceMonitorActive, /* 0.5.0 */
|
||||
};
|
||||
|
||||
int halNodeRegister(void)
|
||||
|
@ -1723,13 +1723,6 @@ static int udevDeviceMonitorReload(void)
|
||||
}
|
||||
|
||||
|
||||
static int udevDeviceMonitorActive(void)
|
||||
{
|
||||
/* Always ready to deal with a shutdown */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static virDrvOpenStatus udevNodeDrvOpen(virConnectPtr conn,
|
||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||
unsigned int flags)
|
||||
@ -1772,7 +1765,6 @@ static virStateDriver udevStateDriver = {
|
||||
.initialize = udevDeviceMonitorStartup, /* 0.7.3 */
|
||||
.cleanup = udevDeviceMonitorShutdown, /* 0.7.3 */
|
||||
.reload = udevDeviceMonitorReload, /* 0.7.3 */
|
||||
.active = udevDeviceMonitorActive, /* 0.7.3 */
|
||||
};
|
||||
|
||||
int udevNodeRegister(void)
|
||||
|
@ -304,27 +304,6 @@ nwfilterDriverReload(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* virNWFilterActive:
|
||||
*
|
||||
* Checks if the nwfilter driver is active, i.e. has an active nwfilter
|
||||
*
|
||||
* Returns 1 if active, 0 otherwise
|
||||
*/
|
||||
static int
|
||||
nwfilterDriverActive(void) {
|
||||
int ret;
|
||||
|
||||
if (!driverState)
|
||||
return 0;
|
||||
|
||||
nwfilterDriverLock(driverState);
|
||||
ret = driverState->nwfilters.count ? 1 : 0;
|
||||
ret |= driverState->watchingFirewallD;
|
||||
nwfilterDriverUnlock(driverState);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* virNWFilterIsWatchingFirewallD:
|
||||
@ -695,7 +674,6 @@ static virStateDriver stateDriver = {
|
||||
.initialize = nwfilterDriverStartup,
|
||||
.cleanup = nwfilterDriverShutdown,
|
||||
.reload = nwfilterDriverReload,
|
||||
.active = nwfilterDriverActive,
|
||||
};
|
||||
|
||||
|
||||
|
@ -202,33 +202,6 @@ storageDriverReload(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* virStorageActive:
|
||||
*
|
||||
* Checks if the storage driver is active, i.e. has an active pool
|
||||
*
|
||||
* Returns 1 if active, 0 otherwise
|
||||
*/
|
||||
static int
|
||||
storageDriverActive(void) {
|
||||
unsigned int i;
|
||||
int active = 0;
|
||||
|
||||
if (!driverState)
|
||||
return 0;
|
||||
|
||||
storageDriverLock(driverState);
|
||||
|
||||
for (i = 0 ; i < driverState->pools.count ; i++) {
|
||||
virStoragePoolObjLock(driverState->pools.objs[i]);
|
||||
if (virStoragePoolObjIsActive(driverState->pools.objs[i]))
|
||||
active = 1;
|
||||
virStoragePoolObjUnlock(driverState->pools.objs[i]);
|
||||
}
|
||||
|
||||
storageDriverUnlock(driverState);
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* virStorageShutdown:
|
||||
@ -2445,7 +2418,6 @@ static virStateDriver stateDriver = {
|
||||
.initialize = storageDriverStartup,
|
||||
.cleanup = storageDriverShutdown,
|
||||
.reload = storageDriverReload,
|
||||
.active = storageDriverActive,
|
||||
};
|
||||
|
||||
int storageRegister(void) {
|
||||
|
Loading…
Reference in New Issue
Block a user