From nobody Thu May 2 09:35:39 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1526642968996690.4226042203973; Fri, 18 May 2018 04:29:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4148630D70A6; Fri, 18 May 2018 11:29:27 +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 056DB6595D; Fri, 18 May 2018 11:29:27 +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 B6EDB4CAA0; Fri, 18 May 2018 11:29:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4IBTHVN016012 for ; Fri, 18 May 2018 07:29:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0B9932026E03; Fri, 18 May 2018 11:29:17 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CFC12026DFD for ; Fri, 18 May 2018 11:29:16 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 May 2018 13:28:51 +0200 Message-Id: <2e3bbc6ef2858fb97dd875da185f32fcd5dd6d50.1526642823.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/15] qemu: block: Don't nest storage layer properties into format layer 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 18 May 2018 11:29:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Reference the storage via node name rather than inlining it. This is the approach that will be used with -blockdev/blockdev-add since it allows more control and is more future proof. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_block.c | 8 +- tests/qemublocktest.c | 11 +- .../xml2json/block-raw-noopts.json | 15 ++- .../qemublocktestdata/xml2json/dir-fat-cache.json | 27 ++-- .../qemublocktestdata/xml2json/dir-fat-floppy.json | 19 +-- .../xml2json/dir-fat-readonly.json | 19 +-- .../xml2json/file-backing_basic-aio_threads.json | 82 +++++------ .../file-backing_basic-cache-directsync.json | 108 ++++++++------- .../xml2json/file-backing_basic-cache-none.json | 108 ++++++++------- .../xml2json/file-backing_basic-cache-unsafe.json | 108 ++++++++------- .../file-backing_basic-cache-writeback.json | 108 ++++++++------- .../file-backing_basic-cache-writethrough.json | 108 ++++++++------- .../xml2json/file-backing_basic-detect.json | 76 ++++++----- .../xml2json/file-backing_basic-noopts.json | 60 +++++---- .../xml2json/file-backing_basic-unmap-detect.json | 76 ++++++----- .../xml2json/file-backing_basic-unmap-ignore.json | 76 ++++++----- .../xml2json/file-backing_basic-unmap.json | 76 ++++++----- .../xml2json/file-bochs-noopts.json | 15 ++- .../xml2json/file-cloop-noopts.json | 15 ++- .../xml2json/file-dmg-noopts.json | 15 ++- .../xml2json/file-ploop-noopts.json | 15 ++- .../file-qcow2-backing-chain-encryption.json | 30 +++-- .../xml2json/file-qcow2-backing-chain-noopts.json | 150 +++++++++++------= ---- .../file-qcow2-backing-chain-unterminated.json | 30 +++-- .../xml2json/file-raw-aio_native.json | 25 ++-- .../qemublocktestdata/xml2json/file-raw-luks.json | 15 ++- .../xml2json/file-raw-noopts.json | 15 ++- .../xml2json/file-vdi-noopts.json | 15 ++- .../xml2json/file-vhd-noopts.json | 15 ++- .../xml2json/file-vpc-noopts.json | 15 ++- .../network-qcow2-backing-chain-cache-unsafe.json | 74 +++++----- ...etwork-qcow2-backing-chain-encryption_auth.json | 64 ++++----- 32 files changed, 834 insertions(+), 759 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 12f37cda01..a514e8a055 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1432,7 +1432,6 @@ virJSONValuePtr qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src) { bool backingSupported =3D src->format >=3D VIR_STORAGE_FILE_BACKING; - virJSONValuePtr storage =3D NULL; virJSONValuePtr props =3D NULL; virJSONValuePtr ret =3D NULL; @@ -1446,13 +1445,9 @@ qemuBlockStorageSourceGetBlockdevProps(virStorageSou= rcePtr src) if (!(props =3D qemuBlockStorageSourceGetBlockdevFormatProps(src))) goto cleanup; - if (!(storage =3D qemuBlockStorageSourceGetBackendProps(src, false))) + if (virJSONValueObjectAppendString(props, "file", src->nodestorage) < = 0) goto cleanup; - if (virJSONValueObjectAppend(props, "file", storage) < 0) - goto cleanup; - storage =3D NULL; - if (src->backingStore && backingSupported) { if (virStorageSourceHasBacking(src)) { if (virJSONValueObjectAppendString(props, "backing", @@ -1469,7 +1464,6 @@ qemuBlockStorageSourceGetBlockdevProps(virStorageSour= cePtr src) VIR_STEAL_PTR(ret, props); cleanup: - virJSONValueFree(storage); virJSONValueFree(props); return ret; } diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index eae1ca8ee3..d671505969 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -191,7 +191,8 @@ testQemuDiskXMLToProps(const void *opaque) struct testQemuDiskXMLToJSONData *data =3D (void *) opaque; virDomainDiskDefPtr disk =3D NULL; virStorageSourcePtr n; - virJSONValuePtr props =3D NULL; + virJSONValuePtr formatProps =3D NULL; + virJSONValuePtr storageProps =3D NULL; char *xmlpath =3D NULL; char *xmlstr =3D NULL; int ret =3D -1; @@ -221,7 +222,8 @@ testQemuDiskXMLToProps(const void *opaque) if (testQemuDiskXMLToJSONFakeSecrets(n) < 0) goto cleanup; - if (!(props =3D qemuBlockStorageSourceGetBlockdevProps(n))) { + if (!(formatProps =3D qemuBlockStorageSourceGetBlockdevProps(n)) || + !(storageProps =3D qemuBlockStorageSourceGetBackendProps(n, fa= lse))) { if (!data->fail) { VIR_TEST_VERBOSE("failed to generate qemu blockdev props\n= "); goto cleanup; @@ -231,13 +233,16 @@ testQemuDiskXMLToProps(const void *opaque) goto cleanup; } - if (VIR_APPEND_ELEMENT(data->props, data->nprops, props) < 0) + if (VIR_APPEND_ELEMENT(data->props, data->nprops, formatProps) < 0= || + VIR_APPEND_ELEMENT(data->props, data->nprops, storageProps) < = 0) goto cleanup; } ret =3D 0; cleanup: + virJSONValueFree(formatProps); + virJSONValueFree(storageProps); virDomainDiskDefFree(disk); VIR_FREE(xmlpath); VIR_FREE(xmlstr); diff --git a/tests/qemublocktestdata/xml2json/block-raw-noopts.json b/tests= /qemublocktestdata/xml2json/block-raw-noopts.json index 25bf77d5aa..f223659c76 100644 --- a/tests/qemublocktestdata/xml2json/block-raw-noopts.json +++ b/tests/qemublocktestdata/xml2json/block-raw-noopts.json @@ -2,11 +2,12 @@ "node-name": "0123456789ABCDEF0123456789ABCDE", "read-only": false, "driver": "raw", - "file": { - "driver": "host_device", - "filename": "/dev/blah", - "node-name": "0123456789ABCDEF0123456789ABCDE", - "read-only": false, - "discard": "unmap" - } + "file": "0123456789ABCDEF0123456789ABCDE" +} +{ + "driver": "host_device", + "filename": "/dev/blah", + "node-name": "0123456789ABCDEF0123456789ABCDE", + "read-only": false, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/dir-fat-cache.json b/tests/qe= mublocktestdata/xml2json/dir-fat-cache.json index 8c0a045ed5..ef33add681 100644 --- a/tests/qemublocktestdata/xml2json/dir-fat-cache.json +++ b/tests/qemublocktestdata/xml2json/dir-fat-cache.json @@ -6,17 +6,18 @@ "no-flush": false }, "driver": "raw", - "file": { - "driver": "vvfat", - "dir": "/var/somefiles", - "floppy": false, - "rw": false, - "node-name": "node-s", - "cache": { - "direct": true, - "no-flush": false - }, - "read-only": true, - "discard": "unmap" - } + "file": "node-s" +} +{ + "driver": "vvfat", + "dir": "/var/somefiles", + "floppy": false, + "rw": false, + "node-name": "node-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/dir-fat-floppy.json b/tests/q= emublocktestdata/xml2json/dir-fat-floppy.json index 9685acaa8b..db7954a6bc 100644 --- a/tests/qemublocktestdata/xml2json/dir-fat-floppy.json +++ b/tests/qemublocktestdata/xml2json/dir-fat-floppy.json @@ -2,13 +2,14 @@ "node-name": "node-f", "read-only": true, "driver": "raw", - "file": { - "driver": "vvfat", - "dir": "/var/somefiles", - "floppy": true, - "rw": false, - "node-name": "node-s", - "read-only": true, - "discard": "unmap" - } + "file": "node-s" +} +{ + "driver": "vvfat", + "dir": "/var/somefiles", + "floppy": true, + "rw": false, + "node-name": "node-s", + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/dir-fat-readonly.json b/tests= /qemublocktestdata/xml2json/dir-fat-readonly.json index 7d35d255cc..a306fb4d47 100644 --- a/tests/qemublocktestdata/xml2json/dir-fat-readonly.json +++ b/tests/qemublocktestdata/xml2json/dir-fat-readonly.json @@ -2,13 +2,14 @@ "node-name": "node-f", "read-only": true, "driver": "raw", - "file": { - "driver": "vvfat", - "dir": "/var/somefiles", - "floppy": false, - "rw": false, - "node-name": "node-s", - "read-only": true, - "discard": "unmap" - } + "file": "node-s" +} +{ + "driver": "vvfat", + "dir": "/var/somefiles", + "floppy": false, + "rw": false, + "node-name": "node-s", + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-aio_thread= s.json b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.js= on index dcaf905085..a9bdd1bcc2 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.json @@ -2,61 +2,65 @@ "node-name": "node-a-f", "read-only": false, "driver": "qcow", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/a", - "aio": "threads", - "node-name": "node-a-s", - "read-only": false, - "discard": "unmap" - }, + "file": "node-a-s", "backing": "node-b-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "aio": "threads", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" +} { "node-name": "node-b-f", "read-only": true, "driver": "qed", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/b", - "aio": "threads", - "node-name": "node-b-s", - "read-only": true, - "discard": "unmap" - }, + "file": "node-b-s", "backing": "node-c-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "aio": "threads", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" +} { "node-name": "node-c-f", "read-only": true, "driver": "vmdk", - "file": { - "driver": "gluster", - "volume": "images", - "path": "c", - "server": [ - { - "type": "inet", - "host": "test.org", - "port": "24007" - } - ], - "node-name": "node-c-s", - "read-only": true, - "discard": "unmap" - }, + "file": "node-c-s", "backing": "node-d-f" } +{ + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" +} { "node-name": "node-d-f", "read-only": true, "driver": "raw", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/d", - "aio": "threads", - "node-name": "node-d-s", - "read-only": true, - "discard": "unmap" - } + "file": "node-d-s" +} +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "aio": "threads", + "node-name": "node-d-s", + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-dire= ctsync.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-dir= ectsync.json index 023caf013f..18cd183cd8 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.= json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.= json @@ -6,19 +6,20 @@ "no-flush": false }, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/a", - "node-name": "node-a-s", - "cache": { - "direct": true, - "no-flush": false - }, - "read-only": false, - "discard": "unmap" - }, + "file": "node-a-s", "backing": "node-b-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": false, + "discard": "unmap" +} { "node-name": "node-b-f", "read-only": true, @@ -27,19 +28,20 @@ "no-flush": false }, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/b", - "node-name": "node-b-s", - "cache": { - "direct": true, - "no-flush": false - }, - "read-only": true, - "discard": "unmap" - }, + "file": "node-b-s", "backing": "node-c-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" +} { "node-name": "node-c-f", "read-only": true, @@ -48,27 +50,28 @@ "no-flush": false }, "driver": "qcow2", - "file": { - "driver": "gluster", - "volume": "images", - "path": "c", - "server": [ - { - "type": "inet", - "host": "test.org", - "port": "24007" - } - ], - "node-name": "node-c-s", - "cache": { - "direct": true, - "no-flush": false - }, - "read-only": true, - "discard": "unmap" - }, + "file": "node-c-s", "backing": "node-d-f" } +{ + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" +} { "node-name": "node-d-f", "read-only": true, @@ -77,15 +80,16 @@ "no-flush": false }, "driver": "raw", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/d", - "node-name": "node-d-s", - "cache": { - "direct": true, - "no-flush": false - }, - "read-only": true, - "discard": "unmap" - } + "file": "node-d-s" +} +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none= .json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json index 023caf013f..18cd183cd8 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json @@ -6,19 +6,20 @@ "no-flush": false }, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/a", - "node-name": "node-a-s", - "cache": { - "direct": true, - "no-flush": false - }, - "read-only": false, - "discard": "unmap" - }, + "file": "node-a-s", "backing": "node-b-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": false, + "discard": "unmap" +} { "node-name": "node-b-f", "read-only": true, @@ -27,19 +28,20 @@ "no-flush": false }, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/b", - "node-name": "node-b-s", - "cache": { - "direct": true, - "no-flush": false - }, - "read-only": true, - "discard": "unmap" - }, + "file": "node-b-s", "backing": "node-c-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" +} { "node-name": "node-c-f", "read-only": true, @@ -48,27 +50,28 @@ "no-flush": false }, "driver": "qcow2", - "file": { - "driver": "gluster", - "volume": "images", - "path": "c", - "server": [ - { - "type": "inet", - "host": "test.org", - "port": "24007" - } - ], - "node-name": "node-c-s", - "cache": { - "direct": true, - "no-flush": false - }, - "read-only": true, - "discard": "unmap" - }, + "file": "node-c-s", "backing": "node-d-f" } +{ + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" +} { "node-name": "node-d-f", "read-only": true, @@ -77,15 +80,16 @@ "no-flush": false }, "driver": "raw", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/d", - "node-name": "node-d-s", - "cache": { - "direct": true, - "no-flush": false - }, - "read-only": true, - "discard": "unmap" - } + "file": "node-d-s" +} +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsa= fe.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.= json index 5f6b94a9d5..4e92061c65 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.json @@ -6,19 +6,20 @@ "no-flush": true }, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/a", - "node-name": "node-a-s", - "cache": { - "direct": false, - "no-flush": true - }, - "read-only": false, - "discard": "unmap" - }, + "file": "node-a-s", "backing": "node-b-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "cache": { + "direct": false, + "no-flush": true + }, + "read-only": false, + "discard": "unmap" +} { "node-name": "node-b-f", "read-only": true, @@ -27,19 +28,20 @@ "no-flush": true }, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/b", - "node-name": "node-b-s", - "cache": { - "direct": false, - "no-flush": true - }, - "read-only": true, - "discard": "unmap" - }, + "file": "node-b-s", "backing": "node-c-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "cache": { + "direct": false, + "no-flush": true + }, + "read-only": true, + "discard": "unmap" +} { "node-name": "node-c-f", "read-only": true, @@ -48,27 +50,28 @@ "no-flush": true }, "driver": "qcow2", - "file": { - "driver": "gluster", - "volume": "images", - "path": "c", - "server": [ - { - "type": "inet", - "host": "test.org", - "port": "24007" - } - ], - "node-name": "node-c-s", - "cache": { - "direct": false, - "no-flush": true - }, - "read-only": true, - "discard": "unmap" - }, + "file": "node-c-s", "backing": "node-d-f" } +{ + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "cache": { + "direct": false, + "no-flush": true + }, + "read-only": true, + "discard": "unmap" +} { "node-name": "node-d-f", "read-only": true, @@ -77,15 +80,16 @@ "no-flush": true }, "driver": "raw", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/d", - "node-name": "node-d-s", - "cache": { - "direct": false, - "no-flush": true - }, - "read-only": true, - "discard": "unmap" - } + "file": "node-d-s" +} +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "cache": { + "direct": false, + "no-flush": true + }, + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writ= eback.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writ= eback.json index 9dc7d38850..a105b47483 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.j= son +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.j= son @@ -6,19 +6,20 @@ "no-flush": false }, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/a", - "node-name": "node-a-s", - "cache": { - "direct": false, - "no-flush": false - }, - "read-only": false, - "discard": "unmap" - }, + "file": "node-a-s", "backing": "node-b-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": false, + "discard": "unmap" +} { "node-name": "node-b-f", "read-only": true, @@ -27,19 +28,20 @@ "no-flush": false }, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/b", - "node-name": "node-b-s", - "cache": { - "direct": false, - "no-flush": false - }, - "read-only": true, - "discard": "unmap" - }, + "file": "node-b-s", "backing": "node-c-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" +} { "node-name": "node-c-f", "read-only": true, @@ -48,27 +50,28 @@ "no-flush": false }, "driver": "qcow2", - "file": { - "driver": "gluster", - "volume": "images", - "path": "c", - "server": [ - { - "type": "inet", - "host": "test.org", - "port": "24007" - } - ], - "node-name": "node-c-s", - "cache": { - "direct": false, - "no-flush": false - }, - "read-only": true, - "discard": "unmap" - }, + "file": "node-c-s", "backing": "node-d-f" } +{ + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" +} { "node-name": "node-d-f", "read-only": true, @@ -77,15 +80,16 @@ "no-flush": false }, "driver": "raw", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/d", - "node-name": "node-d-s", - "cache": { - "direct": false, - "no-flush": false - }, - "read-only": true, - "discard": "unmap" - } + "file": "node-d-s" +} +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writ= ethrough.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-w= ritethrough.json index 9dc7d38850..a105b47483 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethroug= h.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethroug= h.json @@ -6,19 +6,20 @@ "no-flush": false }, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/a", - "node-name": "node-a-s", - "cache": { - "direct": false, - "no-flush": false - }, - "read-only": false, - "discard": "unmap" - }, + "file": "node-a-s", "backing": "node-b-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": false, + "discard": "unmap" +} { "node-name": "node-b-f", "read-only": true, @@ -27,19 +28,20 @@ "no-flush": false }, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/b", - "node-name": "node-b-s", - "cache": { - "direct": false, - "no-flush": false - }, - "read-only": true, - "discard": "unmap" - }, + "file": "node-b-s", "backing": "node-c-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" +} { "node-name": "node-c-f", "read-only": true, @@ -48,27 +50,28 @@ "no-flush": false }, "driver": "qcow2", - "file": { - "driver": "gluster", - "volume": "images", - "path": "c", - "server": [ - { - "type": "inet", - "host": "test.org", - "port": "24007" - } - ], - "node-name": "node-c-s", - "cache": { - "direct": false, - "no-flush": false - }, - "read-only": true, - "discard": "unmap" - }, + "file": "node-c-s", "backing": "node-d-f" } +{ + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" +} { "node-name": "node-d-f", "read-only": true, @@ -77,15 +80,16 @@ "no-flush": false }, "driver": "raw", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/d", - "node-name": "node-d-s", - "cache": { - "direct": false, - "no-flush": false - }, - "read-only": true, - "discard": "unmap" - } + "file": "node-d-s" +} +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-detect.jso= n b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json index c1e4c40757..44a6e90fcd 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json @@ -3,58 +3,62 @@ "read-only": false, "detect-zeroes": "on", "driver": "qcow", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/a", - "node-name": "node-a-s", - "read-only": false, - "discard": "unmap" - }, + "file": "node-a-s", "backing": "node-b-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" +} { "node-name": "node-b-f", "read-only": true, "driver": "qed", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/b", - "node-name": "node-b-s", - "read-only": true, - "discard": "unmap" - }, + "file": "node-b-s", "backing": "node-c-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" +} { "node-name": "node-c-f", "read-only": true, "driver": "vmdk", - "file": { - "driver": "gluster", - "volume": "images", - "path": "c", - "server": [ - { - "type": "inet", - "host": "test.org", - "port": "24007" - } - ], - "node-name": "node-c-s", - "read-only": true, - "discard": "unmap" - }, + "file": "node-c-s", "backing": "node-d-f" } +{ + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" +} { "node-name": "node-d-f", "read-only": true, "driver": "raw", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/d", - "node-name": "node-d-s", - "read-only": true, - "discard": "unmap" - } + "file": "node-d-s" +} +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.jso= n b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json index 3285a6ec67..b0fd9b6988 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json @@ -2,50 +2,54 @@ "node-name": "node-a-f", "read-only": false, "driver": "qed", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/a", - "node-name": "node-a-s", - "read-only": false, - "discard": "unmap" - }, + "file": "node-a-s", "backing": "node-b-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" +} { "node-name": "node-b-f", "read-only": true, "driver": "qcow", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/b", - "node-name": "node-b-s", - "read-only": true, - "discard": "unmap" - }, + "file": "node-b-s", "backing": "node-c-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" +} { "node-name": "node-c-f", "read-only": true, "driver": "vmdk", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/c", - "node-name": "node-c-s", - "read-only": true, - "discard": "unmap" - }, + "file": "node-c-s", "backing": "node-d-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/c", + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" +} { "node-name": "node-d-f", "read-only": true, "driver": "raw", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/d", - "node-name": "node-d-s", - "read-only": true, - "discard": "unmap" - } + "file": "node-d-s" +} +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-dete= ct.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.= json index b00008dd54..6cf4e77090 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json @@ -4,61 +4,65 @@ "discard": "unmap", "detect-zeroes": "unmap", "driver": "qcow", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/a", - "node-name": "node-a-s", - "read-only": false, - "discard": "unmap" - }, + "file": "node-a-s", "backing": "node-b-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" +} { "node-name": "node-b-f", "read-only": true, "discard": "unmap", "driver": "qed", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/b", - "node-name": "node-b-s", - "read-only": true, - "discard": "unmap" - }, + "file": "node-b-s", "backing": "node-c-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" +} { "node-name": "node-c-f", "read-only": true, "discard": "unmap", "driver": "vmdk", - "file": { - "driver": "gluster", - "volume": "images", - "path": "c", - "server": [ - { - "type": "inet", - "host": "test.org", - "port": "24007" - } - ], - "node-name": "node-c-s", - "read-only": true, - "discard": "unmap" - }, + "file": "node-c-s", "backing": "node-d-f" } +{ + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" +} { "node-name": "node-d-f", "read-only": true, "discard": "unmap", "driver": "raw", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/d", - "node-name": "node-d-s", - "read-only": true, - "discard": "unmap" - } + "file": "node-d-s" +} +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-igno= re.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.= json index 5419deafc0..b6e454297f 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json @@ -4,61 +4,65 @@ "discard": "ignore", "detect-zeroes": "on", "driver": "qcow", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/a", - "node-name": "node-a-s", - "read-only": false, - "discard": "unmap" - }, + "file": "node-a-s", "backing": "node-b-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" +} { "node-name": "node-b-f", "read-only": true, "discard": "ignore", "driver": "qed", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/b", - "node-name": "node-b-s", - "read-only": true, - "discard": "unmap" - }, + "file": "node-b-s", "backing": "node-c-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" +} { "node-name": "node-c-f", "read-only": true, "discard": "ignore", "driver": "vmdk", - "file": { - "driver": "gluster", - "volume": "images", - "path": "c", - "server": [ - { - "type": "inet", - "host": "test.org", - "port": "24007" - } - ], - "node-name": "node-c-s", - "read-only": true, - "discard": "unmap" - }, + "file": "node-c-s", "backing": "node-d-f" } +{ + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" +} { "node-name": "node-d-f", "read-only": true, "discard": "ignore", "driver": "raw", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/d", - "node-name": "node-d-s", - "read-only": true, - "discard": "unmap" - } + "file": "node-d-s" +} +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json= b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json index 1efc462c06..21a10c8543 100644 --- a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json @@ -3,61 +3,65 @@ "read-only": false, "discard": "unmap", "driver": "qcow", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/a", - "node-name": "node-a-s", - "read-only": false, - "discard": "unmap" - }, + "file": "node-a-s", "backing": "node-b-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" +} { "node-name": "node-b-f", "read-only": true, "discard": "unmap", "driver": "qed", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/b", - "node-name": "node-b-s", - "read-only": true, - "discard": "unmap" - }, + "file": "node-b-s", "backing": "node-c-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" +} { "node-name": "node-c-f", "read-only": true, "discard": "unmap", "driver": "vmdk", - "file": { - "driver": "gluster", - "volume": "images", - "path": "c", - "server": [ - { - "type": "inet", - "host": "test.org", - "port": "24007" - } - ], - "node-name": "node-c-s", - "read-only": true, - "discard": "unmap" - }, + "file": "node-c-s", "backing": "node-d-f" } +{ + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" +} { "node-name": "node-d-f", "read-only": true, "discard": "unmap", "driver": "raw", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/d", - "node-name": "node-d-s", - "read-only": true, - "discard": "unmap" - } + "file": "node-d-s" +} +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-bochs-noopts.json b/test= s/qemublocktestdata/xml2json/file-bochs-noopts.json index 22e2560998..6ab43b2a1c 100644 --- a/tests/qemublocktestdata/xml2json/file-bochs-noopts.json +++ b/tests/qemublocktestdata/xml2json/file-bochs-noopts.json @@ -2,11 +2,12 @@ "node-name": "test1", "read-only": false, "driver": "bochs", - "file": { - "driver": "file", - "filename": "/path/to/i.img", - "node-name": "test2", - "read-only": false, - "discard": "unmap" - } + "file": "test2" +} +{ + "driver": "file", + "filename": "/path/to/i.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-cloop-noopts.json b/test= s/qemublocktestdata/xml2json/file-cloop-noopts.json index b72bb5df56..f709c3d3bd 100644 --- a/tests/qemublocktestdata/xml2json/file-cloop-noopts.json +++ b/tests/qemublocktestdata/xml2json/file-cloop-noopts.json @@ -2,11 +2,12 @@ "node-name": "test1", "read-only": false, "driver": "cloop", - "file": { - "driver": "file", - "filename": "/path/to/i.img", - "node-name": "test2", - "read-only": false, - "discard": "unmap" - } + "file": "test2" +} +{ + "driver": "file", + "filename": "/path/to/i.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-dmg-noopts.json b/tests/= qemublocktestdata/xml2json/file-dmg-noopts.json index 9f2912b8d3..55261de4b2 100644 --- a/tests/qemublocktestdata/xml2json/file-dmg-noopts.json +++ b/tests/qemublocktestdata/xml2json/file-dmg-noopts.json @@ -2,11 +2,12 @@ "node-name": "test1", "read-only": false, "driver": "dmg", - "file": { - "driver": "file", - "filename": "/path/to/i.img", - "node-name": "test2", - "read-only": false, - "discard": "unmap" - } + "file": "test2" +} +{ + "driver": "file", + "filename": "/path/to/i.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-ploop-noopts.json b/test= s/qemublocktestdata/xml2json/file-ploop-noopts.json index 64006d28a3..81fa263098 100644 --- a/tests/qemublocktestdata/xml2json/file-ploop-noopts.json +++ b/tests/qemublocktestdata/xml2json/file-ploop-noopts.json @@ -2,11 +2,12 @@ "node-name": "test1", "read-only": false, "driver": "parallels", - "file": { - "driver": "file", - "filename": "/path/to/i.img", - "node-name": "test2", - "read-only": false, - "discard": "unmap" - } + "file": "test2" +} +{ + "driver": "file", + "filename": "/path/to/i.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encr= yption.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-enc= ryption.json index 94e2ecd1e2..3469c06654 100644 --- a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.= json +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.= json @@ -6,15 +6,16 @@ "format": "luks", "key-secret": "node-b-f-encalias" }, - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/a", - "node-name": "node-a-s", - "read-only": false, - "discard": "unmap" - }, + "file": "node-a-s", "backing": "node-b-f" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" +} { "node-name": "node-b-f", "read-only": true, @@ -23,12 +24,13 @@ "format": "aes", "key-secret": "node-b-f-encalias" }, - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/b", - "node-name": "node-b-s", - "read-only": true, - "discard": "unmap" - }, + "file": "node-b-s", "backing": null } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" +} diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noop= ts.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.= json index 3e7c08f080..6bc6e2fe30 100644 --- a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.json +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.json @@ -2,129 +2,139 @@ "node-name": "#block126", "read-only": false, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/rhel7.3.1507297895", - "node-name": "#block004", - "read-only": false, - "discard": "unmap" - }, + "file": "#block004", "backing": "#block313" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1507297895", + "node-name": "#block004", + "read-only": false, + "discard": "unmap" +} { "node-name": "#block313", "read-only": true, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", - "node-name": "#block256", - "read-only": true, - "discard": "unmap" - }, + "file": "#block256", "backing": "#block556" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", + "node-name": "#block256", + "read-only": true, + "discard": "unmap" +} { "node-name": "#block556", "read-only": true, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "node-name": "#block418", - "read-only": true, - "discard": "unmap" - }, + "file": "#block418", "backing": "#block767" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", + "node-name": "#block418", + "read-only": true, + "discard": "unmap" +} { "node-name": "#block767", "read-only": true, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "node-name": "#block624", - "read-only": true, - "discard": "unmap" - }, + "file": "#block624", "backing": "#block937" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", + "node-name": "#block624", + "read-only": true, + "discard": "unmap" +} { "node-name": "#block937", "read-only": true, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "node-name": "#block869", - "read-only": true, - "discard": "unmap" - }, + "file": "#block869", "backing": "#block1157" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", + "node-name": "#block869", + "read-only": true, + "discard": "unmap" +} { "node-name": "#block1157", "read-only": true, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "node-name": "#block1047", - "read-only": true, - "discard": "unmap" - }, + "file": "#block1047", "backing": "#block1392" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", + "node-name": "#block1047", + "read-only": true, + "discard": "unmap" +} { "node-name": "#block1392", "read-only": true, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "node-name": "#block1279", - "read-only": true, - "discard": "unmap" - }, + "file": "#block1279", "backing": "#block1523" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", + "node-name": "#block1279", + "read-only": true, + "discard": "unmap" +} { "node-name": "#block1523", "read-only": true, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "node-name": "#block1444", - "read-only": true, - "discard": "unmap" - }, + "file": "#block1444", "backing": "#block1742" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", + "node-name": "#block1444", + "read-only": true, + "discard": "unmap" +} { "node-name": "#block1742", "read-only": true, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "node-name": "#block1602", - "read-only": true, - "discard": "unmap" - }, + "file": "#block1602", "backing": "#block1909" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "node-name": "#block1602", + "read-only": true, + "discard": "unmap" +} { "node-name": "#block1909", "read-only": true, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "node-name": "#block1864", - "read-only": true, - "discard": "unmap" - }, + "file": "#block1864", "backing": null } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "node-name": "#block1864", + "read-only": true, + "discard": "unmap" +} diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unte= rminated.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-u= nterminated.json index 8fcdc48bb0..454c07faec 100644 --- a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminate= d.json +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminate= d.json @@ -2,24 +2,26 @@ "node-name": "#block126", "read-only": false, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/rhel7.3.1507297895", - "node-name": "#block004", - "read-only": false, - "discard": "unmap" - }, + "file": "#block004", "backing": "#block313" } +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1507297895", + "node-name": "#block004", + "read-only": false, + "discard": "unmap" +} { "node-name": "#block313", "read-only": true, "driver": "qcow2", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", - "node-name": "#block256", - "read-only": true, - "discard": "unmap" - } + "file": "#block256" +} +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", + "node-name": "#block256", + "read-only": true, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-raw-aio_native.json b/te= sts/qemublocktestdata/xml2json/file-raw-aio_native.json index 2752e0b204..4e63561311 100644 --- a/tests/qemublocktestdata/xml2json/file-raw-aio_native.json +++ b/tests/qemublocktestdata/xml2json/file-raw-aio_native.json @@ -6,16 +6,17 @@ "no-flush": false }, "driver": "raw", - "file": { - "driver": "file", - "filename": "/path/to/i.img", - "aio": "native", - "node-name": "test2", - "cache": { - "direct": true, - "no-flush": false - }, - "read-only": false, - "discard": "unmap" - } + "file": "test2" +} +{ + "driver": "file", + "filename": "/path/to/i.img", + "aio": "native", + "node-name": "test2", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": false, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-raw-luks.json b/tests/qe= mublocktestdata/xml2json/file-raw-luks.json index e3d9c4c26b..c26dd3bba5 100644 --- a/tests/qemublocktestdata/xml2json/file-raw-luks.json +++ b/tests/qemublocktestdata/xml2json/file-raw-luks.json @@ -3,11 +3,12 @@ "read-only": false, "driver": "luks", "key-secret": "test1-encalias", - "file": { - "driver": "file", - "filename": "/path/luks.img", - "node-name": "test2", - "read-only": false, - "discard": "unmap" - } + "file": "test2" +} +{ + "driver": "file", + "filename": "/path/luks.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-raw-noopts.json b/tests/= qemublocktestdata/xml2json/file-raw-noopts.json index 25de571428..cace1f6448 100644 --- a/tests/qemublocktestdata/xml2json/file-raw-noopts.json +++ b/tests/qemublocktestdata/xml2json/file-raw-noopts.json @@ -2,11 +2,12 @@ "node-name": "0123456789ABCDEF0123456789ABCDE", "read-only": false, "driver": "raw", - "file": { - "driver": "file", - "filename": "/var/lib/libvirt/images/i.img", - "node-name": "0123456789ABCDEF0123456789ABCDE", - "read-only": false, - "discard": "unmap" - } + "file": "0123456789ABCDEF0123456789ABCDE" +} +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/i.img", + "node-name": "0123456789ABCDEF0123456789ABCDE", + "read-only": false, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-vdi-noopts.json b/tests/= qemublocktestdata/xml2json/file-vdi-noopts.json index ce8e359c91..15f9da2091 100644 --- a/tests/qemublocktestdata/xml2json/file-vdi-noopts.json +++ b/tests/qemublocktestdata/xml2json/file-vdi-noopts.json @@ -2,11 +2,12 @@ "node-name": "test1", "read-only": false, "driver": "vdi", - "file": { - "driver": "file", - "filename": "/path/to/i.img", - "node-name": "test2", - "read-only": false, - "discard": "unmap" - } + "file": "test2" +} +{ + "driver": "file", + "filename": "/path/to/i.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-vhd-noopts.json b/tests/= qemublocktestdata/xml2json/file-vhd-noopts.json index d4b8e1f55a..ce96c4be8a 100644 --- a/tests/qemublocktestdata/xml2json/file-vhd-noopts.json +++ b/tests/qemublocktestdata/xml2json/file-vhd-noopts.json @@ -2,11 +2,12 @@ "node-name": "test1", "read-only": false, "driver": "vhdx", - "file": { - "driver": "file", - "filename": "/path/to/i.img", - "node-name": "test2", - "read-only": false, - "discard": "unmap" - } + "file": "test2" +} +{ + "driver": "file", + "filename": "/path/to/i.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/file-vpc-noopts.json b/tests/= qemublocktestdata/xml2json/file-vpc-noopts.json index be1ec795a7..9cba99e567 100644 --- a/tests/qemublocktestdata/xml2json/file-vpc-noopts.json +++ b/tests/qemublocktestdata/xml2json/file-vpc-noopts.json @@ -2,11 +2,12 @@ "node-name": "test1", "read-only": false, "driver": "vpc", - "file": { - "driver": "file", - "filename": "/path/to/i.img", - "node-name": "test2", - "read-only": false, - "discard": "unmap" - } + "file": "test2" +} +{ + "driver": "file", + "filename": "/path/to/i.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" } diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-c= ache-unsafe.json b/tests/qemublocktestdata/xml2json/network-qcow2-backing-c= hain-cache-unsafe.json index 6161f3375d..80a694eee4 100644 --- a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-un= safe.json +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-un= safe.json @@ -6,30 +6,31 @@ "no-flush": true }, "driver": "qcow2", - "file": { - "driver": "rbd", - "pool": "rbdpool", - "image": "rbdimg", - "server": [ - { - "host": "host1.example.com", - "port": "0" - }, - { - "host": "host2.example.com", - "port": "0" - } - ], - "user": "testuser-rbd", - "node-name": "node-a-s", - "cache": { - "direct": false, - "no-flush": true + "file": "node-a-s", + "backing": "node-b-f" +} +{ + "driver": "rbd", + "pool": "rbdpool", + "image": "rbdimg", + "server": [ + { + "host": "host1.example.com", + "port": "0" }, - "read-only": false, - "discard": "unmap" + { + "host": "host2.example.com", + "port": "0" + } + ], + "user": "testuser-rbd", + "node-name": "node-a-s", + "cache": { + "direct": false, + "no-flush": true }, - "backing": "node-b-f" + "read-only": false, + "discard": "unmap" } { "node-name": "node-b-f", @@ -39,19 +40,20 @@ "no-flush": true }, "driver": "qcow2", - "file": { - "driver": "iscsi", - "portal": "example.org:3260", - "target": "iscsitarget", - "lun": 1, - "transport": "tcp", - "node-name": "node-b-s", - "cache": { - "direct": false, - "no-flush": true - }, - "read-only": true, - "discard": "unmap" - }, + "file": "node-b-s", "backing": null } +{ + "driver": "iscsi", + "portal": "example.org:3260", + "target": "iscsitarget", + "lun": 1, + "transport": "tcp", + "node-name": "node-b-s", + "cache": { + "direct": false, + "no-flush": true + }, + "read-only": true, + "discard": "unmap" +} diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-e= ncryption_auth.json b/tests/qemublocktestdata/xml2json/network-qcow2-backin= g-chain-encryption_auth.json index 7e7a4e44f7..6e5abbfbdd 100644 --- a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encrypti= on_auth.json +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encrypti= on_auth.json @@ -6,27 +6,28 @@ "format": "luks", "key-secret": "node-b-f-encalias" }, - "file": { - "driver": "rbd", - "pool": "rbdpool", - "image": "rbdimg", - "server": [ - { - "host": "host1.example.com", - "port": "0" - }, - { - "host": "host2.example.com", - "port": "0" - } - ], - "user": "testuser-rbd", - "node-name": "node-a-s", - "read-only": false, - "discard": "unmap" - }, + "file": "node-a-s", "backing": "node-b-f" } +{ + "driver": "rbd", + "pool": "rbdpool", + "image": "rbdimg", + "server": [ + { + "host": "host1.example.com", + "port": "0" + }, + { + "host": "host2.example.com", + "port": "0" + } + ], + "user": "testuser-rbd", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" +} { "node-name": "node-b-f", "read-only": true, @@ -35,17 +36,18 @@ "format": "aes", "key-secret": "node-b-f-encalias" }, - "file": { - "driver": "iscsi", - "portal": "example.org:3260", - "target": "iqn.2016-09.com.example:iscsitarget", - "lun": 1, - "transport": "tcp", - "user": "testuser-iscsi", - "password-secret": "node-b-s-secalias", - "node-name": "node-b-s", - "read-only": true, - "discard": "unmap" - }, + "file": "node-b-s", "backing": null } +{ + "driver": "iscsi", + "portal": "example.org:3260", + "target": "iqn.2016-09.com.example:iscsitarget", + "lun": 1, + "transport": "tcp", + "user": "testuser-iscsi", + "password-secret": "node-b-s-secalias", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" +} --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 09:35:39 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1526642963349717.8123894932847; Fri, 18 May 2018 04:29:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 79DC8A53BF; Fri, 18 May 2018 11:29:21 +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 479CE1001F3C; Fri, 18 May 2018 11:29:21 +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 E73F14BB79; Fri, 18 May 2018 11:29:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4IBTHkD016020 for ; Fri, 18 May 2018 07:29:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id A134F2026E03; Fri, 18 May 2018 11:29:17 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46E312026DFD for ; Fri, 18 May 2018 11:29:17 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 May 2018 13:28:52 +0200 Message-Id: <0888435494589e253742b8023c85494ceb76a7aa.1526642823.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/15] conf: domain: Export virDomainStorageSourceParse 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 18 May 2018 11:29:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It will be used when parsing the migration private data. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/conf/domain_conf.c | 2 +- src/conf/domain_conf.h | 6 ++++++ src/libvirt_private.syms | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3689ac0a82..b220232f3f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8692,7 +8692,7 @@ virDomainDiskSourcePRParse(xmlNodePtr node, } -static int +int virDomainStorageSourceParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virStorageSourcePtr src, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index a78fdee40c..1daf15d454 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3446,6 +3446,12 @@ int virDomainStorageSourceFormat(virBufferPtr attrBu= f, bool skipSeclabels) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); +int virDomainStorageSourceParse(xmlNodePtr node, + xmlXPathContextPtr ctxt, + virStorageSourcePtr src, + unsigned int flags) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); + int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def, int maplen, int ncpumaps, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 3dece252df..a97b7fe223 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -547,6 +547,7 @@ virDomainStateReasonToString; virDomainStateTypeFromString; virDomainStateTypeToString; virDomainStorageSourceFormat; +virDomainStorageSourceParse; virDomainTaintTypeFromString; virDomainTaintTypeToString; virDomainTimerModeTypeFromString; --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 09:35:39 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15266429743911015.378395396732; Fri, 18 May 2018 04:29:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A4FD1A075F; Fri, 18 May 2018 11:29:32 +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 756A226320; Fri, 18 May 2018 11:29:32 +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 2B806180B5B5; Fri, 18 May 2018 11:29:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4IBTIKu016025 for ; Fri, 18 May 2018 07:29:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 446F62026E03; Fri, 18 May 2018 11:29:18 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id DCF052026DFD for ; Fri, 18 May 2018 11:29:17 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 May 2018 13:28:53 +0200 Message-Id: <46e6bf9a1ed6c47b2c7699a4a0271204472b7ff6.1526642823.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/15] qemu: migration: Don't access disk members without lock 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 18 May 2018 11:29:33 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The initiation of a synchronous block job in the NBD storage migration code was placed after entering the monitor thus after the lock on the VM object was unlocked. Thankfully nothing bad could happen in this situation since the migration job prevents any disk detaches or other modifications of the domain object. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_migration.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index f753e42d1b..5fa2b4b56b 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -833,11 +833,12 @@ qemuMigrationSrcDriveMirror(virQEMUDriverPtr driver, hoststr, port, diskAlias) < 0)) goto cleanup; + qemuBlockJobSyncBegin(disk); + if (qemuDomainObjEnterMonitorAsync(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT) <= 0) goto cleanup; - qemuBlockJobSyncBegin(disk); /* Force "raw" format for NBD export */ mon_ret =3D qemuMonitorDriveMirror(priv->mon, diskAlias, nbd_dest, "raw", mirror_speed, 0, 0, mirror= _flags); --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 09:35:39 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15266429627101009.9599908556783; Fri, 18 May 2018 04:29:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB9982A2D44; Fri, 18 May 2018 11:29:20 +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 7FC621001920; Fri, 18 May 2018 11:29:20 +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 0BB33180B536; Fri, 18 May 2018 11:29:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4IBTILp016032 for ; Fri, 18 May 2018 07:29:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id DB0E32026E03; Fri, 18 May 2018 11:29:18 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7FBFD2026DFD for ; Fri, 18 May 2018 11:29:18 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 May 2018 13:28:54 +0200 Message-Id: <8a604e60033b774d2768d8f2b20b43e6e405028f.1526642823.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/15] qemu: caps: Add capability for blockdev-add/blockdev-del 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 18 May 2018 11:29:21 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The capability also represents that 'blockdev-add' is functional. It's necessary to detect it via presence of 'blockdev-del' since blockdev-add did not have the unsupported 'x-blockdev-add' version previously and thus would be marked as present even if we could not use it. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + 14 files changed, 15 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index bface72de2..b841eba0c9 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -487,6 +487,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, /* 300 */ "sdl-gl", "screendump_device", + "blockdev-del", ); @@ -996,6 +997,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] =3D= { { "query-named-block-nodes", QEMU_CAPS_QUERY_NAMED_BLOCK_NODES }, { "query-cpus-fast", QEMU_CAPS_QUERY_CPUS_FAST }, { "qom-list-properties", QEMU_CAPS_QOM_LIST_PROPERTIES }, + { "blockdev-del", QEMU_CAPS_BLOCKDEV_DEL }, }; struct virQEMUCapsStringFlags virQEMUCapsMigration[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 6f9953478a..db5773b02f 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -471,6 +471,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ /* 300 */ QEMU_CAPS_SDL_GL, /* -sdl gl */ QEMU_CAPS_SCREENDUMP_DEVICE, /* screendump command accepts device & he= ad */ + QEMU_CAPS_BLOCKDEV_DEL, /* blockdev-del is supported */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml b/tests/qem= ucapabilitiesdata/caps_2.10.0.aarch64.xml index 5904306848..2206724645 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml @@ -155,6 +155,7 @@ + 2010000 0 303541 diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemuc= apabilitiesdata/caps_2.10.0.ppc64.xml index 2912c8d66b..d2767c1fde 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml @@ -154,6 +154,7 @@ + 2010000 0 382824 diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml b/tests/qemuc= apabilitiesdata/caps_2.10.0.s390x.xml index 518788ac13..3fa1fa569f 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml @@ -116,6 +116,7 @@ + 2010000 0 303434 diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemu= capabilitiesdata/caps_2.10.0.x86_64.xml index 77ca3013b5..9f2ee7a4c4 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml @@ -197,6 +197,7 @@ + 2010000 0 344938 diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml b/tests/qemuc= apabilitiesdata/caps_2.11.0.s390x.xml index 9adca9d46b..012ba109fb 100644 --- a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml @@ -122,6 +122,7 @@ + 2011000 0 342166 diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml b/tests/qem= ucapabilitiesdata/caps_2.12.0.aarch64.xml index de41d96cd0..6fa01c1a2d 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml @@ -163,6 +163,7 @@ + 2011090 0 343099 diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml b/tests/qemuc= apabilitiesdata/caps_2.12.0.ppc64.xml index fc26f934ee..3fdb38df76 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml @@ -160,6 +160,7 @@ + 2011090 0 419968 diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml b/tests/qemuc= apabilitiesdata/caps_2.12.0.s390x.xml index bdfb81c998..cfc85d5849 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml @@ -128,6 +128,7 @@ + 2012000 0 371055 diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml b/tests/qemu= capabilitiesdata/caps_2.12.0.x86_64.xml index 820b3ef759..c8c7e3b8bd 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml @@ -201,6 +201,7 @@ + 2011090 0 390813 diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_2.9.0.ppc64.xml index cfc9405095..8a15683634 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml @@ -146,6 +146,7 @@ + 2009000 0 346538 diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_2.9.0.s390x.xml index 96521efb8a..513aa0b395 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml @@ -111,6 +111,7 @@ + 2009000 0 265159 diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.9.0.x86_64.xml index 0701c244f6..d3e7492590 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml @@ -192,6 +192,7 @@ + 2009000 0 320947 --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 09:35:39 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1526642968060742.5480838843067; Fri, 18 May 2018 04:29:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9F7430F8DA0; Fri, 18 May 2018 11:29:26 +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 7621C9759F; Fri, 18 May 2018 11:29:26 +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 2BF60180B536; Fri, 18 May 2018 11:29:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4IBTJIN016038 for ; Fri, 18 May 2018 07:29:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id A5ED22026E03; Fri, 18 May 2018 11:29:19 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 260162026DFD for ; Fri, 18 May 2018 11:29:19 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 May 2018 13:28:55 +0200 Message-Id: <36d2d56645e8fcb0c795f5eb3ca2c111a1887e78.1526642823.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/15] qemu: monitor: Factor out and document code to format QMP command 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 18 May 2018 11:29:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move formatting of the qemu command out of qemuMonitorJSONMakeCommandRaw to qemuMonitorJSONMakeCommandInternal to allow greater reusability and document the function better. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_monitor_json.c | 70 +++++++++++++++++++++++++++++++---------= ---- 1 file changed, 49 insertions(+), 21 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 6dcded9369..0b0fb7feba 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -464,40 +464,68 @@ qemuMonitorJSONHasError(virJSONValuePtr reply, } -/* Top-level commands and nested transaction list elements share a - * common structure for everything except the dictionary names. */ +/** + * qemuMonitorJSONMakeCommandInternal: + * @cmdname: QMP command name + * @arguments: a JSON object containing command arguments or NULL + * @transaction: format the command as arguments for the 'transaction' com= mand + * + * Create a JSON object used on the QMP monitor to call a command. If + * @transaction is true, the returned object is formatted to be used as a = member + * of the 'transaction' command. + * + * Note that @arguments is always consumed and should not be referenced af= ter + * the call to this function. + */ +static virJSONValuePtr +qemuMonitorJSONMakeCommandInternal(const char *cmdname, + virJSONValuePtr arguments, + bool transaction) +{ + virJSONValuePtr cmd =3D NULL; + virJSONValuePtr ret =3D NULL; + + if (!transaction) { + if (virJSONValueObjectCreate(&cmd, + "s:execute", cmdname, + "A:arguments", &arguments, NULL) < 0) + goto cleanup; + } else { + if (virJSONValueObjectCreate(&cmd, + "s:type", cmdname, + "A:data", &arguments, NULL) < 0) + goto cleanup; + } + + VIR_STEAL_PTR(ret, cmd); + + cleanup: + virJSONValueFree(arguments); + virJSONValueFree(cmd); + return ret; +} + + static virJSONValuePtr ATTRIBUTE_SENTINEL -qemuMonitorJSONMakeCommandRaw(bool wrap, const char *cmdname, ...) +qemuMonitorJSONMakeCommandRaw(bool transaction, + const char *cmdname, + ...) { - virJSONValuePtr obj; + virJSONValuePtr obj =3D NULL; virJSONValuePtr jargs =3D NULL; va_list args; va_start(args, cmdname); - if (!(obj =3D virJSONValueNewObject())) - goto error; - - if (virJSONValueObjectAppendString(obj, wrap ? "type" : "execute", - cmdname) < 0) - goto error; - if (virJSONValueObjectCreateVArgs(&jargs, args) < 0) - goto error; + goto cleanup; - if (jargs && - virJSONValueObjectAppend(obj, wrap ? "data" : "arguments", jargs) = < 0) - goto error; + obj =3D qemuMonitorJSONMakeCommandInternal(cmdname, jargs, transaction= ); + cleanup: va_end(args); return obj; - - error: - virJSONValueFree(obj); - virJSONValueFree(jargs); - va_end(args); - return NULL; } #define qemuMonitorJSONMakeCommand(cmdname, ...) \ --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 09:35:39 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1526642970219487.20821871877604; Fri, 18 May 2018 04:29:30 -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 6068F30C4D27; Fri, 18 May 2018 11:29:28 +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 33178600C9; Fri, 18 May 2018 11:29: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 E0E6D4CAAD; Fri, 18 May 2018 11:29:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4IBTKe7016043 for ; Fri, 18 May 2018 07:29:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 47AA32026E03; Fri, 18 May 2018 11:29:20 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id E161B2026DFD for ; Fri, 18 May 2018 11:29:19 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 May 2018 13:28:56 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/15] qemu: monitor: Add implementation for blockdev-add and blockdev-del 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.40]); Fri, 18 May 2018 11:29:29 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_monitor.c | 37 +++++++++++++++++++++++++++++ src/qemu/qemu_monitor.h | 7 ++++++ src/qemu/qemu_monitor_json.c | 55 ++++++++++++++++++++++++++++++++++++++++= ++++ src/qemu/qemu_monitor_json.h | 9 ++++++++ 4 files changed, 108 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f21bf7000d..fb9583e405 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4412,3 +4412,40 @@ qemuMonitorSetWatchdogAction(qemuMonitorPtr mon, return qemuMonitorJSONSetWatchdogAction(mon, action); } + + +/** + * qemuMonitorBlockdevAdd: + * @mon: monitor object + * @props: JSON object describing the blockdev to add + * + * Adds a new block device (BDS) to qemu. Note that @props is always consu= med + * by this function and should not be accessed after calling this function. + */ +int +qemuMonitorBlockdevAdd(qemuMonitorPtr mon, + virJSONValuePtr props) +{ + VIR_DEBUG("props=3D%p (node-name=3D%s)", props, + NULLSTR(virJSONValueObjectGetString(props, "node-name"))); + + QEMU_CHECK_MONITOR_JSON_GOTO(mon, error); + + return qemuMonitorJSONBlockdevAdd(mon, props); + + error: + virJSONValueFree(props); + return -1; +} + + +int +qemuMonitorBlockdevDel(qemuMonitorPtr mon, + const char *nodename) +{ + VIR_DEBUG("nodename=3D%s", nodename); + + QEMU_CHECK_MONITOR_JSON(mon); + + return qemuMonitorJSONBlockdevDel(mon, nodename); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 6cba37c281..52ad843029 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1142,4 +1142,11 @@ virJSONValuePtr qemuMonitorQueryNamedBlockNodes(qemu= MonitorPtr mon); int qemuMonitorSetWatchdogAction(qemuMonitorPtr mon, const char *action); + +int qemuMonitorBlockdevAdd(qemuMonitorPtr mon, + virJSONValuePtr props); + +int qemuMonitorBlockdevDel(qemuMonitorPtr mon, + const char *nodename); + #endif /* QEMU_MONITOR_H */ diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 0b0fb7feba..61554a7ebc 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -7889,3 +7889,58 @@ qemuMonitorJSONSetWatchdogAction(qemuMonitorPtr mon, virJSONValueFree(reply); return ret; } + + +int +qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon, + virJSONValuePtr props) +{ + virJSONValuePtr cmd; + virJSONValuePtr reply =3D NULL; + int ret =3D -1; + + if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("blockdev-add", + props, false))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + goto cleanup; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + return ret; +} + + +int +qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon, + const char *nodename) +{ + virJSONValuePtr cmd; + virJSONValuePtr reply =3D NULL; + int ret =3D -1; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("blockdev-del", + "s:node-name", nodename, + NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + goto cleanup; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + return ret; +} diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 8461932cac..22bcc1e8ef 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -537,4 +537,13 @@ virJSONValuePtr qemuMonitorJSONQueryNamedBlockNodes(qe= muMonitorPtr mon) int qemuMonitorJSONSetWatchdogAction(qemuMonitorPtr mon, const char *action) ATTRIBUTE_NONNULL(1); + +int qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon, + virJSONValuePtr props) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + +int qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon, + const char *nodename) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + #endif /* QEMU_MONITOR_JSON_H */ --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 09:35:39 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1526642978415286.4026954791984; Fri, 18 May 2018 04:29:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F0A453C7A4B; Fri, 18 May 2018 11:29:36 +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 A553930012A4; Fri, 18 May 2018 11:29:36 +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 5DE323FCFC; Fri, 18 May 2018 11:29:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4IBTLgB016051 for ; Fri, 18 May 2018 07:29:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id DE0CA2026E03; Fri, 18 May 2018 11:29:20 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 831062026DFD for ; Fri, 18 May 2018 11:29:20 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 May 2018 13:28:57 +0200 Message-Id: <31afb1ca53273ff13a51f6ba6e5efb8e583abd8d.1526642823.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/15] qemu: monitor: Introduce support for blockdev-mirror 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 18 May 2018 11:29:37 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" drive-mirror allows only file targets. Introduce support for blockdev-mirror that is able to copy to any BDS described by a node name in qemu. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_monitor.c | 22 ++++++++++++++++++++++ src/qemu/qemu_monitor.h | 9 +++++++++ src/qemu/qemu_monitor_json.c | 39 +++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 9 +++++++++ 4 files changed, 79 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index fb9583e405..315bb460b9 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3362,6 +3362,28 @@ qemuMonitorDriveMirror(qemuMonitorPtr mon, } +int +qemuMonitorBlockdevMirror(qemuMonitorPtr mon, + const char *jobname, + const char *device, + const char *target, + unsigned long long bandwidth, + unsigned int granularity, + unsigned long long buf_size, + unsigned int flags) +{ + VIR_DEBUG("jobname=3D%s, device=3D%s, target=3D%s, bandwidth=3D%lld, " + "granularity=3D%#x, buf_size=3D%lld, flags=3D0x%x", + NULLSTR(jobname), device, target, bandwidth, granularity, + buf_size, flags); + + QEMU_CHECK_MONITOR_JSON(mon); + + return qemuMonitorJSONBlockdevMirror(mon, jobname, device, target, ban= dwidth, + granularity, buf_size, flags); +} + + /* Use the transaction QMP command to run atomic snapshot commands. */ int qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr *actions) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 52ad843029..6acc4edffa 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -860,6 +860,15 @@ int qemuMonitorDriveMirror(qemuMonitorPtr mon, unsigned long long buf_size, unsigned int flags) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); +int qemuMonitorBlockdevMirror(qemuMonitorPtr mon, + const char *jobname, + const char *device, + const char *target, + unsigned long long bandwidth, + unsigned int granularity, + unsigned long long buf_size, + unsigned int flags) + ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4); int qemuMonitorDrivePivot(qemuMonitorPtr mon, const char *device) ATTRIBUTE_NONNULL(2); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 61554a7ebc..2a7abf538e 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4189,6 +4189,45 @@ qemuMonitorJSONDriveMirror(qemuMonitorPtr mon, return ret; } + +int +qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon, + const char *jobname, + const char *device, + const char *target, + unsigned long long speed, + unsigned int granularity, + unsigned long long buf_size, + unsigned int flags) +{ + int ret =3D -1; + virJSONValuePtr cmd; + virJSONValuePtr reply =3D NULL; + bool shallow =3D (flags & VIR_DOMAIN_BLOCK_REBASE_SHALLOW) !=3D 0; + + cmd =3D qemuMonitorJSONMakeCommand("blockdev-mirror", + "S:job-id", jobname, + "s:device", device, + "s:target", target, + "Y:speed", speed, + "z:granularity", granularity, + "P:buf-size", buf_size, + "s:sync", shallow ? "top" : "full", + NULL); + if (!cmd) + return -1; + + if ((ret =3D qemuMonitorJSONCommand(mon, cmd, &reply)) < 0) + goto cleanup; + ret =3D qemuMonitorJSONCheckError(cmd, reply); + + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + return ret; +} + + int qemuMonitorJSONTransaction(qemuMonitorPtr mon, virJSONValuePtr *actions) { diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 22bcc1e8ef..646cfcc8ac 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -264,6 +264,15 @@ int qemuMonitorJSONDriveMirror(qemuMonitorPtr mon, unsigned long long buf_size, unsigned int flags) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); +int qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon, + const char *jobname, + const char *device, + const char *target, + unsigned long long speed, + unsigned int granularity, + unsigned long long buf_size, + unsigned int flags) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4); int qemuMonitorJSONDrivePivot(qemuMonitorPtr mon, const char *device) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 09:35:39 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1526642984347695.7200423125636; Fri, 18 May 2018 04:29:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 363B73110E85; Fri, 18 May 2018 11:29:42 +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 AFF656596B; Fri, 18 May 2018 11:29:41 +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 44AB34BB78; Fri, 18 May 2018 11:29:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4IBTLQK016059 for ; Fri, 18 May 2018 07:29:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 81C772026E03; Fri, 18 May 2018 11:29:21 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 271C92026DFD for ; Fri, 18 May 2018 11:29:21 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 May 2018 13:28:58 +0200 Message-Id: <8959b7b230b5bcdf734cc77f16ce3e7cd7bedfe8.1526642823.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/15] qemu: block: Add helpers for hot-adding virStorageSource via blockdev 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 18 May 2018 11:29:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" These helpers add infrastructure which simplifies adding and rolling back virStorageSources to a running qemu instance. Using of the helper structure and separate functions allows for a much cleaner code in the section dealing with the monitor. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_block.c | 155 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ src/qemu/qemu_block.h | 34 +++++++++++ 2 files changed, 189 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index a514e8a055..09437cdb40 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1467,3 +1467,158 @@ qemuBlockStorageSourceGetBlockdevProps(virStorageSo= urcePtr src) virJSONValueFree(props); return ret; } + + +void +qemuBlockStorageSourceAttachDataFree(qemuBlockStorageSourceAttachDataPtr d= ata) +{ + if (!data) + return; + + virJSONValueFree(data->storageProps); + virJSONValueFree(data->formatProps); + VIR_FREE(data); +} + + +/** + * qemuBlockStorageSourceAttachPrepareBlockdev: + * @src: storage source to prepare data from + * + * Creates a qemuBlockStorageSourceAttachData structure containing data to= attach + * @src to a VM using the blockdev-add approach. Note that this function o= nly + * creates the data for the storage source itself, any other related + * authentication/encryption/... objects need to be prepared separately. + * + * The changes are then applied using qemuBlockStorageSourceAttachApply. + * + * Returns the filled data structure on success or NULL on error and a lib= virt + * error is reported + */ +qemuBlockStorageSourceAttachDataPtr +qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src) +{ + qemuBlockStorageSourceAttachDataPtr data; + qemuBlockStorageSourceAttachDataPtr ret =3D NULL; + + if (VIR_ALLOC(data) < 0) + return NULL; + + if (!(data->formatProps =3D qemuBlockStorageSourceGetBlockdevProps(src= )) || + !(data->storageProps =3D qemuBlockStorageSourceGetBackendProps(src= , false))) + goto cleanup; + + data->storageNodeName =3D src->nodestorage; + data->formatNodeName =3D src->nodeformat; + + VIR_STEAL_PTR(ret, data); + + cleanup: + qemuBlockStorageSourceAttachDataFree(data); + return ret; +} + + +/** + * qemuBlockStorageSourceAttachApply: + * @mon: monitor object + * @data: structure holding data of block device to apply + * + * Attaches a virStorageSource definition converted to + * qemuBlockStorageSourceAttachData to a running VM. This function expects= being + * called after the monitor was entered. + * + * Returns 0 on success and -1 on error with a libvirt error reported. If = an + * error occured, changes which were already applied need to be rolled bac= k by + * calling qemuBlockStorageSourceAttachRollback. + */ +int +qemuBlockStorageSourceAttachApply(qemuMonitorPtr mon, + qemuBlockStorageSourceAttachDataPtr data) +{ + int rv; + + if (data->storageProps) { + rv =3D qemuMonitorBlockdevAdd(mon, data->storageProps); + data->storageProps =3D NULL; + + if (rv < 0) + return -1; + + data->storageAttached =3D true; + } + + if (data->formatProps) { + rv =3D qemuMonitorBlockdevAdd(mon, data->formatProps); + data->formatProps =3D NULL; + + if (rv < 0) + return -1; + + data->formatAttached =3D true; + } + + return 0; +} + + +/** + * qemuBlockStorageSourceAttachRollback: + * @mon: monitor object + * @data: structure holding data of block device to roll back + * + * Attempts a best effort rollback of changes which were made to a running= VM by + * qemuBlockStorageSourceAttachApply. Preserves any existing errors. + * + * This function expects being called after the monitor was entered. + */ +void +qemuBlockStorageSourceAttachRollback(qemuMonitorPtr mon, + qemuBlockStorageSourceAttachDataPtr d= ata) +{ + virErrorPtr orig_err; + + virErrorPreserveLast(&orig_err); + + if (data->formatAttached) + ignore_value(qemuMonitorBlockdevDel(mon, data->formatNodeName)); + + if (data->storageAttached) + ignore_value(qemuMonitorBlockdevDel(mon, data->storageNodeName)); + + virErrorRestore(&orig_err); +} + + +/** + * qemuBlockStorageSourceDetachOneBlockdev: + * @driver: qemu driver object + * @vm: domain object + * @asyncJob: currently running async job + * @src: storage source to detach + * + * Detaches one virStorageSource using blockdev-del. Note that this does n= ot + * detach any authentication/encryption objects. This function enters the + * monitor internally. + */ +int +qemuBlockStorageSourceDetachOneBlockdev(virQEMUDriverPtr driver, + virDomainObjPtr vm, + qemuDomainAsyncJob asyncJob, + virStorageSourcePtr src) +{ + int ret; + + if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + return -1; + + ret =3D qemuMonitorBlockdevDel(qemuDomainGetMonitor(vm), src->nodeform= at); + + if (ret =3D=3D 0) + ret =3D qemuMonitorBlockdevDel(qemuDomainGetMonitor(vm), src->node= storage); + + if (qemuDomainObjExitMonitor(driver, vm) < 0) + return -1; + + return ret; +} diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index f819c6f907..bbaf9ec0f1 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -67,4 +67,38 @@ qemuBlockStorageSourceGetURI(virStorageSourcePtr src); virJSONValuePtr qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src); + +typedef struct qemuBlockStorageSourceAttachData qemuBlockStorageSourceAtta= chData; +typedef qemuBlockStorageSourceAttachData *qemuBlockStorageSourceAttachData= Ptr; +struct qemuBlockStorageSourceAttachData { + virJSONValuePtr storageProps; + const char *storageNodeName; + bool storageAttached; + + virJSONValuePtr formatProps; + const char *formatNodeName; + bool formatAttached; +}; + + +void +qemuBlockStorageSourceAttachDataFree(qemuBlockStorageSourceAttachDataPtr d= ata); + +qemuBlockStorageSourceAttachDataPtr +qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src); + +int +qemuBlockStorageSourceAttachApply(qemuMonitorPtr mon, + qemuBlockStorageSourceAttachDataPtr data= ); + +void +qemuBlockStorageSourceAttachRollback(qemuMonitorPtr mon, + qemuBlockStorageSourceAttachDataPtr d= ata); + +int +qemuBlockStorageSourceDetachOneBlockdev(virQEMUDriverPtr driver, + virDomainObjPtr vm, + qemuDomainAsyncJob asyncJob, + virStorageSourcePtr src); + #endif /* __QEMU_BLOCK_H__ */ --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 09:35:39 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1526642974317640.7259374254966; Fri, 18 May 2018 04:29:34 -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 A5AF7C1F61; Fri, 18 May 2018 11:29:32 +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 6AEB0600CD; Fri, 18 May 2018 11:29:32 +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 2302041F4E; Fri, 18 May 2018 11:29:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4IBTMjS016065 for ; Fri, 18 May 2018 07:29:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 25C2E2026E03; Fri, 18 May 2018 11:29:22 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDFC72026DFD for ; Fri, 18 May 2018 11:29:21 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 May 2018 13:28:59 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/15] qemu: domain: Extract NBD disk migration private data formatting 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.26]); Fri, 18 May 2018 11:29:33 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We will be adding source data to it so extract it to a separate function. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_domain.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d3beee5d87..0bca80f3c6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2067,6 +2067,23 @@ qemuDomainObjPrivateXMLFormatPR(virBufferPtr buf, } +static void +qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf, + virDomainObjPtr vm) +{ + size_t i; + virDomainDiskDefPtr disk; + qemuDomainDiskPrivatePtr diskPriv; + + for (i =3D 0; i < vm->def->ndisks; i++) { + disk =3D vm->def->disks[i]; + diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); + virBufferAsprintf(buf, "\n", + disk->dst, diskPriv->migrating ? "yes" : "no"); + } +} + + static int qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf, virDomainObjPtr vm, @@ -2098,18 +2115,8 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf, if (priv->job.asyncJob !=3D QEMU_ASYNC_JOB_NONE) virBufferAsprintf(&attrBuf, " flags=3D'0x%lx'", priv->job.apiFlags= ); - if (priv->job.asyncJob =3D=3D QEMU_ASYNC_JOB_MIGRATION_OUT) { - size_t i; - virDomainDiskDefPtr disk; - qemuDomainDiskPrivatePtr diskPriv; - - for (i =3D 0; i < vm->def->ndisks; i++) { - disk =3D vm->def->disks[i]; - diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); - virBufferAsprintf(&childBuf, "\n", - disk->dst, diskPriv->migrating ? "yes" : "no= "); - } - } + if (priv->job.asyncJob =3D=3D QEMU_ASYNC_JOB_MIGRATION_OUT) + qemuDomainObjPrivateXMLFormatNBDMigration(&childBuf, vm); if (priv->job.migParams) qemuMigrationParamsFormat(&childBuf, priv->job.migParams); --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 09:35:39 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1526642975063695.7534830388477; Fri, 18 May 2018 04:29:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C22A2A2D55; Fri, 18 May 2018 11:29:33 +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 200FF1001920; Fri, 18 May 2018 11:29:33 +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 CD072180B5B6; Fri, 18 May 2018 11:29:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4IBTMTa016077 for ; Fri, 18 May 2018 07:29:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id C04C02026E03; Fri, 18 May 2018 11:29:22 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 618FC2026DFD for ; Fri, 18 May 2018 11:29:22 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 May 2018 13:29:00 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/15] qemu: domain: Extract parsing of NBD status XML 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 18 May 2018 11:29:34 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Extract the NBD portion of the 'job' status XML element parser into a separate function. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_domain.c | 61 ++++++++++++++++++++++++++++++++--------------= ---- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0bca80f3c6..94a9c5d1bc 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2367,16 +2367,51 @@ qemuDomainObjPrivateXMLParsePR(xmlXPathContextPtr c= txt, } +static int +qemuDomainObjPrivateXMLParseJobNBD(virDomainObjPtr vm, + qemuDomainObjPrivatePtr priv, + xmlXPathContextPtr ctxt) +{ + xmlNodePtr *nodes =3D NULL; + size_t i; + int n; + int ret =3D -1; + + if ((n =3D virXPathNodeSet("./disk[@migrating=3D'yes']", ctxt, &nodes)= ) < 0) + goto cleanup; + + if (n > 0) { + if (priv->job.asyncJob !=3D QEMU_ASYNC_JOB_MIGRATION_OUT) { + VIR_WARN("Found disks marked for migration but we were not " + "migrating"); + n =3D 0; + } + for (i =3D 0; i < n; i++) { + char *dst =3D virXMLPropString(nodes[i], "dev"); + virDomainDiskDefPtr disk; + + if (dst && (disk =3D virDomainDiskByName(vm->def, dst, false))) + QEMU_DOMAIN_DISK_PRIVATE(disk)->migrating =3D true; + VIR_FREE(dst); + } + } + VIR_FREE(nodes); + + ret =3D 0; + + cleanup: + VIR_FREE(nodes); + return ret; +} + + static int qemuDomainObjPrivateXMLParseJob(virDomainObjPtr vm, qemuDomainObjPrivatePtr priv, xmlXPathContextPtr ctxt) { - xmlNodePtr *nodes =3D NULL; xmlNodePtr savedNode =3D ctxt->node; char *tmp =3D NULL; - size_t i; - int n; int ret =3D -1; if (!(ctxt->node =3D virXPathNode("./job[1]", ctxt))) { @@ -2423,26 +2458,9 @@ qemuDomainObjPrivateXMLParseJob(virDomainObjPtr vm, goto cleanup; } - if ((n =3D virXPathNodeSet("./disk[@migrating=3D'yes']", ctxt, &nodes)= ) < 0) + if (qemuDomainObjPrivateXMLParseJobNBD(vm, priv, ctxt) < 0) goto cleanup; - if (n > 0) { - if (priv->job.asyncJob !=3D QEMU_ASYNC_JOB_MIGRATION_OUT) { - VIR_WARN("Found disks marked for migration but we were not " - "migrating"); - n =3D 0; - } - for (i =3D 0; i < n; i++) { - char *dst =3D virXMLPropString(nodes[i], "dev"); - virDomainDiskDefPtr disk; - - if (dst && (disk =3D virDomainDiskByName(vm->def, dst, false))) - QEMU_DOMAIN_DISK_PRIVATE(disk)->migrating =3D true; - VIR_FREE(dst); - } - } - VIR_FREE(nodes); - if (qemuMigrationParamsParse(ctxt, &priv->job.migParams) < 0) goto cleanup; @@ -2451,7 +2469,6 @@ qemuDomainObjPrivateXMLParseJob(virDomainObjPtr vm, cleanup: ctxt->node =3D savedNode; VIR_FREE(tmp); - VIR_FREE(nodes); return ret; } --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 09:35:39 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1526642978099905.2704494471565; Fri, 18 May 2018 04:29:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8664E30E070A; Fri, 18 May 2018 11:29:36 +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 5089930BA8E6; Fri, 18 May 2018 11:29:36 +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 E424F180BACF; Fri, 18 May 2018 11:29:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4IBTNAM016081 for ; Fri, 18 May 2018 07:29:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6697B2026980; Fri, 18 May 2018 11:29:23 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 099552026DFD for ; Fri, 18 May 2018 11:29:22 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 May 2018 13:29:01 +0200 Message-Id: <6a1bc5207cabf84b41f02f44cab30ccbd9cf0227.1526642823.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/15] qemu: domain: Add private data for NBD migration storage source definition 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 18 May 2018 11:29:37 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Allow saving various aspects necessary to do NBD migration via blockdev by storing a 'virStorageSource' in the disk private data meant to store the NBD target of migration. Along with this add code to parse and format it into the status XML. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_domain.c | 162 +++++++++++++++++++++++++++++++++++++++++++++= +--- src/qemu/qemu_domain.h | 1 + 2 files changed, 156 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 94a9c5d1bc..632c025bef 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1015,6 +1015,7 @@ qemuDomainDiskPrivateDispose(void *obj) qemuDomainDiskPrivatePtr priv =3D obj; VIR_FREE(priv->blockJobError); + virStorageSourceFree(priv->migrSource); } static virClassPtr qemuDomainStorageSourcePrivateClass; @@ -2067,20 +2068,82 @@ qemuDomainObjPrivateXMLFormatPR(virBufferPtr buf, } -static void +static int +qemuDomainObjPrivateXMLFormatNBDMigrationSource(virBufferPtr buf, + virStorageSourcePtr src) +{ + virBuffer attrBuf =3D VIR_BUFFER_INITIALIZER; + virBuffer childBuf =3D VIR_BUFFER_INITIALIZER; + virBuffer privateDataBuf =3D VIR_BUFFER_INITIALIZER; + int ret =3D -1; + + virBufferSetChildIndent(&childBuf, buf); + virBufferSetChildIndent(&privateDataBuf, &childBuf); + + virBufferAsprintf(&attrBuf, " type=3D'%s' format=3D'%s'", + virStorageTypeToString(src->type), + virStorageFileFormatTypeToString(src->format)); + + if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, + VIR_DOMAIN_DEF_FORMAT_STATUS, false) = < 0) + goto cleanup; + + if (qemuStorageSourcePrivateDataFormat(src, &privateDataBuf) < 0) + goto cleanup; + + if (virXMLFormatElement(&childBuf, "privateData", NULL, &privateDataBu= f) < 0) + goto cleanup; + + if (virXMLFormatElement(buf, "migrationSource", &attrBuf, &childBuf) <= 0) + goto cleanup; + + ret =3D 0; + + cleanup: + virBufferFreeAndReset(&attrBuf); + virBufferFreeAndReset(&childBuf); + virBufferFreeAndReset(&privateDataBuf); + + return ret; +} + + +static int qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf, virDomainObjPtr vm) { + virBuffer attrBuf =3D VIR_BUFFER_INITIALIZER; + virBuffer childBuf =3D VIR_BUFFER_INITIALIZER; size_t i; virDomainDiskDefPtr disk; qemuDomainDiskPrivatePtr diskPriv; + int ret =3D -1; for (i =3D 0; i < vm->def->ndisks; i++) { disk =3D vm->def->disks[i]; diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); - virBufferAsprintf(buf, "\n", + + virBufferSetChildIndent(&childBuf, buf); + + virBufferAsprintf(&attrBuf, " dev=3D'%s' migrating=3D'%s'", disk->dst, diskPriv->migrating ? "yes" : "no"); + + if (diskPriv->migrSource && + qemuDomainObjPrivateXMLFormatNBDMigrationSource(&childBuf, + diskPriv->migr= Source) < 0) + goto cleanup; + + if (virXMLFormatElement(buf, "disk", &attrBuf, &childBuf) < 0) + goto cleanup; } + + ret =3D 0; + + cleanup: + virBufferFreeAndReset(&attrBuf); + virBufferFreeAndReset(&childBuf); + + return ret; } @@ -2092,6 +2155,7 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf, virBuffer attrBuf =3D VIR_BUFFER_INITIALIZER; virBuffer childBuf =3D VIR_BUFFER_INITIALIZER; qemuDomainJob job =3D priv->job.active; + int ret =3D -1; if (!qemuDomainTrackJob(job)) job =3D QEMU_JOB_NONE; @@ -2115,13 +2179,23 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf, if (priv->job.asyncJob !=3D QEMU_ASYNC_JOB_NONE) virBufferAsprintf(&attrBuf, " flags=3D'0x%lx'", priv->job.apiFlags= ); - if (priv->job.asyncJob =3D=3D QEMU_ASYNC_JOB_MIGRATION_OUT) - qemuDomainObjPrivateXMLFormatNBDMigration(&childBuf, vm); + if (priv->job.asyncJob =3D=3D QEMU_ASYNC_JOB_MIGRATION_OUT && + qemuDomainObjPrivateXMLFormatNBDMigration(&childBuf, vm) < 0) + goto cleanup; if (priv->job.migParams) qemuMigrationParamsFormat(&childBuf, priv->job.migParams); - return virXMLFormatElement(buf, "job", &attrBuf, &childBuf); + if (virXMLFormatElement(buf, "job", &attrBuf, &childBuf) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + virBufferFreeAndReset(&attrBuf); + virBufferFreeAndReset(&childBuf); + + return ret; } @@ -2367,12 +2441,79 @@ qemuDomainObjPrivateXMLParsePR(xmlXPathContextPtr c= txt, } +static int +qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node, + xmlXPathContextPtr ctxt, + virDomainDiskDefPtr disk) +{ + xmlNodePtr savedNode =3D ctxt->node; + qemuDomainDiskPrivatePtr diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); + virStorageSourcePtr migrSource =3D NULL; + char *format =3D NULL; + char *type =3D NULL; + int ret =3D -1; + + ctxt->node =3D node; + + if (!(ctxt->node =3D virXPathNode("./migrationSource", ctxt))) { + ret =3D 0; + goto cleanup; + } + + if (VIR_ALLOC(migrSource) < 0) + goto cleanup; + + if (!(type =3D virXMLPropString(ctxt->node, "type"))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing storage source type")); + goto cleanup; + } + + if (!(format =3D virXMLPropString(ctxt->node, "format"))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + ("missing storage source format")); + goto cleanup; + } + + if ((migrSource->type =3D virStorageTypeFromString(type)) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown storage source type '%s'"), type); + goto cleanup; + } + + if ((migrSource->format =3D virStorageFileFormatTypeFromString(format)= ) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown storage source format '%s'"), format); + goto cleanup; + } + + if (virDomainStorageSourceParse(ctxt->node, ctxt, migrSource, + VIR_DOMAIN_DEF_PARSE_STATUS) < 0) + goto cleanup; + + if ((ctxt->node =3D virXPathNode("./privateData", ctxt)) && + qemuStorageSourcePrivateDataParse(ctxt, migrSource) < 0) + goto cleanup; + + VIR_STEAL_PTR(diskPriv->migrSource, migrSource); + ret =3D 0; + + cleanup: + virStorageSourceFree(migrSource); + VIR_FREE(format); + VIR_FREE(type); + ctxt->node =3D savedNode; + return ret; +} + + static int qemuDomainObjPrivateXMLParseJobNBD(virDomainObjPtr vm, qemuDomainObjPrivatePtr priv, xmlXPathContextPtr ctxt) { xmlNodePtr *nodes =3D NULL; + char *dst =3D NULL; size_t i; int n; int ret =3D -1; @@ -2387,11 +2528,17 @@ qemuDomainObjPrivateXMLParseJobNBD(virDomainObjPtr = vm, n =3D 0; } for (i =3D 0; i < n; i++) { - char *dst =3D virXMLPropString(nodes[i], "dev"); virDomainDiskDefPtr disk; - if (dst && (disk =3D virDomainDiskByName(vm->def, dst, false))) + if ((dst =3D virXMLPropString(nodes[i], "dev")) && + (disk =3D virDomainDiskByName(vm->def, dst, false))) { QEMU_DOMAIN_DISK_PRIVATE(disk)->migrating =3D true; + + if (qemuDomainObjPrivateXMLParseJobNBDSource(nodes[i], ctx= t, + disk) < 0) + goto cleanup; + } + VIR_FREE(dst); } } @@ -2401,6 +2548,7 @@ qemuDomainObjPrivateXMLParseJobNBD(virDomainObjPtr vm, cleanup: VIR_FREE(nodes); + VIR_FREE(dst); return ret; } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 40d1d095a3..000d8fb8d7 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -370,6 +370,7 @@ struct _qemuDomainDiskPrivate { bool blockJobSync; /* the block job needs synchronized termination */ bool migrating; /* the disk is being migrated */ + virStorageSourcePtr migrSource; /* disk source object used for NBD mig= ration */ /* information about the device */ bool tray; /* device has tray */ --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 09:35:39 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1526642989501757.565795217717; Fri, 18 May 2018 04:29:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C8F2F3BB858; Fri, 18 May 2018 11:29:46 +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 9CDD71001F40; Fri, 18 May 2018 11:29:46 +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 4B4AC3FA58; Fri, 18 May 2018 11:29:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4IBTOjv016092 for ; Fri, 18 May 2018 07:29:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0D1C62026E03; Fri, 18 May 2018 11:29:24 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6C5E2026DFD for ; Fri, 18 May 2018 11:29:23 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 May 2018 13:29:02 +0200 Message-Id: <780a721bc8ef45cb2ecfd950fe686bedebf5ee36.1526642823.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/15] test: Add status XML test for NBD tls storage migration 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 18 May 2018 11:29:48 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- .../migration-out-nbd-tls-in.xml | 464 +++++++++++++++++= ++++ .../migration-out-nbd-tls-out.xml | 1 + tests/qemuxml2xmltest.c | 1 + 3 files changed, 466 insertions(+) create mode 100644 tests/qemustatusxml2xmldata/migration-out-nbd-tls-in.xml create mode 120000 tests/qemustatusxml2xmldata/migration-out-nbd-tls-out.x= ml diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-tls-in.xml b/tes= ts/qemustatusxml2xmldata/migration-out-nbd-tls-in.xml new file mode 100644 index 0000000000..be1dc7347e --- /dev/null +++ b/tests/qemustatusxml2xmldata/migration-out-nbd-tls-in.xml @@ -0,0 +1,464 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + upstream + dcf47dbd-46d1-4d5b-b442-262a806a333a + 1024000 + 1024000 + + + + 8 + + + + + /machine + + + hvm + + + + + + + + + + + + + + + + + + + destroy + restart + restart + + + + + + /usr/bin/qemu-system-x86_64 + + + + + + + + base.qcow2 + + + + + + +
+ + + + + + + + + +
+ + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+ + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+ + + +
+ + + + + + + + + + + + + +
+ +