From nobody Tue May 7 19:05:09 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 1528102776485125.55965871400997; Mon, 4 Jun 2018 01:59:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D2B0230014B4; Mon, 4 Jun 2018 08:59:34 +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 920C05B680; Mon, 4 Jun 2018 08:59: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 2FC8618033EF; Mon, 4 Jun 2018 08:59:34 +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 w548x7f7018629 for ; Mon, 4 Jun 2018 04:59:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 744A62026E0E; Mon, 4 Jun 2018 08:59:07 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1357B2026DEF for ; Mon, 4 Jun 2018 08:59:06 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 4 Jun 2018 10:58:43 +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 01/10] tests: Drop tests enabling allowDiskFormatProbing 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 04 Jun 2018 08:59:35 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Format probing will be dropped so remove the tests which will become obsolete. Signed-off-by: Peter Krempa Reviewed-by: J=EF=BF=BDn Tomko --- .../qemuxml2argvdata/disk-many-format-probing.args | 32 ------------- .../qemuxml2argvdata/disk-many-format-probing.xml | 48 ------------------= -- tests/qemuxml2argvtest.c | 6 --- .../disk-many-format-probing.xml | 52 ------------------= ---- tests/qemuxml2xmltest.c | 6 --- 5 files changed, 144 deletions(-) delete mode 100644 tests/qemuxml2argvdata/disk-many-format-probing.args delete mode 100644 tests/qemuxml2argvdata/disk-many-format-probing.xml delete mode 100644 tests/qemuxml2xmloutdata/disk-many-format-probing.xml diff --git a/tests/qemuxml2argvdata/disk-many-format-probing.args b/tests/q= emuxml2argvdata/disk-many-format-probing.args deleted file mode 100644 index 8980b80f92..0000000000 --- a/tests/qemuxml2argvdata/disk-many-format-probing.args +++ /dev/null @@ -1,32 +0,0 @@ -LC_ALL=3DC \ -PATH=3D/bin \ -HOME=3D/home/test \ -USER=3Dtest \ -LOGNAME=3Dtest \ -QEMU_AUDIO_DRV=3Dnone \ -/usr/bin/qemu-system-i686 \ --name QEMUGuest1 \ --S \ --machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ --m 214 \ --smp 1,sockets=3D1,cores=3D1,threads=3D1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ -server,nowait \ --mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ --rtc base=3Dutc \ --no-shutdown \ --no-acpi \ --boot c \ --usb \ --drive file=3D/dev/HostVG/QEMUGuest1,if=3Dnone,id=3Ddrive-ide0-0-0 \ --device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-= 0 \ --drive file=3D/dev/HostVG/QEMUGuest2,if=3Dnone,id=3Ddrive-ide0-0-1 \ --device ide-drive,bus=3Dide.0,unit=3D1,drive=3Ddrive-ide0-0-1,id=3Dide0-0-= 1 \ --drive file=3D/tmp/data.img,if=3Dnone,id=3Ddrive-ide0-1-0 \ --device ide-drive,bus=3Dide.1,unit=3D0,drive=3Ddrive-ide0-1-0,id=3Dide0-1-= 0 \ --drive file=3D/tmp/logs.img,if=3Dnone,id=3Ddrive-ide0-1-1 \ --device ide-drive,bus=3Dide.1,unit=3D1,drive=3Ddrive-ide0-1-1,id=3Dide0-1-1 diff --git a/tests/qemuxml2argvdata/disk-many-format-probing.xml b/tests/qe= muxml2argvdata/disk-many-format-probing.xml deleted file mode 100644 index 5e34eb46e0..0000000000 --- a/tests/qemuxml2argvdata/disk-many-format-probing.xml +++ /dev/null @@ -1,48 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 1 - - hvm - - - - destroy - restart - destroy - - /usr/bin/qemu-system-i686 - - - - -
- - - - - -
- - - - - -
- - - - - -
- - - - - - - - - diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 14a994523f..0f859ca3bc 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2848,12 +2848,6 @@ mymain(void) DO_TEST_CAPS_LATEST("disk-virtio-scsi-reservations"); - /* Test disks with format probing enabled for legacy reasons. - * New tests should not go in this section. */ - driver.config->allowDiskFormatProbing =3D true; - DO_TEST("disk-many-format-probing", QEMU_CAPS_DRIVE_BOOT); - driver.config->allowDiskFormatProbing =3D false; - DO_TEST("video-virtio-gpu-ccw", QEMU_CAPS_CCW, QEMU_CAPS_DEVICE_VIRTIO_GPU, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, diff --git a/tests/qemuxml2xmloutdata/disk-many-format-probing.xml b/tests/= qemuxml2xmloutdata/disk-many-format-probing.xml deleted file mode 100644 index 914b9b0937..0000000000 --- a/tests/qemuxml2xmloutdata/disk-many-format-probing.xml +++ /dev/null @@ -1,52 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 1 - - hvm - - - - destroy - restart - destroy - - /usr/bin/qemu-system-i686 - - - - -
- - - - - -
- - - - - -
- - - - - -
- - -
- - -
- - - - - - - diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index f53f9a7db5..a6be502cf7 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1183,12 +1183,6 @@ mymain(void) QEMU_CAPS_DEVICE_VIRTIO_MOUSE_CCW, QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW); - /* Test disks with format probing enabled for legacy reasons. - * New tests should not go in this section. */ - driver.config->allowDiskFormatProbing =3D true; - DO_TEST("disk-many-format-probing", NONE); - driver.config->allowDiskFormatProbing =3D false; - # define DO_TEST_STATUS(name) \ do { \ if (testInfoSetStatus(&info, name, GIC_NONE) < 0) { \ --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 19:05:09 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 152810275443710.398674424951423; Mon, 4 Jun 2018 01:59:14 -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 91BF530BB205; Mon, 4 Jun 2018 08:59:12 +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 0C7A83001A50; Mon, 4 Jun 2018 08:59:12 +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 4A55B4CA80; Mon, 4 Jun 2018 08:59:10 +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 w548x8dO018637 for ; Mon, 4 Jun 2018 04:59:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 18CC62026E0E; Mon, 4 Jun 2018 08:59:08 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id B11D22026DEF for ; Mon, 4 Jun 2018 08:59:07 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 4 Jun 2018 10:58:44 +0200 Message-Id: <407ab3e587967a095137b7731596045cefc6a923.1528102541.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/10] qemu: conf: Remove 'allow_disk_format_probing' config option 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.47]); Mon, 04 Jun 2018 08:59:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The option is insecure and it has been long enough for users to migrate their disk files to use explicit format. Drop the option and related code. The config parser still parses it and rejects statup if it's still present in the config in enabled state. The augeas lens is also kept so that users can disable it. Signed-off-by: Peter Krempa Reviewed-by: J=EF=BF=BDn Tomko --- src/qemu/qemu.conf | 12 --------- src/qemu/qemu_conf.c | 8 +++++- src/qemu/qemu_conf.h | 1 - src/qemu/qemu_domain.c | 54 +++++++++++-----------------------= ---- src/qemu/qemu_driver.c | 20 +++++--------- src/qemu/test_libvirtd_qemu.aug.in | 1 - 6 files changed, 28 insertions(+), 68 deletions(-) diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index c8e1a62d1c..9be4d2c1e7 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -650,18 +650,6 @@ #relaxed_acs_check =3D 1 -# If allow_disk_format_probing is enabled, libvirt will probe disk -# images to attempt to identify their format, when not otherwise -# specified in the XML. This is disabled by default. -# -# WARNING: Enabling probing is a security hole in almost all -# deployments. It is strongly recommended that users update their -# guest XML elements to include -# elements instead of enabling this option. -# -#allow_disk_format_probing =3D 1 - - # In order to prevent accidentally starting two domains that # share one writable disk, libvirt offers two approaches for # locking files. The first one is sanlock, the other one, diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 5f35a49e91..873c5fd123 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -481,6 +481,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, char **nvram =3D NULL; char *corestr =3D NULL; char **namespaces =3D NULL; + bool tmp; /* Just check the file is readable before opening it, otherwise * libvirt emits an error. @@ -773,8 +774,13 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, goto cleanup; if (virConfGetValueBool(conf, "clear_emulator_capabilities", &cfg->cle= arEmulatorCapabilities) < 0) goto cleanup; - if (virConfGetValueBool(conf, "allow_disk_format_probing", &cfg->allow= DiskFormatProbing) < 0) + if (virConfGetValueBool(conf, "allow_disk_format_probing", &tmp) < 0) goto cleanup; + if (tmp) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("allow_disk_format_probing is no longer supported= ")); + goto cleanup; + } if (virConfGetValueBool(conf, "set_process_name", &cfg->setProcessName= ) < 0) goto cleanup; if (virConfGetValueUInt(conf, "max_processes", &cfg->maxProcesses) < 0) diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 6d25c3e74f..be7d5a1e96 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -161,7 +161,6 @@ struct _virQEMUDriverConfig { bool vncAllowHostAudio; bool nogfxAllowHostAudio; bool clearEmulatorCapabilities; - bool allowDiskFormatProbing; bool setProcessName; unsigned int maxProcesses; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a7c76c1afd..d230ead359 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5917,39 +5917,23 @@ qemuDomainDeviceDiskDefPostParseRestoreSecAlias(vir= DomainDiskDefPtr disk, static int qemuDomainDeviceDiskDefPostParse(virDomainDiskDefPtr disk, virQEMUCapsPtr qemuCaps, - unsigned int parseFlags, - virQEMUDriverConfigPtr cfg) + unsigned int parseFlags) { /* set default disk types and drivers */ - /* assign default storage format and driver according to config */ - if (cfg->allowDiskFormatProbing) { - /* default disk format for drives */ - if (virDomainDiskGetFormat(disk) =3D=3D VIR_STORAGE_FILE_NONE && - (virDomainDiskGetType(disk) =3D=3D VIR_STORAGE_TYPE_FILE || - virDomainDiskGetType(disk) =3D=3D VIR_STORAGE_TYPE_BLOCK)) - virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_AUTO); - - /* default disk format for mirrored drive */ - if (disk->mirror && - disk->mirror->format =3D=3D VIR_STORAGE_FILE_NONE) - disk->mirror->format =3D VIR_STORAGE_FILE_AUTO; - } else { - /* default driver if probing is forbidden */ - if (!virDomainDiskGetDriver(disk) && - virDomainDiskSetDriver(disk, "qemu") < 0) - return -1; + if (!virDomainDiskGetDriver(disk) && + virDomainDiskSetDriver(disk, "qemu") < 0) + return -1; - /* default disk format for drives */ - if (virDomainDiskGetFormat(disk) =3D=3D VIR_STORAGE_FILE_NONE && - (virDomainDiskGetType(disk) =3D=3D VIR_STORAGE_TYPE_FILE || - virDomainDiskGetType(disk) =3D=3D VIR_STORAGE_TYPE_BLOCK)) - virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_RAW); + /* default disk format for drives */ + if (virDomainDiskGetFormat(disk) =3D=3D VIR_STORAGE_FILE_NONE && + (virDomainDiskGetType(disk) =3D=3D VIR_STORAGE_TYPE_FILE || + virDomainDiskGetType(disk) =3D=3D VIR_STORAGE_TYPE_BLOCK)) + virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_RAW); - /* default disk format for mirrored drive */ - if (disk->mirror && - disk->mirror->format =3D=3D VIR_STORAGE_FILE_NONE) - disk->mirror->format =3D VIR_STORAGE_FILE_RAW; - } + /* default disk format for mirrored drive */ + if (disk->mirror && + disk->mirror->format =3D=3D VIR_STORAGE_FILE_NONE) + disk->mirror->format =3D VIR_STORAGE_FILE_RAW; if (qemuDomainDeviceDiskDefPostParseRestoreSecAlias(disk, qemuCaps, parseFlags) < 0) @@ -6044,7 +6028,6 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr de= v, * function shall not fail in that case. It will be re-run on VM start= up * with the capabilities populated. */ virQEMUCapsPtr qemuCaps =3D parseOpaque; - virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); int ret =3D -1; switch ((virDomainDeviceType) dev->type) { @@ -6054,7 +6037,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr de= v, case VIR_DOMAIN_DEVICE_DISK: ret =3D qemuDomainDeviceDiskDefPostParse(dev->data.disk, qemuCaps, - parseFlags, cfg); + parseFlags); break; case VIR_DOMAIN_DEVICE_VIDEO: @@ -6112,7 +6095,6 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr de= v, break; } - virObjectUnref(cfg); return ret; } @@ -7126,11 +7108,6 @@ void qemuDomainObjCheckDiskTaint(virQEMUDriverPtr dr= iver, qemuDomainLogContextPtr logCtxt) { virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); - int format =3D virDomainDiskGetFormat(disk); - - if ((!format || format =3D=3D VIR_STORAGE_FILE_AUTO) && - cfg->allowDiskFormatProbing) - qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_DISK_PROBING, log= Ctxt); if (disk->rawio =3D=3D VIR_TRISTATE_BOOL_YES) qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HIGH_PRIVILEGES, @@ -8085,8 +8062,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, qemuDomainGetImageIds(cfg, vm, src, disk->src, &uid, &gid); if (virStorageFileGetMetadata(src, - uid, gid, - cfg->allowDiskFormatProbing, + uid, gid, false, report_broken) < 0) goto cleanup; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b7c3348550..0283a906af 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -365,8 +365,6 @@ qemuSecurityInit(virQEMUDriverPtr driver) virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); unsigned int flags =3D 0; - if (cfg->allowDiskFormatProbing) - flags |=3D VIR_SECURITY_MANAGER_ALLOW_DISK_PROBE; if (cfg->securityDefaultConfined) flags |=3D VIR_SECURITY_MANAGER_DEFAULT_CONFINED; if (cfg->securityRequireConfined) @@ -11939,8 +11937,7 @@ qemuStorageLimitsRefresh(virQEMUDriverPtr driver, if (virStorageSourceUpdateBackingSizes(src, fd, &sb) < 0) goto cleanup; - if (virStorageSourceUpdateCapacity(src, buf, len, - cfg->allowDiskFormatProbing) < 0) + if (virStorageSourceUpdateCapacity(src, buf, len, false) < 0) goto cleanup; /* If guest is not using raw disk format and is on a host block @@ -14169,16 +14166,11 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUD= riverPtr driver, defdisk->src->path, virStorageFileFormatTypeToString(defdis= k->src->format)); } else { - if (!cfg->allowDiskFormatProbing) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown image format of '%s' and " - "format probing is disabled"), - defdisk->src->path); - goto cleanup; - } - - /* adds cmd line arg: backing_file=3D/path/to/backing/file */ - virCommandAddArgFormat(cmd, "backing_file=3D%s", defdisk->src-= >path); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown image format of '%s' and " + "format probing is disabled"), + defdisk->src->path); + goto cleanup; } /* adds cmd line args: /path/to/target/file */ diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qe= mu.aug.in index 912161c272..587e8f6521 100644 --- a/src/qemu/test_libvirtd_qemu.aug.in +++ b/src/qemu/test_libvirtd_qemu.aug.in @@ -79,7 +79,6 @@ module Test_libvirtd_qemu =3D { "dump_guest_core" =3D "1" } { "mac_filter" =3D "1" } { "relaxed_acs_check" =3D "1" } -{ "allow_disk_format_probing" =3D "1" } { "lock_manager" =3D "lockd" } { "max_queued" =3D "0" } { "keepalive_interval" =3D "5" } --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 19:05:09 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 1528102776815663.8066900311342; Mon, 4 Jun 2018 01:59:36 -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 1642D30C7B95; Mon, 4 Jun 2018 08:59:35 +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 D64003001A50; Mon, 4 Jun 2018 08:59: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 699254CA80; Mon, 4 Jun 2018 08:59:34 +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 w548x8Ok018644 for ; Mon, 4 Jun 2018 04:59:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id AF3D32026E0E; Mon, 4 Jun 2018 08:59:08 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 544572026DEF for ; Mon, 4 Jun 2018 08:59:08 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 4 Jun 2018 10:58:45 +0200 Message-Id: <2f3f273d3537845293255e1637b7e6ff2accb39d.1528102541.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/10] qemu: driver: Remove impossible code path in qemuDomainSnapshotCreateInactiveExternal 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.42]); Mon, 04 Jun 2018 08:59:35 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Previous patch naively removed all code relevant to disk format checking. The semantics now dictate that the format check when creating external snapshots is now impossible as we always fill in the format for disks in domain definition in the post-parse callback. Remove the impossible code path. Signed-off-by: Peter Krempa Reviewed-by: J=EF=BF=BDn Tomko --- src/qemu/qemu_driver.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0283a906af..156f5d52ce 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14160,18 +14160,10 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUD= riverPtr driver, NULL))) goto cleanup; - if (defdisk->src->format > 0) { - /* adds cmd line arg: backing_file=3D/path/to/backing/file,bac= king_fmd=3Dformat */ - virCommandAddArgFormat(cmd, "backing_file=3D%s,backing_fmt=3D%= s", - defdisk->src->path, - virStorageFileFormatTypeToString(defdis= k->src->format)); - } else { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown image format of '%s' and " - "format probing is disabled"), - defdisk->src->path); - goto cleanup; - } + /* adds cmd line arg: backing_file=3D/path/to/backing/file,backing= _fmd=3Dformat */ + virCommandAddArgFormat(cmd, "backing_file=3D%s,backing_fmt=3D%s", + defdisk->src->path, + virStorageFileFormatTypeToString(defdisk->s= rc->format)); /* adds cmd line args: /path/to/target/file */ virCommandAddArg(cmd, snapdisk->src->path); --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 19:05:09 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 1528102782962784.3662064888711; Mon, 4 Jun 2018 01:59:42 -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 C8626750EC; Mon, 4 Jun 2018 08:59:40 +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 8CDA7308BDB0; Mon, 4 Jun 2018 08:59:40 +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 3C86D4CA88; Mon, 4 Jun 2018 08:59:40 +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 w548x9hD018650 for ; Mon, 4 Jun 2018 04:59:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 52B1F2026E0E; Mon, 4 Jun 2018 08:59:09 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB12A2026DEF for ; Mon, 4 Jun 2018 08:59:08 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 4 Jun 2018 10:58:46 +0200 Message-Id: <1c0d92508247575d71fa811ed2c05ceedc4b7728.1528102541.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/10] security: Remove VIR_SECURITY_MANAGER_ALLOW_DISK_PROBE 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.39]); Mon, 04 Jun 2018 08:59:41 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Nothing is setting that flag now so it can be removed. Note that removing 'mgr' from 'load_profile' in the apparmor driver would create a lot of churn. Signed-off-by: Peter Krempa Reviewed-by: J=EF=BF=BDn Tomko --- src/security/security_apparmor.c | 6 ++---- src/security/security_manager.c | 7 ------- src/security/security_manager.h | 5 +---- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/security/security_apparmor.c b/src/security/security_appar= mor.c index 333d098be4..cb41df71a9 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -170,7 +170,7 @@ profile_status_file(const char *str) * load (add) a profile. Will create one if necessary */ static int -load_profile(virSecurityManagerPtr mgr, +load_profile(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, const char *profile, virDomainDefPtr def, const char *fn, @@ -180,8 +180,6 @@ load_profile(virSecurityManagerPtr mgr, bool create =3D true; char *xml =3D NULL; virCommandPtr cmd =3D NULL; - const char *probe =3D virSecurityManagerGetAllowDiskFormatProbing(mgr) - ? "1" : "0"; xml =3D virDomainDefFormat(def, NULL, VIR_DOMAIN_DEF_FORMAT_SECURE); if (!xml) @@ -190,7 +188,7 @@ load_profile(virSecurityManagerPtr mgr, if (profile_status_file(profile) >=3D 0) create =3D false; - cmd =3D virCommandNewArgList(VIRT_AA_HELPER, "-p", probe, + cmd =3D virCommandNewArgList(VIRT_AA_HELPER, create ? "-c" : "-r", "-u", profile, NULL); if (!create && fn) { diff --git a/src/security/security_manager.c b/src/security/security_manage= r.c index 71f7f59b9c..cacd1d5457 100644 --- a/src/security/security_manager.c +++ b/src/security/security_manager.c @@ -365,13 +365,6 @@ virSecurityManagerGetBaseLabel(virSecurityManagerPtr m= gr, } -bool -virSecurityManagerGetAllowDiskFormatProbing(virSecurityManagerPtr mgr) -{ - return mgr->flags & VIR_SECURITY_MANAGER_ALLOW_DISK_PROBE; -} - - bool virSecurityManagerGetDefaultConfined(virSecurityManagerPtr mgr) { diff --git a/src/security/security_manager.h b/src/security/security_manage= r.h index c36a8b488f..c5e472bba4 100644 --- a/src/security/security_manager.h +++ b/src/security/security_manager.h @@ -31,7 +31,6 @@ typedef struct _virSecurityManager virSecurityManager; typedef virSecurityManager *virSecurityManagerPtr; typedef enum { - VIR_SECURITY_MANAGER_ALLOW_DISK_PROBE =3D 1 << 0, VIR_SECURITY_MANAGER_DEFAULT_CONFINED =3D 1 << 1, VIR_SECURITY_MANAGER_REQUIRE_CONFINED =3D 1 << 2, VIR_SECURITY_MANAGER_PRIVILEGED =3D 1 << 3, @@ -40,8 +39,7 @@ typedef enum { } virSecurityManagerNewFlags; # define VIR_SECURITY_MANAGER_NEW_MASK \ - (VIR_SECURITY_MANAGER_ALLOW_DISK_PROBE | \ - VIR_SECURITY_MANAGER_DEFAULT_CONFINED | \ + (VIR_SECURITY_MANAGER_DEFAULT_CONFINED | \ VIR_SECURITY_MANAGER_REQUIRE_CONFINED | \ VIR_SECURITY_MANAGER_PRIVILEGED) @@ -89,7 +87,6 @@ const char *virSecurityManagerGetDOI(virSecurityManagerPt= r mgr); const char *virSecurityManagerGetModel(virSecurityManagerPtr mgr); const char *virSecurityManagerGetBaseLabel(virSecurityManagerPtr mgr, int = virtType); -bool virSecurityManagerGetAllowDiskFormatProbing(virSecurityManagerPtr mgr= ); bool virSecurityManagerGetDefaultConfined(virSecurityManagerPtr mgr); bool virSecurityManagerGetRequireConfined(virSecurityManagerPtr mgr); bool virSecurityManagerGetPrivileged(virSecurityManagerPtr mgr); --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 19:05:09 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 1528102782477692.4100928190513; Mon, 4 Jun 2018 01:59:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 97012E9A22; Mon, 4 Jun 2018 08:59:40 +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 634B95D6A8; Mon, 4 Jun 2018 08:59:40 +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 0A78618033F3; Mon, 4 Jun 2018 08:59:40 +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 w548xAxH018664 for ; Mon, 4 Jun 2018 04:59:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id EC6052026E0E; Mon, 4 Jun 2018 08:59:09 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 911F32026DEF for ; Mon, 4 Jun 2018 08:59:09 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 4 Jun 2018 10:58:47 +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 05/10] security: aa-helper: Remove the -p parameter 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 04 Jun 2018 08:59:41 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" As the aa-helper binary is supposed to be used only with libvirt, we can fully remove it. Signed-off-by: Peter Krempa Reviewed-by: J=EF=BF=BDn Tomko --- src/security/virt-aa-helper.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index d0f9876da5..37fe36a329 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -63,7 +63,6 @@ static char *progname; typedef struct { - bool allowDiskFormatProbing; char uuid[PROFILE_NAME_SIZE]; /* UUID of vm */ bool dryrun; /* dry run */ char cmd; /* 'c' create @@ -115,7 +114,6 @@ vah_usage(void) " -r | --replace reload profile\n" " -R | --remove unload profile\n" " -h | --help this help\n" - " -p | --probing [0|1] allow disk format probing\= n" " -u | --uuid uuid (profile name)\n" "\n"), progname); @@ -975,10 +973,8 @@ get_files(vahControl * ctl) /* XXX - if we knew the qemu user:group here we could send it in * so that the open could be re-tried as that user:group. */ - if (!virStorageSourceHasBacking(disk->src)) { - bool probe =3D ctl->allowDiskFormatProbing; - virStorageFileGetMetadata(disk->src, -1, -1, probe, false); - } + if (!virStorageSourceHasBacking(disk->src)) + virStorageFileGetMetadata(disk->src, -1, -1, false, false); /* XXX passing ignoreOpenFailure =3D true to get back to the behav= ior * from before using virDomainDiskDefForeachPath. actually we shou= ld @@ -1228,7 +1224,6 @@ vahParseArgv(vahControl * ctl, int argc, char **argv) { int arg, idx =3D 0; struct option opt[] =3D { - {"probing", 1, 0, 'p' }, {"add", 0, 0, 'a'}, {"create", 0, 0, 'c'}, {"dryrun", 0, 0, 'd'}, @@ -1280,12 +1275,6 @@ vahParseArgv(vahControl * ctl, int argc, char **argv) PROFILE_NAME_SIZE) =3D=3D NULL) vah_error(ctl, 1, _("error copying UUID")); break; - case 'p': - if (STREQ(optarg, "1")) - ctl->allowDiskFormatProbing =3D true; - else - ctl->allowDiskFormatProbing =3D false; - break; default: vah_error(ctl, 1, _("unsupported option")); break; --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 19:05:09 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 1528102787707730.8458760494499; Mon, 4 Jun 2018 01:59:47 -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 4A0D5B9F2A; Mon, 4 Jun 2018 08:59: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 144633001A50; Mon, 4 Jun 2018 08:59: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 A5DD34CA86; Mon, 4 Jun 2018 08:59:45 +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 w548xA5S018669 for ; Mon, 4 Jun 2018 04:59:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8F5BE2026E0E; Mon, 4 Jun 2018 08:59:10 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33BB62026DEF for ; Mon, 4 Jun 2018 08:59:10 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 4 Jun 2018 10:58:48 +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/10] tests: virstoragetest: Add complementary test case for QED format 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.27]); Mon, 04 Jun 2018 08:59:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We have a test case for QED disk image with autodetection but not with the format explicitly specified. Signed-off-by: Peter Krempa Reviewed-by: J=EF=BF=BDn Tomko --- tests/virstoragetest.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 0e11602e84..f3b96a9b87 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -949,6 +949,9 @@ mymain(void) .type =3D VIR_STORAGE_TYPE_FILE, .format =3D VIR_STORAGE_FILE_RAW, }; + TEST_CHAIN(absqed, VIR_STORAGE_FILE_QED, + (&qed, &raw), EXP_PASS, + (&qed, &raw), ALLOW_PROBE | EXP_PASS); TEST_CHAIN(absqed, VIR_STORAGE_FILE_AUTO, (&qed_as_raw), EXP_PASS, (&qed, &raw), ALLOW_PROBE | EXP_PASS); --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 19:05:09 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 1528102758453897.6426466858863; Mon, 4 Jun 2018 01:59:18 -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 91BEEC08C6EA; Mon, 4 Jun 2018 08:59:16 +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 36AB4600C4; Mon, 4 Jun 2018 08:59:16 +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 CAB474CA82; Mon, 4 Jun 2018 08:59:15 +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 w548xBg8018674 for ; Mon, 4 Jun 2018 04:59:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 318B22026E0E; Mon, 4 Jun 2018 08:59:11 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id CAB552026DEF for ; Mon, 4 Jun 2018 08:59:10 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 4 Jun 2018 10:58:49 +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 07/10] tests: storage: Absorb ALLOW_PROBE flag into the TEST_CHAIN macro 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.32]); Mon, 04 Jun 2018 08:59:17 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The second set of arguments for TEST_CHAIN always specifies the 'ALLOW_PROBE' flag. Make it part of the macro. Signed-off-by: Peter Krempa Reviewed-by: J=EF=BF=BDn Tomko --- tests/virstoragetest.c | 48 ++++++++++++++++++++++++----------------------= -- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index f3b96a9b87..0fe8ac7e7f 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -757,7 +757,7 @@ mymain(void) #define TEST_CHAIN(path, format, chain1, flags1, chain2, flags2) \ do { \ TEST_ONE_CHAIN(path, format, flags1, VIR_FLATTEN_1(chain1)); \ - TEST_ONE_CHAIN(path, format, flags2, VIR_FLATTEN_1(chain2)); \ + TEST_ONE_CHAIN(path, format, ALLOW_PROBE | flags2, VIR_FLATTEN_1(c= hain2)); \ } while (0) /* The actual tests, in several groups. */ @@ -774,10 +774,10 @@ mymain(void) }; TEST_CHAIN(absraw, VIR_STORAGE_FILE_RAW, (&raw), EXP_PASS, - (&raw), ALLOW_PROBE | EXP_PASS); + (&raw), EXP_PASS); TEST_CHAIN(absraw, VIR_STORAGE_FILE_AUTO, (&raw), EXP_PASS, - (&raw), ALLOW_PROBE | EXP_PASS); + (&raw), EXP_PASS); /* Qcow2 file with relative raw backing, format provided */ raw.pathRel =3D "raw"; @@ -795,10 +795,10 @@ mymain(void) }; TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &raw), EXP_PASS, - (&qcow2, &raw), ALLOW_PROBE | EXP_PASS); + (&qcow2, &raw), EXP_PASS); TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_AUTO, (&qcow2_as_raw), EXP_PASS, - (&qcow2, &raw), ALLOW_PROBE | EXP_PASS); + (&qcow2, &raw), EXP_PASS); /* Rewrite qcow2 file to use absolute backing name */ virCommandFree(cmd); @@ -812,10 +812,10 @@ mymain(void) /* Qcow2 file with raw as absolute backing, backing format provided */ TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &raw), EXP_PASS, - (&qcow2, &raw), ALLOW_PROBE | EXP_PASS); + (&qcow2, &raw), EXP_PASS); TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_AUTO, (&qcow2_as_raw), EXP_PASS, - (&qcow2, &raw), ALLOW_PROBE | EXP_PASS); + (&qcow2, &raw), EXP_PASS); /* Wrapped file access */ testFileData wrap =3D { @@ -827,7 +827,7 @@ mymain(void) }; TEST_CHAIN(abswrap, VIR_STORAGE_FILE_QCOW2, (&wrap, &qcow2, &raw), EXP_PASS, - (&wrap, &qcow2, &raw), ALLOW_PROBE | EXP_PASS); + (&wrap, &qcow2, &raw), EXP_PASS); /* Rewrite qcow2 and wrap file to omit backing file type */ virCommandFree(cmd); @@ -852,7 +852,7 @@ mymain(void) }; TEST_CHAIN(abswrap, VIR_STORAGE_FILE_QCOW2, (&wrap_as_raw, &qcow2_as_raw), EXP_PASS, - (&wrap, &qcow2, &raw), ALLOW_PROBE | EXP_PASS); + (&wrap, &qcow2, &raw), EXP_PASS); /* Rewrite qcow2 to a missing backing file, with backing type */ virCommandFree(cmd); @@ -866,7 +866,7 @@ mymain(void) /* Qcow2 file with missing backing file but specified type */ TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2), EXP_WARN, - (&qcow2), ALLOW_PROBE | EXP_WARN); + (&qcow2), EXP_WARN); /* Rewrite qcow2 to a missing backing file, without backing type */ virCommandFree(cmd); @@ -878,7 +878,7 @@ mymain(void) /* Qcow2 file with missing backing file and no specified type */ TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2), EXP_WARN, - (&qcow2), ALLOW_PROBE | EXP_WARN); + (&qcow2), EXP_WARN); /* Rewrite qcow2 to use an nbd: protocol as backend */ virCommandFree(cmd); @@ -899,7 +899,7 @@ mymain(void) }; TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &nbd), EXP_PASS, - (&qcow2, &nbd), ALLOW_PROBE | EXP_PASS); + (&qcow2, &nbd), EXP_PASS); /* Rewrite qcow2 to use an nbd: protocol as backend */ virCommandFree(cmd); @@ -920,7 +920,7 @@ mymain(void) }; TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &nbd2), EXP_PASS, - (&qcow2, &nbd2), ALLOW_PROBE | EXP_PASS); + (&qcow2, &nbd2), EXP_PASS); /* Rewrite qcow2 to use an nbd: protocol without path as backend */ virCommandFree(cmd); @@ -934,7 +934,7 @@ mymain(void) nbd2.path =3D NULL; TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &nbd2), EXP_PASS, - (&qcow2, &nbd2), ALLOW_PROBE | EXP_PASS); + (&qcow2, &nbd2), EXP_PASS); /* qed file */ testFileData qed =3D { @@ -951,10 +951,10 @@ mymain(void) }; TEST_CHAIN(absqed, VIR_STORAGE_FILE_QED, (&qed, &raw), EXP_PASS, - (&qed, &raw), ALLOW_PROBE | EXP_PASS); + (&qed, &raw), EXP_PASS); TEST_CHAIN(absqed, VIR_STORAGE_FILE_AUTO, (&qed_as_raw), EXP_PASS, - (&qed, &raw), ALLOW_PROBE | EXP_PASS); + (&qed, &raw), EXP_PASS); /* directory */ testFileData dir =3D { @@ -969,13 +969,13 @@ mymain(void) }; TEST_CHAIN(absdir, VIR_STORAGE_FILE_RAW, (&dir_as_raw), EXP_PASS, - (&dir_as_raw), ALLOW_PROBE | EXP_PASS); + (&dir_as_raw), EXP_PASS); TEST_CHAIN(absdir, VIR_STORAGE_FILE_NONE, (&dir), EXP_PASS, - (&dir), ALLOW_PROBE | EXP_PASS); + (&dir), EXP_PASS); TEST_CHAIN(absdir, VIR_STORAGE_FILE_DIR, (&dir), EXP_PASS, - (&dir), ALLOW_PROBE | EXP_PASS); + (&dir), EXP_PASS); #ifdef HAVE_SYMLINK /* Rewrite qcow2 and wrap file to use backing names relative to a @@ -1014,7 +1014,7 @@ mymain(void) raw.pathRel =3D "../raw"; TEST_CHAIN(abslink2, VIR_STORAGE_FILE_QCOW2, (&link2, &link1, &raw), EXP_PASS, - (&link2, &link1, &raw), ALLOW_PROBE | EXP_PASS); + (&link2, &link1, &raw), EXP_PASS); #endif /* Rewrite qcow2 to be a self-referential loop */ @@ -1028,7 +1028,7 @@ mymain(void) /* Behavior of an infinite loop chain */ TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2), EXP_WARN, - (&qcow2), ALLOW_PROBE | EXP_WARN); + (&qcow2), EXP_WARN); /* Rewrite wrap and qcow2 to be mutually-referential loop */ virCommandFree(cmd); @@ -1047,7 +1047,7 @@ mymain(void) /* Behavior of an infinite loop chain */ TEST_CHAIN(abswrap, VIR_STORAGE_FILE_QCOW2, (&wrap, &qcow2), EXP_WARN, - (&wrap, &qcow2), ALLOW_PROBE | EXP_WARN); + (&wrap, &qcow2), EXP_WARN); /* Rewrite qcow2 to use an rbd: protocol as backend */ virCommandFree(cmd); @@ -1067,7 +1067,7 @@ mymain(void) }; TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &rbd1), EXP_PASS, - (&qcow2, &rbd1), ALLOW_PROBE | EXP_PASS); + (&qcow2, &rbd1), EXP_PASS); /* Rewrite qcow2 to use an rbd: protocol as backend */ virCommandFree(cmd); @@ -1089,7 +1089,7 @@ mymain(void) }; TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &rbd2), EXP_PASS, - (&qcow2, &rbd2), ALLOW_PROBE | EXP_PASS); + (&qcow2, &rbd2), EXP_PASS); /* Rewrite wrap and qcow2 back to 3-deep chain, absolute backing */ --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 19:05:09 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 152810277680818.774278768584054; Mon, 4 Jun 2018 01:59:36 -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 CA6E630B7DEA; Mon, 4 Jun 2018 08:59:34 +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 910FF308BDB0; Mon, 4 Jun 2018 08:59: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 2953F18033EE; Mon, 4 Jun 2018 08:59:34 +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 w548xBDW018679 for ; Mon, 4 Jun 2018 04:59:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id C826D2026E0E; Mon, 4 Jun 2018 08:59:11 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D35B2026DEF for ; Mon, 4 Jun 2018 08:59:11 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 4 Jun 2018 10:58:50 +0200 Message-Id: <123516cde5aaa37fac95898ead9f4ba8da570c6d.1528102541.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/10] tests: storage: Drop format probing from tests 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.48]); Mon, 04 Jun 2018 08:59:35 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Storage drivers now don't allow it so there's no need to test it. Signed-off-by: Peter Krempa Reviewed-by: J=EF=BF=BDn Tomko --- tests/virstoragetest.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 0fe8ac7e7f..4d98310ee1 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -95,8 +95,7 @@ testCleanupImages(void) static virStorageSourcePtr testStorageFileGetMetadata(const char *path, int format, - uid_t uid, gid_t gid, - bool allow_probe) + uid_t uid, gid_t gid) { struct stat st; virStorageSourcePtr ret =3D NULL; @@ -118,7 +117,7 @@ testStorageFileGetMetadata(const char *path, if (VIR_STRDUP(ret->path, path) < 0) goto error; - if (virStorageFileGetMetadata(ret, uid, gid, allow_probe, false) < 0) + if (virStorageFileGetMetadata(ret, uid, gid, false, false) < 0) goto error; return ret; @@ -320,8 +319,7 @@ testStorageChain(const void *args) size_t i =3D 0; char *broken =3D NULL; - meta =3D testStorageFileGetMetadata(data->start, data->format, -1, -1, - (data->flags & ALLOW_PROBE) !=3D 0); + meta =3D testStorageFileGetMetadata(data->start, data->format, -1, -1); if (!meta) { if (data->flags & EXP_FAIL) { virResetLastError(); @@ -757,7 +755,7 @@ mymain(void) #define TEST_CHAIN(path, format, chain1, flags1, chain2, flags2) \ do { \ TEST_ONE_CHAIN(path, format, flags1, VIR_FLATTEN_1(chain1)); \ - TEST_ONE_CHAIN(path, format, ALLOW_PROBE | flags2, VIR_FLATTEN_1(c= hain2)); \ + TEST_ONE_CHAIN(path, format, flags2, VIR_FLATTEN_1(chain2)); \ } while (0) /* The actual tests, in several groups. */ @@ -798,7 +796,7 @@ mymain(void) (&qcow2, &raw), EXP_PASS); TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_AUTO, (&qcow2_as_raw), EXP_PASS, - (&qcow2, &raw), EXP_PASS); + (&qcow2_as_raw), EXP_PASS); /* Rewrite qcow2 file to use absolute backing name */ virCommandFree(cmd); @@ -815,7 +813,7 @@ mymain(void) (&qcow2, &raw), EXP_PASS); TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_AUTO, (&qcow2_as_raw), EXP_PASS, - (&qcow2, &raw), EXP_PASS); + (&qcow2_as_raw), EXP_PASS); /* Wrapped file access */ testFileData wrap =3D { @@ -852,7 +850,7 @@ mymain(void) }; TEST_CHAIN(abswrap, VIR_STORAGE_FILE_QCOW2, (&wrap_as_raw, &qcow2_as_raw), EXP_PASS, - (&wrap, &qcow2, &raw), EXP_PASS); + (&wrap_as_raw, &qcow2_as_raw), EXP_PASS); /* Rewrite qcow2 to a missing backing file, with backing type */ virCommandFree(cmd); @@ -954,7 +952,7 @@ mymain(void) (&qed, &raw), EXP_PASS); TEST_CHAIN(absqed, VIR_STORAGE_FILE_AUTO, (&qed_as_raw), EXP_PASS, - (&qed, &raw), EXP_PASS); + (&qed_as_raw), EXP_PASS); /* directory */ testFileData dir =3D { @@ -1101,7 +1099,7 @@ mymain(void) /* Test behavior of chain lookups, absolute backing from relative star= t */ chain =3D testStorageFileGetMetadata("wrap", VIR_STORAGE_FILE_QCOW2, - -1, -1, false); + -1, -1); if (!chain) { ret =3D -1; goto cleanup; @@ -1166,8 +1164,7 @@ mymain(void) /* Test behavior of chain lookups, relative backing from absolute star= t */ virStorageSourceFree(chain); - chain =3D testStorageFileGetMetadata(abswrap, VIR_STORAGE_FILE_QCOW2, - -1, -1, false); + chain =3D testStorageFileGetMetadata(abswrap, VIR_STORAGE_FILE_QCOW2, = -1, -1); if (!chain) { ret =3D -1; goto cleanup; @@ -1214,7 +1211,7 @@ mymain(void) /* Test behavior of chain lookups, relative backing */ virStorageSourceFree(chain); chain =3D testStorageFileGetMetadata("sub/link2", VIR_STORAGE_FILE_QCO= W2, - -1, -1, false); + -1, -1); if (!chain) { ret =3D -1; goto cleanup; --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 19:05:09 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 1528102788553113.22157362959763; Mon, 4 Jun 2018 01:59:48 -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 B4D2FC9DC3; Mon, 4 Jun 2018 08:59: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 7E752600C8; Mon, 4 Jun 2018 08:59: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 2B1424CA8A; Mon, 4 Jun 2018 08:59: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 w548xCAZ018694 for ; Mon, 4 Jun 2018 04:59:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6B05D2026E0E; Mon, 4 Jun 2018 08:59:12 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FAF32026DEF for ; Mon, 4 Jun 2018 08:59:11 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 4 Jun 2018 10:58:51 +0200 Message-Id: <7df48cbb4db2679f1fc578d4af53105a44a10b58.1528102541.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 09/10] tests: storage: Drop duplicate tests with TEST_CHAIN 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.38]); Mon, 04 Jun 2018 08:59:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now that all test cases with TEST_CHAIN were testing the same thing twice drop one of them. Note that some of the cases were duplicate even before dropping the image format probing tests. Signed-off-by: Peter Krempa Reviewed-by: J=EF=BF=BDn Tomko --- tests/virstoragetest.c | 93 +++++++++++++---------------------------------= ---- 1 file changed, 23 insertions(+), 70 deletions(-) diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 4d98310ee1..2236351309 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -752,11 +752,8 @@ mymain(void) #define VIR_FLATTEN_2(...) __VA_ARGS__ #define VIR_FLATTEN_1(_1) VIR_FLATTEN_2 _1 -#define TEST_CHAIN(path, format, chain1, flags1, chain2, flags2) \ - do { \ - TEST_ONE_CHAIN(path, format, flags1, VIR_FLATTEN_1(chain1)); \ - TEST_ONE_CHAIN(path, format, flags2, VIR_FLATTEN_1(chain2)); \ - } while (0) +#define TEST_CHAIN(path, format, chain, flags) \ + TEST_ONE_CHAIN(path, format, flags, VIR_FLATTEN_1(chain)); /* The actual tests, in several groups. */ virTestCounterReset("Storage backing chain "); @@ -770,12 +767,8 @@ mymain(void) .type =3D VIR_STORAGE_TYPE_FILE, .format =3D VIR_STORAGE_FILE_RAW, }; - TEST_CHAIN(absraw, VIR_STORAGE_FILE_RAW, - (&raw), EXP_PASS, - (&raw), EXP_PASS); - TEST_CHAIN(absraw, VIR_STORAGE_FILE_AUTO, - (&raw), EXP_PASS, - (&raw), EXP_PASS); + TEST_CHAIN(absraw, VIR_STORAGE_FILE_RAW, (&raw), EXP_PASS); + TEST_CHAIN(absraw, VIR_STORAGE_FILE_AUTO, (&raw), EXP_PASS); /* Qcow2 file with relative raw backing, format provided */ raw.pathRel =3D "raw"; @@ -791,12 +784,8 @@ mymain(void) .type =3D VIR_STORAGE_TYPE_FILE, .format =3D VIR_STORAGE_FILE_RAW, }; - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, - (&qcow2, &raw), EXP_PASS, - (&qcow2, &raw), EXP_PASS); - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_AUTO, - (&qcow2_as_raw), EXP_PASS, - (&qcow2_as_raw), EXP_PASS); + TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &raw), EXP_PASS); + TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_AUTO, (&qcow2_as_raw), EXP_PASS); /* Rewrite qcow2 file to use absolute backing name */ virCommandFree(cmd); @@ -808,12 +797,8 @@ mymain(void) raw.pathRel =3D NULL; /* Qcow2 file with raw as absolute backing, backing format provided */ - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, - (&qcow2, &raw), EXP_PASS, - (&qcow2, &raw), EXP_PASS); - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_AUTO, - (&qcow2_as_raw), EXP_PASS, - (&qcow2_as_raw), EXP_PASS); + TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &raw), EXP_PASS); + TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_AUTO, (&qcow2_as_raw), EXP_PASS); /* Wrapped file access */ testFileData wrap =3D { @@ -823,9 +808,7 @@ mymain(void) .type =3D VIR_STORAGE_TYPE_FILE, .format =3D VIR_STORAGE_FILE_QCOW2, }; - TEST_CHAIN(abswrap, VIR_STORAGE_FILE_QCOW2, - (&wrap, &qcow2, &raw), EXP_PASS, - (&wrap, &qcow2, &raw), EXP_PASS); + TEST_CHAIN(abswrap, VIR_STORAGE_FILE_QCOW2, (&wrap, &qcow2, &raw), EXP= _PASS); /* Rewrite qcow2 and wrap file to omit backing file type */ virCommandFree(cmd); @@ -849,7 +832,6 @@ mymain(void) .format =3D VIR_STORAGE_FILE_QCOW2, }; TEST_CHAIN(abswrap, VIR_STORAGE_FILE_QCOW2, - (&wrap_as_raw, &qcow2_as_raw), EXP_PASS, (&wrap_as_raw, &qcow2_as_raw), EXP_PASS); /* Rewrite qcow2 to a missing backing file, with backing type */ @@ -862,9 +844,7 @@ mymain(void) qcow2.expBackingStoreRaw =3D datadir "/bogus"; /* Qcow2 file with missing backing file but specified type */ - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, - (&qcow2), EXP_WARN, - (&qcow2), EXP_WARN); + TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2), EXP_WARN); /* Rewrite qcow2 to a missing backing file, without backing type */ virCommandFree(cmd); @@ -874,9 +854,7 @@ mymain(void) ret =3D -1; /* Qcow2 file with missing backing file and no specified type */ - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, - (&qcow2), EXP_WARN, - (&qcow2), EXP_WARN); + TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2), EXP_WARN); /* Rewrite qcow2 to use an nbd: protocol as backend */ virCommandFree(cmd); @@ -895,9 +873,7 @@ mymain(void) .protocol =3D VIR_STORAGE_NET_PROTOCOL_NBD, .hostname =3D "example.org", }; - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, - (&qcow2, &nbd), EXP_PASS, - (&qcow2, &nbd), EXP_PASS); + TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &nbd), EXP_PASS); /* Rewrite qcow2 to use an nbd: protocol as backend */ virCommandFree(cmd); @@ -916,9 +892,7 @@ mymain(void) .protocol =3D VIR_STORAGE_NET_PROTOCOL_NBD, .hostname =3D "example.org", }; - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, - (&qcow2, &nbd2), EXP_PASS, - (&qcow2, &nbd2), EXP_PASS); + TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &nbd2), EXP_PASS= ); /* Rewrite qcow2 to use an nbd: protocol without path as backend */ virCommandFree(cmd); @@ -930,9 +904,7 @@ mymain(void) qcow2.expBackingStoreRaw =3D "nbd://example.org"; nbd2.path =3D NULL; - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, - (&qcow2, &nbd2), EXP_PASS, - (&qcow2, &nbd2), EXP_PASS); + TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &nbd2), EXP_PASS= ); /* qed file */ testFileData qed =3D { @@ -947,12 +919,8 @@ mymain(void) .type =3D VIR_STORAGE_TYPE_FILE, .format =3D VIR_STORAGE_FILE_RAW, }; - TEST_CHAIN(absqed, VIR_STORAGE_FILE_QED, - (&qed, &raw), EXP_PASS, - (&qed, &raw), EXP_PASS); - TEST_CHAIN(absqed, VIR_STORAGE_FILE_AUTO, - (&qed_as_raw), EXP_PASS, - (&qed_as_raw), EXP_PASS); + TEST_CHAIN(absqed, VIR_STORAGE_FILE_QED, (&qed, &raw), EXP_PASS); + TEST_CHAIN(absqed, VIR_STORAGE_FILE_AUTO, (&qed_as_raw), EXP_PASS); /* directory */ testFileData dir =3D { @@ -965,15 +933,9 @@ mymain(void) .type =3D VIR_STORAGE_TYPE_DIR, .format =3D VIR_STORAGE_FILE_RAW, }; - TEST_CHAIN(absdir, VIR_STORAGE_FILE_RAW, - (&dir_as_raw), EXP_PASS, - (&dir_as_raw), EXP_PASS); - TEST_CHAIN(absdir, VIR_STORAGE_FILE_NONE, - (&dir), EXP_PASS, - (&dir), EXP_PASS); - TEST_CHAIN(absdir, VIR_STORAGE_FILE_DIR, - (&dir), EXP_PASS, - (&dir), EXP_PASS); + TEST_CHAIN(absdir, VIR_STORAGE_FILE_RAW, (&dir_as_raw), EXP_PASS); + TEST_CHAIN(absdir, VIR_STORAGE_FILE_NONE, (&dir), EXP_PASS); + TEST_CHAIN(absdir, VIR_STORAGE_FILE_DIR, (&dir), EXP_PASS); #ifdef HAVE_SYMLINK /* Rewrite qcow2 and wrap file to use backing names relative to a @@ -1011,7 +973,6 @@ mymain(void) raw.path =3D datadir "/sub/../sub/../raw"; raw.pathRel =3D "../raw"; TEST_CHAIN(abslink2, VIR_STORAGE_FILE_QCOW2, - (&link2, &link1, &raw), EXP_PASS, (&link2, &link1, &raw), EXP_PASS); #endif @@ -1024,9 +985,7 @@ mymain(void) qcow2.expBackingStoreRaw =3D "qcow2"; /* Behavior of an infinite loop chain */ - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, - (&qcow2), EXP_WARN, - (&qcow2), EXP_WARN); + TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2), EXP_WARN); /* Rewrite wrap and qcow2 to be mutually-referential loop */ virCommandFree(cmd); @@ -1043,9 +1002,7 @@ mymain(void) qcow2.expBackingStoreRaw =3D "wrap"; /* Behavior of an infinite loop chain */ - TEST_CHAIN(abswrap, VIR_STORAGE_FILE_QCOW2, - (&wrap, &qcow2), EXP_WARN, - (&wrap, &qcow2), EXP_WARN); + TEST_CHAIN(abswrap, VIR_STORAGE_FILE_QCOW2, (&wrap, &qcow2), EXP_WARN); /* Rewrite qcow2 to use an rbd: protocol as backend */ virCommandFree(cmd); @@ -1063,9 +1020,7 @@ mymain(void) .format =3D VIR_STORAGE_FILE_RAW, .protocol =3D VIR_STORAGE_NET_PROTOCOL_RBD, }; - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, - (&qcow2, &rbd1), EXP_PASS, - (&qcow2, &rbd1), EXP_PASS); + TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &rbd1), EXP_PASS= ); /* Rewrite qcow2 to use an rbd: protocol as backend */ virCommandFree(cmd); @@ -1085,9 +1040,7 @@ mymain(void) .secret =3D "asdf", .hostname =3D "example.com", }; - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, - (&qcow2, &rbd2), EXP_PASS, - (&qcow2, &rbd2), EXP_PASS); + TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &rbd2), EXP_PASS= ); /* Rewrite wrap and qcow2 back to 3-deep chain, absolute backing */ --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 19:05:09 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 1528102796884457.4233547500885; Mon, 4 Jun 2018 01:59:56 -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 5247CABB38; Mon, 4 Jun 2018 08:59:55 +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 2230D3083321; Mon, 4 Jun 2018 08:59:55 +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 9541D4CA80; Mon, 4 Jun 2018 08:59:54 +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 w548xD5G018709 for ; Mon, 4 Jun 2018 04:59:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0D9BB2026E0E; Mon, 4 Jun 2018 08:59:13 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id A69942026DEF for ; Mon, 4 Jun 2018 08:59:12 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 4 Jun 2018 10:58:52 +0200 Message-Id: <13ef0b57724828cc530fbbecbd3841765df9227b.1528102541.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 10/10] util: storage: remove 'allow_probe' from virStorageFileGetMetadata 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.25]); Mon, 04 Jun 2018 08:59:56 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" All callers pass 'false' now so it's no longer needed. Signed-off-by: Peter Krempa Reviewed-by: J=EF=BF=BDn Tomko --- src/qemu/qemu_domain.c | 4 +--- src/security/virt-aa-helper.c | 2 +- src/util/virstoragefile.c | 18 +++++++----------- src/util/virstoragefile.h | 1 - tests/virstoragetest.c | 2 +- 5 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d230ead359..d4771ff3f7 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8061,9 +8061,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, qemuDomainGetImageIds(cfg, vm, src, disk->src, &uid, &gid); - if (virStorageFileGetMetadata(src, - uid, gid, false, - report_broken) < 0) + if (virStorageFileGetMetadata(src, uid, gid, report_broken) < 0) goto cleanup; for (n =3D src; virStorageSourceIsBacking(n); n =3D n->backingStore) { diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 37fe36a329..971ee6733c 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -974,7 +974,7 @@ get_files(vahControl * ctl) * so that the open could be re-tried as that user:group. */ if (!virStorageSourceHasBacking(disk->src)) - virStorageFileGetMetadata(disk->src, -1, -1, false, false); + virStorageFileGetMetadata(disk->src, -1, -1, false); /* XXX passing ignoreOpenFailure =3D true to get back to the behav= ior * from before using virDomainDiskDefForeachPath. actually we shou= ld diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 62768af968..6ede542df6 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -4678,7 +4678,6 @@ static int virStorageFileGetMetadataRecurse(virStorageSourcePtr src, virStorageSourcePtr parent, uid_t uid, gid_t gid, - bool allow_probe, bool report_broken, virHashTablePtr cycle, unsigned int depth) @@ -4691,9 +4690,9 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr = src, int backingFormat; int rv; - VIR_DEBUG("path=3D%s format=3D%d uid=3D%u gid=3D%u probe=3D%d", + VIR_DEBUG("path=3D%s format=3D%d uid=3D%u gid=3D%u", src->path, src->format, - (unsigned int)uid, (unsigned int)gid, allow_probe); + (unsigned int)uid, (unsigned int)gid); /* exit if we can't load information about the current image */ rv =3D virStorageFileSupportsBackingChainTraversal(src); @@ -4740,7 +4739,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr = src, if (!(backingStore =3D virStorageSourceNewFromBacking(src))) goto cleanup; - if (backingFormat =3D=3D VIR_STORAGE_FILE_AUTO && !allow_probe) + if (backingFormat =3D=3D VIR_STORAGE_FILE_AUTO) backingStore->format =3D VIR_STORAGE_FILE_RAW; else if (backingFormat =3D=3D VIR_STORAGE_FILE_AUTO_SAFE) backingStore->format =3D VIR_STORAGE_FILE_AUTO; @@ -4749,7 +4748,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr = src, if ((ret =3D virStorageFileGetMetadataRecurse(backingStore, parent, uid, gid, - allow_probe, report_br= oken, + report_broken, cycle, depth + 1)) < 0= ) { if (report_broken) goto cleanup; @@ -4802,12 +4801,11 @@ virStorageFileGetMetadataRecurse(virStorageSourcePt= r src, int virStorageFileGetMetadata(virStorageSourcePtr src, uid_t uid, gid_t gid, - bool allow_probe, bool report_broken) { - VIR_DEBUG("path=3D%s format=3D%d uid=3D%u gid=3D%u probe=3D%d, report_= broken=3D%d", + VIR_DEBUG("path=3D%s format=3D%d uid=3D%u gid=3D%u report_broken=3D%d", src->path, src->format, (unsigned int)uid, (unsigned int)gid, - allow_probe, report_broken); + report_broken); virHashTablePtr cycle =3D NULL; virStorageType actualType =3D virStorageSourceGetActualType(src); @@ -4819,14 +4817,12 @@ virStorageFileGetMetadata(virStorageSourcePtr src, if (src->format <=3D VIR_STORAGE_FILE_NONE) { if (actualType =3D=3D VIR_STORAGE_TYPE_DIR) src->format =3D VIR_STORAGE_FILE_DIR; - else if (allow_probe) - src->format =3D VIR_STORAGE_FILE_AUTO; else src->format =3D VIR_STORAGE_FILE_RAW; } ret =3D virStorageFileGetMetadataRecurse(src, src, uid, gid, - allow_probe, report_broken, cyc= le, 1); + report_broken, cycle, 1); virHashFree(cycle); return ret; diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 33fc853fcd..592e19bd7f 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -504,7 +504,6 @@ int virStorageFileSupportsAccess(const virStorageSource= *src); int virStorageFileGetMetadata(virStorageSourcePtr src, uid_t uid, gid_t gid, - bool allow_probe, bool report_broken) ATTRIBUTE_NONNULL(1); diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 2236351309..ad92f3b875 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -117,7 +117,7 @@ testStorageFileGetMetadata(const char *path, if (VIR_STRDUP(ret->path, path) < 0) goto error; - if (virStorageFileGetMetadata(ret, uid, gid, false, false) < 0) + if (virStorageFileGetMetadata(ret, uid, gid, false) < 0) goto error; return ret; --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list