From nobody Sun May 5 04:00:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1496760408139156.568687586024; Tue, 6 Jun 2017 07:46:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9CD088123D; Tue, 6 Jun 2017 14:46:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6F00FDC279; Tue, 6 Jun 2017 14:46:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 185E9180BAFC; Tue, 6 Jun 2017 14:46:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v56EkMAx029178 for ; Tue, 6 Jun 2017 10:46:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0C0A917D38; Tue, 6 Jun 2017 14:46:22 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 618CC17D5F; Tue, 6 Jun 2017 14:46:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9CD088123D Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9CD088123D From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 6 Jun 2017 16:46:14 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/2] qemu: Conditionally allow block-copy for persistent domains X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 06 Jun 2017 14:46:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Allow starting the block-copy job for a persistent domain if a user declares by using a flag that the job will not be recovered if the VM is switched off while the job is active. This allows to use the block-copy job with persistent VMs under the same conditions as would apply to transient domains. --- include/libvirt/libvirt-domain.h | 3 +++ src/libvirt-domain.c | 3 +++ src/qemu/qemu_driver.c | 9 ++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 720db32f7..45f939a8c 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -2428,6 +2428,9 @@ typedef enum { backing chain */ VIR_DOMAIN_BLOCK_COPY_REUSE_EXT =3D 1 << 1, /* Reuse existing external file for a copy */ + VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB =3D 1 << 2, /* Don't force usage of + recoverable job for t= he + copy operation */ } virDomainBlockCopyFlags; /** diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 310b91b37..6726a5120 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -10027,6 +10027,9 @@ virDomainBlockRebase(virDomainPtr dom, const char *= disk, * or virDomainDetachDevice(), while a copy job is active; they may * also restrict a copy job to transient domains. * + * If @flags contains VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB the job will not= be + * recoverable if the VM is turned of while job is active. + * * The @disk parameter is either an unambiguous source name of the * block device (the sub-element, such as * "/path/to/image"), or the device target shorthand (the diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f0cdea659..29efda198 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16507,7 +16507,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, /* Preliminaries: find the disk we are editing, sanity checks */ virCheckFlags(VIR_DOMAIN_BLOCK_COPY_SHALLOW | - VIR_DOMAIN_BLOCK_COPY_REUSE_EXT, -1); + VIR_DOMAIN_BLOCK_COPY_REUSE_EXT | + VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB, -1); priv =3D vm->privateData; cfg =3D virQEMUDriverGetConfig(driver); @@ -16546,7 +16547,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, _("block copy is not supported with this QEMU binar= y")); goto endjob; } - if (vm->persistent) { + if (!(flags & VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB) && + vm->persistent) { /* XXX if qemu ever lets us start a new domain with mirroring * already active, we can relax this; but for now, the risk of * 'managedsave' due to libvirt-guests means we can't risk @@ -16773,7 +16775,8 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *d= isk, const char *destxml, size_t i; virCheckFlags(VIR_DOMAIN_BLOCK_COPY_SHALLOW | - VIR_DOMAIN_BLOCK_COPY_REUSE_EXT, -1); + VIR_DOMAIN_BLOCK_COPY_REUSE_EXT | + VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB, -1); if (virTypedParamsValidate(params, nparams, VIR_DOMAIN_BLOCK_COPY_BANDWIDTH, VIR_TYPED_PARAM_ULLONG, --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 04:00:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1496770721902943.8323709239952; Tue, 6 Jun 2017 10:38:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 90CFC80481; Tue, 6 Jun 2017 17:38:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6AF4E7D4E3; Tue, 6 Jun 2017 17:38:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 14B904A48F; Tue, 6 Jun 2017 17:38:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v56EkNli029189 for ; Tue, 6 Jun 2017 10:46:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 000C517D29; Tue, 6 Jun 2017 14:46:23 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5703F17CCF; Tue, 6 Jun 2017 14:46:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 90CFC80481 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 90CFC80481 From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 6 Jun 2017 16:46:15 +0200 Message-Id: <94f280a2f9b95bb517105feba1b9408d772653fb.1496760336.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/2] virsh: Add support for VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 06 Jun 2017 17:38:40 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Allow using the new flag with virsh. --- tools/virsh-domain.c | 10 +++++++++- tools/virsh.pod | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index ccb514ef9..f39589c20 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2184,6 +2184,10 @@ static const vshCmdOptDef opts_block_copy[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("the bandwidth limit is in bytes/s rather than MiB/s") }, + {.name =3D "transient-job", + .type =3D VSH_OT_BOOL, + .help =3D N_("the copy job is not persisted if VM is turned off") + }, {.name =3D NULL} }; @@ -2205,6 +2209,7 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd) bool blocking =3D vshCommandOptBool(cmd, "wait") || finish || pivot; bool async =3D vshCommandOptBool(cmd, "async"); bool bytes =3D vshCommandOptBool(cmd, "bytes"); + bool transientjob =3D vshCommandOptBool(cmd, "transient-job"); int timeout =3D 0; const char *path =3D NULL; int abort_flags =3D 0; @@ -2234,6 +2239,8 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd) flags |=3D VIR_DOMAIN_BLOCK_REBASE_SHALLOW; if (vshCommandOptBool(cmd, "reuse-external")) flags |=3D VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT; + if (transientjob) + flags |=3D VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB; if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0) return false; @@ -2282,7 +2289,8 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd) } } - if (granularity || buf_size || (format && STRNEQ(format, "raw")) || xm= l) { + if (granularity || buf_size || (format && STRNEQ(format, "raw")) || xm= l || + transientjob) { /* New API */ if (bandwidth || granularity || buf_size) { params =3D vshCalloc(ctl, 3, sizeof(*params)); diff --git a/tools/virsh.pod b/tools/virsh.pod index aee964689..b15595c3c 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1078,6 +1078,7 @@ command. | I<--xml> B } [I<--shallow>] [I<--reuse-external>] [I] [I<--wait> [I<--async>] [I<--verbose>]] [{I<--pivot> | I<--finish>}] [I<--timeout> B] [I] [I] [I<--bytes>] +[I<--transient-job>] Copy a disk backing image chain to a destination. Either I as the destination file name, or I<--xml> with the name of an XML file contai= ning @@ -1132,6 +1133,9 @@ within a certain range. Specifying I will c= ontrol how much data can be simultaneously in-flight during the copy; larger values use more memory= but may allow faster completion (the default value is usually correct). +I<--transient-job> allows to specify that the user does not require the jo= b to +be recovered if the VM crashes or is turned off before the job completes. + =3Ditem B I I [I] [I<--bytes>] [I] [I<--wait> [I<--verbose>] [I<--timeout> B] [I<--async>]] [I<--keep-relative>] --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list