virLXCProcessStop: Add 'cleanupFlags' parameter

Add possibility for the caller to set the flags for the call to
'virLXCProcessCleanup'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
This commit is contained in:
Peter Krempa 2022-06-28 16:20:29 +02:00
parent 25883cd5f0
commit e44a5f43cb
3 changed files with 12 additions and 10 deletions

View File

@ -1354,7 +1354,7 @@ lxcDomainDestroyFlags(virDomainPtr dom,
goto endjob; goto endjob;
priv = vm->privateData; priv = vm->privateData;
ret = virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED); ret = virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED, 0);
event = virDomainEventLifecycleNewFromObj(vm, event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_DESTROYED); VIR_DOMAIN_EVENT_STOPPED_DESTROYED);

View File

@ -67,7 +67,7 @@ lxcProcessAutoDestroy(virDomainObj *dom,
VIR_DEBUG("driver=%p dom=%s conn=%p", driver, dom->def->name, conn); VIR_DEBUG("driver=%p dom=%s conn=%p", driver, dom->def->name, conn);
VIR_DEBUG("Killing domain"); VIR_DEBUG("Killing domain");
virLXCProcessStop(driver, dom, VIR_DOMAIN_SHUTOFF_DESTROYED); virLXCProcessStop(driver, dom, VIR_DOMAIN_SHUTOFF_DESTROYED, 0);
virDomainAuditStop(dom, "destroyed"); virDomainAuditStop(dom, "destroyed");
event = virDomainEventLifecycleNewFromObj(dom, event = virDomainEventLifecycleNewFromObj(dom,
VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED,
@ -108,7 +108,7 @@ virLXCProcessReboot(virLXCDriver *driver,
* So temporarily hide the newDef and then reinstate it * So temporarily hide the newDef and then reinstate it
*/ */
savedDef = g_steal_pointer(&vm->newDef); savedDef = g_steal_pointer(&vm->newDef);
virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN); virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN, 0);
vm->newDef = savedDef; vm->newDef = savedDef;
if (virLXCProcessStart(conn, driver, vm, if (virLXCProcessStart(conn, driver, vm,
0, NULL, autodestroy, reason) < 0) { 0, NULL, autodestroy, reason) < 0) {
@ -687,9 +687,9 @@ static void virLXCProcessMonitorEOFNotify(virLXCMonitor *mon,
virObjectLock(vm); virObjectLock(vm);
priv = vm->privateData; priv = vm->privateData;
virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN); virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN, 0);
if (!priv->wantReboot) { if (!priv->wantReboot) {
virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN); virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN, 0);
if (!priv->doneStopEvent) { if (!priv->doneStopEvent) {
event = virDomainEventLifecycleNewFromObj(vm, event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED,
@ -841,7 +841,8 @@ static virLXCMonitor *virLXCProcessConnectMonitor(virLXCDriver *driver,
int virLXCProcessStop(virLXCDriver *driver, int virLXCProcessStop(virLXCDriver *driver,
virDomainObj *vm, virDomainObj *vm,
virDomainShutoffReason reason) virDomainShutoffReason reason,
unsigned int cleanupFlags)
{ {
int rc; int rc;
virLXCDomainObjPrivate *priv; virLXCDomainObjPrivate *priv;
@ -899,7 +900,7 @@ int virLXCProcessStop(virLXCDriver *driver,
} }
cleanup: cleanup:
virLXCProcessCleanup(driver, vm, reason, 0); virLXCProcessCleanup(driver, vm, reason, cleanupFlags);
return 0; return 0;
} }
@ -1535,7 +1536,7 @@ int virLXCProcessStart(virConnectPtr conn,
if (rc != 0) { if (rc != 0) {
virErrorPreserveLast(&err); virErrorPreserveLast(&err);
if (virDomainObjIsActive(vm)) { if (virDomainObjIsActive(vm)) {
virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED); virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, 0);
} else { } else {
/* virLXCProcessStop() is NOP if the container is not active. /* virLXCProcessStop() is NOP if the container is not active.
* If there was a failure whilst creating it, cleanup manually. */ * If there was a failure whilst creating it, cleanup manually. */
@ -1723,7 +1724,7 @@ virLXCProcessReconnectDomain(virDomainObj *vm,
return ret; return ret;
error: error:
virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED); virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, 0);
virDomainAuditStop(vm, "failed"); virDomainAuditStop(vm, "failed");
goto cleanup; goto cleanup;
} }

View File

@ -31,7 +31,8 @@ int virLXCProcessStart(virConnectPtr conn,
virDomainRunningReason reason); virDomainRunningReason reason);
int virLXCProcessStop(virLXCDriver *driver, int virLXCProcessStop(virLXCDriver *driver,
virDomainObj *vm, virDomainObj *vm,
virDomainShutoffReason reason); virDomainShutoffReason reason,
unsigned int cleanupFlags);
void virLXCProcessAutoDestroyRun(virLXCDriver *driver, void virLXCProcessAutoDestroyRun(virLXCDriver *driver,
virConnectPtr conn); virConnectPtr conn);