Parallels Server Bare Metal is a virtualization solution which allows to run
both Containers (OpenVZ-like) and virtual machines (like any other hardware
hypervisor).
This patch implements initial driver stub with almost no functionality except an
ability to open and close driver. At the same time it contains initialization of
Parallels API and clearly demonstrates supposed approach to future driver
implementation. In particular, I suppose to use parallels-virtualization-sdk
library provisioned with the PSBM distribution (and separately also) for PSBM's
virtual servers management.
Signed-off-by: Dmitry Mishin <dim(a)parallels.com>
---
autobuild.sh | 1 +
configure.ac | 21 +++++
include/libvirt/virterror.h | 1 +
src/Makefile.am | 22 +++++
src/README | 1 +
src/driver.h | 1 +
src/libvirt.c | 9 ++
src/psbm/psbm_api.c | 117 ++++++++++++++++++++++++
src/psbm/psbm_api.h | 59 ++++++++++++
src/psbm/psbm_driver.c | 208 +++++++++++++++++++++++++++++++++++++++++++
src/psbm/psbm_driver.h | 32 +++++++
src/psbm/psbm_private.h | 49 ++++++++++
src/util/virterror.c | 3 +
13 files changed, 524 insertions(+), 0 deletions(-)
create mode 100644 src/psbm/psbm_api.c
create mode 100644 src/psbm/psbm_api.h
create mode 100644 src/psbm/psbm_driver.c
create mode 100644 src/psbm/psbm_driver.h
create mode 100644 src/psbm/psbm_private.h
diff --git a/autobuild.sh b/autobuild.sh
index 491f1b8..f552343 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -81,6 +81,7 @@ if [ -x /usr/bin/i686-pc-mingw32-gcc ]; then
--without-uml \
--without-vbox \
--without-openvz \
+ --without-psbm \
--without-phyp \
--without-netcf \
--without-audit \
diff --git a/configure.ac b/configure.ac
index df19445..7cff4f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -283,6 +283,8 @@ AC_ARG_WITH([uml],
AC_HELP_STRING([--with-uml], [add UML support
@<:@default=check@:>@]),[],[with_uml=check])
AC_ARG_WITH([openvz],
AC_HELP_STRING([--with-openvz], [add OpenVZ support
@<:@default=check@:>@]),[],[with_openvz=check])
+AC_ARG_WITH([psbm],
+ AC_HELP_STRING([--with-psbm], [add PSBM support
@<:@default=no@:>@]),[],[with_psbm=no])
AC_ARG_WITH([vmware],
AC_HELP_STRING([--with-vmware], [add VMware support
@<:@default=yes@:>@]),[],[with_vmware=yes])
AC_ARG_WITH([libssh2],
@@ -385,6 +387,24 @@ AM_CONDITIONAL([WITH_OPENVZ], [test "$with_openvz" =
"yes"])
dnl
+dnl Checks for the PSBM driver
+dnl
+
+if test "$with_psbm" = "check"; then
+ with_psbm=$with_linux
+fi
+
+if test "$with_psbm" = "yes" && test "$with_linux"
= "no"; then
+ AC_MSG_ERROR([The PSBM driver can be enabled on Linux only.])
+fi
+
+if test "$with_psbm" = "yes"; then
+ AC_DEFINE_UNQUOTED([WITH_PSBM], 1, [whether PSBM driver is enabled])
+fi
+AM_CONDITIONAL([WITH_PSBM], [test "$with_psbm" = "yes"])
+
+
+dnl
dnl Checks for the VMware Workstation/Player driver
dnl
@@ -2504,6 +2524,7 @@ AC_MSG_NOTICE([ Xen: $with_xen])
AC_MSG_NOTICE([ QEMU: $with_qemu])
AC_MSG_NOTICE([ UML: $with_uml])
AC_MSG_NOTICE([ OpenVZ: $with_openvz])
+AC_MSG_NOTICE([ PSBM: $with_psbm])
AC_MSG_NOTICE([ VMware: $with_vmware])
AC_MSG_NOTICE([ VBox: $with_vbox])
AC_MSG_NOTICE([ XenAPI: $with_xenapi])
diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index 0aae622..858e051 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -83,6 +83,7 @@ typedef enum {
VIR_FROM_LIBXL = 41, /* Error from libxenlight driver */
VIR_FROM_LOCKING = 42, /* Error from lock manager */
VIR_FROM_HYPERV = 43, /* Error from Hyper-V driver */
+ VIR_FROM_PSBM = 44, /* Error from PSBM driver */
} virErrorDomain;
diff --git a/src/Makefile.am b/src/Makefile.am
index 738ee91..99f4995 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -320,6 +320,11 @@ OPENVZ_DRIVER_SOURCES = \
openvz/openvz_conf.c openvz/openvz_conf.h \
openvz/openvz_driver.c openvz/openvz_driver.h
+PSBM_DRIVER_SOURCES = \
+ psbm/psbm_driver.c psbm/psbm_driver.h \
+ psbm/psbm_api.c psbm/psbm_api.h \
+ psbm/psbm_private.h
+
VMWARE_DRIVER_SOURCES = \
vmware/vmware_driver.c vmware/vmware_driver.h \
vmware/vmware_conf.c vmware/vmware_conf.h
@@ -684,6 +689,22 @@ endif
libvirt_driver_openvz_la_SOURCES = $(OPENVZ_DRIVER_SOURCES)
endif
+if WITH_PSBM
+if WITH_DRIVER_MODULES
+mod_LTLIBRARIES += libvirt_driver_psbm.la
+else
+noinst_LTLIBRARIES += libvirt_driver_psbm.la
+libvirt_la_BUILT_LIBADD += libvirt_driver_psbm.la
+endif
+libvirt_driver_psbm_la_CFLAGS = \
+ -I@top_srcdir@/src/conf $(AM_CFLAGS)
+if WITH_DRIVER_MODULES
+libvirt_driver_psbm_la_LIBADD = ../gnulib/lib/libgnu.la
+libvirt_driver_psbm_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
+endif
+libvirt_driver_psbm_la_SOURCES = $(PSBM_DRIVER_SOURCES)
+endif
+
if WITH_VMWARE
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_vmware.la
@@ -1078,6 +1099,7 @@ EXTRA_DIST += \
$(LXC_DRIVER_SOURCES) \
$(UML_DRIVER_SOURCES) \
$(OPENVZ_DRIVER_SOURCES) \
+ $(PSBM_DRIVER_SOURCES) \
$(PHYP_DRIVER_SOURCES) \
$(VBOX_DRIVER_SOURCES) \
$(XENAPI_DRIVER_SOURCES) \
diff --git a/src/README b/src/README
index 00d11d1..02c3f9c 100644
--- a/src/README
+++ b/src/README
@@ -29,6 +29,7 @@ Then there are the hypervisor implementations:
* hyperv/ - Microsoft Hyper-V support using WinRM
* lxc/ - Linux Native Containers
* openvz/ - OpenVZ containers using cli tools
+ * psbm/ - Parallels Server Bare Metal using SDK API
* phyp/ - IBM Power Hypervisor using CLI tools over SSH
* qemu/ - QEMU / KVM using qemu CLI/monitor
* remote/ - Generic libvirt native RPC client
diff --git a/src/driver.h b/src/driver.h
index 3792003..ad97790 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -30,6 +30,7 @@ typedef enum {
VIR_DRV_VMWARE = 13,
VIR_DRV_LIBXL = 14,
VIR_DRV_HYPERV = 15,
+ VIR_DRV_PSBM = 16,
} virDrvNo;
diff --git a/src/libvirt.c b/src/libvirt.c
index 8f94b11..59eb368 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -55,6 +55,9 @@
# ifdef WITH_OPENVZ
# include "openvz/openvz_driver.h"
# endif
+# ifdef WITH_PSBM
+# include "psbm/psbm_driver.h"
+# endif
# ifdef WITH_VMWARE
# include "vmware/vmware_driver.h"
# endif
@@ -447,6 +450,9 @@ virInitialize(void)
# ifdef WITH_OPENVZ
virDriverLoadModule("openvz");
# endif
+# ifdef WITH_PSBM
+ virDriverLoadModule("psbm");
+# endif
# ifdef WITH_VMWARE
virDriverLoadModule("vmware");
# endif
@@ -475,6 +481,9 @@ virInitialize(void)
# ifdef WITH_OPENVZ
if (openvzRegister() == -1) return -1;
# endif
+# ifdef WITH_PSBM
+ if (psbmRegister() == -1) return -1;
+# endif
# ifdef WITH_VMWARE
if (vmwareRegister() == -1) return -1;
# endif
diff --git a/src/psbm/psbm_api.c b/src/psbm/psbm_api.c
new file mode 100644
index 0000000..b5a89f1
--- /dev/null
+++ b/src/psbm/psbm_api.c
@@ -0,0 +1,117 @@
+/*
+ * psbm_api.c: core driver methods for managing PSBM virtual servers
+ *
+ * Copyright (C) 2011 Parallels, Inc.
+ *
+ * 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
+ *
+ * Authors:
+ * Dmitry Mishin <dim(a)parallels.com>
+ *
+ */
+
+#include <config.h>
+
+#include <sys/utsname.h>
+#include <dlfcn.h>
+
+#include "psbm_api.h"
+#include "virterror_internal.h"
+
+#ifdef PRL_SDK_WRAP_FOR_EACH_ITERATOR
+ #undef PRL_SDK_WRAP_FOR_EACH_ITERATOR
+ #undef PRL_SDK_WRAP_FOR_EACH_DEPR_ITERATOR
+#endif
+#define PRL_SDK_WRAP_FOR_EACH_ITERATOR( name ) \
+ name##wrap##_Ptr name;
+#define PRL_SDK_WRAP_FOR_EACH_DEPR_ITERATOR( name ) \
+ name##wrap##_Ptr name;
+
+PRL_SDK_WRAP_FOR_EACH()
+
+#ifdef PRL_SDK_WRAP_FOR_EACH_ITERATOR
+ #undef PRL_SDK_WRAP_FOR_EACH_ITERATOR
+ #undef PRL_SDK_WRAP_FOR_EACH_DEPR_ITERATOR
+#endif
+
+
+int psbmApiInit(struct psbm_driver *driver)
+{
+ const char *libname = "libprl_sdk.so";
+ void *handle = NULL;
+ PRL_RESULT res;
+
+ handle = dlopen(libname, RTLD_LAZY);
+ if (!handle) {
+ psbmError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to load SDK library %s %s"), libname, dlerror());
+ return VIR_ERR_INTERNAL_ERROR;
+ }
+
+#define PRL_SDK_WRAP_FOR_EACH_ITERATOR(name) \
+ if (!(name = (name##wrap##_Ptr)dlsym(handle, #name))) { \
+ psbmError(VIR_ERR_INTERNAL_ERROR, \
+ _("Failed to locate SDK symbol '%s' on initialization"),
#name); \
+ }
+
+#define PRL_SDK_WRAP_FOR_EACH_DEPR_ITERATOR(name) \
+ if (!(name = (name##wrap##_Ptr)dlsym(handle, #name))) { \
+ }
+
+ PRL_SDK_WRAP_FOR_EACH();
+#undef PRL_SDK_WRAP_FOR_EACH_DEPR_ITERATOR
+#undef PRL_SDK_WRAP_FOR_EACH_ITERATOR
+
+ res = PrlApi_Init(PARALLELS_API_VER);
+ if (PRL_FAILED(res)) {
+ psbmError(VIR_ERR_OPERATION_FAILED,
+ _("Can't initialize Parallels SDK"));
+ dlclose(handle);
+ return VIR_ERR_OPERATION_FAILED;
+ }
+
+ driver->handle = handle;
+ return VIR_ERR_OK;
+}
+
+int psbmApiDeinit(struct psbm_driver *driver)
+{
+ if (driver->handle) {
+ PrlApi_Deinit();
+
+ if (dlclose(driver->handle)) {
+ psbmError(VIR_ERR_SYSTEM_ERROR, _("Can't unload Parallels
SDK"));
+ return VIR_ERR_SYSTEM_ERROR;
+ }
+ }
+
+#ifdef PRL_SDK_WRAP_FOR_EACH_ITERATOR
+# undef PRL_SDK_WRAP_FOR_EACH_ITERATOR
+# undef PRL_SDK_WRAP_FOR_EACH_DEPR_ITERATOR
+#endif
+
+#define PRL_SDK_WRAP_FOR_EACH_ITERATOR(name) \
+ name = 0;
+#define PRL_SDK_WRAP_FOR_EACH_DEPR_ITERATOR(name) \
+ name = 0;
+
+PRL_SDK_WRAP_FOR_EACH()
+
+#undef PRL_SDK_WRAP_FOR_EACH_ITERATOR
+#undef PRL_SDK_WRAP_FOR_EACH_DEPR_ITERATOR
+
+ driver->handle = NULL;
+ return VIR_ERR_OK;
+}
diff --git a/src/psbm/psbm_api.h b/src/psbm/psbm_api.h
new file mode 100644
index 0000000..8793bc6
--- /dev/null
+++ b/src/psbm/psbm_api.h
@@ -0,0 +1,59 @@
+/*
+ * psbm_api.h: SDK API methods for managing PSBM virtual servers
+ *
+ * Copyright (C) 2011 Parallels, Inc.
+ *
+ * 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
+ *
+ * Authors:
+ * Dmitry Mishin <dim(a)parallels.com>
+ *
+ */
+
+
+#ifndef _PSBM_API_H_
+#define _PSBM_API_H_
+
+/* necessary for dynamic loading of Parallels SDK library define */
+#define DYN_API_WRAP
+
+#include <parallels-virtualization-sdk/Parallels.h>
+#include <parallels-virtualization-sdk/PrlApiMacro.h>
+
+#include "internal.h"
+#include "psbm_private.h"
+
+#ifdef PRL_SDK_WRAP_FOR_EACH_ITERATOR
+ #undef PRL_SDK_WRAP_FOR_EACH_ITERATOR
+ #undef PRL_SDK_WRAP_FOR_EACH_DEPR_ITERATOR
+#endif
+#define PRL_SDK_WRAP_FOR_EACH_ITERATOR( name ) \
+ extern name##wrap##_Ptr name;
+#define PRL_SDK_WRAP_FOR_EACH_DEPR_ITERATOR( name ) \
+ extern name##wrap##_Ptr name;
+
+PRL_SDK_WRAP_FOR_EACH()
+
+#ifdef PRL_SDK_WRAP_FOR_EACH_ITERATOR
+ #undef PRL_SDK_WRAP_FOR_EACH_ITERATOR
+ #undef PRL_SDK_WRAP_FOR_EACH_DEPR_ITERATOR
+#endif
+
+
+/* Library initialization/deinitialization */
+int psbmApiInit(struct psbm_driver *driver);
+int psbmApiDeinit(struct psbm_driver *driver);
+
+#endif /* _PSBM_API_H_ */
diff --git a/src/psbm/psbm_driver.c b/src/psbm/psbm_driver.c
new file mode 100644
index 0000000..183d5ba
--- /dev/null
+++ b/src/psbm/psbm_driver.c
@@ -0,0 +1,208 @@
+/*
+ * psbm_driver.c: core driver methods for managing PSBM virtual servers
+ *
+ * Copyright (C) 2011 Parallels, Inc.
+ *
+ * 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
+ *
+ * Authors:
+ * Dmitry Mishin <dim(a)parallels.com>
+ *
+ */
+
+#include <config.h>
+
+#include <sys/utsname.h>
+
+#include "psbm_driver.h"
+#include "psbm_api.h"
+#include "virterror_internal.h"
+#include "datatypes.h"
+#include "memory.h"
+#include "nodeinfo.h"
+
+static void psbmDriverLock(struct psbm_driver *driver)
+{
+ virMutexLock(&driver->lock);
+}
+
+static void psbmDriverUnlock(struct psbm_driver *driver)
+{
+ virMutexUnlock(&driver->lock);
+}
+
+static void psbmFreeDriver(struct psbm_driver *driver)
+{
+ if (!driver)
+ return;
+
+ virDomainObjListDeinit(&driver->domains);
+ virCapabilitiesFree(driver->caps);
+ VIR_FREE(driver);
+}
+
+static virCapsPtr psbmCapsInit(void)
+{
+ struct utsname utsname;
+ virCapsPtr caps;
+ virCapsGuestPtr guest;
+
+ uname(&utsname);
+
+ if ((caps = virCapabilitiesNew(utsname.machine,
+ 0, 0)) == NULL)
+ goto no_memory;
+
+ if (nodeCapsInitNUMA(caps) < 0)
+ goto no_memory;
+
+ virCapabilitiesSetMacPrefix(caps, (unsigned char[]){ 0x52, 0x54, 0x00 });
+
+ if ((guest = virCapabilitiesAddGuest(caps,
+ "exe",
+ utsname.machine,
+ sizeof(int) == 4 ? 32 : 8,
+ NULL,
+ NULL,
+ 0,
+ NULL)) == NULL)
+ goto no_memory;
+
+ if (virCapabilitiesAddGuestDomain(guest,
+ "psbm",
+ NULL,
+ NULL,
+ 0,
+ NULL) == NULL)
+ goto no_memory;
+
+ caps->defaultInitPath = "/sbin/init";
+
+ return caps;
+no_memory:
+ virCapabilitiesFree(caps);
+ return NULL;
+}
+
+
+static virDrvOpenStatus psbmOpen(virConnectPtr conn,
+ virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+ unsigned int flags)
+{
+ struct psbm_driver *driver;
+
+ virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
+
+ /* Decline if the URI is NULL or the scheme is not 'psbm' */
+ if (conn->uri == NULL || conn->uri->scheme == NULL ||
+ STRCASENEQ(conn->uri->scheme, "psbm"))
+ return VIR_DRV_OPEN_DECLINED;
+
+
+ /* If path isn't /system, then they typoed, so tell them correct path */
+ if (conn->uri->path == NULL ||
+ STRNEQ (conn->uri->path, "/system")) {
+ psbmError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected PSBM URI path '%s', try
psbm:///system"),
+ conn->uri->path);
+ return VIR_DRV_OPEN_ERROR;
+ }
+
+ /* We now know the URI is definitely for this driver, so beyond
+ * here, don't return DECLINED, always use ERROR */
+
+ if (VIR_ALLOC(driver) < 0) {
+ virReportOOMError();
+ return VIR_DRV_OPEN_ERROR;
+ }
+
+ if (virDomainObjListInit(&driver->domains) < 0)
+ goto cleanup;
+
+ if (!(driver->caps = psbmCapsInit()))
+ goto cleanup;
+
+ /* load Parallels SDK library, resolve symbols, initialize it */
+ if (psbmApiInit(driver) != VIR_ERR_OK)
+ goto cleanup;
+
+ conn->privateData = driver;
+
+ return VIR_DRV_OPEN_SUCCESS;
+
+cleanup:
+ psbmFreeDriver(driver);
+ return VIR_DRV_OPEN_ERROR;
+};
+
+static int psbmClose(virConnectPtr conn) {
+ struct psbm_driver *driver = conn->privateData;
+ int err;
+
+ err = psbmApiDeinit(driver);
+ if (err != VIR_ERR_OK)
+ return err;
+
+ psbmFreeDriver(driver);
+ conn->privateData = NULL;
+
+ return 0;
+}
+
+static const char *psbmGetType(virConnectPtr conn ATTRIBUTE_UNUSED) {
+ return "PSBM";
+}
+
+static int psbmGetVersion(virConnectPtr conn, unsigned long *version) {
+ struct psbm_driver *driver = conn->privateData;
+ psbmDriverLock(driver);
+ *version = driver->version;
+ psbmDriverUnlock(driver);
+ return 0;
+}
+
+static int psbmListDomains(virConnectPtr conn ATTRIBUTE_UNUSED,
+ int *ids ATTRIBUTE_UNUSED , int nids ATTRIBUTE_UNUSED) {
+ /* FIXME implement via API */
+ return -1;
+}
+
+static int psbmNumDomains(virConnectPtr conn) {
+ struct psbm_driver *driver = conn->privateData;
+ int n;
+
+ psbmDriverLock(driver);
+ n = virDomainObjListNumOfDomains(&driver->domains, 1);
+ psbmDriverUnlock(driver);
+
+ return n;
+}
+
+static virDriver psbmDriver = {
+ .no = VIR_DRV_PSBM,
+ .name = "PSBM",
+ .open = psbmOpen, /* 0.3.1 */
+ .close = psbmClose, /* 0.3.1 */
+ .type = psbmGetType, /* 0.3.1 */
+ .version = psbmGetVersion, /* 0.3.1 */
+ .nodeGetInfo = nodeGetInfo, /* 0.3.1 */
+ .listDomains = psbmListDomains, /* 0.3.1 */
+ .numOfDomains = psbmNumDomains, /* 0.3.1 */
+};
+
+int psbmRegister(void) {
+ virRegisterDriver(&psbmDriver);
+ return 0;
+}
diff --git a/src/psbm/psbm_driver.h b/src/psbm/psbm_driver.h
new file mode 100644
index 0000000..aff171c
--- /dev/null
+++ b/src/psbm/psbm_driver.h
@@ -0,0 +1,32 @@
+/*
+ * psbm_driver.h: core driver methods for managing PSBM virtual servers
+ *
+ * Copyright (C) 2011 Parallels, Inc.
+ *
+ * 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
+ *
+ * Authors:
+ * Dmitry Mishin <dim(a)parallels.com>
+ *
+ */
+
+#ifndef _PSBM_DRIVER_H_
+#define _PSBM_DRIVER_H_
+
+#include "internal.h"
+
+int psbmRegister(void);
+
+#endif /* _PSBM_DRIVER_H_ */
diff --git a/src/psbm/psbm_private.h b/src/psbm/psbm_private.h
new file mode 100644
index 0000000..6994feb
--- /dev/null
+++ b/src/psbm/psbm_private.h
@@ -0,0 +1,49 @@
+/*
+ * psbm_private.h: internal definitions for PSBM driver
+ *
+ * Copyright (C) 2011 Parallels, Inc.
+ *
+ * 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
+ *
+ * Authors:
+ * Dmitry Mishin <dim(a)parallels.com>
+ *
+ */
+
+#ifndef _PSBM_PRIVATE_H_
+#define _PSBM_PRIVATE_H_
+
+#include "internal.h"
+#include "threads.h"
+#include "capabilities.h"
+#include "domain_conf.h"
+
+
+#define VIR_FROM_THIS VIR_FROM_PSBM
+
+# define psbmError(code, ...) \
+ virReportErrorHelper(VIR_FROM_PSBM, code, __FILE__, \
+ __FUNCTION__, __LINE__, __VA_ARGS__)
+
+struct psbm_driver {
+ virMutex lock;
+
+ virCapsPtr caps;
+ virDomainObjList domains;
+ int version;
+ void *handle;
+};
+
+#endif /* _PSBM_PRIVATE_H_ */
diff --git a/src/util/virterror.c b/src/util/virterror.c
index 26c4981..73f2618 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -100,6 +100,9 @@ static const char *virErrorDomainName(virErrorDomain domain) {
case VIR_FROM_OPENVZ:
dom = "OpenVZ ";
break;
+ case VIR_FROM_PSBM:
+ dom = "PSBM ";
+ break;
case VIR_FROM_VMWARE:
dom = "VMware ";
break;
--
1.7.3.4