mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 13:17:58 +03:00
qemu: Split up qemuDomainRemoveInactive
Introduce qemuDomainRemoveInactiveJobCommon to handle what will be the common parts of the code with a new function that will be used to call virDomainObjListRemoveLocked instead of the unlocked variant. Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
5095394e1e
commit
6901a9321d
@ -8344,23 +8344,13 @@ qemuDomainSnapshotDiscardAllMetadata(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
static void
|
||||||
* qemuDomainRemoveInactive:
|
qemuDomainRemoveInactiveCommon(virQEMUDriverPtr driver,
|
||||||
*
|
virDomainObjPtr vm)
|
||||||
* The caller must hold a lock to the vm.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
qemuDomainRemoveInactive(virQEMUDriverPtr driver,
|
|
||||||
virDomainObjPtr vm)
|
|
||||||
{
|
{
|
||||||
char *snapDir;
|
char *snapDir;
|
||||||
virQEMUDriverConfigPtr cfg;
|
virQEMUDriverConfigPtr cfg;
|
||||||
|
|
||||||
if (vm->persistent) {
|
|
||||||
/* Short-circuit, we don't want to remove a persistent domain */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg = virQEMUDriverGetConfig(driver);
|
cfg = virQEMUDriverGetConfig(driver);
|
||||||
|
|
||||||
/* Remove any snapshot metadata prior to removing the domain */
|
/* Remove any snapshot metadata prior to removing the domain */
|
||||||
@ -8379,12 +8369,30 @@ qemuDomainRemoveInactive(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
qemuExtDevicesCleanupHost(driver, vm->def);
|
qemuExtDevicesCleanupHost(driver, vm->def);
|
||||||
|
|
||||||
virDomainObjListRemove(driver->domains, vm);
|
|
||||||
|
|
||||||
virObjectUnref(cfg);
|
virObjectUnref(cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qemuDomainRemoveInactive:
|
||||||
|
*
|
||||||
|
* The caller must hold a lock to the vm.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
qemuDomainRemoveInactive(virQEMUDriverPtr driver,
|
||||||
|
virDomainObjPtr vm)
|
||||||
|
{
|
||||||
|
if (vm->persistent) {
|
||||||
|
/* Short-circuit, we don't want to remove a persistent domain */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qemuDomainRemoveInactiveCommon(driver, vm);
|
||||||
|
|
||||||
|
virDomainObjListRemove(driver->domains, vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qemuDomainRemoveInactiveJob:
|
* qemuDomainRemoveInactiveJob:
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user