From nobody Fri Nov 21 10:09:55 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=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1763628450; cv=none; d=zohomail.com; s=zohoarc; b=KSiakuzB5Zw7B2MAPB1BGei/nr9Y4MbH3DEr9hYhg04XcZ5M5oS/hKe9zJZdpDcddoJJb/pvv/dG+M9bfP7QdBNDrTWdTatQz1Ldti5yEs7QX6LBbm3QZqQQ4xL8mckqMWkQzBkwrHMnL26KXzY5AOuSIxjZkNckrJY3qUmi5jg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763628450; 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=MCOjAcLPTYsx5qDjd4aKgkTPawhwwOU/oHFU1bf21t0=; b=IqZCgwIpewCTa5o0EcTd6ZlAZmTqa2KZMqB1qolWwuoZVKc2GCaJrh+NTIAZhRywpqZK/uKWitUABpH7WsUeGY54Qu8CsTO80snI04M0knWFaJ3vQZ7rwRf2droXDpsb3wkDk0x2ZrUIH/lWaGApzcg6FVK/XYHRHneVyhzp0kA= 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 1763628450123697.4406355665847; Thu, 20 Nov 2025 00:47:30 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 7E52B418B7; Thu, 20 Nov 2025 03:47:29 -0500 (EST) Received: from [172.19.199.53] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 3B15644884; Thu, 20 Nov 2025 03:37:34 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 8551041C09; Thu, 20 Nov 2025 03:33:13 -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 BA22F41C09 for ; Thu, 20 Nov 2025 03:33:11 -0500 (EST) Received: from mx-prod-mc-06.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-641-y13nu2ehNfKEXZYelLO4BQ-1; Thu, 20 Nov 2025 03:33:08 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C4EF818011EF for ; Thu, 20 Nov 2025 08:33:07 +0000 (UTC) Received: from moe (unknown [10.43.3.236]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2B414180049F for ; Thu, 20 Nov 2025 08:33:06 +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=1763627591; 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=MCOjAcLPTYsx5qDjd4aKgkTPawhwwOU/oHFU1bf21t0=; b=erwDt5fr8K/m5b0xF3oSgn6dkcdyGmq09NavcUSJaGSvXzP4wItdVP+pYXy6ZZqWFBmV62 DSa1oVC6gP8y2Fm8LY1pJXFsK3cJynT3ct/0+WO9oAPazmSsiv/v/cXRCasle1IUlkTtds ZixwhowMc/UZwO23UicstEvwfj9pTlU= X-MC-Unique: y13nu2ehNfKEXZYelLO4BQ-1 X-Mimecast-MFC-AGG-ID: y13nu2ehNfKEXZYelLO4BQ_1763627587 To: devel@lists.libvirt.org Subject: [PATCH 8/9] esx: Allow disk images in subdirectories Date: Thu, 20 Nov 2025 09:32:53 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: hBr4ajMORw-zT1RD8n5U5bShNF3PDAUIgKAZALE0t6I_1763627587 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 4ZMULCUQMRV24KS2W3NJXIOCYNZURX5Z X-Message-ID-Hash: 4ZMULCUQMRV24KS2W3NJXIOCYNZURX5Z X-MailFrom: mprivozn@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: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1763628450617018900 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik The esxParseVMXFileName() function parses path to a disk image trying to replace some "known" patterns (e.g. datastore paths). A simple filename is treated as a path relative to .vmx file. But disk images (and thus filenames) can be in a subdirectory, relative to the .vmx file. For instance: subfolder/disk.vmdk Adapt our parser to this fact. Resolves: https://issues.redhat.com/browse/RHEL-122751 Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/esx/esx_driver.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 6452a33b7c..9f965811b1 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -72,9 +72,11 @@ esxFreePrivate(esxPrivate **priv) * Parse a file name from a .vmx file and convert it to datastore path for= mat * if possible. A .vmx file can contain file names in various formats: * - * - A single name referencing a file in the same directory as the .vmx fi= le: + * - A single name referencing a file in the same directory as the .vmx fi= le, + * or in a subdirectory: * * test1.vmdk + * subdir/test2.vmdk * * - An absolute file name referencing a file in a datastore that is mount= ed at * /vmfs/volumes/: @@ -106,8 +108,9 @@ esxFreePrivate(esxPrivate **priv) * * Firstly this functions checks if the given file name contains a separat= or. * If it doesn't then the referenced file is in the same directory as the = .vmx - * file. The datastore name and directory of the .vmx file are passed to t= his - * function via the opaque parameter by the caller of virVMXParseConfig. + * file, or in a subdirectory. The datastore name and directory of the .vmx + * file are passed to this function via the opaque parameter by the caller= of + * virVMXParseConfig. * * Otherwise query for all known datastores and their mount directories. T= hen * try to find a datastore with a mount directory that is a prefix to the = given @@ -138,7 +141,7 @@ esxParseVMXFileName(const char *fileName, =20 *out =3D NULL; =20 - if (!strchr(fileName, '/') && !strchr(fileName, '\\')) { + if (*fileName !=3D '/' && !strchr(fileName, '\\')) { /* Plain file name, use same directory as for the .vmx file */ *out =3D g_strdup_printf("%s/%s", data->datastorePathWithoutFileNa= me, fileName); --=20 2.51.0