]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
esx: Expose esxParseVMXFileName() for tests
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 13 Nov 2025 09:34:26 +0000 (10:34 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 20 Nov 2025 14:08:59 +0000 (15:08 +0100)
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 <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/esx/esx_driver.c
src/esx/esx_driverpriv.h [new file with mode: 0644]
src/libvirt_esx.syms

index 34c0e28d315bebd090437e78f08eb8d35358c3ce..6452a33b7c5310072e1be2041ca4112f4eec76f9 100644 (file)
 #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");
 
 static int esxDomainGetMaxVcpus(virDomainPtr domain);
 
-typedef struct _esxVMX_Data esxVMX_Data;
-
-struct _esxVMX_Data {
-    esxVI_Context *ctx;
-    char *datastorePathWithoutFileName;
-};
-
-
 
 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 (file)
index 0000000..c947866
--- /dev/null
@@ -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 suites"
+#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);
index 023fecbe94232edc6f0ed325a1983f1a3e298087..6a61b7019c6dc6e9da935daf5c1a2c6e41931023 100644 (file)
@@ -2,6 +2,10 @@
 # These symbols are dependent upon --with-esx via WITH_ESX
 #
 
+# esx/esx_driverpriv.h
+esxParseVMXFileName;
+
+
 # esx/esx_util.h
 esxUtil_EscapeDatastoreItem;
 esxUtil_ParseDatastorePath;