[libvirt] [PATCH 1/3] qemu: Don't reject making domain persistent if block copy is running

Peter Krempa pkrempa at redhat.com
Mon Jan 21 15:26:43 UTC 2019


Add documentation that the 'VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB' flag
is auto-assumed if the block copy job is started while the VM is
transient and remove the restriction to define the domain when copy
is running.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/libvirt-domain.c   | 13 ++-----------
 src/qemu/qemu_driver.c |  6 ------
 2 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 75c9014c0e..c155b36e16 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -6137,11 +6137,6 @@ virDomainGetBlockInfo(virDomainPtr domain, const char *disk,
  * virDomainUndefine(). A previous definition for this domain would be
  * overridden if it already exists.
  *
- * Some hypervisors may prevent this operation if there is a current
- * block copy operation on a transient domain with the same id as the
- * domain being defined; in that case, use virDomainBlockJobAbort() to
- * stop the block copy first.
- *
  * virDomainFree should be used to free the resources after the
  * domain object is no longer needed.
  *
@@ -6185,11 +6180,6 @@ virDomainDefineXML(virConnectPtr conn, const char *xml)
  * virDomainUndefine(). A previous definition for this domain would be
  * overridden if it already exists.
  *
- * Some hypervisors may prevent this operation if there is a current
- * block copy operation on a transient domain with the same id as the
- * domain being defined; in that case, use virDomainBlockJobAbort() to
- * stop the block copy first.
- *
  * virDomainFree should be used to free the resources after the
  * domain object is no longer needed.
  *
@@ -10316,7 +10306,8 @@ virDomainBlockRebase(virDomainPtr dom, const char *disk,
  *
  * If @flags contains VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB the job will not be
  * recoverable if the VM is turned off while job is active. This flag will
- * remove the restriction of copy jobs to transient domains.
+ * remove the restriction of copy jobs to transient domains. Note that this flag
+ * is automatically implied if the VM is transient at the time it's started.
  *
  * The @disk parameter is either an unambiguous source name of the
  * block device (the <source file='...'/> sub-element, such as
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 90319261ff..567d39ea35 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7713,12 +7713,6 @@ qemuDomainDefineXMLFlags(virConnectPtr conn,
         goto cleanup;
     def = NULL;

-    if (qemuDomainHasBlockjob(vm, true)) {
-        virReportError(VIR_ERR_BLOCK_COPY_ACTIVE, "%s",
-                       _("domain has active block job"));
-        virDomainObjAssignDef(vm, NULL, false, NULL);
-        goto cleanup;
-    }
     vm->persistent = 1;

     if (virDomainSaveConfig(cfg->configDir, driver->caps,
-- 
2.20.1




More information about the libvir-list mailing list