From nobody Fri Jan 3 01:19:24 2025 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=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 1729261292459893.5759705332673; Fri, 18 Oct 2024 07:21:32 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2338412D1; Fri, 18 Oct 2024 10:21:31 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 6CC781280; Fri, 18 Oct 2024 10:21:13 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D415A1257; Fri, 18 Oct 2024 10:21:10 -0400 (EDT) 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 567CF124D for ; Fri, 18 Oct 2024 10:21:10 -0400 (EDT) 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-414-HmPJ-LcWOkebrwarJc4ypA-1; Fri, 18 Oct 2024 10:21:08 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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 8309F1955F41 for ; Fri, 18 Oct 2024 14:21:07 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.4]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 93C891956086 for ; Fri, 18 Oct 2024 14:21:06 +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.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729261270; 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=jM0hWSRIm7OmUzfmGoyKnEYGxTsc0/ySTzzttNN9glA=; b=ZovVxFciJi+9Zg8PWp+C+4JX6uaEdH8zKT+UaDxd7WFM7lGRi4aIh7pb1wHA9pL2hVtPHJ pT4/srNX/g/8tkL4szMwBBkXfMPmYEZoFM35YEvbELudHswJp0lz9nWQuPEyWzYe8MZ2FY iO7WvTWOT/mcp5MghMjl1LY4k42Gp8g= X-MC-Unique: HmPJ-LcWOkebrwarJc4ypA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 1/2] qemu: snapshot: Delete leftover overlay files for disks Date: Fri, 18 Oct 2024 16:21:02 +0200 Message-ID: <7b4763477a06df7e7602129970a63621448ad9af.1729261182.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NDSDOZGAW4RTSML5J573TEKYQPLEJRPL X-Message-ID-Hash: NDSDOZGAW4RTSML5J573TEKYQPLEJRPL 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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1729261293440116600 Content-Type: text/plain; charset="utf-8" When a VM is terminated by host reboot libvirt doesn't get to cleaning out the temporary overlay file used for transient disks. Since we create those files with a very specific suffix it's almost guaranteed that if it exists it's a leftover from a libvirt run. Delete them instead of complaining to preserve functionality. Closes: https://gitlab.com/libvirt/libvirt/-/issues/684 Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_snapshot.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 1187ebf276..795522da21 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1287,10 +1287,12 @@ qemuSnapshotGetTransientDiskDef(virDomainDiskDef *d= omdisk, domdisk->src->path, suffix); if (virFileExists(snapdisk->src->path)) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, - _("Overlay file '%1$s' for transient disk '%2$s' al= ready exists"), - snapdisk->src->path, domdisk->dst); - return NULL; + if (unlink(snapdisk->src->path) !=3D 0) { + virReportSystemError(errno, + _("Failed to delete overlay file '%1$s' f= or transient disk '%2$s'"), + snapdisk->src->path, domdisk->dst); + return NULL; + } } return g_steal_pointer(&snapdisk); --=20 2.47.0 From nobody Fri Jan 3 01:19:24 2025 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=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 172926132244929.96174168666903; Fri, 18 Oct 2024 07:22:02 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 58B7E1252; Fri, 18 Oct 2024 10:22:01 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id AF6341543; Fri, 18 Oct 2024 10:21:16 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 10423124D; Fri, 18 Oct 2024 10:21:12 -0400 (EDT) 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 A3CD81264 for ; Fri, 18 Oct 2024 10:21:11 -0400 (EDT) Received: from mx-prod-mc-04.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-464-9JgqqAYmMiOMZ-wTqGyUMA-1; Fri, 18 Oct 2024 10:21:09 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CCA1119560A2 for ; Fri, 18 Oct 2024 14:21:08 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.4]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0466C1956086 for ; Fri, 18 Oct 2024 14:21:07 +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.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729261271; 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=oLv5coPbvVZEwchaeY9NBVPJs/+CHSOMCm1Lm1/fy3s=; b=eJjpJCw034oYALrHVVCqVVRnghq5bqxp88RpBX8a4WR+so5OxwCzyzpChaAUjwdxv7aji1 cQMYA0EMjzMhlR/AmIvvGaYBoaTWGCT5kjh6Xqb1j+ixPvvALNQS2cZyQPbAlTLRSkNaHz F8+apQDGjiIcfXLu18xLCsX+JxtamVk= X-MC-Unique: 9JgqqAYmMiOMZ-wTqGyUMA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 2/2] docs: formatdomain: Document the temporary file for transient disks Date: Fri, 18 Oct 2024 16:21:03 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: WCE7DYTYPVAFLS7UI6QVS6YK7Y5VWWPV X-Message-ID-Hash: WCE7DYTYPVAFLS7UI6QVS6YK7Y5VWWPV 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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1729261323249116600 Content-Type: text/plain; charset="utf-8" Mention that hypervisors may need a temporary file and document the qemu template for creating them. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/formatdomain.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index e6f09a728f..3253a28e5a 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3479,6 +3479,13 @@ paravirtualized driver is specified via the ``disk``= element. ``shareBacking`` attribute should be set to ``yes``. Note that hypervis= or drivers may need to hotplug such disk and thus it works only with configurations supporting hotplug. :since:`Since 7.4.0` + + Hypervisors may need to store a temporary file containing the data writ= ten + by the domain while running, which may be stored in the same location + as the original source of the disk (The ``qemu`` driver stores the temp= orary + files as ``$(origsource).TRANSIENT-$(vmname)``, where ``$(origsource)``= is + the full original path of the disk source and ``$(vmname)`` is the name= of the + domain). ``serial`` If present, this specify serial number of virtual hard drive. For examp= le, it may look like ``WD-WMAP9A966149``. Not supported for --=20 2.47.0