[libvirt] [PATCH] esx: Add stubs for secondary driver types

Matthias Bolte matthias.bolte at googlemail.com
Fri Jan 15 15:35:06 UTC 2010


This stops libvirt from probing for a libvirtd on the ESX server and
sets the base for the implementation of the secondary drivers.
---
 src/Makefile.am                |    5 ++
 src/esx/esx_device_monitor.c   |   93 +++++++++++++++++++++++++++++++
 src/esx/esx_device_monitor.h   |   29 ++++++++++
 src/esx/esx_driver.c           |   28 +++++-----
 src/esx/esx_driver.h           |   20 +++++++-
 src/esx/esx_interface_driver.c |   96 ++++++++++++++++++++++++++++++++
 src/esx/esx_interface_driver.h |   29 ++++++++++
 src/esx/esx_network_driver.c   |  101 ++++++++++++++++++++++++++++++++++
 src/esx/esx_network_driver.h   |   29 ++++++++++
 src/esx/esx_secret_driver.c    |   91 +++++++++++++++++++++++++++++++
 src/esx/esx_secret_driver.h    |   28 ++++++++++
 src/esx/esx_storage_driver.c   |  117 ++++++++++++++++++++++++++++++++++++++++
 src/esx/esx_storage_driver.h   |   29 ++++++++++
 13 files changed, 680 insertions(+), 15 deletions(-)
 create mode 100644 src/esx/esx_device_monitor.c
 create mode 100644 src/esx/esx_device_monitor.h
 create mode 100644 src/esx/esx_interface_driver.c
 create mode 100644 src/esx/esx_interface_driver.h
 create mode 100644 src/esx/esx_network_driver.c
 create mode 100644 src/esx/esx_network_driver.h
 create mode 100644 src/esx/esx_secret_driver.c
 create mode 100644 src/esx/esx_secret_driver.h
 create mode 100644 src/esx/esx_storage_driver.c
 create mode 100644 src/esx/esx_storage_driver.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 324030b..7d426ae 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -214,6 +214,11 @@ ONE_DRIVER_SOURCES =						\
 
 ESX_DRIVER_SOURCES =						\
 		esx/esx_driver.c esx/esx_driver.h		\
+		esx/esx_interface_driver.c esx/esx_interface_driver.h		\
+		esx/esx_network_driver.c esx/esx_network_driver.h		\
+		esx/esx_storage_driver.c esx/esx_storage_driver.h		\
+		esx/esx_device_monitor.c esx/esx_device_monitor.h		\
+		esx/esx_secret_driver.c esx/esx_secret_driver.h		\
 		esx/esx_util.c esx/esx_util.h			\
 		esx/esx_vi.c esx/esx_vi.h			\
 		esx/esx_vi_methods.c esx/esx_vi_methods.h	\
