|
|
6ae9ed |
From 5f706cf9ca50573f42c44d154d18e6c813712610 Mon Sep 17 00:00:00 2001
|
|
|
6ae9ed |
Message-Id: <5f706cf9ca50573f42c44d154d18e6c813712610@dist-git>
|
|
|
6ae9ed |
From: Martin Kletzander <mkletzan@redhat.com>
|
|
|
6ae9ed |
Date: Tue, 2 Aug 2016 13:32:35 +0200
|
|
|
6ae9ed |
Subject: [PATCH] qemu: Fix support for startupPolicy with volume/pool disks
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Until now we simply errored out when the translation from pool+volume
|
|
|
6ae9ed |
failed. However, we should instead check whether that disk is needed or
|
|
|
6ae9ed |
not since there is an option for that.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1168453
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
6ae9ed |
(cherry picked from commit a2b97a8d912a37ba1935bf98be4c332f42332236)
|
|
|
6ae9ed |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
6ae9ed |
---
|
|
|
6ae9ed |
src/qemu/qemu_domain.c | 18 ++++++++++++++++--
|
|
|
6ae9ed |
src/qemu/qemu_domain.h | 5 +++--
|
|
|
6ae9ed |
src/qemu/qemu_process.c | 20 +++++---------------
|
|
|
6ae9ed |
3 files changed, 24 insertions(+), 19 deletions(-)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
6ae9ed |
index c74033b..8ab09c7 100644
|
|
|
6ae9ed |
--- a/src/qemu/qemu_domain.c
|
|
|
6ae9ed |
+++ b/src/qemu/qemu_domain.c
|
|
|
6ae9ed |
@@ -27,6 +27,7 @@
|
|
|
6ae9ed |
#include "qemu_alias.h"
|
|
|
6ae9ed |
#include "qemu_cgroup.h"
|
|
|
6ae9ed |
#include "qemu_command.h"
|
|
|
6ae9ed |
+#include "qemu_process.h"
|
|
|
6ae9ed |
#include "qemu_parse_command.h"
|
|
|
6ae9ed |
#include "qemu_capabilities.h"
|
|
|
6ae9ed |
#include "qemu_migration.h"
|
|
|
6ae9ed |
@@ -4110,11 +4111,14 @@ qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver,
|
|
|
6ae9ed |
|
|
|
6ae9ed |
|
|
|
6ae9ed |
int
|
|
|
6ae9ed |
-qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
|
|
|
6ae9ed |
+qemuDomainCheckDiskPresence(virConnectPtr conn,
|
|
|
6ae9ed |
+ virQEMUDriverPtr driver,
|
|
|
6ae9ed |
virDomainObjPtr vm,
|
|
|
6ae9ed |
- bool cold_boot)
|
|
|
6ae9ed |
+ unsigned int flags)
|
|
|
6ae9ed |
{
|
|
|
6ae9ed |
size_t i;
|
|
|
6ae9ed |
+ bool pretend = flags & VIR_QEMU_PROCESS_START_PRETEND;
|
|
|
6ae9ed |
+ bool cold_boot = flags & VIR_QEMU_PROCESS_START_COLD;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
VIR_DEBUG("Checking for disk presence");
|
|
|
6ae9ed |
for (i = vm->def->ndisks; i > 0; i--) {
|
|
|
6ae9ed |
@@ -4122,6 +4126,16 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
|
|
|
6ae9ed |
virDomainDiskDefPtr disk = vm->def->disks[idx];
|
|
|
6ae9ed |
virStorageFileFormat format = virDomainDiskGetFormat(disk);
|
|
|
6ae9ed |
|
|
|
6ae9ed |
+ if (virStorageTranslateDiskSourcePool(conn, vm->def->disks[idx]) < 0) {
|
|
|
6ae9ed |
+ if (pretend ||
|
|
|
6ae9ed |
+ qemuDomainCheckDiskStartupPolicy(driver, vm, idx, cold_boot) < 0)
|
|
|
6ae9ed |
+ return -1;
|
|
|
6ae9ed |
+ continue;
|
|
|
6ae9ed |
+ }
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
+ if (pretend)
|
|
|
6ae9ed |
+ continue;
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
if (virStorageSourceIsEmpty(disk->src))
|
|
|
6ae9ed |
continue;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
|
|
|
6ae9ed |
index bbec0d4..888732a 100644
|
|
|
6ae9ed |
--- a/src/qemu/qemu_domain.h
|
|
|
6ae9ed |
+++ b/src/qemu/qemu_domain.h
|
|
|
6ae9ed |
@@ -537,9 +537,10 @@ void qemuDomainSetFakeReboot(virQEMUDriverPtr driver,
|
|
|
6ae9ed |
bool qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv,
|
|
|
6ae9ed |
qemuDomainJob job);
|
|
|
6ae9ed |
|
|
|
6ae9ed |
-int qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
|
|
|
6ae9ed |
+int qemuDomainCheckDiskPresence(virConnectPtr conn,
|
|
|
6ae9ed |
+ virQEMUDriverPtr driver,
|
|
|
6ae9ed |
virDomainObjPtr vm,
|
|
|
6ae9ed |
- bool start_with_state);
|
|
|
6ae9ed |
+ unsigned int flags);
|
|
|
6ae9ed |
|
|
|
6ae9ed |
int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
|
|
|
6ae9ed |
virDomainObjPtr vm,
|
|
|
6ae9ed |
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
|
6ae9ed |
index 129c070..2f0ef2b 100644
|
|
|
6ae9ed |
--- a/src/qemu/qemu_process.c
|
|
|
6ae9ed |
+++ b/src/qemu/qemu_process.c
|
|
|
6ae9ed |
@@ -4893,21 +4893,11 @@ qemuProcessPrepareDomain(virConnectPtr conn,
|
|
|
6ae9ed |
if (qemuProcessSetupGraphics(driver, vm, flags) < 0)
|
|
|
6ae9ed |
goto cleanup;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
- /* "volume" type disk's source must be translated before
|
|
|
6ae9ed |
- * cgroup and security setting.
|
|
|
6ae9ed |
- */
|
|
|
6ae9ed |
- for (i = 0; i < vm->def->ndisks; i++) {
|
|
|
6ae9ed |
- if (virStorageTranslateDiskSourcePool(conn, vm->def->disks[i]) < 0)
|
|
|
6ae9ed |
- goto cleanup;
|
|
|
6ae9ed |
- }
|
|
|
6ae9ed |
-
|
|
|
6ae9ed |
- /* drop possibly missing disks from the definition. This needs to happen
|
|
|
6ae9ed |
- * after the def is copied, aliases are set and disk sources are translated */
|
|
|
6ae9ed |
- if (!(flags & VIR_QEMU_PROCESS_START_PRETEND)) {
|
|
|
6ae9ed |
- if (qemuDomainCheckDiskPresence(driver, vm,
|
|
|
6ae9ed |
- flags & VIR_QEMU_PROCESS_START_COLD) < 0)
|
|
|
6ae9ed |
- goto cleanup;
|
|
|
6ae9ed |
- }
|
|
|
6ae9ed |
+ /* Drop possibly missing disks from the definition. This function
|
|
|
6ae9ed |
+ * also resolves source pool/volume into a path and it needs to
|
|
|
6ae9ed |
+ * happen after the def is copied and aliases are set. */
|
|
|
6ae9ed |
+ if (qemuDomainCheckDiskPresence(conn, driver, vm, flags) < 0)
|
|
|
6ae9ed |
+ goto cleanup;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
VIR_DEBUG("Create domain masterKey");
|
|
|
6ae9ed |
if (qemuDomainMasterKeyCreate(vm) < 0)
|
|
|
6ae9ed |
--
|
|
|
6ae9ed |
2.9.2
|
|
|
6ae9ed |
|