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=1763627974; cv=none; d=zohomail.com; s=zohoarc; b=I36UJMAeWX4kM9zVcsO1CeSAgRmqLSudk1Hr5N0+eoAWx4UETY0qu4g7izh1b9I3jtC9vWfYc/4qOWNjVy6MxHMQy6PScPcGuIeDT36hZM2GWFiZuGgvOPyfHsShV7QgkaTbF5SlAVmR1y43Xq/OXA3gUxyGHtX5n3uey+UjUiQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763627974; 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=JWKdOJa47wKeUeRNal2nKh+zuO8uAgkGGz1c+ALXmK4=; b=jzbjcVdm5f/nz1N0mDex9AJX1t3V2QqiW6x6G8oD7D1M7NgB/DJ4URGRr9po6oOn4sLG+EedNso55kys7uuNi5UMUMIy10nSf6MAXMpmLrSG3dTZdHp35a5su1ORjsNcuTn5n2mRL0M3sHzX6B7p1JJ1PRG8oUc6RvqUl9Cvxvs= 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 1763627974053473.7904184834948; Thu, 20 Nov 2025 00:39:34 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 8184C44052; Thu, 20 Nov 2025 03:39:33 -0500 (EST) Received: from [172.19.199.53] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 5D4C941AB2; Thu, 20 Nov 2025 03:37:01 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 9FD7644051; Thu, 20 Nov 2025 03:33:08 -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 CA02944051 for ; Thu, 20 Nov 2025 03:33: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-619-u8jOULJ6MW24m9Vni_mgOA-1; Thu, 20 Nov 2025 03:33:02 -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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 69ABC1800473 for ; Thu, 20 Nov 2025 08:33:01 +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 C2B2618004A3 for ; Thu, 20 Nov 2025 08:33:00 +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=1763627583; 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=JWKdOJa47wKeUeRNal2nKh+zuO8uAgkGGz1c+ALXmK4=; b=CBon5xOcbtu5+TNCNxIxWjkkOroDmilIdK4suLyxn8iS6yscfk7ljDEiHGA9uR559MDGiv zSl0Wf8d3XwlLWmh9ZIj6DLn2ut0JOb14XEJ4HygOvJE906PNxlRy/30YEnqdsyKf52vEq c1kDadmyHHunbRvYEBCZVu5qIS3mx/Q= X-MC-Unique: u8jOULJ6MW24m9Vni_mgOA-1 X-Mimecast-MFC-AGG-ID: u8jOULJ6MW24m9Vni_mgOA_1763627581 To: devel@lists.libvirt.org Subject: [PATCH 2/9] esx: Expose esxParseVMXFileName() for tests Date: Thu, 20 Nov 2025 09:32:47 +0100 Message-ID: <007174e3551ef13a40039ef15f1a9ee08384340c.1763627556.git.mprivozn@redhat.com> 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: QDRskPTG_FoTx2ZhH4omUFqrzna9OE0Z7lB-6Z3TTNU_1763627581 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: BYT6JVLCV6NN232VGTZOLAOFTWAK2TVZ X-Message-ID-Hash: BYT6JVLCV6NN232VGTZOLAOFTWAK2TVZ 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: 1763627975316018900 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik So far, our vmx2xmltest uses a custom .parseFileName callback. And it kind of makes sense because the one that's used in production (esxParseVMXFileName()) does some HTTP requests which we don't want to do in our test suite. But this creates other sorts of problems and the idea is to have the test ditch custom parse callback and stick with the production one. But for now, just expose it. With it, the esxVMX_Data struct is exposed too as it is passed into the function (via 'opaque' argument). Signed-off-by: Michal Privoznik --- src/esx/esx_driver.c | 13 +++---------- src/esx/esx_driverpriv.h | 27 +++++++++++++++++++++++++++ src/libvirt_esx.syms | 4 ++++ 3 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 src/esx/esx_driverpriv.h diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 34c0e28d31..6452a33b7c 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -33,11 +33,12 @@ #include "vmx.h" #include "virtypedparam.h" #include "esx_driver.h" +#define LIBVIRT_ESX_DRIVERPRIV_H_ALLOW +#include "esx_driverpriv.h" #include "esx_interface_driver.h" #include "esx_network_driver.h" #include "esx_storage_driver.h" #include "esx_private.h" -#include "esx_vi.h" #include "esx_vi_methods.h" #include "esx_util.h" #include "esx_stream.h" @@ -50,14 +51,6 @@ VIR_LOG_INIT("esx.esx_driver"); =20 static int esxDomainGetMaxVcpus(virDomainPtr domain); =20 -typedef struct _esxVMX_Data esxVMX_Data; - -struct _esxVMX_Data { - esxVI_Context *ctx; - char *datastorePathWithoutFileName; -}; - - =20 static void esxFreePrivate(esxPrivate **priv) @@ -124,7 +117,7 @@ esxFreePrivate(esxPrivate **priv) * exception and need special handling. Parse the datastore name and use it * to lookup the datastore by name to verify that it exists. */ -static int +int esxParseVMXFileName(const char *fileName, void *opaque, char **out, diff --git a/src/esx/esx_driverpriv.h b/src/esx/esx_driverpriv.h new file mode 100644 index 0000000000..c947866d4e --- /dev/null +++ b/src/esx/esx_driverpriv.h @@ -0,0 +1,27 @@ +/* + * esx_driverpriv.h: private declarations for ESX driver + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef LIBVIRT_ESX_DRIVERPRIV_H_ALLOW +# error "esx_driverpriv.h may only be included by esx_driver.c or test sui= tes" +#endif /* LIBVIRT_ESX_DRIVERPRIV_H_ALLOW */ + +#pragma once + +#include "esx_vi.h" + +typedef struct _esxVMX_Data esxVMX_Data; + +struct _esxVMX_Data { + esxVI_Context *ctx; + char *datastorePathWithoutFileName; +}; + + +int +esxParseVMXFileName(const char *fileName, + void *opaque, + char **out, + bool allow_missing); diff --git a/src/libvirt_esx.syms b/src/libvirt_esx.syms index 023fecbe94..6a61b7019c 100644 --- a/src/libvirt_esx.syms +++ b/src/libvirt_esx.syms @@ -2,6 +2,10 @@ # These symbols are dependent upon --with-esx via WITH_ESX # =20 +# esx/esx_driverpriv.h +esxParseVMXFileName; + + # esx/esx_util.h esxUtil_EscapeDatastoreItem; esxUtil_ParseDatastorePath; --=20 2.51.0