diff --git a/src/esx/esx_device_monitor.c b/src/esx/esx_device_monitor.c
new file mode 100644
index 0000000..c813adf
--- /dev/null
+++ b/src/esx/esx_device_monitor.c
@@ -0,0 +1,93 @@
+
+/*
+ * esx_device_monitor.c: device monitor methods for managing VMware ESX
+ *                       host devices
+ *
+ * Copyright (C) 2010 Matthias Bolte <matthias.bolte at googlemail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#include <config.h>
+
+#include "internal.h"
+#include "virterror_internal.h"
+#include "util.h"
+#include "memory.h"
+#include "logging.h"
+#include "uuid.h"
+#include "esx_driver.h"
+#include "esx_device_monitor.h"
+#include "esx_vi.h"
+#include "esx_vi_methods.h"
+#include "esx_util.h"
+
+#define VIR_FROM_THIS VIR_FROM_ESX
+
+#define ESX_ERROR(conn, code, fmt...)                                         \
+    virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
+                         __LINE__, fmt)
+
+
+
+static virDrvOpenStatus
+esxDeviceOpen(virConnectPtr conn,
+              virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+              int flags ATTRIBUTE_UNUSED)
+{
+    if (STRNEQ(conn->driver->name, "ESX")) {
+        return VIR_DRV_OPEN_DECLINED;
+    }
+
+    conn->devMonPrivateData = conn->privateData;
+
+    return VIR_DRV_OPEN_SUCCESS;
+}
+
+
+
+static int
+esxDeviceClose(virConnectPtr conn)
+{
+    conn->devMonPrivateData = NULL;
+
+    return 0;
+}
+
+
+
+static virDeviceMonitor esxDeviceMonitor = {
+    "ESX",                                 /* name */
+    esxDeviceOpen,                         /* open */
+    esxDeviceClose,                        /* close */
+    NULL,                                  /* numOfDevices */
+    NULL,                                  /* listDevices */
+    NULL,                                  /* deviceLookupByName */
+    NULL,                                  /* deviceDumpXML */
+    NULL,                                  /* deviceGetParent */
+    NULL,                                  /* deviceNumOfCaps */
+    NULL,                                  /* deviceListCaps */
+    NULL,                                  /* deviceCreateXML */
+    NULL,                                  /* deviceDestroy */
+};
+
+
+
+int
+esxDeviceRegister(void)
+{
+    return virRegisterDeviceMonitor(&esxDeviceMonitor);
+}
diff --git a/src/esx/esx_device_monitor.h b/src/esx/esx_device_monitor.h
new file mode 100644
index 0000000..e72a5b6
--- /dev/null
+++ b/src/esx/esx_device_monitor.h
@@ -0,0 +1,29 @@
+
+/*
+ * esx_device_monitor.h: device monitor methods for managing VMware ESX
+ *                       host devices
+ *
+ * Copyright (C) 2010 Matthias Bolte <matthias.bolte at googlemail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#ifndef __ESX_DEVICE_MONITOR_H__
+#define __ESX_DEVICE_MONITOR_H__
+
+int esxDeviceRegister(void);
+
+#endif /* __ESX_DEVICE_MONITOR_H__ */
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index ddda66e..5aa3237 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -2,7 +2,7 @@
 /*
  * esx_driver.c: core driver methods for managing VMware ESX hosts
  *
- * Copyright (C) 2009 Matthias Bolte <matthias.bolte at googlemail.com>
+ * Copyright (C) 2009, 2010 Matthias Bolte <matthias.bolte at googlemail.com>
  * Copyright (C) 2009 Maximilian Wilhelm <max at rfc2324.org>
  *
  * This library is free software; you can redistribute it and/or
@@ -33,6 +33,11 @@
 #include "logging.h"
 #include "uuid.h"
 #include "esx_driver.h"
+#include "esx_interface_driver.h"
+#include "esx_network_driver.h"
+#include "esx_storage_driver.h"
+#include "esx_device_monitor.h"
+#include "esx_secret_driver.h"
 #include "esx_vi.h"
 #include "esx_vi_methods.h"
 #include "esx_util.h"
@@ -46,18 +51,6 @@
 
 static int esxDomainGetMaxVcpus(virDomainPtr domain);
 
-typedef struct _esxPrivate {
-    esxVI_Context *host;
-    esxVI_Context *vCenter;
-    virCapsPtr caps;
-    char *transport;
-    int32_t maxVcpus;
-    esxVI_Boolean supportsVMotion;
-    esxVI_Boolean supportsLongMode; /* aka x86_64 */
-    esxVI_Boolean autoAnswer;
-    int32_t usedCpuTimeCounterId;
-} esxPrivate;
-
 
 
 static esxVI_Boolean
