mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
qemu: Introduce qemuDomainRemoveInactiveJobLocked
Create a qemuDomainRemoveInactiveJobLocked which copies qemuDomainRemoveInactiveJob except of course calling another new helper qemuDomainRemoveInactiveLocked. The qemuDomainRemoveInactiveLocked is a copy of qemuDomainRemoveInactive except that instead of calling virDomainObjListRemove it calls virDomainObjListRemoveLocked. Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
6901a9321d
commit
a7b236345b
@ -8393,6 +8393,28 @@ qemuDomainRemoveInactive(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuDomainRemoveInactiveLocked:
|
||||
*
|
||||
* The caller must hold a lock to the vm and must hold the
|
||||
* lock on driver->domains in order to call the remove obj
|
||||
* from locked list method.
|
||||
*/
|
||||
static void
|
||||
qemuDomainRemoveInactiveLocked(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm)
|
||||
{
|
||||
if (vm->persistent) {
|
||||
/* Short-circuit, we don't want to remove a persistent domain */
|
||||
return;
|
||||
}
|
||||
|
||||
qemuDomainRemoveInactiveCommon(driver, vm);
|
||||
|
||||
virDomainObjListRemoveLocked(driver->domains, vm);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuDomainRemoveInactiveJob:
|
||||
*
|
||||
@ -8416,6 +8438,27 @@ qemuDomainRemoveInactiveJob(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuDomainRemoveInactiveJobLocked:
|
||||
*
|
||||
* Similar to qemuDomainRemoveInactiveJob, except that the caller must
|
||||
* also hold the lock @driver->domains
|
||||
*/
|
||||
void
|
||||
qemuDomainRemoveInactiveJobLocked(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm)
|
||||
{
|
||||
bool haveJob;
|
||||
|
||||
haveJob = qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) >= 0;
|
||||
|
||||
qemuDomainRemoveInactiveLocked(driver, vm);
|
||||
|
||||
if (haveJob)
|
||||
qemuDomainObjEndJob(driver, vm);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
qemuDomainSetFakeReboot(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
|
@ -704,6 +704,9 @@ void qemuDomainRemoveInactive(virQEMUDriverPtr driver,
|
||||
void qemuDomainRemoveInactiveJob(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm);
|
||||
|
||||
void qemuDomainRemoveInactiveJobLocked(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm);
|
||||
|
||||
void qemuDomainSetFakeReboot(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
bool value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user