--- src/qemu/qemu_domain.c | 18 +++++++++++++++++- src/qemu/qemu_domain.h | 5 +++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b202d02f9..8aa082618 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5625,7 +5625,23 @@ qemuDomainCheckRemoveOptionalDisk(virQEMUDriverPtr driver, qemuDomainEventQueue(driver, event); } -static int + +/** + * qemuDomainCheckDiskStartupPolicy: + * @driver: qemu driver object + * @vm: domain object + * @disk: index of disk to check + * @cold_boot: true if a new VM is being started + * + * This function should be called when the source storage for a disk device is + * missing. The function checks whether the startup policy for the disk allows + * removal of the source (or disk) according to the state of the VM. + * + * The function returns 0 if the source or disk was dropped and -1 if the state + * of the VM does not allow this. This function does not report errors, but + * clears any reported error if 0 is returned. + */ +int qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver, virDomainObjPtr vm, size_t diskIndex, diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 1a47396ab..b3db50c2f 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -639,6 +639,11 @@ void qemuDomainSetFakeReboot(virQEMUDriverPtr driver, bool qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv, qemuDomainJob job); +int qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver, + virDomainObjPtr vm, + size_t diskIndex, + bool cold_boot); + int qemuDomainCheckDiskPresence(virConnectPtr conn, virQEMUDriverPtr driver, virDomainObjPtr vm, -- 2.14.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list