MINGW_EXTRA_LDFLAGS=
WIN32_EXTRA_CFLAGS=
LIBVIRT_SYMBOL_FILE=libvirt.syms
+LIBVIRT_QEMU_SYMBOL_FILE=libvirt_qemu.syms
case "$host" in
*-*-cygwin*)
CYGWIN_EXTRA_LDFLAGS="-no-undefined"
AC_SUBST([MINGW_EXTRA_LDFLAGS])
AC_SUBST([WIN32_EXTRA_CFLAGS])
AC_SUBST([LIBVIRT_SYMBOL_FILE])
+AC_SUBST([LIBVIRT_QEMU_SYMBOL_FILE])
AC_SUBST([VERSION_SCRIPT_FLAGS])
virincdir = $(includedir)/libvirt
virinc_HEADERS = libvirt.h \
+ libvirt-qemu.h \
virterror.h
install-exec-hook:
--- /dev/null
+/* -*- c -*-
+ * libvirt-qemu.h:
+ * Summary: qemu specific interfaces
+ * Description: Provides the interfaces of the libvirt library to handle
+ * qemu specific methods
+ *
+ * Copy: Copyright (C) 2010 Red Hat, Inc.
+ *
+ * See COPYING.LIB for the License of this software
+ *
+ * Author: Chris Lalancette <clalance@redhat.com>
+ */
+
+#ifndef __VIR_QEMU_H__
+# define __VIR_QEMU_H__
+
+# include "libvirt.h"
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+int virDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd,
+ char **result, unsigned int flags);
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif /* __VIR_QEMU_H__ */
UUID=$(shell uuidgen 2>/dev/null)
endif
-lib_LTLIBRARIES = libvirt.la
+lib_LTLIBRARIES = libvirt.la libvirt-qemu.la
moddir = $(libdir)/libvirt/drivers
mod_LTLIBRARIES =
libvirt_test_la_LDFLAGS = $(test_LDFLAGS)
libvirt_test_la_CFLAGS = $(COVERAGE_CFLAGS)
+libvirt_qemu_la_SOURCES = libvirt-qemu.c
+libvirt_qemu_la_LDFLAGS = $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_QEMU_SYMBOL_FILE) \
+ -version-info $(LIBVIRT_VERSION_INFO) \
+ $(CYGWIN_EXTRA_LDFLAGS) $(MINGW_EXTRA_LDFLAGS)
+libvirt_qemu_la_CFLAGS = $(COVERAGE_CFLAGS)
+libvirt_qemu_la_LIBADD = libvirt.la $(CYGWIN_EXTRA_LIBADD)
libexec_PROGRAMS =
(*virDrvDomainSnapshotDelete)(virDomainSnapshotPtr snapshot,
unsigned int flags);
+typedef int
+ (*virDrvQemuDomainMonitorCommand)(virDomainPtr domain, const char *cmd,
+ char **result, unsigned int flags);
+
+
/**
* _virDriver:
virDrvDomainSnapshotCurrent domainSnapshotCurrent;
virDrvDomainRevertToSnapshot domainRevertToSnapshot;
virDrvDomainSnapshotDelete domainSnapshotDelete;
+ virDrvQemuDomainMonitorCommand qemuDomainMonitorCommand;
};
typedef int
esxDomainSnapshotCurrent, /* domainSnapshotCurrent */
esxDomainRevertToSnapshot, /* domainRevertToSnapshot */
esxDomainSnapshotDelete, /* domainSnapshotDelete */
+ NULL, /* qemuDomainMonitorCommand */
};
--- /dev/null
+/*
+ * libvirt-qemu.c: Interfaces for the libvirt library to handle qemu-specific
+ * APIs.
+ *
+ * Copyright (C) 2010 Red Hat, 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
+ *
+ * Author: Chris Lalancette <clalance@redhat.com>
+ */
+
+#include <config.h>
+
+#include "virterror_internal.h"
+#include "logging.h"
+#include "datatypes.h"
+#include "libvirt/libvirt-qemu.h"
+
+#define virLibConnError(conn, error, info) \
+ virReportErrorHelper(conn, VIR_FROM_NONE, error, NULL, __FUNCTION__, \
+ __LINE__, info)
+
+#define virLibDomainError(domain, error, info) \
+ virReportErrorHelper(NULL, VIR_FROM_DOM, error, NULL, __FUNCTION__, \
+ __LINE__, info)
+
+int
+virDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd,
+ char **result, unsigned int flags)
+{
+ virConnectPtr conn;
+
+ DEBUG("domain=%p, cmd=%s, result=%p, flags=%u", domain, cmd, result, flags);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
+ virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+ virDispatchError(NULL);
+ return -1;
+ }
+
+ conn = domain->conn;
+
+ if (result == NULL) {
+ virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ goto error;
+ }
+
+ if (conn->flags & VIR_CONNECT_RO) {
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ goto error;
+ }
+
+ if (conn->driver->qemuDomainMonitorCommand) {
+ int ret;
+ ret = conn->driver->qemuDomainMonitorCommand(domain, cmd, result,
+ flags);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+ virDispatchError(conn);
+ return -1;
+}
virReportOOMErrorFull;
virStrerror;
virSetError;
+virDispatchError;
# xml.h
--- /dev/null
+#
+# Officially exported symbols, for which header
+# file definitions are installed in /usr/include/libvirt
+# from libvirt-qemu.h
+#
+# Versions here are *fixed* to match the libvirt version
+# at which the symbol was introduced. This ensures that
+# a new client app requiring symbol foo() can't accidentally
+# run with old libvirt-qemu.so not providing foo() - the global
+# soname version info can't enforce this since we never
+# change the soname
+#
+LIBVIRT_QEMU_0.8.3 {
+ global:
+ virDomainQemuMonitorCommand;
+};
NULL, /* domainSnapshotCurrent */
NULL, /* domainRevertToSnapshot */
NULL, /* domainSnapshotDelete */
+ NULL, /* qemuDomainMonitorCommand */
};
static virStateDriver lxcStateDriver = {
NULL, /* domainSnapshotCurrent */
NULL, /* domainRevertToSnapshot */
NULL, /* domainSnapshotDelete */
+ NULL, /* qemuDomainMonitorCommand */
};
static virStateDriver oneStateDriver = {
NULL, /* domainSnapshotCurrent */
NULL, /* domainRevertToSnapshot */
NULL, /* domainSnapshotDelete */
+ NULL, /* qemuDomainMonitorCommand */
};
int openvzRegister(void) {
NULL, /* domainSnapshotCurrent */
NULL, /* domainRevertToSnapshot */
NULL, /* domainSnapshotDelete */
+ NULL, /* qemuMonitorCommand */
};
static virStorageDriver phypStorageDriver = {
qemuDomainSnapshotCurrent, /* domainSnapshotCurrent */
qemuDomainRevertToSnapshot, /* domainRevertToSnapshot */
qemuDomainSnapshotDelete, /* domainSnapshotDelete */
+ NULL, /* qemuDomainMonitorCommand */
};
remoteDomainSnapshotCurrent, /* domainSnapshotCurrent */
remoteDomainRevertToSnapshot, /* domainRevertToSnapshot */
remoteDomainSnapshotDelete, /* domainSnapshotDelete */
+ NULL, /* qemuDomainMonitorCommand */
};
static virNetworkDriver network_driver = {
NULL, /* domainSnapshotCurrent */
NULL, /* domainRevertToSnapshot */
NULL, /* domainSnapshotDelete */
+ NULL, /* qemuDomainMonitorCommand */
};
static virNetworkDriver testNetworkDriver = {
NULL, /* domainSnapshotCurrent */
NULL, /* domainRevertToSnapshot */
NULL, /* domainSnapshotDelete */
+ NULL, /* qemuDomainMonitorCommand */
};
vboxDomainSnapshotCurrent, /* domainSnapshotCurrent */
vboxDomainRevertToSnapshot, /* domainRevertToSnapshot */
vboxDomainSnapshotDelete, /* domainSnapshotDelete */
+ NULL, /* qemuDomainMonitorCommand */
};
virNetworkDriver NAME(NetworkDriver) = {
NULL, /* domainSnapshotCurrent */
NULL, /* domainRevertToSnapshot */
NULL, /* domainSnapshotDelete */
+ NULL, /* qemuDomainMonitorCommand */
};
/**
NULL, /* domainSnapshotCurrent */
NULL, /* domainRevertToSnapshot */
NULL, /* domainSnapshotDelete */
+ NULL, /* qemuDomainMonitorCommand */
};
/**