From nobody Fri May 3 08:40:22 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511526095808930.3980232997422; Fri, 24 Nov 2017 04:21:35 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9514C61BB4; Fri, 24 Nov 2017 12:21:34 +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 65EA5183F9; Fri, 24 Nov 2017 12:21:34 +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 D84734BB79; Fri, 24 Nov 2017 12:21:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAOCLUCe007308 for ; Fri, 24 Nov 2017 07:21:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7062E1802E; Fri, 24 Nov 2017 12:21:30 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id C097C5C88A; Fri, 24 Nov 2017 12:21:29 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 24 Nov 2017 13:21:01 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/3] qemu: domain: Refactor control flow in qemuDomainDetermineDiskChain X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 24 Nov 2017 12:21:34 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Split out clearing of the backing chain prior to other code since it will be required later and optimize few layers of nested conditions and loops. Reviewed-by: John Ferlan --- src/qemu/qemu_domain.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2bda4a726b..0e6ebdc0a8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6151,29 +6151,26 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr drive= r, goto cleanup; } - if (virStorageSourceHasBacking(src)) { - if (force_probe) { - virStorageSourceBackingStoreClear(src); - } else { - /* skip to the end of the chain */ - while (virStorageSourceIsBacking(src)) { - if (report_broken && - virStorageFileSupportsAccess(src)) { - - if (qemuDomainStorageFileInit(driver, vm, src, disk->s= rc) < 0) - goto cleanup; - - if (virStorageFileAccess(src, F_OK) < 0) { - virStorageFileReportBrokenChain(errno, src, disk->= src); - virStorageFileDeinit(src); - goto cleanup; - } + if (force_probe) + virStorageSourceBackingStoreClear(src); - virStorageFileDeinit(src); - } - src =3D src->backingStore; + /* skip to the end of the chain if there is any */ + while (virStorageSourceHasBacking(src)) { + if (report_broken && + virStorageFileSupportsAccess(src)) { + + if (qemuDomainStorageFileInit(driver, vm, src, disk->src) < 0) + goto cleanup; + + if (virStorageFileAccess(src, F_OK) < 0) { + virStorageFileReportBrokenChain(errno, src, disk->src); + virStorageFileDeinit(src); + goto cleanup; } + + virStorageFileDeinit(src); } + src =3D src->backingStore; } /* We skipped to the end of the chain. Skip detection if there's the --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 08:40:22 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511526105124831.6271260118809; Fri, 24 Nov 2017 04:21:45 -0800 (PST) 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 1DDF34902F; Fri, 24 Nov 2017 12:21:44 +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 EEF555C8A3; Fri, 24 Nov 2017 12:21:43 +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 B8AD33FCFD; Fri, 24 Nov 2017 12:21:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAOCLW8K007320 for ; Fri, 24 Nov 2017 07:21:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id D21415C8A3; Fri, 24 Nov 2017 12:21:32 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E3565C88A; Fri, 24 Nov 2017 12:21:30 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 24 Nov 2017 13:21:02 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/3] qemu: process: Move handling of non-backing files into qemuDomainDetermineDiskChain 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.38]); Fri, 24 Nov 2017 12:21:44 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Until now we would skip loading of the backing chain for files which don't support backing chains only when starting up the VM. Move the check from qemuProcessPrepareHostStorage with some adaptations so that's always applied. Reviewed-by: John Ferlan --- src/qemu/qemu_domain.c | 17 +++++++++++++++++ src/qemu/qemu_process.c | 10 ---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0e6ebdc0a8..0cdcb11c37 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6154,6 +6154,23 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, if (force_probe) virStorageSourceBackingStoreClear(src); + /* There is no need to check the backing chain for disks without backi= ng + * support */ + if (virStorageSourceIsLocalStorage(src) && + src->format > VIR_STORAGE_FILE_NONE && + src->format < VIR_STORAGE_FILE_BACKING) { + + if (!virFileExists(src->path)) { + if (report_broken) + virStorageFileReportBrokenChain(errno, src, disk->src); + + goto cleanup; + } + + ret =3D 0; + goto cleanup; + } + /* skip to the end of the chain if there is any */ while (virStorageSourceHasBacking(src)) { if (report_broken && diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 8574f2b413..ea70885dd9 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5555,20 +5555,10 @@ qemuProcessPrepareHostStorage(virQEMUDriverPtr driv= er, for (i =3D vm->def->ndisks; i > 0; i--) { size_t idx =3D i - 1; virDomainDiskDefPtr disk =3D vm->def->disks[idx]; - virStorageFileFormat format =3D virDomainDiskGetFormat(disk); if (virStorageSourceIsEmpty(disk->src)) continue; - /* There is no need to check the backing chain for disks - * without backing support, the fact that the file exists is - * more than enough */ - if (virStorageSourceIsLocalStorage(disk->src) && - format > VIR_STORAGE_FILE_NONE && - format < VIR_STORAGE_FILE_BACKING && - virFileExists(virDomainDiskGetSource(disk))) - continue; - if (qemuDomainDetermineDiskChain(driver, vm, disk, true, true) >= =3D 0) continue; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 08:40:22 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1511526108502562.8210842142844; Fri, 24 Nov 2017 04:21:48 -0800 (PST) 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 C45A8C02738B; Fri, 24 Nov 2017 12:21:46 +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 A01876064E; Fri, 24 Nov 2017 12:21: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 588321800BDC; Fri, 24 Nov 2017 12:21:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAOCLXgW007328 for ; Fri, 24 Nov 2017 07:21:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id CDD7C5C269; Fri, 24 Nov 2017 12:21:33 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BC115C88A; Fri, 24 Nov 2017 12:21:33 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 24 Nov 2017 13:21:03 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 3/3] qemu: domain: Fix backing store terminator for non-backing local files 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.31]); Fri, 24 Nov 2017 12:21:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Raw local files do not pass through the backing store detector and thus the code did not allocate the required backing store terminator for them. Previously the terminating element would be formatted into the XML since the default values used for the metadata allowed that. This is a regression since a693fdba0111ff which was not detected in the review. This patch also reverts all the changes in the test files. Reviewed-by: John Ferlan --- src/qemu/qemu_domain.c | 5 += ++++ .../qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml | 1 + ...uhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml | 2 ++ .../qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml | 1 + ...muhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml | 1 + .../qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml | 1 + .../qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml | 1 + tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml | 1 + tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml | 1 + tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml | 1 + .../qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml | 1 + 11 files changed, 16 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0cdcb11c37..82671d99c6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6167,6 +6167,11 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, goto cleanup; } + /* terminate the chain for such images as the code below would do = */ + if (!src->backingStore && + VIR_ALLOC(src->backingStore) < 0) + goto cleanup; + ret =3D 0; goto cleanup; } diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-vir= tio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio= .xml index 0fa8d036b9..cd03d0e09b 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml @@ -22,6 +22,7 @@ + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-= ccw-virtio+ccw-virtio-1-reverse.xml b/tests/qemuhotplugtestdomains/qemuhotp= lug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml index 135427fff5..7be75f977b 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-vir= tio+ccw-virtio-1-reverse.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-vir= tio+ccw-virtio-1-reverse.xml @@ -22,6 +22,7 @@ + @@ -31,6 +32,7 @@ + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-= ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-wit= h-2-ccw-virtio.xml index e17c4e43b2..a83f1b5d73 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-vir= tio.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-vir= tio.xml @@ -22,6 +22,7 @@ + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-cc= w-virtio+ccw-virtio-2-explicit.xml b/tests/qemuhotplugtestdomains/qemuhotpl= ug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml index 326d312fa9..3e90207519 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virti= o+ccw-virtio-2-explicit.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virti= o+ccw-virtio-2-explicit.xml @@ -22,6 +22,7 @@ + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-cc= w-virtio+ccw-virtio-2.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-c= cw-live-with-ccw-virtio+ccw-virtio-2.xml index 326d312fa9..3e90207519 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virti= o+ccw-virtio-2.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virti= o+ccw-virtio-2.xml @@ -22,6 +22,7 @@ + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-w= wn+disk-scsi-duplicate-wwn.xml b/tests/qemuhotplugtestdomains/qemuhotplug-b= ase-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml index 16caeb3542..4c3ea3202b 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk= -scsi-duplicate-wwn.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk= -scsi-duplicate-wwn.xml @@ -33,6 +33,7 @@ + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.x= ml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml index a6dbf0b1bd..493a615fd3 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml @@ -22,6 +22,7 @@ + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xm= l b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml index 6ccb88f140..3609819ea3 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml @@ -22,6 +22,7 @@ + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio= .xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml index b97c0b41e2..b88b220e33 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml @@ -22,6 +22,7 @@ + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-con= troller-live+disk-scsi-2.xml b/tests/qemuhotplugtestdomains/qemuhotplug-bas= e-without-scsi-controller-live+disk-scsi-2.xml index 6422e1640d..c12d18f716 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller= -live+disk-scsi-2.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller= -live+disk-scsi-2.xml @@ -22,6 +22,7 @@ + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list