@@ -3479,7 +3472,14 @@ static virDriver esxDriver = {
 int
 esxRegister(void)
 {
-    virRegisterDriver(&esxDriver);
+    if (virRegisterDriver(&esxDriver) < 0 ||
+        esxInterfaceRegister() < 0 ||
+        esxNetworkRegister() < 0 ||
+        esxStorageRegister() < 0 ||
+        esxDeviceRegister() < 0 ||
+        esxSecretRegister() < 0) {
+        return -1;
+    }
 
     return 0;
 }
diff --git a/src/esx/esx_driver.h b/src/esx/esx_driver.h
index 85f4b32..18e821b 100644
--- a/src/esx/esx_driver.h
+++ b/src/esx/esx_driver.h
@@ -2,7 +2,7 @@
 /*
  * esx_driver.h: core driver methods for managing VMware ESX hosts
  *
- * Copyright (C) 2009 Matthias Bolte <matthias.bolte at googlemail.com>
+ * Copyright (C) 2009, 2010 Matthias Bolte <matthias.bolte at googlemail.com>
  * Copyright (C) 2009 Maximilian Wilhelm <max at rfc2324.org>
  *
  * This library is free software; you can redistribute it and/or
@@ -24,6 +24,24 @@
 #ifndef __ESX_DRIVER_H__
 #define __ESX_DRIVER_H__
 
+#include "internal.h"
+#include "capabilities.h"
+#include "esx_vi.h"
+
+typedef struct _esxPrivate {
+    esxVI_Context *host;
+    esxVI_Context *vCenter;
+    virCapsPtr caps;
+    char *transport;
+    int32_t maxVcpus;
+    esxVI_Boolean supportsVMotion;
+    esxVI_Boolean supportsLongMode; /* aka x86_64 */
+    esxVI_Boolean autoAnswer;
+    int32_t usedCpuTimeCounterId;
+} esxPrivate;
+
+
+
 int esxRegister(void);
 
 #endif /* __ESX_DRIVER_H__ */
