From nobody Wed May 15 17:41:33 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1700823226800532.2171156953443; Fri, 24 Nov 2023 02:53:46 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id A7F14191D; Fri, 24 Nov 2023 05:53:45 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5CBD71913; Fri, 24 Nov 2023 05:50:54 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id A85D417C0; Fri, 24 Nov 2023 05:50:43 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 3009217A4 for ; Fri, 24 Nov 2023 05:50:43 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-132-Qtkw_XBWM_Cmmqdp1rLNNQ-1; Fri, 24 Nov 2023 05:50:41 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 45FF5280641B for ; Fri, 24 Nov 2023 10:50:41 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id C32DC492BE7 for ; Fri, 24 Nov 2023 10:50:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: Qtkw_XBWM_Cmmqdp1rLNNQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 1/7] storage_file_probe: Remove unused state 'BACKING_STORE_ERROR' Date: Fri, 24 Nov 2023 11:50:32 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: GC322XYGHVDRJ2BERLEC46M7EFBXRTEL X-Message-ID-Hash: GC322XYGHVDRJ2BERLEC46M7EFBXRTEL X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1700823228677100001 None of the backing store parser functions actually use it. Remove it to avoid confusion. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/storage_file/storage_file_probe.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/storage_file/storage_file_probe.c b/src/storage_file/stora= ge_file_probe.c index 19f77086da..c73f533d2d 100644 --- a/src/storage_file/storage_file_probe.c +++ b/src/storage_file/storage_file_probe.c @@ -46,7 +46,6 @@ enum lv_endian { enum { BACKING_STORE_OK, BACKING_STORE_INVALID, - BACKING_STORE_ERROR, }; #define FILE_TYPE_VERSIONS_LAST 3 @@ -963,9 +962,6 @@ virStorageFileProbeGetMetadata(virStorageSource *meta, if (store =3D=3D BACKING_STORE_INVALID) return 0; - - if (store =3D=3D BACKING_STORE_ERROR) - return -1; } g_clear_pointer(&meta->features, virBitmapFree); --=20 2.42.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 17:41:33 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1700823309457961.9224272215523; Fri, 24 Nov 2023 02:55:09 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 6923B1860; Fri, 24 Nov 2023 05:55:08 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C720A180D; Fri, 24 Nov 2023 05:51:03 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id A112117C0; Fri, 24 Nov 2023 05:50:44 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 3422D17BB for ; Fri, 24 Nov 2023 05:50:44 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-56-qWqHPh3dNH6f4MX5RUrPAQ-1; Fri, 24 Nov 2023 05:50:42 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 573ED3C00212 for ; Fri, 24 Nov 2023 10:50:42 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5040492BE7 for ; Fri, 24 Nov 2023 10:50:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: qWqHPh3dNH6f4MX5RUrPAQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 2/7] virStorageFileProbeGetMetadata: Do not partially skip probing of the image Date: Fri, 24 Nov 2023 11:50:33 +0100 Message-ID: <2bebd88829d935bd720555d1d867fcb33a13c5f4.1700822943.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: RZNITROAN3ZK2HVRPJGFWNKS7AS2DBEU X-Message-ID-Hash: RZNITROAN3ZK2HVRPJGFWNKS7AS2DBEU X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1700823311154100001 Since we consider the failure of parsing the backing store to be actually success based on the value we return to the caller, we should continue parsing also features and the 'compat' field so that we don't have a partial definition if e.g. the backing store format is not known. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/storage_file/storage_file_probe.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/storage_file/storage_file_probe.c b/src/storage_file/stora= ge_file_probe.c index c73f533d2d..4cf052c03d 100644 --- a/src/storage_file/storage_file_probe.c +++ b/src/storage_file/storage_file_probe.c @@ -955,13 +955,9 @@ virStorageFileProbeGetMetadata(virStorageSource *meta, VIR_FREE(meta->backingStoreRaw); if (fileTypeInfo[meta->format].getBackingStore !=3D NULL) { - int store =3D fileTypeInfo[meta->format].getBackingStore(&meta->ba= ckingStoreRaw, - &format, - buf, len); + fileTypeInfo[meta->format].getBackingStore(&meta->backingStoreRaw, + &format, buf, len); meta->backingStoreRawFormat =3D format; - - if (store =3D=3D BACKING_STORE_INVALID) - return 0; } g_clear_pointer(&meta->features, virBitmapFree); --=20 2.42.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 17:41:33 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1700823404923533.0094772411662; Fri, 24 Nov 2023 02:56:44 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id D5D6C1919; Fri, 24 Nov 2023 05:56:43 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2BAFA1939; Fri, 24 Nov 2023 05:51:13 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 481B617C5; Fri, 24 Nov 2023 05:50:46 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 2897B17BB for ; Fri, 24 Nov 2023 05:50:45 -0500 (EST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-kKjnktn4NgqXMRBzImsR0w-1; Fri, 24 Nov 2023 05:50:43 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 25B2D101A529 for ; Fri, 24 Nov 2023 10:50:43 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3350492BE7 for ; Fri, 24 Nov 2023 10:50:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: kKjnktn4NgqXMRBzImsR0w-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 3/7] storage_file_probe: Remove BACKING_STORE_OK,BACKING_STORE_INVALID states Date: Fri, 24 Nov 2023 11:50:34 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: HUOB2DW6GUKJQJEN5EEQ2Z6ZA7IRWQ2W X-Message-ID-Hash: HUOB2DW6GUKJQJEN5EEQ2Z6ZA7IRWQ2W X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1700823405893100001 Replace the return values by 0 because none of the callers care and some of the backing store parser functions return this state also in cases the rest of the code would consider as success. Subsequently the parsers will be refactored and proper error reporting returned. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/storage_file/storage_file_probe.c | 51 ++++++++++++--------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/src/storage_file/storage_file_probe.c b/src/storage_file/stora= ge_file_probe.c index 4cf052c03d..16298f76c7 100644 --- a/src/storage_file/storage_file_probe.c +++ b/src/storage_file/storage_file_probe.c @@ -43,11 +43,6 @@ enum lv_endian { LV_BIG_ENDIAN /* 4321 */ }; -enum { - BACKING_STORE_OK, - BACKING_STORE_INVALID, -}; - #define FILE_TYPE_VERSIONS_LAST 3 struct FileEncryptionInfo { @@ -382,14 +377,14 @@ cowGetBackingStore(char **res, *format =3D VIR_STORAGE_FILE_AUTO; if (buf_size < 4+4+ COW_FILENAME_MAXLEN) - return BACKING_STORE_INVALID; + return 0; if (buf[4+4] =3D=3D '\0') { /* cow_header_v2.backing_file[0] */ *format =3D VIR_STORAGE_FILE_NONE; - return BACKING_STORE_OK; + return 0; } *res =3D g_strndup((const char *)buf + 4 + 4, COW_FILENAME_MAXLEN); - return BACKING_STORE_OK; + return 0; } @@ -527,34 +522,34 @@ qcowXGetBackingStore(char **res, *format =3D VIR_STORAGE_FILE_AUTO; if (buf_size < QCOWX_HDR_BACKING_FILE_OFFSET+8+4) - return BACKING_STORE_INVALID; + return 0; offset =3D virReadBufInt64BE(buf + QCOWX_HDR_BACKING_FILE_OFFSET); if (offset > buf_size) - return BACKING_STORE_INVALID; + return 0; if (offset =3D=3D 0) { *format =3D VIR_STORAGE_FILE_NONE; - return BACKING_STORE_OK; + return 0; } size =3D virReadBufInt32BE(buf + QCOWX_HDR_BACKING_FILE_SIZE); if (size =3D=3D 0) { *format =3D VIR_STORAGE_FILE_NONE; - return BACKING_STORE_OK; + return 0; } if (size > 1023) - return BACKING_STORE_INVALID; + return 0; if (offset + size > buf_size || offset + size < offset) - return BACKING_STORE_INVALID; + return 0; *res =3D g_new0(char, size + 1); memcpy(*res, buf + offset, size); (*res)[size] =3D '\0'; if (qcow2GetExtensions(buf, buf_size, format) < 0) - return BACKING_STORE_INVALID; + return 0; - return BACKING_STORE_OK; + return 0; } @@ -582,7 +577,7 @@ vmdk4GetBackingStore(char **res, *format =3D VIR_STORAGE_FILE_AUTO; if (buf_size <=3D 0x200) - return BACKING_STORE_INVALID; + return 0; len =3D buf_size - 0x200; if (len >=3D VIR_STORAGE_MAX_HEADER) @@ -592,21 +587,21 @@ vmdk4GetBackingStore(char **res, start =3D strstr(desc, prefix); if (start =3D=3D NULL) { *format =3D VIR_STORAGE_FILE_NONE; - return BACKING_STORE_OK; + return 0; } start +=3D strlen(prefix); end =3D strchr(start, '"'); if (end =3D=3D NULL) - return BACKING_STORE_INVALID; + return 0; if (end =3D=3D start) { *format =3D VIR_STORAGE_FILE_NONE; - return BACKING_STORE_OK; + return 0; } *end =3D '\0'; *res =3D g_strdup(start); - return BACKING_STORE_OK; + return 0; } static int @@ -621,24 +616,24 @@ qedGetBackingStore(char **res, *res =3D NULL; /* Check if this image has a backing file */ if (buf_size < QED_HDR_FEATURES_OFFSET+8) - return BACKING_STORE_INVALID; + return 0; flags =3D virReadBufInt64LE(buf + QED_HDR_FEATURES_OFFSET); if (!(flags & QED_F_BACKING_FILE)) { *format =3D VIR_STORAGE_FILE_NONE; - return BACKING_STORE_OK; + return 0; } /* Parse the backing file */ if (buf_size < QED_HDR_BACKING_FILE_OFFSET+8) - return BACKING_STORE_INVALID; + return 0; offset =3D virReadBufInt32LE(buf + QED_HDR_BACKING_FILE_OFFSET); if (offset > buf_size) - return BACKING_STORE_INVALID; + return 0; size =3D virReadBufInt32LE(buf + QED_HDR_BACKING_FILE_SIZE); if (size =3D=3D 0) - return BACKING_STORE_OK; + return 0; if (offset + size > buf_size || offset + size < offset) - return BACKING_STORE_INVALID; + return 0; *res =3D g_new0(char, size + 1); memcpy(*res, buf + offset, size); (*res)[size] =3D '\0'; @@ -648,7 +643,7 @@ qedGetBackingStore(char **res, else *format =3D VIR_STORAGE_FILE_AUTO_SAFE; - return BACKING_STORE_OK; + return 0; } --=20 2.42.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 17:41:33 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1700823538200137.92674654205678; Fri, 24 Nov 2023 02:58:58 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 20BA219D8; Fri, 24 Nov 2023 05:58:57 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 433BC18BE; Fri, 24 Nov 2023 05:51:23 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 9C62B17C5; Fri, 24 Nov 2023 05:50:47 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id A09D417A4 for ; Fri, 24 Nov 2023 05:50:45 -0500 (EST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-NuoRyaudMp-Q9yv8fLMEsw-1; Fri, 24 Nov 2023 05:50:44 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 046AA811E88 for ; Fri, 24 Nov 2023 10:50:44 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F309492BE7 for ; Fri, 24 Nov 2023 10:50:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,WEIRD_PORT autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: NuoRyaudMp-Q9yv8fLMEsw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 4/7] virstoragetest: Use strings for storage type and format in output data Date: Fri, 24 Nov 2023 11:50:35 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: EGLKYCKMRBSHXWFHV7WLFQFA36CYP56T X-Message-ID-Hash: EGLKYCKMRBSHXWFHV7WLFQFA36CYP56T X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1700823538727100001 Make it easier for the humans to read/compare the outputs. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/virstoragetest.c | 8 ++++---- tests/virstoragetestdata/out/directory-dir | 4 ++-- tests/virstoragetestdata/out/directory-none | 4 ++-- tests/virstoragetestdata/out/directory-raw | 4 ++-- .../out/qcow2-auto_qcow2-qcow2_raw-raw | 4 ++-- .../out/qcow2-auto_raw-raw-relative | 4 ++-- tests/virstoragetestdata/out/qcow2-qcow2_nbd-raw | 8 ++++---- tests/virstoragetestdata/out/qcow2-qcow2_qcow2-auto | 8 ++++---- .../out/qcow2-qcow2_qcow2-qcow2_qcow2-auto | 12 ++++++------ .../out/qcow2-qcow2_qcow2-qcow2_raw-auto | 12 ++++++------ .../out/qcow2-qcow2_qcow2-qcow2_raw-raw | 12 ++++++------ .../out/qcow2-qcow2_raw-raw-relative | 8 ++++---- tests/virstoragetestdata/out/qcow2-symlinks | 12 ++++++------ tests/virstoragetestdata/out/qed-auto_raw | 4 ++-- tests/virstoragetestdata/out/qed-qed_raw | 8 ++++---- tests/virstoragetestdata/out/raw-auto | 4 ++-- tests/virstoragetestdata/out/raw-raw | 4 ++-- 17 files changed, 60 insertions(+), 60 deletions(-) diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 11f7abbda6..c7421c55de 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -187,8 +187,8 @@ testStorageChain(const void *args) "capacity: %lld\n" "encryption: %d\n" "relPath:%s\n" - "type:%d\n" - "format:%d\n" + "type:%s\n" + "format:%s\n" "protocol:%s\n" "hostname:%s\n\n", strippedPath, @@ -196,8 +196,8 @@ testStorageChain(const void *args) elt->capacity, !!elt->encryption, strippedRelPath, - elt->type, - elt->format, + NULLSTR(virStorageTypeToString(elt->type)), + NULLSTR(virStorageFileFormatTypeToString(elt->fo= rmat)), virStorageNetProtocolTypeToString(elt->protocol), NULLSTR(elt->nhosts ? elt->hosts[0].name : NULL)= ); } diff --git a/tests/virstoragetestdata/out/directory-dir b/tests/virstoraget= estdata/out/directory-dir index 65b7b91912..298c6cfb4a 100644 --- a/tests/virstoragetestdata/out/directory-dir +++ b/tests/virstoragetestdata/out/directory-dir @@ -3,7 +3,7 @@ backingStoreRaw: capacity: 0 encryption: 0 relPath: -type:3 -format:2 +type:dir +format:dir protocol:none hostname: diff --git a/tests/virstoragetestdata/out/directory-none b/tests/virstorage= testdata/out/directory-none index 65b7b91912..298c6cfb4a 100644 --- a/tests/virstoragetestdata/out/directory-none +++ b/tests/virstoragetestdata/out/directory-none @@ -3,7 +3,7 @@ backingStoreRaw: capacity: 0 encryption: 0 relPath: -type:3 -format:2 +type:dir +format:dir protocol:none hostname: diff --git a/tests/virstoragetestdata/out/directory-raw b/tests/virstoraget= estdata/out/directory-raw index 5def2c4b8b..42589746b8 100644 --- a/tests/virstoragetestdata/out/directory-raw +++ b/tests/virstoragetestdata/out/directory-raw @@ -3,7 +3,7 @@ backingStoreRaw: capacity: 0 encryption: 0 relPath: -type:3 -format:1 +type:dir +format:raw protocol:none hostname: diff --git a/tests/virstoragetestdata/out/qcow2-auto_qcow2-qcow2_raw-raw b/= tests/virstoragetestdata/out/qcow2-auto_qcow2-qcow2_raw-raw index 2ea087592e..7c299542a4 100644 --- a/tests/virstoragetestdata/out/qcow2-auto_qcow2-qcow2_raw-raw +++ b/tests/virstoragetestdata/out/qcow2-auto_qcow2-qcow2_raw-raw @@ -3,7 +3,7 @@ backingStoreRaw: capacity: 0 encryption: 0 relPath: -type:1 -format:1 +type:file +format:raw protocol:none hostname: diff --git a/tests/virstoragetestdata/out/qcow2-auto_raw-raw-relative b/tes= ts/virstoragetestdata/out/qcow2-auto_raw-raw-relative index f9afc138f0..9f8246900d 100644 --- a/tests/virstoragetestdata/out/qcow2-auto_raw-raw-relative +++ b/tests/virstoragetestdata/out/qcow2-auto_raw-raw-relative @@ -3,7 +3,7 @@ backingStoreRaw: capacity: 0 encryption: 0 relPath: -type:1 -format:1 +type:file +format:raw protocol:none hostname: diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_nbd-raw b/tests/virst= oragetestdata/out/qcow2-qcow2_nbd-raw index 08a93b9f32..761e65b234 100644 --- a/tests/virstoragetestdata/out/qcow2-qcow2_nbd-raw +++ b/tests/virstoragetestdata/out/qcow2-qcow2_nbd-raw @@ -3,8 +3,8 @@ backingStoreRaw: nbd+tcp://example.org:6000/blah capacity: 1024 encryption: 0 relPath: -type:1 -format:14 +type:file +format:qcow2 protocol:none hostname: @@ -13,7 +13,7 @@ backingStoreRaw: capacity: 0 encryption: 0 relPath: -type:4 -format:1 +type:network +format:raw protocol:nbd hostname:example.org diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-auto b/tests/vi= rstoragetestdata/out/qcow2-qcow2_qcow2-auto index e23c43f328..57f2f51108 100644 --- a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-auto +++ b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-auto @@ -3,8 +3,8 @@ backingStoreRaw: qcow2 capacity: 1024 encryption: 0 relPath: -type:1 -format:14 +type:file +format:qcow2 protocol:none hostname: @@ -13,7 +13,7 @@ backingStoreRaw: capacity: 1024 encryption: 0 relPath:qcow2 -type:1 -format:14 +type:file +format:qcow2 protocol:none hostname: diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-aut= o b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-auto index 17f53f3ed0..99d3c4c273 100644 --- a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-auto +++ b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-auto @@ -3,8 +3,8 @@ backingStoreRaw: qcow2_qcow2-auto.qcow2 capacity: 1024 encryption: 0 relPath: -type:1 -format:14 +type:file +format:qcow2 protocol:none hostname: @@ -13,8 +13,8 @@ backingStoreRaw: qcow2 capacity: 1024 encryption: 0 relPath:qcow2_qcow2-auto.qcow2 -type:1 -format:14 +type:file +format:qcow2 protocol:none hostname: @@ -23,7 +23,7 @@ backingStoreRaw: capacity: 1024 encryption: 0 relPath:qcow2 -type:1 -format:14 +type:file +format:qcow2 protocol:none hostname: diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto = b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto index 1be5a82cc9..9734cf22b9 100644 --- a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto +++ b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto @@ -3,8 +3,8 @@ backingStoreRaw: qcow2_raw-auto.qcow2 capacity: 1024 encryption: 0 relPath: -type:1 -format:14 +type:file +format:qcow2 protocol:none hostname: @@ -13,8 +13,8 @@ backingStoreRaw: raw capacity: 1024 encryption: 0 relPath:qcow2_raw-auto.qcow2 -type:1 -format:14 +type:file +format:qcow2 protocol:none hostname: @@ -23,7 +23,7 @@ backingStoreRaw: capacity: 0 encryption: 0 relPath:raw -type:1 -format:1 +type:file +format:raw protocol:none hostname: diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-raw b= /tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-raw index 5f93fe746b..0c90e9858d 100644 --- a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-raw +++ b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-raw @@ -3,8 +3,8 @@ backingStoreRaw: ABS_BUILDDIR/virstoragedata/qcow2 capacity: 1024 encryption: 0 relPath: -type:1 -format:14 +type:file +format:qcow2 protocol:none hostname: @@ -13,8 +13,8 @@ backingStoreRaw: ABS_BUILDDIR/virstoragedata/raw capacity: 1024 encryption: 0 relPath: -type:1 -format:14 +type:file +format:qcow2 protocol:none hostname: @@ -23,7 +23,7 @@ backingStoreRaw: capacity: 0 encryption: 0 relPath: -type:1 -format:1 +type:file +format:raw protocol:none hostname: diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_raw-raw-relative b/te= sts/virstoragetestdata/out/qcow2-qcow2_raw-raw-relative index 6e3f7ab339..552353e980 100644 --- a/tests/virstoragetestdata/out/qcow2-qcow2_raw-raw-relative +++ b/tests/virstoragetestdata/out/qcow2-qcow2_raw-raw-relative @@ -3,8 +3,8 @@ backingStoreRaw: raw capacity: 1024 encryption: 0 relPath: -type:1 -format:14 +type:file +format:qcow2 protocol:none hostname: @@ -13,7 +13,7 @@ backingStoreRaw: capacity: 0 encryption: 0 relPath:raw -type:1 -format:1 +type:file +format:raw protocol:none hostname: diff --git a/tests/virstoragetestdata/out/qcow2-symlinks b/tests/virstorage= testdata/out/qcow2-symlinks index 34c3a37c2e..8e531e4cf8 100644 --- a/tests/virstoragetestdata/out/qcow2-symlinks +++ b/tests/virstoragetestdata/out/qcow2-symlinks @@ -3,8 +3,8 @@ backingStoreRaw: ../sub/link1 capacity: 1024 encryption: 0 relPath: -type:1 -format:14 +type:file +format:qcow2 protocol:none hostname: @@ -13,8 +13,8 @@ backingStoreRaw: ../raw capacity: 1024 encryption: 0 relPath:../sub/link1 -type:1 -format:14 +type:file +format:qcow2 protocol:none hostname: @@ -23,7 +23,7 @@ backingStoreRaw: capacity: 0 encryption: 0 relPath:../raw -type:1 -format:1 +type:file +format:raw protocol:none hostname: diff --git a/tests/virstoragetestdata/out/qed-auto_raw b/tests/virstoragete= stdata/out/qed-auto_raw index 292a8fa7fb..a75ef8189b 100644 --- a/tests/virstoragetestdata/out/qed-auto_raw +++ b/tests/virstoragetestdata/out/qed-auto_raw @@ -3,7 +3,7 @@ backingStoreRaw: capacity: 0 encryption: 0 relPath: -type:1 -format:1 +type:file +format:raw protocol:none hostname: diff --git a/tests/virstoragetestdata/out/qed-qed_raw b/tests/virstoragetes= tdata/out/qed-qed_raw index 043ec4240b..18a5091e6f 100644 --- a/tests/virstoragetestdata/out/qed-qed_raw +++ b/tests/virstoragetestdata/out/qed-qed_raw @@ -3,8 +3,8 @@ backingStoreRaw: raw capacity: 1024 encryption: 0 relPath: -type:1 -format:15 +type:file +format:qed protocol:none hostname: @@ -13,7 +13,7 @@ backingStoreRaw: capacity: 0 encryption: 0 relPath:raw -type:1 -format:1 +type:file +format:raw protocol:none hostname: diff --git a/tests/virstoragetestdata/out/raw-auto b/tests/virstoragetestda= ta/out/raw-auto index d98b6e8bf5..90a9dfceda 100644 --- a/tests/virstoragetestdata/out/raw-auto +++ b/tests/virstoragetestdata/out/raw-auto @@ -3,7 +3,7 @@ backingStoreRaw: capacity: 0 encryption: 0 relPath: -type:1 -format:1 +type:file +format:raw protocol:none hostname: diff --git a/tests/virstoragetestdata/out/raw-raw b/tests/virstoragetestdat= a/out/raw-raw index d98b6e8bf5..90a9dfceda 100644 --- a/tests/virstoragetestdata/out/raw-raw +++ b/tests/virstoragetestdata/out/raw-raw @@ -3,7 +3,7 @@ backingStoreRaw: capacity: 0 encryption: 0 relPath: -type:1 -format:1 +type:file +format:raw protocol:none hostname: --=20 2.42.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 17:41:33 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 170082368772752.97495362887571; Fri, 24 Nov 2023 03:01:27 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 8B953193E; Fri, 24 Nov 2023 06:01:26 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 6CC64189B; Fri, 24 Nov 2023 05:51:32 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id D02801887; Fri, 24 Nov 2023 05:50:50 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id A0BDB17C0 for ; Fri, 24 Nov 2023 05:50:46 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-495-yUODONXBPE6ftKO4PDhNhw-1; Fri, 24 Nov 2023 05:50:45 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C10BB3C0BE2E for ; Fri, 24 Nov 2023 10:50:44 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48EAF492BE7 for ; Fri, 24 Nov 2023 10:50:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,WEIRD_PORT autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: yUODONXBPE6ftKO4PDhNhw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 5/7] virstoragetest: Format detected/unprocessed backing store format into output files Date: Fri, 24 Nov 2023 11:50:36 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: UE4ZBJBCHSIN4YNM7HJW4GOF73JKRYFQ X-Message-ID-Hash: UE4ZBJBCHSIN4YNM7HJW4GOF73JKRYFQ X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1700823689621100001 Compare also the detected format of the backing file ('backingStoreRawFormat' field) into the outptu data for comparison with others. Since the ToString function can't convert VIR_STORAGE_FILE_AUTO use also the numeric value. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/virstoragetest.c | 3 +++ tests/virstoragetestdata/out/directory-dir | 1 + tests/virstoragetestdata/out/directory-none | 1 + tests/virstoragetestdata/out/directory-raw | 1 + tests/virstoragetestdata/out/qcow2-auto_qcow2-qcow2_raw-raw | 1 + tests/virstoragetestdata/out/qcow2-auto_raw-raw-relative | 1 + tests/virstoragetestdata/out/qcow2-qcow2_nbd-raw | 2 ++ tests/virstoragetestdata/out/qcow2-qcow2_qcow2-auto | 2 ++ .../virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-auto | 3 +++ tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto | 3 +++ tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-raw | 3 +++ tests/virstoragetestdata/out/qcow2-qcow2_raw-raw-relative | 2 ++ tests/virstoragetestdata/out/qcow2-symlinks | 3 +++ tests/virstoragetestdata/out/qed-auto_raw | 1 + tests/virstoragetestdata/out/qed-qed_raw | 2 ++ tests/virstoragetestdata/out/raw-auto | 1 + tests/virstoragetestdata/out/raw-raw | 1 + 17 files changed, 31 insertions(+) diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index c7421c55de..c28a23e332 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -184,6 +184,7 @@ testStorageChain(const void *args) virBufferAsprintf(&buf, "path:%s\n" "backingStoreRaw: %s\n" + "backingStoreRawFormat: %s(%d)\n" "capacity: %lld\n" "encryption: %d\n" "relPath:%s\n" @@ -193,6 +194,8 @@ testStorageChain(const void *args) "hostname:%s\n\n", strippedPath, strippedBackingStoreRaw, + NULLSTR(virStorageFileFormatTypeToString(elt->ba= ckingStoreRawFormat)), + elt->backingStoreRawFormat, elt->capacity, !!elt->encryption, strippedRelPath, diff --git a/tests/virstoragetestdata/out/directory-dir b/tests/virstoraget= estdata/out/directory-dir index 298c6cfb4a..c6a2fa3673 100644 --- a/tests/virstoragetestdata/out/directory-dir +++ b/tests/virstoragetestdata/out/directory-dir @@ -1,5 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/ backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 0 encryption: 0 relPath: diff --git a/tests/virstoragetestdata/out/directory-none b/tests/virstorage= testdata/out/directory-none index 298c6cfb4a..c6a2fa3673 100644 --- a/tests/virstoragetestdata/out/directory-none +++ b/tests/virstoragetestdata/out/directory-none @@ -1,5 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/ backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 0 encryption: 0 relPath: diff --git a/tests/virstoragetestdata/out/directory-raw b/tests/virstoraget= estdata/out/directory-raw index 42589746b8..6e190c97f4 100644 --- a/tests/virstoragetestdata/out/directory-raw +++ b/tests/virstoragetestdata/out/directory-raw @@ -1,5 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/ backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 0 encryption: 0 relPath: diff --git a/tests/virstoragetestdata/out/qcow2-auto_qcow2-qcow2_raw-raw b/= tests/virstoragetestdata/out/qcow2-auto_qcow2-qcow2_raw-raw index 7c299542a4..0540be0c09 100644 --- a/tests/virstoragetestdata/out/qcow2-auto_qcow2-qcow2_raw-raw +++ b/tests/virstoragetestdata/out/qcow2-auto_qcow2-qcow2_raw-raw @@ -1,5 +1,6 @@ path:ABS_BUILDDIR/virstoragedata/wrap backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 0 encryption: 0 relPath: diff --git a/tests/virstoragetestdata/out/qcow2-auto_raw-raw-relative b/tes= ts/virstoragetestdata/out/qcow2-auto_raw-raw-relative index 9f8246900d..e145cca417 100644 --- a/tests/virstoragetestdata/out/qcow2-auto_raw-raw-relative +++ b/tests/virstoragetestdata/out/qcow2-auto_raw-raw-relative @@ -1,5 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/qcow2_raw-raw-relative.qcow2 backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 0 encryption: 0 relPath: diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_nbd-raw b/tests/virst= oragetestdata/out/qcow2-qcow2_nbd-raw index 761e65b234..0c2bb0ddc4 100644 --- a/tests/virstoragetestdata/out/qcow2-qcow2_nbd-raw +++ b/tests/virstoragetestdata/out/qcow2-qcow2_nbd-raw @@ -1,5 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/qcow2_nbd-raw.qcow2 backingStoreRaw: nbd+tcp://example.org:6000/blah +backingStoreRawFormat: raw(1) capacity: 1024 encryption: 0 relPath: @@ -10,6 +11,7 @@ hostname: path:blah backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 0 encryption: 0 relPath: diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-auto b/tests/vi= rstoragetestdata/out/qcow2-qcow2_qcow2-auto index 57f2f51108..58f1dd6d9e 100644 --- a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-auto +++ b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-auto @@ -1,5 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/qcow2_qcow2-auto.qcow2 backingStoreRaw: qcow2 +backingStoreRawFormat: (-1) capacity: 1024 encryption: 0 relPath: @@ -10,6 +11,7 @@ hostname: path:ABS_SRCDIR/virstoragetestdata/images/qcow2 backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 1024 encryption: 0 relPath:qcow2 diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-aut= o b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-auto index 99d3c4c273..81263c4bc0 100644 --- a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-auto +++ b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-auto @@ -1,5 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/qcow2_qcow2-qcow2_qcow2-auto.qco= w2 backingStoreRaw: qcow2_qcow2-auto.qcow2 +backingStoreRawFormat: qcow2(14) capacity: 1024 encryption: 0 relPath: @@ -10,6 +11,7 @@ hostname: path:ABS_SRCDIR/virstoragetestdata/images/qcow2_qcow2-auto.qcow2 backingStoreRaw: qcow2 +backingStoreRawFormat: (-1) capacity: 1024 encryption: 0 relPath:qcow2_qcow2-auto.qcow2 @@ -20,6 +22,7 @@ hostname: path:ABS_SRCDIR/virstoragetestdata/images/qcow2 backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 1024 encryption: 0 relPath:qcow2 diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto = b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto index 9734cf22b9..cbb8d6a33f 100644 --- a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto +++ b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto @@ -1,5 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/qcow2_qcow2-qcow2_raw-auto.qcow2 backingStoreRaw: qcow2_raw-auto.qcow2 +backingStoreRawFormat: qcow2(14) capacity: 1024 encryption: 0 relPath: @@ -10,6 +11,7 @@ hostname: path:ABS_SRCDIR/virstoragetestdata/images/qcow2_raw-auto.qcow2 backingStoreRaw: raw +backingStoreRawFormat: (-1) capacity: 1024 encryption: 0 relPath:qcow2_raw-auto.qcow2 @@ -20,6 +22,7 @@ hostname: path:ABS_SRCDIR/virstoragetestdata/images/raw backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 0 encryption: 0 relPath:raw diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-raw b= /tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-raw index 0c90e9858d..de11029922 100644 --- a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-raw +++ b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-raw @@ -1,5 +1,6 @@ path:ABS_BUILDDIR/virstoragedata/wrap backingStoreRaw: ABS_BUILDDIR/virstoragedata/qcow2 +backingStoreRawFormat: qcow2(14) capacity: 1024 encryption: 0 relPath: @@ -10,6 +11,7 @@ hostname: path:ABS_BUILDDIR/virstoragedata/qcow2 backingStoreRaw: ABS_BUILDDIR/virstoragedata/raw +backingStoreRawFormat: raw(1) capacity: 1024 encryption: 0 relPath: @@ -20,6 +22,7 @@ hostname: path:ABS_BUILDDIR/virstoragedata/raw backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 0 encryption: 0 relPath: diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_raw-raw-relative b/te= sts/virstoragetestdata/out/qcow2-qcow2_raw-raw-relative index 552353e980..b4bfd432ad 100644 --- a/tests/virstoragetestdata/out/qcow2-qcow2_raw-raw-relative +++ b/tests/virstoragetestdata/out/qcow2-qcow2_raw-raw-relative @@ -1,5 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/qcow2_raw-raw-relative.qcow2 backingStoreRaw: raw +backingStoreRawFormat: raw(1) capacity: 1024 encryption: 0 relPath: @@ -10,6 +11,7 @@ hostname: path:ABS_SRCDIR/virstoragetestdata/images/raw backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 0 encryption: 0 relPath:raw diff --git a/tests/virstoragetestdata/out/qcow2-symlinks b/tests/virstorage= testdata/out/qcow2-symlinks index 8e531e4cf8..f053f95fd7 100644 --- a/tests/virstoragetestdata/out/qcow2-symlinks +++ b/tests/virstoragetestdata/out/qcow2-symlinks @@ -1,5 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/sub/link2 backingStoreRaw: ../sub/link1 +backingStoreRawFormat: qcow2(14) capacity: 1024 encryption: 0 relPath: @@ -10,6 +11,7 @@ hostname: path:ABS_SRCDIR/virstoragetestdata/images/sub/../sub/link1 backingStoreRaw: ../raw +backingStoreRawFormat: raw(1) capacity: 1024 encryption: 0 relPath:../sub/link1 @@ -20,6 +22,7 @@ hostname: path:ABS_SRCDIR/virstoragetestdata/images/sub/../sub/../raw backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 0 encryption: 0 relPath:../raw diff --git a/tests/virstoragetestdata/out/qed-auto_raw b/tests/virstoragete= stdata/out/qed-auto_raw index a75ef8189b..260c3fbc79 100644 --- a/tests/virstoragetestdata/out/qed-auto_raw +++ b/tests/virstoragetestdata/out/qed-auto_raw @@ -1,5 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/qed_raw-raw-relative backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 0 encryption: 0 relPath: diff --git a/tests/virstoragetestdata/out/qed-qed_raw b/tests/virstoragetes= tdata/out/qed-qed_raw index 18a5091e6f..a13d407a5f 100644 --- a/tests/virstoragetestdata/out/qed-qed_raw +++ b/tests/virstoragetestdata/out/qed-qed_raw @@ -1,5 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/qed_raw-raw-relative backingStoreRaw: raw +backingStoreRawFormat: raw(1) capacity: 1024 encryption: 0 relPath: @@ -10,6 +11,7 @@ hostname: path:ABS_SRCDIR/virstoragetestdata/images/raw backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 0 encryption: 0 relPath:raw diff --git a/tests/virstoragetestdata/out/raw-auto b/tests/virstoragetestda= ta/out/raw-auto index 90a9dfceda..70ec22f309 100644 --- a/tests/virstoragetestdata/out/raw-auto +++ b/tests/virstoragetestdata/out/raw-auto @@ -1,5 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/raw backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 0 encryption: 0 relPath: diff --git a/tests/virstoragetestdata/out/raw-raw b/tests/virstoragetestdat= a/out/raw-raw index 90a9dfceda..70ec22f309 100644 --- a/tests/virstoragetestdata/out/raw-raw +++ b/tests/virstoragetestdata/out/raw-raw @@ -1,5 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/raw backingStoreRaw: +backingStoreRawFormat: none(0) capacity: 0 encryption: 0 relPath: --=20 2.42.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 17:41:33 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1700823836273702.8040204207668; Fri, 24 Nov 2023 03:03:56 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id EB10C1916; Fri, 24 Nov 2023 06:03:54 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 98BC81914; Fri, 24 Nov 2023 05:51:42 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id B16C7193E; Fri, 24 Nov 2023 05:51:13 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 7877017C7 for ; Fri, 24 Nov 2023 05:50:48 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-685-ZcbtwpzWOkGAWKDhNtzOdw-1; Fri, 24 Nov 2023 05:50:46 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 347F41C03D82 for ; Fri, 24 Nov 2023 10:50:46 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C653492BE8 for ; Fri, 24 Nov 2023 10:50:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,WEIRD_PORT autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: ZcbtwpzWOkGAWKDhNtzOdw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 6/7] virstoragetest: Add test cases for QCOW2 files with a protocol name as backing file format Date: Fri, 24 Nov 2023 11:50:37 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: PQZJ7KMYXPGCFL5M64BMNXA5CRWXKADW X-Message-ID-Hash: PQZJ7KMYXPGCFL5M64BMNXA5CRWXKADW X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1700823838433100001 QEMU allows and in cases where you omit the not-strictly-needed 'raw' driver on top of raw images automatically uses the protocol name inside of the 'backing file format' field of the qcow2 image. Libvirt expects only format names in that field. Add example images showing this scenario, which will be fixed later. The qcow2 image files in this commit were formatted as: qemu-img create -f qcow2 -F nbd -b nbd+tcp://example.org:6000/blah -u qc= ow2-protocol-backing-nbd.qcow2 10M and qemu-img create -f qcow2 -F file -b raw qcow2-protocol-backing-file.qcow2 thus using 'nbd' and 'file' as backing format respectively. (note that '-b raw' refers to the file in the example image folder) To satisfy the test, note that the NBD image is also rejected as we can't probe it, thus such configuration would not work. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/virstoragetest.c | 8 +++++++ .../images/qcow2-protocol-backing-file.qcow2 | Bin 0 -> 196616 bytes .../images/qcow2-protocol-backing-nbd.qcow2 | Bin 0 -> 196616 bytes .../out/qcow2-protocol-backing-file | 21 ++++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 tests/virstoragetestdata/images/qcow2-protocol-backing-= file.qcow2 create mode 100644 tests/virstoragetestdata/images/qcow2-protocol-backing-= nbd.qcow2 create mode 100644 tests/virstoragetestdata/out/qcow2-protocol-backing-file diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index c28a23e332..53533d5885 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -478,6 +478,14 @@ mymain(void) abs_srcdir "/virstoragetestdata/images/qcow2_qcow2-auto.qco= w2", VIR_STORAGE_FILE_QCOW2, EXP_PASS); + /* QCOW2 with protocol recorded inside the 'backing file format field = */ + TEST_CHAIN("qcow2-protocol-backing-file", + abs_srcdir "/virstoragetestdata/images/qcow2-protocol-backi= ng-file.qcow2", + VIR_STORAGE_FILE_QCOW2, EXP_PASS); + TEST_CHAIN("qcow2-protocol-backing-nbd", + abs_srcdir "/virstoragetestdata/images/qcow2-protocol-backi= ng-nbd.qcow2", + VIR_STORAGE_FILE_QCOW2, EXP_FAIL); + /* Qcow2 file with missing backing file but specified type */ TEST_CHAIN("qcow2-qcow2_missing", abs_srcdir "/virstoragetestdata/images/qcow2_qcow2-missing.= qcow2", diff --git a/tests/virstoragetestdata/images/qcow2-protocol-backing-file.qc= ow2 b/tests/virstoragetestdata/images/qcow2-protocol-backing-file.qcow2 new file mode 100644 index 0000000000000000000000000000000000000000..b3fe320f0f521820f2c4a614fed= 4cea18fdca55c GIT binary patch literal 196616 zcmeIuJx;?g6aZi+?EyGKW=3D0Nygv7$c9GX-_YLh4pf-rGDj=3D?FASaABIib`$S`#DN% zKR?@f-^1O$iVnK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ;4%e% E0pRvEvj6}9 literal 0 HcmV?d00001 diff --git a/tests/virstoragetestdata/images/qcow2-protocol-backing-nbd.qco= w2 b/tests/virstoragetestdata/images/qcow2-protocol-backing-nbd.qcow2 new file mode 100644 index 0000000000000000000000000000000000000000..0ae422d8f550cc6bacf3d4d7571= 10177ce457865 GIT binary patch literal 196616 zcmeIv!EVzq00v+u-2?CjH+{fAMWuudtJpor#9|pHYh?@f8JLqUT=3DomKF>vu ztCV4q+1BGfgQq>qBGsR&Kh8Y!HIGBne|ecV(-1) +capacity: 1024 +encryption: 0 +relPath: +type:file +format:qcow2 +protocol:none +hostname: + +path:ABS_SRCDIR/virstoragetestdata/images/raw +backingStoreRaw: +backingStoreRawFormat: none(0) +capacity: 0 +encryption: 0 +relPath:raw +type:file +format:raw +protocol:none +hostname: --=20 2.42.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Wed May 15 17:41:33 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1700823913438106.4298552651436; Fri, 24 Nov 2023 03:05:13 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 3DAED188C; Fri, 24 Nov 2023 06:05:12 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id A5A3817D8; Fri, 24 Nov 2023 05:51:53 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4F4D41887; Fri, 24 Nov 2023 05:51:15 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 02CDE17CD for ; Fri, 24 Nov 2023 05:50:48 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-300-cD_o6xLjPzKkm9womxD_ug-1; Fri, 24 Nov 2023 05:50:47 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0A5513C0BE4D for ; Fri, 24 Nov 2023 10:50:47 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EBB8492BE7 for ; Fri, 24 Nov 2023 10:50:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,WEIRD_PORT autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: cD_o6xLjPzKkm9womxD_ug-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 7/7] storage_file_probe: Treat qcow2 images with protocol drivers in backing store field as raw Date: Fri, 24 Nov 2023 11:50:38 +0100 Message-ID: <83301baaec451dcba6f6405a3bcd27c99b6e31cc.1700822943.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 4U3QG2NHXD6734QWYD2CYGEO5NTSWP7R X-Message-ID-Hash: 4U3QG2NHXD6734QWYD2CYGEO5NTSWP7R X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1700823914606100001 qemu allows and in some cases uses protocol driver names ('file', 'host_device', 'nbd', ...) in the 'backing file format' field of a qcow to denote a image where the dummy 'raw' driver was not used on top. Adapt our backing store parser for such cases. The examples added in previous patch show the difference in behaviour. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/storage_file/storage_file_probe.c | 8 ++++++- tests/virstoragetest.c | 2 +- .../out/qcow2-protocol-backing-file | 2 +- .../out/qcow2-protocol-backing-nbd | 21 +++++++++++++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 tests/virstoragetestdata/out/qcow2-protocol-backing-nbd diff --git a/src/storage_file/storage_file_probe.c b/src/storage_file/stora= ge_file_probe.c index 16298f76c7..243927d50a 100644 --- a/src/storage_file/storage_file_probe.c +++ b/src/storage_file/storage_file_probe.c @@ -474,9 +474,15 @@ qcow2GetExtensions(const char *buf, memcpy(tmp, buf + offset, len); tmp[len] =3D '\0'; + /* qemu and qemu-img allow using the protocol driver name insi= de + * of the format field in cases when the dummy 'raw' driver sh= ould + * not be created. Thus libvirt needs to consider anything that + * doesn't look like a format driver name to be a protocol dri= ver + * directly and thus the image is in fact still considered raw + */ *backingFormat =3D virStorageFileFormatTypeFromString(tmp); if (*backingFormat <=3D VIR_STORAGE_FILE_NONE) - return -1; + *backingFormat =3D VIR_STORAGE_FILE_RAW; break; } diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 53533d5885..d07a05d04b 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -484,7 +484,7 @@ mymain(void) VIR_STORAGE_FILE_QCOW2, EXP_PASS); TEST_CHAIN("qcow2-protocol-backing-nbd", abs_srcdir "/virstoragetestdata/images/qcow2-protocol-backi= ng-nbd.qcow2", - VIR_STORAGE_FILE_QCOW2, EXP_FAIL); + VIR_STORAGE_FILE_QCOW2, EXP_PASS); /* Qcow2 file with missing backing file but specified type */ TEST_CHAIN("qcow2-qcow2_missing", diff --git a/tests/virstoragetestdata/out/qcow2-protocol-backing-file b/tes= ts/virstoragetestdata/out/qcow2-protocol-backing-file index b565bdba77..d9d4c1316c 100644 --- a/tests/virstoragetestdata/out/qcow2-protocol-backing-file +++ b/tests/virstoragetestdata/out/qcow2-protocol-backing-file @@ -1,6 +1,6 @@ path:ABS_SRCDIR/virstoragetestdata/images/qcow2-protocol-backing-file.qcow2 backingStoreRaw: raw -backingStoreRawFormat: (-1) +backingStoreRawFormat: raw(1) capacity: 1024 encryption: 0 relPath: diff --git a/tests/virstoragetestdata/out/qcow2-protocol-backing-nbd b/test= s/virstoragetestdata/out/qcow2-protocol-backing-nbd new file mode 100644 index 0000000000..360a496ab0 --- /dev/null +++ b/tests/virstoragetestdata/out/qcow2-protocol-backing-nbd @@ -0,0 +1,21 @@ +path:ABS_SRCDIR/virstoragetestdata/images/qcow2-protocol-backing-nbd.qcow2 +backingStoreRaw: nbd+tcp://example.org:6000/blah +backingStoreRawFormat: raw(1) +capacity: 10485760 +encryption: 0 +relPath: +type:file +format:qcow2 +protocol:none +hostname: + +path:blah +backingStoreRaw: +backingStoreRawFormat: none(0) +capacity: 0 +encryption: 0 +relPath: +type:network +format:raw +protocol:nbd +hostname:example.org --=20 2.42.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org