|
|
6d3351 |
From e88d64a75a55dcd0173ba35b6f100d2ec5fcf312 Mon Sep 17 00:00:00 2001
|
|
|
6d3351 |
Message-Id: <e88d64a75a55dcd0173ba35b6f100d2ec5fcf312@dist-git>
|
|
|
6d3351 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
6d3351 |
Date: Wed, 7 Jun 2017 13:31:21 +0200
|
|
|
6d3351 |
Subject: [PATCH] qemu: Conditionally allow block-copy for persistent domains
|
|
|
6d3351 |
|
|
|
6d3351 |
Allow starting the block-copy job for a persistent domain if a user
|
|
|
6d3351 |
declares by using a flag that the job will not be recovered if the VM is
|
|
|
6d3351 |
switched off while the job is active.
|
|
|
6d3351 |
|
|
|
6d3351 |
This allows to use the block-copy job with persistent VMs under the same
|
|
|
6d3351 |
conditions as would apply to transient domains.
|
|
|
6d3351 |
|
|
|
6d3351 |
(cherry picked from commit b7e534c651bfa28c65f7b11661b478613c96598c)
|
|
|
6d3351 |
|
|
|
6d3351 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1459113
|
|
|
6d3351 |
|
|
|
6d3351 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6d3351 |
---
|
|
|
6d3351 |
include/libvirt/libvirt-domain.h | 3 +++
|
|
|
6d3351 |
src/libvirt-domain.c | 4 ++++
|
|
|
6d3351 |
src/qemu/qemu_driver.c | 9 ++++++---
|
|
|
6d3351 |
3 files changed, 13 insertions(+), 3 deletions(-)
|
|
|
6d3351 |
|
|
|
6d3351 |
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
|
|
|
6d3351 |
index 720db32f76..45f939a8cc 100644
|
|
|
6d3351 |
--- a/include/libvirt/libvirt-domain.h
|
|
|
6d3351 |
+++ b/include/libvirt/libvirt-domain.h
|
|
|
6d3351 |
@@ -2428,6 +2428,9 @@ typedef enum {
|
|
|
6d3351 |
backing chain */
|
|
|
6d3351 |
VIR_DOMAIN_BLOCK_COPY_REUSE_EXT = 1 << 1, /* Reuse existing external
|
|
|
6d3351 |
file for a copy */
|
|
|
6d3351 |
+ VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB = 1 << 2, /* Don't force usage of
|
|
|
6d3351 |
+ recoverable job for the
|
|
|
6d3351 |
+ copy operation */
|
|
|
6d3351 |
} virDomainBlockCopyFlags;
|
|
|
6d3351 |
|
|
|
6d3351 |
/**
|
|
|
6d3351 |
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
|
|
|
6d3351 |
index 4670c54e5e..0adc9e8cbe 100644
|
|
|
6d3351 |
--- a/src/libvirt-domain.c
|
|
|
6d3351 |
+++ b/src/libvirt-domain.c
|
|
|
6d3351 |
@@ -10026,6 +10026,10 @@ virDomainBlockRebase(virDomainPtr dom, const char *disk,
|
|
|
6d3351 |
* or virDomainDetachDevice(), while a copy job is active; they may
|
|
|
6d3351 |
* also restrict a copy job to transient domains.
|
|
|
6d3351 |
*
|
|
|
6d3351 |
+ * If @flags contains VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB the job will not be
|
|
|
6d3351 |
+ * recoverable if the VM is turned off while job is active. This flag will
|
|
|
6d3351 |
+ * remove the restriction of copy jobs to transient domains.
|
|
|
6d3351 |
+ *
|
|
|
6d3351 |
* The @disk parameter is either an unambiguous source name of the
|
|
|
6d3351 |
* block device (the <source file='...'/> sub-element, such as
|
|
|
6d3351 |
* "/path/to/image"), or the device target shorthand (the
|
|
|
6d3351 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
6d3351 |
index a9ac06a63c..354329fe64 100644
|
|
|
6d3351 |
--- a/src/qemu/qemu_driver.c
|
|
|
6d3351 |
+++ b/src/qemu/qemu_driver.c
|
|
|
6d3351 |
@@ -16509,7 +16509,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
|
|
|
6d3351 |
|
|
|
6d3351 |
/* Preliminaries: find the disk we are editing, sanity checks */
|
|
|
6d3351 |
virCheckFlags(VIR_DOMAIN_BLOCK_COPY_SHALLOW |
|
|
|
6d3351 |
- VIR_DOMAIN_BLOCK_COPY_REUSE_EXT, -1);
|
|
|
6d3351 |
+ VIR_DOMAIN_BLOCK_COPY_REUSE_EXT |
|
|
|
6d3351 |
+ VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB, -1);
|
|
|
6d3351 |
|
|
|
6d3351 |
priv = vm->privateData;
|
|
|
6d3351 |
cfg = virQEMUDriverGetConfig(driver);
|
|
|
6d3351 |
@@ -16548,7 +16549,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
|
|
|
6d3351 |
_("block copy is not supported with this QEMU binary"));
|
|
|
6d3351 |
goto endjob;
|
|
|
6d3351 |
}
|
|
|
6d3351 |
- if (vm->persistent) {
|
|
|
6d3351 |
+ if (!(flags & VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB) &&
|
|
|
6d3351 |
+ vm->persistent) {
|
|
|
6d3351 |
/* XXX if qemu ever lets us start a new domain with mirroring
|
|
|
6d3351 |
* already active, we can relax this; but for now, the risk of
|
|
|
6d3351 |
* 'managedsave' due to libvirt-guests means we can't risk
|
|
|
6d3351 |
@@ -16775,7 +16777,8 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *disk, const char *destxml,
|
|
|
6d3351 |
size_t i;
|
|
|
6d3351 |
|
|
|
6d3351 |
virCheckFlags(VIR_DOMAIN_BLOCK_COPY_SHALLOW |
|
|
|
6d3351 |
- VIR_DOMAIN_BLOCK_COPY_REUSE_EXT, -1);
|
|
|
6d3351 |
+ VIR_DOMAIN_BLOCK_COPY_REUSE_EXT |
|
|
|
6d3351 |
+ VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB, -1);
|
|
|
6d3351 |
if (virTypedParamsValidate(params, nparams,
|
|
|
6d3351 |
VIR_DOMAIN_BLOCK_COPY_BANDWIDTH,
|
|
|
6d3351 |
VIR_TYPED_PARAM_ULLONG,
|
|
|
6d3351 |
--
|
|
|
6d3351 |
2.13.1
|
|
|
6d3351 |
|