diff --git a/src/esx/esx_interface_driver.c b/src/esx/esx_interface_driver.c
new file mode 100644
index 0000000..7664e4a
--- /dev/null
+++ b/src/esx/esx_interface_driver.c
@@ -0,0 +1,96 @@
+
+/*
+ * esx_interface_driver.h: interface driver methods for managing VMware ESX
+ *                         host interfaces
+ *
+ * Copyright (C) 2010 Matthias Bolte <matthias.bolte at googlemail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#include <config.h>
+
+#include "internal.h"
+#include "virterror_internal.h"
+#include "util.h"
+#include "memory.h"
+#include "logging.h"
+#include "uuid.h"
+#include "esx_driver.h"
+#include "esx_interface_driver.h"
+#include "esx_vi.h"
+#include "esx_vi_methods.h"
+#include "esx_util.h"
+
+#define VIR_FROM_THIS VIR_FROM_ESX
+
+#define ESX_ERROR(conn, code, fmt...)                                         \
+    virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
+                         __LINE__, fmt)
+
+
+
+static virDrvOpenStatus
+esxInterfaceOpen(virConnectPtr conn,
+                 virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+                 int flags ATTRIBUTE_UNUSED)
+{
+    if (STRNEQ(conn->driver->name, "ESX")) {
+        return VIR_DRV_OPEN_DECLINED;
+    }
+
+    conn->interfacePrivateData = conn->privateData;
+
+    return VIR_DRV_OPEN_SUCCESS;
+}
+
+
+
+static int
+esxInterfaceClose(virConnectPtr conn)
+{
+    conn->interfacePrivateData = NULL;
+
+    return 0;
+}
+
+
+
+static virInterfaceDriver esxInterfaceDriver = {
+    "ESX",                                 /* name */
+    esxInterfaceOpen,                      /* open */
+    esxInterfaceClose,                     /* close */
+    NULL,                                  /* numOfInterfaces */
+    NULL,                                  /* listInterfaces */
+    NULL,                                  /* numOfDefinedInterfaces */
+    NULL,                                  /* listDefinedInterfaces */
+    NULL,                                  /* interfaceLookupByName */
+    NULL,                                  /* interfaceLookupByMACString */
+    NULL,                                  /* interfaceGetXMLDesc */
+    NULL,                                  /* interfaceDefineXML */
+    NULL,                                  /* interfaceUndefine */
+    NULL,                                  /* interfaceCreate */
+    NULL,                                  /* interfaceDestroy */
+    NULL,                                  /* interfaceIsActive */
+};
+
+
+
+int
+esxInterfaceRegister(void)
+{
+    return virRegisterInterfaceDriver(&esxInterfaceDriver);
+}
diff --git a/src/esx/esx_interface_driver.h b/src/esx/esx_interface_driver.h
new file mode 100644
index 0000000..d30641a
--- /dev/null
+++ b/src/esx/esx_interface_driver.h
@@ -0,0 +1,29 @@
+
+/*
+ * esx_interface_driver.h: interface driver methods for managing VMware ESX
+ *                         host interfaces
+ *
+ * Copyright (C) 2010 Matthias Bolte <matthias.bolte at googlemail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#ifndef __ESX_INTERFACE_DRIVER_H__
+#define __ESX_INTERFACE_DRIVER_H__
+
+int esxInterfaceRegister(void);
+
+#endif /* __ESX_INTERFACE_DRIVER_H__ */
diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c
new file mode 100644
index 0000000..9532352
--- /dev/null
+++ b/src/esx/esx_network_driver.c
@@ -0,0 +1,101 @@
+
+/*
+ * esx_network_driver.c: network driver methods for managing VMware ESX
+ *                       host networks
+ *
+ * Copyright (C) 2010 Matthias Bolte <matthias.bolte at googlemail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#include <config.h>
+
+#include "internal.h"
+#include "virterror_internal.h"
+#include "util.h"
+#include "memory.h"
+#include "logging.h"
+#include "uuid.h"
+#include "esx_driver.h"
+#include "esx_network_driver.h"
+#include "esx_vi.h"
+#include "esx_vi_methods.h"
+#include "esx_util.h"
+
+#define VIR_FROM_THIS VIR_FROM_ESX
+
+#define ESX_ERROR(conn, code, fmt...)                                         \
+    virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
+                         __LINE__, fmt)
+
+
+
+static virDrvOpenStatus
+esxNetworkOpen(virConnectPtr conn,
+               virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+               int flags ATTRIBUTE_UNUSED)
+{
+    if (STRNEQ(conn->driver->name, "ESX")) {
+        return VIR_DRV_OPEN_DECLINED;
+    }
+
+    conn->networkPrivateData = conn->privateData;
+
+    return VIR_DRV_OPEN_SUCCESS;
+}
+
+
+
+static int
+esxNetworkClose(virConnectPtr conn)
+{
+    conn->networkPrivateData = NULL;
+
+    return 0;
+}
+
+
+
+static virNetworkDriver esxNetworkDriver = {
+    "ESX",                                 /* name */
+    esxNetworkOpen,                        /* open */
+    esxNetworkClose,                       /* close */
+    NULL,                                  /* numOfNetworks */
+    NULL,                                  /* listNetworks */
+    NULL,                                  /* numOfDefinedNetworks */
+    NULL,                                  /* listDefinedNetworks */
+    NULL,                                  /* networkLookupByUUID */
+    NULL,                                  /* networkLookupByName */
+    NULL,                                  /* networkCreateXML */
+    NULL,                                  /* networkDefineXML */
+    NULL,                                  /* networkUndefine */
+    NULL,                                  /* networkCreate */
+    NULL,                                  /* networkDestroy */
+    NULL,                                  /* networkDumpXML */
+    NULL,                                  /* networkGetBridgeName */
+    NULL,                                  /* networkGetAutostart */
+    NULL,                                  /* networkSetAutostart */
+    NULL,                                  /* networkIsActive */
+    NULL,                                  /* networkIsPersistent */
+};
+
+
+
+int
+esxNetworkRegister(void)
+{
+    return virRegisterNetworkDriver(&esxNetworkDriver);
+}
diff --git a/src/esx/esx_network_driver.h b/src/esx/esx_network_driver.h
new file mode 100644
index 0000000..f117e03
--- /dev/null
+++ b/src/esx/esx_network_driver.h
@@ -0,0 +1,29 @@
+
+/*
+ * esx_network_driver.h: network driver methods for managing VMware ESX
+ *                       host networks
+ *
+ * Copyright (C) 2010 Matthias Bolte <matthias.bolte at googlemail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#ifndef __ESX_NETWORK_DRIVER_H__
+#define __ESX_NETWORK_DRIVER_H__
+
+int esxNetworkRegister(void);
+
+#endif /* __ESX_NETWORK_DRIVER_H__ */
diff --git a/src/esx/esx_secret_driver.c b/src/esx/esx_secret_driver.c
new file mode 100644
index 0000000..e451b13
--- /dev/null
+++ b/src/esx/esx_secret_driver.c
@@ -0,0 +1,91 @@
+
+/*
+ * esx_secret_driver.c: secret driver methods for VMware ESX secret manipulation
+ *
+ * Copyright (C) 2010 Matthias Bolte <matthias.bolte at googlemail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#include <config.h>
+
+#include "internal.h"
+#include "virterror_internal.h"
+#include "util.h"
+#include "memory.h"
+#include "logging.h"
+#include "uuid.h"
+#include "esx_driver.h"
+#include "esx_secret_driver.h"
+#include "esx_vi.h"
+#include "esx_vi_methods.h"
+#include "esx_util.h"
+
+#define VIR_FROM_THIS VIR_FROM_ESX
+
+#define ESX_ERROR(conn, code, fmt...)                                         \
+    virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
+                         __LINE__, fmt)
+
+
+
+static virDrvOpenStatus
+esxSecretOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+              int flags ATTRIBUTE_UNUSED)
+{
+    if (STRNEQ(conn->driver->name, "ESX")) {
+        return VIR_DRV_OPEN_DECLINED;
+    }
+
+    conn->secretPrivateData = conn->privateData;
+
+    return VIR_DRV_OPEN_SUCCESS;
+}
+
+
+
+static int
+esxSecretClose(virConnectPtr conn)
+{
+    conn->secretPrivateData = NULL;
+
+    return 0;
+}
+
+
+
+static virSecretDriver esxSecretDriver = {
+    "ESX",                                 /* name */
+    esxSecretOpen,                         /* open */
+    esxSecretClose,                        /* close */
+    NULL,                                  /* numOfSecrets */
+    NULL,                                  /* listSecrets */
+    NULL,                                  /* lookupByUUID */
+    NULL,                                  /* lookupByUsage */
+    NULL,                                  /* defineXML */
+    NULL,                                  /* getXMLDesc */
+    NULL,                                  /* setValue */
+    NULL,                                  /* getValue */
+    NULL,                                  /* undefine */
+};
+
+
+
+int
+esxSecretRegister(void)
+{
+    return virRegisterSecretDriver(&esxSecretDriver);
+}
diff --git a/src/esx/esx_secret_driver.h b/src/esx/esx_secret_driver.h
new file mode 100644
index 0000000..c0d4a48
--- /dev/null
+++ b/src/esx/esx_secret_driver.h
@@ -0,0 +1,28 @@
+
+/*
+ * esx_secret_driver.h: secret driver methods for VMware ESX secret manipulation
+ *
+ * Copyright (C) 2010 Matthias Bolte <matthias.bolte at googlemail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#ifndef __ESX_SECRET_DRIVER_H__
+#define __ESX_SECRET_DRIVER_H__
+
+int esxSecretRegister(void);
+
+#endif /* __ESX_SECRET_DRIVER_H__ */
diff --git a/src/esx/esx_storage_driver.c b/src/esx/esx_storage_driver.c
new file mode 100644
index 0000000..7e9b98d
--- /dev/null
+++ b/src/esx/esx_storage_driver.c
@@ -0,0 +1,117 @@
+
+/*
+ * esx_storage_driver.c: storage driver methods for managing VMware ESX
+ *                       host storage
+ *
+ * Copyright (C) 2010 Matthias Bolte <matthias.bolte at googlemail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#include <config.h>
+
+#include "internal.h"
+#include "virterror_internal.h"
+#include "util.h"
+#include "memory.h"
+#include "logging.h"
+#include "uuid.h"
+#include "esx_driver.h"
+#include "esx_storage_driver.h"
+#include "esx_vi.h"
+#include "esx_vi_methods.h"
+#include "esx_util.h"
+
+#define VIR_FROM_THIS VIR_FROM_ESX
+
+#define ESX_ERROR(conn, code, fmt...)                                         \
+    virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
+                         __LINE__, fmt)
+
+
+
+static virDrvOpenStatus
+esxStorageOpen(virConnectPtr conn,
+               virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+               int flags ATTRIBUTE_UNUSED)
+{
+    if (STRNEQ(conn->driver->name, "ESX")) {
+        return VIR_DRV_OPEN_DECLINED;
+    }
+
+    conn->storagePrivateData = conn->privateData;
+
+    return VIR_DRV_OPEN_SUCCESS;
+}
+
+
+
+static int
+esxStorageClose(virConnectPtr conn)
+{
+    conn->storagePrivateData = NULL;
+
+    return 0;
+}
+
+
+
+static virStorageDriver esxStorageDriver = {
+    "ESX",                                 /* name */
+    esxStorageOpen,                        /* open */
+    esxStorageClose,                       /* close */
+    NULL,                                  /* numOfPools */
+    NULL,                                  /* listPools */
+    NULL,                                  /* numOfDefinedPools */
+    NULL,                                  /* listDefinedPools */
+    NULL,                                  /* findPoolSources */
+    NULL,                                  /* poolLookupByName */
+    NULL,                                  /* poolLookupByUUID */
+    NULL,                                  /* poolLookupByVolume */
+    NULL,                                  /* poolCreateXML */
+    NULL,                                  /* poolDefineXML */
+    NULL,                                  /* poolBuild */
+    NULL,                                  /* poolUndefine */
+    NULL,                                  /* poolCreate */
+    NULL,                                  /* poolDestroy */
+    NULL,                                  /* poolDelete */
+    NULL,                                  /* poolRefresh */
+    NULL,                                  /* poolGetInfo */
+    NULL,                                  /* poolGetXMLDesc */
+    NULL,                                  /* poolGetAutostart */
+    NULL,                                  /* poolSetAutostart */
+    NULL,                                  /* poolNumOfVolumes */
+    NULL,                                  /* poolListVolumes */
+    NULL,                                  /* volLookupByName */
+    NULL,                                  /* volLookupByKey */
+    NULL,                                  /* volLookupByPath */
+    NULL,                                  /* volCreateXML */
+    NULL,                                  /* volCreateXMLFrom */
+    NULL,                                  /* volDelete */
+    NULL,                                  /* volGetInfo */
+    NULL,                                  /* volGetXMLDesc */
+    NULL,                                  /* volGetPath */
+    NULL,                                  /* poolIsActive */
+    NULL,                                  /* poolIsPersistent */
+};
+
+
+
+int
+esxStorageRegister(void)
+{
+    return virRegisterStorageDriver(&esxStorageDriver);
+}
diff --git a/src/esx/esx_storage_driver.h b/src/esx/esx_storage_driver.h
new file mode 100644
index 0000000..91a5d03
--- /dev/null
+++ b/src/esx/esx_storage_driver.h
@@ -0,0 +1,29 @@
+
+/*
+ * esx_storage_driver.h: storage driver methods for managing VMware ESX
+ *                       host storage
+ *
+ * Copyright (C) 2010 Matthias Bolte <matthias.bolte at googlemail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#ifndef __ESX_STORAGE_DRIVER_H__
+#define __ESX_STORAGE_DRIVER_H__
+
+int esxStorageRegister(void);
+
+#endif /* __ESX_STORAGE_DRIVER_H__ */
-- 
1.6.3.3




More information about the libvir-list mailing list