From nobody Tue Mar 3 04:54:09 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=1771343949; cv=none; d=zohomail.com; s=zohoarc; b=Mi442BRMRR8cdT47rK6czph97ac2cKVFLmq0nJPrB+Kdj8hxVUeP0trhGGxX7qQLfxW0WfXFhHjuDMKdzqjwTjAtwsi/3+fdoBhQMkNBYVjBPnUOnaCuaLJfo+tY82Nmhn4rOA3gvmPAIEZKrEb7CzOr6EHy+sfhh5n6CdHLZ4Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771343949; 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=eudAkgZF3X5JWZIbGsUnFYtYxkHjlAvrUhuZSxHZbEs=; b=UYwdSxU6yCbfjY3Ltp1vVBbwQn5U1+Av6w5YYfjYfPXphF+sWq1p8fNyhIHMULFxGO0PaHZ0AMr2qRZl4HknbBVA9FOAvNsow+jliX3i15b92kbxrGFdNRQll+Gvi/ma+PNnVNlApP2ZHTJ/rFiB/MU/sSNmR39gq5TAXKw/VOk= 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 1771343949839645.0266236925554; Tue, 17 Feb 2026 07:59:09 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 4F7853F8E5; Tue, 17 Feb 2026 10:59:09 -0500 (EST) Received: from [172.19.199.9] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 88AEC41AE5; Tue, 17 Feb 2026 10:54:49 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id D13E44196C; Tue, 17 Feb 2026 10:54:44 -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 8CC8B3F3DD for ; Tue, 17 Feb 2026 10:53: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-689-a7g2ezvfOAyTe88id-PzzQ-1; Tue, 17 Feb 2026 10:53: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 133C21955F1A for ; Tue, 17 Feb 2026 15:52:59 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.39]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5CD19180058F for ; Tue, 17 Feb 2026 15:52: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=-4.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HELO_MISC_IP,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=1771343584; 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=eudAkgZF3X5JWZIbGsUnFYtYxkHjlAvrUhuZSxHZbEs=; b=LnZeFCGY3yfTx2peSzt4bLCvCK+8jX3kTnoZbfzWDR/mQscrKbI8qgIiwgneUbzvN6cNX2 q5RmwFEU5fOomzNJYpt6OfBk6GZdOnZNRe2ue611Bobbuqc9/orIM+sk62eCGiw8lLCPkI Lk7WS7ULROHyGmvSLXsLHIxZx9wJFps= X-MC-Unique: a7g2ezvfOAyTe88id-PzzQ-1 X-Mimecast-MFC-AGG-ID: a7g2ezvfOAyTe88id-PzzQ_1771343579 To: devel@lists.libvirt.org Subject: [PATCH 4/6] qemuSaveImageCreateFd: Handle case when 'virQEMUFileOpenAs' doesn't return a file fd for 'sparse' format Date: Tue, 17 Feb 2026 16:52:49 +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: dAlkyVDDoQo7hxUFCTOH7eT9Ls75Q0b39psdcK8AHJs_1771343579 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FMI7HCNSWHC4FXL46WJ74QENDNDIRNIS X-Message-ID-Hash: FMI7HCNSWHC4FXL46WJ74QENDNDIRNIS 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: 1771343951374154101 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The 'sparse' uses a mode in qemu which requires direct access to the file descriptior of the file itself. If we reside on root-squashed NFS the FD from 'virQEMUFileOpenAs' may not actually be a file which would not work with qemu. Reject such a config with a better error message and add documentation outlining the quirk. Signed-off-by: Peter Krempa --- src/qemu/qemu_saveimage.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c index 23922acd51..a3519f8538 100644 --- a/src/qemu/qemu_saveimage.c +++ b/src/qemu/qemu_saveimage.c @@ -423,6 +423,20 @@ qemuSaveImageDecompressionStop(virCommand *cmd, } +/** + * qemuSaveImageCreateFd: + * @vm: domain object + * @path: path to the save image file + * @wrapperFd: filled with helper structure for the virFileWrapper + * @sparse: 'sparse' image format is used for the save image + * @needUnlink: if filled with 'true' a new file was created and needs to = be + * removed on failure + * @bypassCache: Don't use cache for the writes of the save image + * + * Opens the save image @path and prepares it for saving of the VM state. + * Returns a file descriptor on succes. The returned FD is a pipe unless @ + * sparse is true in which case it's an fd to a file. + */ static int qemuSaveImageCreateFd(virDomainObj *vm, const char *path, @@ -455,6 +469,16 @@ qemuSaveImageCreateFd(virDomainObj *vm, if (fd < 0) return -1; + /* 'virQEMUFileOpenAs' can return a pipe/socket in case when it needs = to bypass + * root-squashed NFS. Since 'sparse' backing format works only with re= al + * files we need to reject such cases */ + if (sparse && !virFileFDIsRegular(fd)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("path '%1$s' can't be opened directly (without th= e use of helper proces) which is incompatible with 'sparse' save image"), + path); + return -1; + } + if (qemuSecuritySetImageFDLabel(priv->driver->securityManager, vm->def= , fd) < 0) return -1; --=20 2.53.0