From nobody Mon Feb 2 05:55:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1769443726; cv=none; d=zohomail.com; s=zohoarc; b=dDwsBEsVaFKMDUSC67t8uIN0axd5dD0TYlMip+vrpDEYPHWToDk4Pg7TYOaND0hHIDpHnxoDrffBen+GuGzeOnH3TouLie67ZrZafc9XEnbrijyb48xNQL84CgpmIlnlsexEhP6sYUziopniKRVktqRWZ0oBllUvQZXVbj88jvo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769443726; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=u35z2YXwdOFY2da0teA+cB53M5Q0G03lFTcCuReCgjY=; b=bQa2R4cSeYeCXUsqj+Gkk5D2n6fYuceSPHFX52pXF0G0VkMpZJaREGm7VNjrCtSna05X/SG1IGsFHIuLJmDnkcxckEmcLQybttYc7Mij8wiKXIIKk0qIrfUIzDGaiRdGOCNxItD3dB7rnofrV4hGI+eLyvUid8c0jBzbPvmsy2Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1769443726769795.225172161; Mon, 26 Jan 2026 08:08:46 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id CE0E041B97; Mon, 26 Jan 2026 11:08:45 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 6C0CC43DCA; Mon, 26 Jan 2026 11:07:07 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 8942241950; Mon, 26 Jan 2026 11:07:00 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 113524194C for ; Mon, 26 Jan 2026 11:07:00 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-639-2akpRkoNNVWi7-Dj0CAVdQ-1; Mon, 26 Jan 2026 11:06:58 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4A7C619775D6 for ; Mon, 26 Jan 2026 16:06:57 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 90BFB18001D5 for ; Mon, 26 Jan 2026 16:06:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769443619; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u35z2YXwdOFY2da0teA+cB53M5Q0G03lFTcCuReCgjY=; b=eOV6FUrmuW/zCaVpcw0cpPNao/n3mTeE2j/YerxQ634piNSQA82Gj/SbbzJTVDbjZc94+Y 957plVVdX9sJ/XmUppbM7nqI9SwA3TAhuzgKO/PJt4OmDrozKdFSCpUXAOjaf79X7aqZyM zoCIrFOJ33igkkinNhEagj+0+D9q044= X-MC-Unique: 2akpRkoNNVWi7-Dj0CAVdQ-1 X-Mimecast-MFC-AGG-ID: 2akpRkoNNVWi7-Dj0CAVdQ_1769443617 To: devel@lists.libvirt.org Subject: [PATCH v2 1/5] qemuSnapshotDiskHasBackingDisk: Avoid call of virStorageSourceIsSameLocation with NULL argument Date: Mon, 26 Jan 2026 17:06:49 +0100 Message-ID: <641838b5d03750d50397dc4cc7239bf81ace9253.1769443445.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: chn4hP01LddjiZKK6myQ0mUGWeAC0AIQjIFzLcFiyuc_1769443617 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 3R67CEM3PORJ6ECYETQROCT625XWJ5DH X-Message-ID-Hash: 3R67CEM3PORJ6ECYETQROCT625XWJ5DH X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1769443728334158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa When the 'backingStore' pointer is not populated the function calls 'virStorageSourceGetMetadata' to try to populate it but if the on-disk metadata doesn't have a backing image (e.g. if it's the 'base' image of the chain) the 'backingStore' or the metadata fetcher fails the pointer will still be NULL. The function then calls 'virStorageSourceIsSameLocation' but the internal functions for dealing with storage sources don't handle NULL gracefully. Since the code calling 'qemu-img' based on the data detected here doesn't actually raise errors if the operations fail there's no point in raising errors here either. Closes: https://gitlab.com/libvirt/libvirt/-/issues/844 Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index e738afffc3..8f58df3b45 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3147,7 +3147,8 @@ qemuSnapshotDiskHasBackingDisk(void *payload, if (!disk->src->backingStore) ignore_value(virStorageSourceGetMetadata(disk->src, uid, gid, = 1, false)); - if (virStorageSourceIsSameLocation(disk->src->backingStore, iterda= ta->diskSrc)) { + if (disk->src->backingStore && + virStorageSourceIsSameLocation(disk->src->backingStore, iterda= ta->diskSrc)) { struct _qemuSnapshotDisksWithBackingStoreData *data =3D g_new0(struct _qemuSnapshotDisksWithBackingStoreData, 1); --=20 2.52.0 From nobody Mon Feb 2 05:55:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1769443885; cv=none; d=zohomail.com; s=zohoarc; b=h+7KRx9O4Vvi6GT22wYMUzO3hGhpHN03eINQ6L12x6DF1nYpYA2nuKCK25zbo8f9WhSEc5C+f+yONlO1N9QTes3F9by743F2Waxj09RlrjHede8mgj+wU1X9A8EDoXPmbqR8q06SNsHBb4yGpWJnrbS6mYxDjS+AKmFHgnvzJGU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769443885; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=AC7HZbVtcEiVwB0pCqrt4qkvn0/1Z1C5DhC/pwcrxy0=; b=G5hHJPSIidkizT+0+d52bRrCcG/qOjYg1ht/GpiX/wywVoIigWM/LVbR2dbo5DKmAv3HKrtKvX9T5PBDVdLRYsMxifQFxMHIpIM4UKEf4GLyzbv70no0TWZuVVDqYRGSYAlJ9qsJe9JVriHDgArWFL7i0Sgtjl2O+I5d6jFKLeY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1769443885882736.3720356840353; Mon, 26 Jan 2026 08:11:25 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 34E11419AD; Mon, 26 Jan 2026 11:11:25 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id A06BA41B1A; Mon, 26 Jan 2026 11:08:15 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id D905E4199F; Mon, 26 Jan 2026 11:08:10 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id DF8E641C8E for ; Mon, 26 Jan 2026 11:07:06 -0500 (EST) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-299-RmhT_r-lNP6qrAReAyUyqA-1; Mon, 26 Jan 2026 11:06:59 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 745F21955D84 for ; Mon, 26 Jan 2026 16:06:58 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B3748180049F for ; Mon, 26 Jan 2026 16:06:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769443626; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AC7HZbVtcEiVwB0pCqrt4qkvn0/1Z1C5DhC/pwcrxy0=; b=b0uoEEizAJkem4CjfbFiIb/i1gYayWV9NgcQW69zpWKSHw5eC4JU8HQ94vI+oWcs4NyPY0 TxS1hhfdSBjNPbFsZTJx8157953DE2dQiT9UHcJde+BZNPZhvqqdh/jX/B82qPto3PQ1nu GLtUzQNDo9SoSQECxdeoYngkWN+ouOs= X-MC-Unique: RmhT_r-lNP6qrAReAyUyqA-1 X-Mimecast-MFC-AGG-ID: RmhT_r-lNP6qrAReAyUyqA_1769443618 To: devel@lists.libvirt.org Subject: [PATCH v2 2/5] qemuSnapshotUpdateBackingStore: Remove stale comment Date: Mon, 26 Jan 2026 17:06:50 +0100 Message-ID: <2cb32f35c2191ec80687f25a74b2ecb2139c84e5.1769443445.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: TWcNuTVs4TsXckw3aw6_F1-gLS54ShPSwWSDOLRJZTs_1769443618 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: MTO7DLLWNFWB7PN3BV5DHKSKWZHPVEIK X-Message-ID-Hash: MTO7DLLWNFWB7PN3BV5DHKSKWZHPVEIK X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1769443888703154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The code does a 'qemu-img rebase' rather than a 'qemu-img create' what the commit suggests. Since we enumerate all arguments right below, there's no need for a comment. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 8f58df3b45..19bb6f8b37 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3710,7 +3710,6 @@ qemuSnapshotUpdateBackingStore(qemuSnapshotDeleteExte= rnalData *data) struct _qemuSnapshotDisksWithBackingStoreData *backingData =3D cur= ->data; g_autoptr(virCommand) cmd =3D NULL; - /* creates cmd line args: qemu-img create -f qcow2 -o */ if (!(cmd =3D virCommandNewArgList("qemu-img", "rebase", "-u", --=20 2.52.0 From nobody Mon Feb 2 05:55:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1769443779; cv=none; d=zohomail.com; s=zohoarc; b=kgF79EdEb+c/Z3cGshWA0+WK1SfmI9un2x8CN9pFuECs7V9d2raGzuWOUF1tSprVM5eRTvl4938/+j83+ltRAxQg9b80HGbppFdBBeHbLWpnh40S/TrgIvm/FAk4rnOKMA7OSIXaJ031mudELy8ydgSy9JfCgHzrUaH5CWpJAiY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769443779; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=3ak0/INwpiV52gR+1ZqOf/GI9N/+sI6q1+Q9RjOqk88=; b=IX95h9qrvjv3CXrfXWYs8MNcJ7rs2Fc5ziZZ+gk8rZArYgXmdvn+sWgQXb/hAZMIDAN/2/OeUxpVosvB7cVOOIxNq7ra3NC8S0ZiYoMT8dyXyqEOIT6mfpaB4NT8x7TjopMqQI6hzffGq0zBp79Zk9hvYLjkG0rXLwGsGaYOpSA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1769443779018673.0993909725679; Mon, 26 Jan 2026 08:09:39 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 9945C419A3; Mon, 26 Jan 2026 11:09:36 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 987CA43E44; Mon, 26 Jan 2026 11:07:09 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id EA96E4194C; Mon, 26 Jan 2026 11:07:03 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 17DA14194C for ; Mon, 26 Jan 2026 11:07:03 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-387-KHH2EdZ3MJ6QQAaZ38v5lA-1; Mon, 26 Jan 2026 11:07:00 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9D5141944EBB for ; Mon, 26 Jan 2026 16:06:59 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E79E318001D5 for ; Mon, 26 Jan 2026 16:06:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769443622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3ak0/INwpiV52gR+1ZqOf/GI9N/+sI6q1+Q9RjOqk88=; b=hK6+iwlbVtOTQ3V9sY89gtyhww5Jw6UHU1Hfbb5jI84xTzgospC3kIJ1hpR+wfCAGOsdg8 40OBb+aItxOrMarQaSsHO5/+C8JqYzu6XIzchFl9UapKBfc8Z+qRQH4OBy/MzSG+y/E0IV 2bGc3+95XnNtfLk7jM3Jh97A/+wK3n0= X-MC-Unique: KHH2EdZ3MJ6QQAaZ38v5lA-1 X-Mimecast-MFC-AGG-ID: KHH2EdZ3MJ6QQAaZ38v5lA_1769443619 To: devel@lists.libvirt.org Subject: [PATCH v2 3/5] qemuSnapshotDiskHasBackingDisk: Use proper 'max_depth' when calling 'virStorageSourceGetMetadata' Date: Mon, 26 Jan 2026 17:06:51 +0100 Message-ID: <7b10280a27e9425192810ff05620e60cf1852c2a.1769443445.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: huVGNowjzk0mcrJzYtwPJETaFKKQDvONGhDHLcAN37M_1769443619 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: MBX3QKWIIOWK2BZEF3HMY2ORF6DOIIWT X-Message-ID-Hash: MBX3QKWIIOWK2BZEF3HMY2ORF6DOIIWT X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1769443781384154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The 'max_depth' argument of 'virStorageSourceGetMetadata' doesn't just limit how far the function goes but also fails completely if the chain is deeper than the passed value. In 'qemuSnapshotDiskHasBackingDisk' we only care about finding the backing image, so just one level below, the passed path, but due to the above setting '1' as max_depth will make the function simply fail every time. Extract and reuse QEMU_DOMAIN_STORAGE_SOURCE_CHAIN_MAX_DEPTH as the detection depth. While '200' layers is overkill for this code, we also start a full qemu instance just to delete an snapshot so this doens't matter and still protects from self-referential images. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_domain.c | 2 -- src/qemu/qemu_domain.h | 1 + src/qemu/qemu_snapshot.c | 4 +++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ac56fc7cb4..486a0e7913 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6297,8 +6297,6 @@ qemuDomainStorageAlias(const char *device, int depth) } -#define QEMU_DOMAIN_STORAGE_SOURCE_CHAIN_MAX_DEPTH 200 - /** * qemuDomainStorageSourceValidateDepth: * @src: storage source chain to validate diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 3396f929fd..b9bb338682 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -706,6 +706,7 @@ int qemuDomainCheckDiskStartupPolicy(virQEMUDriver *dri= ver, size_t diskIndex, bool cold_boot); +#define QEMU_DOMAIN_STORAGE_SOURCE_CHAIN_MAX_DEPTH 200 int qemuDomainStorageSourceValidateDepth(virStorageSource *src, int add, const char *diskdst); diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 19bb6f8b37..1628c33865 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3145,7 +3145,9 @@ qemuSnapshotDiskHasBackingDisk(void *payload, NULL, &uid, &gid); if (!disk->src->backingStore) - ignore_value(virStorageSourceGetMetadata(disk->src, uid, gid, = 1, false)); + ignore_value(virStorageSourceGetMetadata(disk->src, uid, gid, + QEMU_DOMAIN_STORAGE_S= OURCE_CHAIN_MAX_DEPTH, + false)); if (disk->src->backingStore && virStorageSourceIsSameLocation(disk->src->backingStore, iterda= ta->diskSrc)) { --=20 2.52.0 From nobody Mon Feb 2 05:55:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1769443813; cv=none; d=zohomail.com; s=zohoarc; b=QBEhy81uLt4nQ9x1uIwL5teLXUChB4wzoTUXoPBTXwWm4JkfKfJgOng0z5zPyPYTKjTb9wj2XjRydlIhpxmPW/C7wtxQqgYfa13J0dUcKDLy33pP/eX06xM2YHmIko3tAh1pydaKfmNVH+r8xjx2IHhyuQ2f5dhrTL9qck7SP0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769443813; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=brPGIpL2bUrG35X9d/FMMNTpWjEKh5W4QheYTPZkg/k=; b=P45ASf95zRwI+kLdS8Agj5FRCPVrYPD6V1QMqaId7V7M6jlbT1X4b4ZQskqQBN8MIcLPUZL40RJgxJv7u7bF4GTBJExDpooH0NUr9J9K7EbYQvoMYeHomft3cMHywQEs6tHiuVHju9iP0UdrhdIwPrZHQbXn6tzDrf+1oXx8Ti4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1769443813867139.3017633073854; Mon, 26 Jan 2026 08:10:13 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id F0D8741A6F; Mon, 26 Jan 2026 11:10:12 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id C6F2143E98; Mon, 26 Jan 2026 11:07:21 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id F2A2043E4F; Mon, 26 Jan 2026 11:07:17 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id A627841A09 for ; Mon, 26 Jan 2026 11:07:03 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-437-BseS3ieHMYmk4llCCsZQWQ-1; Mon, 26 Jan 2026 11:07:01 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C8AE2180034A for ; Mon, 26 Jan 2026 16:07:00 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 154A4180049F for ; Mon, 26 Jan 2026 16:06:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769443623; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=brPGIpL2bUrG35X9d/FMMNTpWjEKh5W4QheYTPZkg/k=; b=YeUq8x3JAiPn118cLcA5sJaEetsvvXsyyngrfb4yDnc9gN+GWPONK8LQdlmuK0j8fymLb+ tKKquDoUuQJlKTmVDehzLbUUk5r2AH/QJJoJ5+El3YT7z7kweVnXVmfMXFEqYwV6PdLuot ZilWbUbO8gWHcy9SCsNx1xsScdMVgTI= X-MC-Unique: BseS3ieHMYmk4llCCsZQWQ-1 X-Mimecast-MFC-AGG-ID: BseS3ieHMYmk4llCCsZQWQ_1769443620 To: devel@lists.libvirt.org Subject: [PATCH v2 4/5] virDomainSnapshotDefAssignExternalNames: Improve error message Date: Mon, 26 Jan 2026 17:06:52 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: v_DshJUYPdr_V3w9g6LSmqSTLzLzj8gniP3CwrWR8go_1769443620 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FGNJYPXESUN6LI6GSBFBCZ5NREST7QY6 X-Message-ID-Hash: FGNJYPXESUN6LI6GSBFBCZ5NREST7QY6 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1769443814714158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Mention the 'path' where the detection failed as well as include the possibility that the 'path' doesn't exist in the message itself. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/conf/snapshot_conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 039ed77b84..4309667a34 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -541,8 +541,8 @@ virDomainSnapshotDefAssignExternalNames(virDomainSnapsh= otDef *def, if (stat(origpath, &sb) < 0 || !S_ISREG(sb.st_mode)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("source for disk '%1$s' is not a regular file= ; refusing to generate external snapshot name"), - disk->name); + _("source for disk '%1$s' (%2$s) doesn't exist = or is not a regular file; refusing to generate external snapshot name"), + disk->name, origpath); return -1; } --=20 2.52.0 From nobody Mon Feb 2 05:55:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1769443850; cv=none; d=zohomail.com; s=zohoarc; b=ImFwjEvzDrvKQ8s/TWZMVqoxCd257utf7mW1kuvOiHj/sMqG/Rjp5TcEcAxybilR4DJOC8lZk9KHQ9BB6cmu0Yim6BINWkjQ78aUdBizkLS1BI81CXQOoz4/QgalJpkwo644q8KgiWWAnw/TU9e6rYEjc9iXMTtQFdudzCvnOsI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769443850; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=H4E4EYR3HyBM/aQvZj+eFU/m9lp8BdNOPD/vGDtRQiM=; b=MX/GPT4q2xh8DgLN5cBKiyM0j84egBIhr7+CZlUbDOt/UrZiqPkLfvxpboaGP52fARkaEPp9pKPHM6BPwBAbUlqROHGDHdflFrqYewf6R8cqRfLx2vNoSI2VtRn+8yPNPf++SKhxsFYFtH5jOZSo53KD+PxRiON0r4AqGvdChEU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1769443850804666.839815337147; Mon, 26 Jan 2026 08:10:50 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 0121341B0D; Mon, 26 Jan 2026 11:10:49 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 07CB543EA3; Mon, 26 Jan 2026 11:07:55 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id A0EB841A40; Mon, 26 Jan 2026 11:07:50 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id A1D9541B39 for ; Mon, 26 Jan 2026 11:07:04 -0500 (EST) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-451-KJ_mRQPyOU6lrzKtg4NmkQ-1; Mon, 26 Jan 2026 11:07:02 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 24DE71955D95 for ; Mon, 26 Jan 2026 16:07:02 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 595DD180049F for ; Mon, 26 Jan 2026 16:07:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769443624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H4E4EYR3HyBM/aQvZj+eFU/m9lp8BdNOPD/vGDtRQiM=; b=E2hXWmyqzDOhNZBFMqckDnLrfDqRdBZJ0zUmJaMH9IWzzvFqWr8oJufzN6hwEMtvuzPuPb VDAXa+JuHI/TepXQGW0iQ7irEhHrTFwg4BdWlL94NhhXXSqqgwLa1UbHt7QuSV+j3ktDoB uz2nZhMcn8byoA3VBb8js3enzXixUhQ= X-MC-Unique: KJ_mRQPyOU6lrzKtg4NmkQ-1 X-Mimecast-MFC-AGG-ID: KJ_mRQPyOU6lrzKtg4NmkQ_1769443622 To: devel@lists.libvirt.org Subject: [PATCH v2 5/5] qemuSnapshotUpdateBackingStore: Retry as curent user if qemu-img fails Date: Mon, 26 Jan 2026 17:06:53 +0100 Message-ID: <37ca0662a40201ed08ac3a4095c680ab83077b66.1769443445.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: cK_PADSz7EmymLITgGKKbY3-bJ8DWSMYPwLHB2kW-Ss_1769443622 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 7RVLJFNB7WAB3SRH5K7NPHZJSBLZZYIA X-Message-ID-Hash: 7RVLJFNB7WAB3SRH5K7NPHZJSBLZZYIA X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1769443853119158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The code calls 'qemu-img rebase' to fix the backing store references. The 'qemu-img' process here is run as the 'qemu' user or whatever the defaults and domain XML resolve to. Since this, in certain cases, works also on images which are not part of the backing chain and in privileged deployments thus can be owned by 'root:root' the update may fail (silently). To preserver root-squash deployments but fix also the above case, retry the operation on failure as current user. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 53 ++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 1628c33865..70e4c37144 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3710,25 +3710,48 @@ qemuSnapshotUpdateBackingStore(qemuSnapshotDeleteEx= ternalData *data) for (cur =3D data->disksWithBacking; cur; cur =3D g_slist_next(cur)) { struct _qemuSnapshotDisksWithBackingStoreData *backingData =3D cur= ->data; - g_autoptr(virCommand) cmd =3D NULL; + /* Try to run the command first as the appropriate user based on t= he + * domain definition and config. If error is returned retry as cur= rent + * (possibly privileged) user for cases where seclabels were reset + * to the default */ + g_autoptr(virCommand) cmd_user_qemu =3D NULL; + g_autoptr(virCommand) cmd_user_curr =3D NULL; + + if (!(cmd_user_qemu =3D virCommandNewArgList("qemu-img", + "rebase", + "-u", + "-F", + virStorageFileFormatTyp= eToString(data->parentDiskSrc->format), + "-f", + virStorageFileFormatTyp= eToString(backingData->diskSrc->format), + "-b", + data->parentDiskSrc->pa= th, + backingData->diskSrc->p= ath, + NULL))) + continue; - if (!(cmd =3D virCommandNewArgList("qemu-img", - "rebase", - "-u", - "-F", - virStorageFileFormatTypeToString(= data->parentDiskSrc->format), - "-f", - virStorageFileFormatTypeToString(= backingData->diskSrc->format), - "-b", - data->parentDiskSrc->path, - backingData->diskSrc->path, - NULL))) + virCommandSetUID(cmd_user_qemu, backingData->uid); + virCommandSetGID(cmd_user_qemu, backingData->gid); + + /* done on success */ + if (virCommandRun(cmd_user_qemu, NULL) =3D=3D 0) continue; - virCommandSetUID(cmd, backingData->uid); - virCommandSetGID(cmd, backingData->gid); + /* retry as current user */ + if (!(cmd_user_curr =3D virCommandNewArgList("qemu-img", + "rebase", + "-u", + "-F", + virStorageFileFormatTyp= eToString(data->parentDiskSrc->format), + "-f", + virStorageFileFormatTyp= eToString(backingData->diskSrc->format), + "-b", + data->parentDiskSrc->pa= th, + backingData->diskSrc->p= ath, + NULL))) + continue; - ignore_value(virCommandRun(cmd, NULL)); + ignore_value(virCommandRun(cmd_user_curr, NULL)); } } --=20 2.52.0