From nobody Wed Apr 24 07:24:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633766441216481.73043495699653; Sat, 9 Oct 2021 01:00:41 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-232-0GirLHHpNDOlijwzWpGFEQ-1; Sat, 09 Oct 2021 04:00:37 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 486BC1006AA9; Sat, 9 Oct 2021 08:00:31 +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 107995D9DE; Sat, 9 Oct 2021 08:00:28 +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 76CA54E58F; Sat, 9 Oct 2021 08:00:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19980Jkn013039 for ; Sat, 9 Oct 2021 04:00:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 14DC55017B; Sat, 9 Oct 2021 08:00:19 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F4594405A for ; Sat, 9 Oct 2021 08:00:16 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 612CA899EC0 for ; Sat, 9 Oct 2021 08:00:16 +0000 (UTC) Received: from cmccmta1.chinamobile.com (cmccmta1.chinamobile.com [221.176.66.79]) by relay.mimecast.com with ESMTP id us-mta-505-A4GYVc-sMBWoSVS5e4wYGQ-1; Sat, 09 Oct 2021 04:00:13 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.15]) by rmmx-syy-dmz-app01-12001 (RichMail) with SMTP id 2ee161614b26922-768dc; Sat, 09 Oct 2021 15:56:23 +0800 (CST) Received: from localhost.localdomain (unknown[112.25.154.146]) by rmsmtp-syy-appsvr08-12008 (RichMail) with SMTP id 2ee861614b2472f-16324; Sat, 09 Oct 2021 15:56:23 +0800 (CST) X-MC-Unique: 0GirLHHpNDOlijwzWpGFEQ-1 X-MC-Unique: A4GYVc-sMBWoSVS5e4wYGQ-1 X-RM-TRANSID: 2ee161614b26922-768dc X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2ee861614b2472f-16324 From: "dinglimin@cmss.chinamobile.com" To: libvir-list@redhat.com Subject: [PATCH] libvirt qemu add rbd mirror dest in qemuDomainBlockCopyCommon Date: Sat, 9 Oct 2021 15:55:54 +0800 Message-Id: <20211009075554.1659-1-dinglimin@cmss.chinamobile.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: dinglimin 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1633766442960100001 Content-Type: text/plain; charset="utf-8" From: dinglimin The BlockCopy command is designed to copy a chain of disk backup images to = dest. For RBD external destination, before the modification, only the '--XML' par= ameter is supported by 'blockdev-mirror'. After the modification, the '--dest' parameter(--dest 'rbd:xxx/xxx:auth_sup= ported=3Dnone:mon_host=3Dxxx.xxx.xxx.xxx')can be used. Signed-off-by: dinglimin --- src/qemu/qemu_driver.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 760d30a..db15898 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14963,12 +14963,27 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, virStorageSource *mirrorBacking =3D NULL; g_autoptr(GHashTable) blockNamedNodeData =3D NULL; int rc =3D 0; + const char *p =3D NULL; =20 /* Preliminaries: find the disk we are editing, sanity checks */ virCheckFlags(VIR_DOMAIN_BLOCK_COPY_SHALLOW | VIR_DOMAIN_BLOCK_COPY_REUSE_EXT | VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB, -1); =20 + /* if mirror->path contains 'rbd:' prefix, set rbd attributes */ + if (STRPREFIX(mirror->path, "rbd:")) { + mirror->format =3D VIR_STORAGE_FILE_RAW; + mirror->protocol =3D VIR_STORAGE_NET_PROTOCOL_RBD; + mirror->type =3D VIR_STORAGE_TYPE_NETWORK; + + p =3D g_strdup(mirror->path); + if (virStorageSourceParseRBDColonString(p, mirror) < 0) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("RBD path conversion failed")); + return -1; + } + } + =20 if (virStorageSourceIsRelative(mirror)) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("absolute path must be used as block copy target"= )); --=20 1.8.3.1