提交 a2b97a8d 编写于 作者: M Martin Kletzander

qemu: Fix support for startupPolicy with volume/pool disks

Until now we simply errored out when the translation from pool+volume
failed.  However, we should instead check whether that disk is needed or
not since there is an option for that.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1168453Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 779a4ea9
......@@ -27,6 +27,7 @@
#include "qemu_alias.h"
#include "qemu_cgroup.h"
#include "qemu_command.h"
#include "qemu_process.h"
#include "qemu_parse_command.h"
#include "qemu_capabilities.h"
#include "qemu_migration.h"
......@@ -4213,11 +4214,14 @@ qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver,
int
qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
qemuDomainCheckDiskPresence(virConnectPtr conn,
virQEMUDriverPtr driver,
virDomainObjPtr vm,
bool cold_boot)
unsigned int flags)
{
size_t i;
bool pretend = flags & VIR_QEMU_PROCESS_START_PRETEND;
bool cold_boot = flags & VIR_QEMU_PROCESS_START_COLD;
VIR_DEBUG("Checking for disk presence");
for (i = vm->def->ndisks; i > 0; i--) {
......@@ -4225,6 +4229,16 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
virDomainDiskDefPtr disk = vm->def->disks[idx];
virStorageFileFormat format = virDomainDiskGetFormat(disk);
if (virStorageTranslateDiskSourcePool(conn, vm->def->disks[idx]) < 0) {
if (pretend ||
qemuDomainCheckDiskStartupPolicy(driver, vm, idx, cold_boot) < 0)
return -1;
continue;
}
if (pretend)
continue;
if (virStorageSourceIsEmpty(disk->src))
continue;
......
......@@ -545,9 +545,10 @@ void qemuDomainSetFakeReboot(virQEMUDriverPtr driver,
bool qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv,
qemuDomainJob job);
int qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
int qemuDomainCheckDiskPresence(virConnectPtr conn,
virQEMUDriverPtr driver,
virDomainObjPtr vm,
bool start_with_state);
unsigned int flags);
int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
virDomainObjPtr vm,
......
......@@ -4792,21 +4792,11 @@ qemuProcessPrepareDomain(virConnectPtr conn,
if (qemuProcessSetupGraphics(driver, vm, flags) < 0)
goto cleanup;
/* "volume" type disk's source must be translated before
* cgroup and security setting.
*/
for (i = 0; i < vm->def->ndisks; i++) {
if (virStorageTranslateDiskSourcePool(conn, vm->def->disks[i]) < 0)
goto cleanup;
}
/* drop possibly missing disks from the definition. This needs to happen
* after the def is copied, aliases are set and disk sources are translated */
if (!(flags & VIR_QEMU_PROCESS_START_PRETEND)) {
if (qemuDomainCheckDiskPresence(driver, vm,
flags & VIR_QEMU_PROCESS_START_COLD) < 0)
goto cleanup;
}
/* Drop possibly missing disks from the definition. This function
* also resolves source pool/volume into a path and it needs to
* happen after the def is copied and aliases are set. */
if (qemuDomainCheckDiskPresence(conn, driver, vm, flags) < 0)
goto cleanup;
VIR_DEBUG("Create domain masterKey");
if (qemuDomainMasterKeyCreate(vm) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册