提交 e65812d4 编写于 作者: M Matthias Bolte

xen-proxy: Remove it entirely and use libvirtd instead

Suggested by danpb, as it's not up-to-date anymore and
lacks many functions that were added to libvirtd.
上级 c3697a0e
......@@ -14,6 +14,7 @@
.sc-start-sc_*
/GNUmakefile
/libvirt-[0-9]*
/proxy/
/maint.mk
ABOUT-NLS
COPYING
......
......@@ -3,7 +3,7 @@
LCOV = lcov
GENHTML = genhtml
SUBDIRS = gnulib/lib include src daemon tools proxy docs gnulib/tests \
SUBDIRS = gnulib/lib include src daemon tools docs gnulib/tests \
python tests po examples/domain-events/events-c examples/hellolibvirt \
examples/dominfo examples/domsuspend examples/python examples/apparmor \
examples/xml/nwfilter examples/openauth examples/systemtap
......
......@@ -17,8 +17,7 @@ rm -rf coverage
./autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \
--enable-test-coverage \
--enable-compile-warnings=error \
--with-xen-proxy
--enable-compile-warnings=error
# If the MAKEFLAGS envvar does not yet include a -j option,
# add -jN where N depends on the number of processors.
......
......@@ -346,7 +346,6 @@ msg_gen_function += virLibConnError
msg_gen_function += virLibDomainError
msg_gen_function += virNetworkReportError
msg_gen_function += virNodeDeviceReportError
msg_gen_function += virProxyError
msg_gen_function += virRaiseError
msg_gen_function += virReportErrorHelper
msg_gen_function += virReportSystemError
......
......@@ -1893,29 +1893,6 @@ if test "$enable_locking" = "yes"; then
fi
AM_CONDITIONAL([WITH_CIL],[test "$enable_locking" = "yes"])
dnl Enable building the proxy?
AC_ARG_WITH([xen-proxy],
AC_HELP_STRING([--with-xen-proxy], [add XEN setuid proxy support @<:@default=auto@:>@]),[],[with_xen_proxy=auto])
AC_MSG_CHECKING([if Xen setuid proxy is needed])
if test "$with_xen_proxy" = "auto"; then
if test "$with_polkit" = "yes"; then
with_xen_proxy="no"
else
with_xen_proxy="yes"
fi
fi
if test "$with_xen" != "yes"; then
with_xen_proxy="no"
fi
AC_MSG_RESULT([$with_xen_proxy])
AM_CONDITIONAL([WITH_PROXY],[test "$with_xen_proxy" = "yes"])
if test "$with_xen_proxy" = "yes"; then
AC_DEFINE([WITH_PROXY], 1, [Whether Xen proxy is enabled])
fi
dnl Enable building libvirtd?
AM_CONDITIONAL([WITH_LIBVIRTD],[test "x$with_libvirtd" = "xyes"])
......@@ -2258,7 +2235,7 @@ AC_OUTPUT(Makefile src/Makefile include/Makefile docs/Makefile \
python/Makefile python/tests/Makefile \
daemon/Makefile \
tools/Makefile \
tests/Makefile proxy/Makefile \
tests/Makefile \
tests/xml2sexprdata/Makefile \
tests/sexpr2xmldata/Makefile \
tests/xmconfigdata/Makefile \
......@@ -2281,7 +2258,6 @@ AC_MSG_NOTICE([])
AC_MSG_NOTICE([Drivers])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([ Xen: $with_xen])
AC_MSG_NOTICE([ Proxy: $with_xen_proxy])
AC_MSG_NOTICE([ QEMU: $with_qemu])
AC_MSG_NOTICE([ UML: $with_uml])
AC_MSG_NOTICE([ OpenVZ: $with_openvz])
......
......@@ -302,7 +302,8 @@ connection.
</p>
<p>
You should consider using <a href="remote.html">libvirt remote support</a>
in future.
in future. <span class="since">Since 0.8.6</span> libvirt doesn't contain
the Xen proxy anymore and you should use libvirtd instead.
</p>
</body>
</html>
......@@ -45,7 +45,7 @@ typedef enum {
VIR_FROM_XML, /* Error in the XML code */
VIR_FROM_DOM, /* Error when operating on a domain */
VIR_FROM_RPC, /* Error in the XML-RPC code */
VIR_FROM_PROXY, /* Error in the proxy code */
VIR_FROM_PROXY, /* Error in the proxy code */ /* unused since 0.8.6 */
VIR_FROM_CONF, /* Error in the configuration file handling */
VIR_FROM_QEMU, /* Error at the QEMU daemon */
VIR_FROM_NET, /* Error when operating on a network */
......
......@@ -31,7 +31,6 @@
# Then the hypervisor drivers that run on local host
%define with_xen 0%{!?_without_xen:%{server_drivers}}
%define with_xen_proxy 0%{!?_without_xen_proxy:%{server_drivers}}
%define with_qemu 0%{!?_without_qemu:%{server_drivers}}
%define with_openvz 0%{!?_without_openvz:%{server_drivers}}
%define with_lxc 0%{!?_without_lxc:%{server_drivers}}
......@@ -115,11 +114,6 @@
%define with_xen 0
%endif
# If Xen isn't turned on, we shouldn't build the xen proxy either
%if ! %{with_xen}
%define with_xen_proxy 0
%endif
# Fedora doesn't have any QEMU on ppc64 - only ppc
%if 0%{?fedora}
%ifarch ppc64
......@@ -127,11 +121,9 @@
%endif
%endif
# PolicyKit was introduced in Fedora 8 / RHEL-6 or newer, allowing
# the setuid Xen proxy to be killed off
# PolicyKit was introduced in Fedora 8 / RHEL-6 or newer
%if 0%{?fedora} >= 8 || 0%{?rhel} >= 6
%define with_polkit 0%{!?_without_polkit:1}
%define with_xen_proxy 0
%endif
# libcapng is used to manage capabilities in Fedora 12 / RHEL-6 or newer
......@@ -848,10 +840,6 @@ fi
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/
%if %{with_xen_proxy}
%attr(4755, root, root) %{_libexecdir}/libvirt_proxy
%endif
%if %{with_lxc}
%attr(0755, root, root) %{_libexecdir}/libvirt_lxc
%endif
......
......@@ -97,7 +97,6 @@ src/util/xml.c
src/vbox/vbox_XPCOMCGlue.c
src/vbox/vbox_driver.c
src/vbox/vbox_tmpl.c
src/xen/proxy_internal.c
src/xen/xen_driver.c
src/xen/xen_hypervisor.c
src/xen/xen_inotify.c
......
Makefile
Makefile.in
.deps
.libs
libvirt_proxy
## Process this file with automake to produce Makefile.in
if WITH_PROXY
INCLUDES = -I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
-I$(top_builddir)/include -I@top_srcdir@/include \
-I@top_srcdir@/proxy -I@top_srcdir@/src \
-I@top_srcdir@/src/util \
-I@top_srcdir@/src/conf \
-I@top_srcdir@/src/xen \
$(LIBXML_CFLAGS) \
-DPROXY -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-DGETTEXT_PACKAGE=\"$(PACKAGE)\" $(WARN_CFLAGS) $(XEN_CFLAGS)
libexec_PROGRAMS = libvirt_proxy
libvirt_proxy_SOURCES = libvirt_proxy.c \
@top_srcdir@/src/util/buf.c \
@top_srcdir@/src/util/files.c \
@top_srcdir@/src/util/hash.c \
@top_srcdir@/src/util/logging.c \
@top_srcdir@/src/util/memory.c \
@top_srcdir@/src/util/network.c \
@top_srcdir@/src/util/threads.c \
@top_srcdir@/src/util/util.c \
@top_srcdir@/src/util/uuid.c \
@top_srcdir@/src/util/virterror.c \
@top_srcdir@/src/conf/capabilities.c \
@top_srcdir@/src/conf/storage_encryption_conf.c \
@top_srcdir@/src/conf/domain_conf.c \
@top_srcdir@/src/conf/cpu_conf.c \
@top_srcdir@/src/conf/nwfilter_params.c \
@top_srcdir@/src/xen/xend_internal.c \
@top_srcdir@/src/xen/xen_hypervisor.c \
@top_srcdir@/src/xen/sexpr.c \
@top_srcdir@/src/xen/xs_internal.c
libvirt_proxy_LDFLAGS = $(WARN_LDFLAGS)
libvirt_proxy_DEPENDENCIES =
libvirt_proxy_LDADD = ../gnulib/lib/libgnu.la $(XEN_LIBS) $(LIB_PTHREAD)
install-exec-hook:
chmod u+s $(DESTDIR)$(libexecdir)/libvirt_proxy
endif
此差异已折叠。
......@@ -228,7 +228,6 @@ TEST_DRIVER_SOURCES = \
# Now the Hypervisor specific drivers
XEN_DRIVER_SOURCES = \
xen/proxy_internal.c xen/proxy_internal.h \
xen/sexpr.c xen/sexpr.h \
xen/block_stats.c xen/block_stats.h \
xen/xen_hypervisor.c xen/xen_hypervisor.h \
......
......@@ -106,7 +106,6 @@ no_memory:
}
#ifndef PROXY
virCPUDefPtr
virCPUDefParseXML(const xmlNodePtr node,
xmlXPathContextPtr ctxt,
......@@ -298,7 +297,6 @@ error:
def = NULL;
goto cleanup;
}
#endif
char *
......
......@@ -26,9 +26,7 @@
# include "util.h"
# include "buf.h"
# ifndef PROXY
# include "xml.h"
# endif
# include "xml.h"
enum virCPUType {
VIR_CPU_TYPE_HOST,
......@@ -87,12 +85,10 @@ virCPUDefFree(virCPUDefPtr def);
virCPUDefPtr
virCPUDefCopy(const virCPUDefPtr cpu);
# ifndef PROXY
virCPUDefPtr
virCPUDefParseXML(const xmlNodePtr node,
xmlXPathContextPtr ctxt,
enum virCPUType mode);
# endif
enum virCPUFormatFlags {
VIR_CPU_FORMAT_EMBEDED = (1 << 0) /* embed into existing <cpu/> element
......
......@@ -335,8 +335,6 @@ VIR_ENUM_IMPL(virDomainTimerMode, VIR_DOMAIN_TIMER_MODE_LAST,
virReportErrorHelper(NULL, VIR_FROM_DOMAIN, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
#ifndef PROXY
int virDomainObjListInit(virDomainObjListPtr doms)
{
doms->objs = virHashCreate(50);
......@@ -428,8 +426,6 @@ virDomainObjPtr virDomainFindByName(const virDomainObjListPtr doms,
return obj;
}
#endif /* !PROXY */
void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
{
if (!def)
......@@ -813,8 +809,6 @@ void virDomainDefFree(virDomainDefPtr def)
VIR_FREE(def);
}
#ifndef PROXY
static void virDomainSnapshotObjListDeinit(virDomainSnapshotObjListPtr snapshots);
static void virDomainObjFree(virDomainObjPtr dom)
{
......@@ -990,7 +984,6 @@ int virDomainDeviceVirtioSerialAddressIsValid(
{
return 1; /* 0 is valid for all fields, so any successfully parsed addr is valid */
}
#endif /* !PROXY */
int virDomainDeviceInfoIsSet(virDomainDeviceInfoPtr info)
......@@ -1153,9 +1146,6 @@ static int virDomainDeviceInfoFormat(virBufferPtr buf,
}
#ifndef PROXY
static int
virDomainDevicePCIAddressParseXML(xmlNodePtr node,
virDomainDevicePCIAddressPtr addr)
......@@ -4045,7 +4035,6 @@ virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps,
VIR_FREE(dev);
return NULL;
}
#endif /* !PROXY */
static const char *
......@@ -4236,7 +4225,6 @@ void virDomainControllerInsertPreAlloced(virDomainDefPtr def,
}
#ifndef PROXY
static char *virDomainDefDefaultEmulator(virDomainDefPtr def,
virCapsPtr caps) {
const char *type;
......@@ -5400,8 +5388,6 @@ int virDomainDefAddImplicitControllers(virDomainDefPtr def)
}
#endif /* ! PROXY */
/************************************************************************
* *
* Parser and converter for the CPUset strings used in libvirt *
......@@ -6949,7 +6935,6 @@ char *virDomainDefFormat(virDomainDefPtr def,
return NULL;
}
#ifndef PROXY
static char *virDomainObjFormat(virCapsPtr caps,
virDomainObjPtr obj,
......@@ -8020,5 +8005,3 @@ cleanup:
return ret;
}
#endif /* ! PROXY */
......@@ -1057,7 +1057,6 @@ void virDomainObjAssignDef(virDomainObjPtr domain,
void virDomainRemoveInactive(virDomainObjListPtr doms,
virDomainObjPtr dom);
# ifndef PROXY
virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps,
const virDomainDefPtr def,
const char *xmlStr,
......@@ -1081,7 +1080,6 @@ virDomainObjPtr virDomainObjParseNode(virCapsPtr caps,
int virDomainDefAddImplicitControllers(virDomainDefPtr def);
# endif
char *virDomainDefFormat(virDomainDefPtr def,
int flags);
......
......@@ -202,8 +202,6 @@ err_exit:
}
#ifndef PROXY
static bool
isValidVarName(const char *var)
{
......@@ -258,7 +256,6 @@ skip_entry:
}
return table;
}
#endif
struct formatterParam {
......
......@@ -68,8 +68,6 @@ virStorageEncryptionFree(virStorageEncryptionPtr enc)
VIR_FREE(enc);
}
#ifndef PROXY
static virStorageEncryptionSecretPtr
virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt,
xmlNodePtr node)
......@@ -211,7 +209,6 @@ virStorageEncryptionParseNode(xmlDocPtr xml, xmlNodePtr root)
xmlXPathFreeContext(ctxt);
return enc;
}
#endif /* ! PROXY */
static int
......
......@@ -195,8 +195,6 @@ int safezero(int fd, int flags ATTRIBUTE_UNUSED, off_t offset, off_t len)
# endif /* HAVE_MMAP */
#endif /* HAVE_POSIX_FALLOCATE */
#ifndef PROXY
int virFileStripSuffix(char *str,
const char *suffix)
{
......@@ -241,14 +239,14 @@ virArgvToString(const char *const *argv)
}
int virSetNonBlock(int fd) {
# ifndef WIN32
#ifndef WIN32
int flags;
if ((flags = fcntl(fd, F_GETFL)) < 0)
return -1;
flags |= O_NONBLOCK;
if ((fcntl(fd, F_SETFL, flags)) < 0)
return -1;
# else
#else
unsigned long flag = 1;
/* This is actually Gnulib's replacement rpl_ioctl function.
......@@ -256,12 +254,12 @@ int virSetNonBlock(int fd) {
*/
if (ioctl (fd, FIONBIO, (void *) &flag) == -1)
return -1;
# endif
#endif
return 0;
}
# ifndef WIN32
#ifndef WIN32
int virSetCloseExec(int fd) {
int flags;
......@@ -274,7 +272,7 @@ int virSetCloseExec(int fd) {
}
# if HAVE_CAPNG
# if HAVE_CAPNG
static int virClearCapabilities(void)
{
int ret;
......@@ -289,13 +287,13 @@ static int virClearCapabilities(void)
return 0;
}
# else
# else
static int virClearCapabilities(void)
{
// VIR_WARN0("libcap-ng support not compiled in, unable to clear capabilities");
return 0;
}
# endif
# endif
/* virFork() - fork a new process while avoiding various race/deadlock conditions
......@@ -314,9 +312,9 @@ static int virClearCapabilities(void)
*/
int virFork(pid_t *pid) {
# ifdef HAVE_PTHREAD_SIGMASK
# ifdef HAVE_PTHREAD_SIGMASK
sigset_t oldmask, newmask;
# endif
# endif
struct sigaction sig_action;
int saved_errno, ret = -1;
......@@ -326,7 +324,7 @@ int virFork(pid_t *pid) {
* Need to block signals now, so that child process can safely
* kill off caller's signal handlers without a race.
*/
# ifdef HAVE_PTHREAD_SIGMASK
# ifdef HAVE_PTHREAD_SIGMASK
sigfillset(&newmask);
if (pthread_sigmask(SIG_SETMASK, &newmask, &oldmask) != 0) {
saved_errno = errno;
......@@ -334,7 +332,7 @@ int virFork(pid_t *pid) {
"%s", _("cannot block signals"));
goto cleanup;
}
# endif
# endif
/* Ensure we hold the logging lock, to protect child processes
* from deadlocking on another thread's inherited mutex state */
......@@ -347,11 +345,11 @@ int virFork(pid_t *pid) {
virLogUnlock();
if (*pid < 0) {
# ifdef HAVE_PTHREAD_SIGMASK
# ifdef HAVE_PTHREAD_SIGMASK
/* attempt to restore signal mask, but ignore failure, to
avoid obscuring the fork failure */
ignore_value (pthread_sigmask(SIG_SETMASK, &oldmask, NULL));
# endif
# endif
virReportSystemError(saved_errno,
"%s", _("cannot fork child process"));
goto cleanup;
......@@ -361,7 +359,7 @@ int virFork(pid_t *pid) {
/* parent process */
# ifdef HAVE_PTHREAD_SIGMASK
# ifdef HAVE_PTHREAD_SIGMASK
/* Restore our original signal mask now that the child is
safely running */
if (pthread_sigmask(SIG_SETMASK, &oldmask, NULL) != 0) {
......@@ -369,7 +367,7 @@ int virFork(pid_t *pid) {
virReportSystemError(errno, "%s", _("cannot unblock signals"));
goto cleanup;
}
# endif
# endif
ret = 0;
} else {
......@@ -405,7 +403,7 @@ int virFork(pid_t *pid) {
sigaction(i, &sig_action, NULL);
}
# ifdef HAVE_PTHREAD_SIGMASK
# ifdef HAVE_PTHREAD_SIGMASK
/* Unmask all signals in child, since we've no idea
what the caller's done with their signal mask
and don't want to propagate that to children */
......@@ -415,7 +413,7 @@ int virFork(pid_t *pid) {
virReportSystemError(errno, "%s", _("cannot unblock signals"));
goto cleanup;
}
# endif
# endif
ret = 0;
}
......@@ -873,7 +871,7 @@ virRunWithHook(const char *const*argv,
return ret;
}
# else /* WIN32 */
#else /* WIN32 */
int virSetCloseExec(int fd ATTRIBUTE_UNUSED)
{
......@@ -937,7 +935,7 @@ virFork(pid_t *pid)
return -1;
}
# endif /* WIN32 */
#endif /* WIN32 */
int
virPipeReadUntilEOF(int outfd, int errfd,
......@@ -1173,7 +1171,7 @@ int virFileHasSuffix(const char *str,
return STRCASEEQ(str + len - suffixlen, suffix);
}
# define SAME_INODE(Stat_buf_1, Stat_buf_2) \
#define SAME_INODE(Stat_buf_1, Stat_buf_2) \
((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
&& (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
......@@ -1279,7 +1277,7 @@ int virFileExists(const char *path)
return(0);
}
# ifndef WIN32
#ifndef WIN32
/* return -errno on failure, or 0 on success */
static int virFileOperationNoFork(const char *path, int openflags, mode_t mode,
uid_t uid, gid_t gid,
......@@ -1591,7 +1589,7 @@ childerror:
_exit(ret);
}
# else /* WIN32 */
#else /* WIN32 */
/* return -errno on failure, or 0 on success */
int virFileOperation(const char *path ATTRIBUTE_UNUSED,
......@@ -1620,7 +1618,7 @@ int virDirCreate(const char *path ATTRIBUTE_UNUSED,
return -1;
}
# endif /* WIN32 */
#endif /* WIN32 */
static int virFileMakePathHelper(char *path) {
struct stat st;
......@@ -1714,7 +1712,7 @@ int virFileOpenTty(int *ttymaster,
rawmode);
}
# ifdef __linux__
#ifdef __linux__
int virFileOpenTtyAt(const char *ptmx,
int *ttymaster,
char **ttyName,
......@@ -1764,7 +1762,7 @@ cleanup:
return rc;
}
# else
#else
int virFileOpenTtyAt(const char *ptmx ATTRIBUTE_UNUSED,
int *ttymaster ATTRIBUTE_UNUSED,
char **ttyName ATTRIBUTE_UNUSED,
......@@ -1772,7 +1770,7 @@ int virFileOpenTtyAt(const char *ptmx ATTRIBUTE_UNUSED,
{
return -1;
}
# endif
#endif
char* virFilePid(const char *dir, const char* name)
{
......@@ -1911,7 +1909,6 @@ cleanup:
return rc;
}
#endif /* PROXY */
/*
* Creates an absolute path for a potentialy realtive path.
......@@ -2861,15 +2858,14 @@ virFileFindMountPoint(const char *type ATTRIBUTE_UNUSED)
#endif /* defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
#ifndef PROXY
# if defined(UDEVADM) || defined(UDEVSETTLE)
#if defined(UDEVADM) || defined(UDEVSETTLE)
void virFileWaitForDevices(void)
{
# ifdef UDEVADM
# ifdef UDEVADM
const char *const settleprog[] = { UDEVADM, "settle", NULL };
# else
# else
const char *const settleprog[] = { UDEVSETTLE, NULL };
# endif
# endif
int exitstatus;
if (access(settleprog[0], X_OK) != 0)
......@@ -2884,9 +2880,8 @@ void virFileWaitForDevices(void)
if (virRun(settleprog, &exitstatus) < 0)
{}
}
# else
#else
void virFileWaitForDevices(void) {}
# endif
#endif
int virBuildPathInternal(char **path, ...)
......
此差异已折叠。
/*
* proxy.h: common definitions for proxy usage
*
* Copyright (C) 2006 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
* Daniel Veillard <veillard@redhat.com>
*/
#ifndef __LIBVIR_PROXY_H__
# define __LIBVIR_PROXY_H__
# include "internal.h"
# define PROXY_SOCKET_PATH "/tmp/livirt_proxy_conn"
# define PROXY_PROTO_VERSION 1
/*
* the command allowed though the proxy
*/
typedef enum {
VIR_PROXY_NONE = 0,
VIR_PROXY_VERSION = 1,
VIR_PROXY_NODE_INFO = 2,
VIR_PROXY_LIST = 3,
VIR_PROXY_NUM_DOMAIN = 4,
VIR_PROXY_LOOKUP_ID = 5,
VIR_PROXY_LOOKUP_UUID = 6,
VIR_PROXY_LOOKUP_NAME = 7,
VIR_PROXY_MAX_MEMORY = 8,
VIR_PROXY_DOMAIN_INFO = 9,
VIR_PROXY_DOMAIN_XML = 10,
VIR_PROXY_DOMAIN_OSTYPE = 11,
VIR_PROXY_GET_CAPABILITIES = 12
} virProxyCommand;
/*
* structure used by the client to make a request to the proxy
* and by the proxy when answering the client.
* the size may not be fixed, it's passed as len.
*/
struct _virProxyPacket {
unsigned short version; /* version of the proxy protocol */
unsigned short command; /* command number a virProxyCommand */
unsigned short serial; /* command serial number */
unsigned short len; /* the length of the request */
union {
char string[8]; /* string data */
int arg; /* or int argument */
long larg; /* or long argument */
} data;
};
typedef struct _virProxyPacket virProxyPacket;
typedef virProxyPacket *virProxyPacketPtr;
/*
* If there is extra data sent from the proxy to the client,
* they are appended after the packet.
* the size may not be fixed, it's passed as len and includes the
* extra data.
*/
struct _virProxyFullPacket {
unsigned short version; /* version of the proxy protocol */
unsigned short command; /* command number a virProxyCommand */
unsigned short serial; /* command serial number */
unsigned short len; /* the length of the request */
union {
char string[8]; /* string data */
int arg; /* or int argument */
long larg; /* or long argument */
} data;
/* that should be aligned on a 16bytes boundary */
union {
char str[4080]; /* extra char array */
int arg[1020]; /* extra int array */
virDomainInfo dinfo; /* domain information */
virNodeInfo ninfo; /* node information */
} extra;
};
typedef struct _virProxyFullPacket virProxyFullPacket;
typedef virProxyFullPacket *virProxyFullPacketPtr;
/* xen_unified makes direct calls or indirect calls through here. */
extern struct xenUnifiedDriver xenProxyDriver;
extern int xenProxyInit (void);
extern virDomainPtr xenProxyLookupByID(virConnectPtr conn, int id);
extern virDomainPtr xenProxyLookupByUUID(virConnectPtr conn,
const unsigned char *uuid);
extern virDomainPtr xenProxyLookupByName(virConnectPtr conn,
const char *domname);
extern char * xenProxyDomainDumpXML(virDomainPtr domain,
int flags);
extern int xenProxyListDomains(virConnectPtr conn, int *ids,
int maxids);
extern int xenProxyNumOfDomains(virConnectPtr conn);
#endif /* __LIBVIR_PROXY_H__ */
......@@ -13,7 +13,7 @@
/* Note:
*
* This driver provides a unified interface to the five
* separate underlying Xen drivers (xen_internal, proxy_internal,
* separate underlying Xen drivers (xen_internal,
* xend_internal, xs_internal and xm_internal). Historically
* the body of libvirt.c handled the five Xen drivers,
* and contained Xen-specific code.
......@@ -33,7 +33,6 @@
#include "xen_driver.h"
#include "xen_hypervisor.h"
#include "proxy_internal.h"
#include "xend_internal.h"
#include "xs_internal.h"
#include "xm_internal.h"
......@@ -61,7 +60,6 @@ xenUnifiedDomainGetVcpus (virDomainPtr dom,
/* The five Xen drivers below us. */
static struct xenUnifiedDriver const * const drivers[XEN_UNIFIED_NR_DRIVERS] = {
[XEN_UNIFIED_HYPERVISOR_OFFSET] = &xenHypervisorDriver,
[XEN_UNIFIED_PROXY_OFFSET] = &xenProxyDriver,
[XEN_UNIFIED_XEND_OFFSET] = &xenDaemonDriver,
[XEN_UNIFIED_XS_OFFSET] = &xenStoreDriver,
[XEN_UNIFIED_XM_OFFSET] = &xenXMDriver,
......@@ -318,7 +316,6 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags)
priv->handle = -1;
priv->xendConfigVersion = -1;
priv->xshandle = NULL;
priv->proxy = -1;
/* Hypervisor is only run with privilege & required to succeed */
......@@ -331,9 +328,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags)
}
}
/* XenD is required to succeed if privileged.
* If it fails as non-root, then the proxy driver may take over
*/
/* XenD is required to succeed if privileged */
DEBUG0("Trying XenD sub-driver");
if (drivers[XEN_UNIFIED_XEND_OFFSET]->open(conn, auth, flags) ==
VIR_DRV_OPEN_SUCCESS) {
......@@ -363,20 +358,9 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags)
if (xenHavePrivilege()) {
goto fail; /* XenD is mandatory when privileged */
} else {
#if WITH_PROXY
DEBUG0("Trying proxy sub-driver");
if (drivers[XEN_UNIFIED_PROXY_OFFSET]->open(conn, auth, flags) ==
VIR_DRV_OPEN_SUCCESS) {
DEBUG0("Activated proxy sub-driver");
priv->opened[XEN_UNIFIED_PROXY_OFFSET] = 1;
} else {
goto fail; /* Proxy is mandatory if XenD failed */
}
#else
DEBUG0("Handing off for remote driver");
ret = VIR_DRV_OPEN_DECLINED; /* Let remote_driver try instead */
goto clean;
#endif
}
}
......@@ -402,9 +386,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags)
fail:
ret = VIR_DRV_OPEN_ERROR;
#ifndef WITH_PROXY
clean:
#endif
DEBUG0("Failed to activate a mandatory sub-driver");
for (i = 0 ; i < XEN_UNIFIED_NR_DRIVERS ; i++)
if (priv->opened[i]) drivers[i]->close(conn);
......@@ -579,11 +561,6 @@ xenUnifiedListDomains (virConnectPtr conn, int *ids, int maxids)
if (ret >= 0) return ret;
}
/* Try proxy. */
if (priv->opened[XEN_UNIFIED_PROXY_OFFSET]) {
ret = xenProxyListDomains (conn, ids, maxids);
if (ret >= 0) return ret;
}
return -1;
}
......@@ -611,12 +588,6 @@ xenUnifiedNumOfDomains (virConnectPtr conn)
if (ret >= 0) return ret;
}
/* Try proxy. */
if (priv->opened[XEN_UNIFIED_PROXY_OFFSET]) {
ret = xenProxyNumOfDomains (conn);
if (ret >= 0) return ret;
}
return -1;
}
......@@ -659,13 +630,6 @@ xenUnifiedDomainLookupByID (virConnectPtr conn, int id)
return ret;
}
/* Try proxy. */
if (priv->opened[XEN_UNIFIED_PROXY_OFFSET]) {
ret = xenProxyLookupByID (conn, id);
if (ret || conn->err.code != VIR_ERR_OK)
return ret;
}
/* Try xend. */
if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
ret = xenDaemonLookupByID (conn, id);
......@@ -697,13 +661,6 @@ xenUnifiedDomainLookupByUUID (virConnectPtr conn,
return ret;
}
/* Try proxy. */
if (priv->opened[XEN_UNIFIED_PROXY_OFFSET]) {
ret = xenProxyLookupByUUID (conn, uuid);
if (ret || conn->err.code != VIR_ERR_OK)
return ret;
}
/* Try xend. */
if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
ret = xenDaemonLookupByUUID (conn, uuid);
......@@ -735,13 +692,6 @@ xenUnifiedDomainLookupByName (virConnectPtr conn,
*/
virConnResetLastError (conn);
/* Try proxy. */
if (priv->opened[XEN_UNIFIED_PROXY_OFFSET]) {
ret = xenProxyLookupByName (conn, name);
if (ret || conn->err.code != VIR_ERR_OK)
return ret;
}
/* Try xend. */
if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
ret = xenDaemonLookupByName (conn, name);
......@@ -1223,8 +1173,6 @@ xenUnifiedDomainDumpXML (virDomainPtr dom, int flags)
VIR_FREE(cpus);
return(res);
}
if (priv->opened[XEN_UNIFIED_PROXY_OFFSET])
return xenProxyDomainDumpXML(dom, flags);
}
xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
......
......@@ -42,16 +42,15 @@
extern int xenRegister (void);
# define XEN_UNIFIED_HYPERVISOR_OFFSET 0
# define XEN_UNIFIED_PROXY_OFFSET 1
# define XEN_UNIFIED_XEND_OFFSET 2
# define XEN_UNIFIED_XS_OFFSET 3
# define XEN_UNIFIED_XM_OFFSET 4
# define XEN_UNIFIED_XEND_OFFSET 1
# define XEN_UNIFIED_XS_OFFSET 2
# define XEN_UNIFIED_XM_OFFSET 3
# if WITH_XEN_INOTIFY
# define XEN_UNIFIED_INOTIFY_OFFSET 5
# define XEN_UNIFIED_NR_DRIVERS 6
# else
# define XEN_UNIFIED_INOTIFY_OFFSET 4
# define XEN_UNIFIED_NR_DRIVERS 5
# else
# define XEN_UNIFIED_NR_DRIVERS 4
# endif
# define MIN_XEN_GUEST_SIZE 64 /* 64 megabytes */
......@@ -175,8 +174,6 @@ struct _xenUnifiedPrivate {
struct xs_handle *xshandle; /* handle to talk to the xenstore */
int proxy; /* fd of proxy. */
/* A list of xenstore watches */
xenStoreWatchListPtr xsWatchList;
......@@ -230,12 +227,7 @@ void xenUnifiedDomainEventDispatch (xenUnifiedPrivatePtr priv,
unsigned long xenUnifiedVersion(void);
int xenUnifiedGetMaxVcpus(virConnectPtr conn, const char *type);
# ifndef PROXY
void xenUnifiedLock(xenUnifiedPrivatePtr priv);
void xenUnifiedUnlock(xenUnifiedPrivatePtr priv);
# else
# define xenUnifiedLock(p) do {} while(0)
# define xenUnifiedUnlock(p) do {} while(0)
# endif
#endif /* __VIR_XEN_UNIFIED_H__ */
......@@ -748,11 +748,8 @@ typedef struct xen_op_v2_dom xen_op_v2_dom;
# error "unsupported platform"
#endif
#ifndef PROXY
static unsigned long xenHypervisorGetMaxMemory(virDomainPtr domain);
#endif
#ifndef PROXY
struct xenUnifiedDriver xenHypervisorDriver = {
xenHypervisorOpen, /* open */
xenHypervisorClose, /* close */
......@@ -792,15 +789,12 @@ struct xenUnifiedDriver xenHypervisorDriver = {
xenHypervisorGetSchedulerParameters, /* domainGetSchedulerParameters */
xenHypervisorSetSchedulerParameters, /* domainSetSchedulerParameters */
};
#endif /* !PROXY */
#define virXenError(code, ...) \
if (in_init == 0) \
virReportErrorHelper(NULL, VIR_FROM_XEN, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
#ifndef PROXY
/**
* virXenErrorFunc:
* @error: the error number
......@@ -835,8 +829,6 @@ virXenErrorFunc(virErrorNumber error, const char *func, const char *info,
}
}
#endif /* PROXY */
/**
* xenHypervisorDoV0Op:
* @handle: the handle to the Xen hypervisor
......@@ -1103,7 +1095,6 @@ virXen_getdomaininfo(int handle, int first_domain,
}
#ifndef PROXY
/**
* xenHypervisorGetSchedulerType:
* @domain: pointer to the Xen Hypervisor block
......@@ -1419,7 +1410,7 @@ xenHypervisorDomainBlockStats (virDomainPtr dom,
const char *path,
struct _virDomainBlockStats *stats)
{
# ifdef __linux__
#ifdef __linux__
xenUnifiedPrivatePtr priv;
int ret;
......@@ -1429,12 +1420,12 @@ xenHypervisorDomainBlockStats (virDomainPtr dom,
ret = xenLinuxDomainBlockStats (priv, dom, path, stats);
xenUnifiedUnlock(priv);
return ret;
# else
#else
virXenErrorFunc(VIR_ERR_NO_SUPPORT, __FUNCTION__,
"block statistics not supported on this platform",
dom->id);
return -1;
# endif
#endif
}
/* Paths have the form vif<domid>.<n> (this interface checks that
......@@ -1449,7 +1440,7 @@ xenHypervisorDomainInterfaceStats (virDomainPtr dom,
const char *path,
struct _virDomainInterfaceStats *stats)
{
# ifdef __linux__
#ifdef __linux__
int rqdomid, device;
/* Verify that the vif requested is one belonging to the current
......@@ -1467,11 +1458,11 @@ xenHypervisorDomainInterfaceStats (virDomainPtr dom,
}
return linuxDomainInterfaceStats(path, stats);
# else
#else
virXenErrorFunc(VIR_ERR_NO_SUPPORT, __FUNCTION__,
"/proc/net/dev: Interface not found", 0);
return -1;
# endif
#endif
}
/**
......@@ -1777,7 +1768,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu,
}
return(ret);
}
#endif /* !PROXY*/
/**
* virXen_getvcpusinfo:
......@@ -2810,7 +2801,6 @@ xenHypervisorListDomains(virConnectPtr conn, int *ids, int maxids)
}
#ifndef PROXY
char *
xenHypervisorDomainGetOSType (virDomainPtr dom)
{
......@@ -2982,7 +2972,6 @@ xenHypervisorLookupDomainByUUID(virConnectPtr conn,
VIR_FREE(name);
return ret;
}
#endif
/**
* xenHypervisorGetMaxVcpus:
......@@ -3044,7 +3033,6 @@ xenHypervisorGetDomMaxMemory(virConnectPtr conn, int id)
return((unsigned long) XEN_GETDOMAININFO_MAX_PAGES(dominfo) * kb_per_pages);
}
#ifndef PROXY
/**
* xenHypervisorGetMaxMemory:
* @domain: a domain object or NULL
......@@ -3069,7 +3057,6 @@ xenHypervisorGetMaxMemory(virDomainPtr domain)
return(xenHypervisorGetDomMaxMemory(domain->conn, domain->id));
}
#endif
/**
* xenHypervisorGetDomInfo:
......@@ -3181,7 +3168,6 @@ xenHypervisorGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info)
}
#ifndef PROXY
/**
* xenHypervisorNodeGetCellsFreeMemory:
* @conn: pointer to the hypervisor connection
......@@ -3371,9 +3357,8 @@ xenHypervisorSetMaxMemory(virDomainPtr domain, unsigned long memory)
return (-1);
return (0);
}
#endif /* PROXY */
#ifndef PROXY
/**
* xenHypervisorSetVcpus:
* @domain: pointer to domain object
......@@ -3436,7 +3421,6 @@ xenHypervisorPinVcpu(virDomainPtr domain, unsigned int vcpu,
return (-1);
return (0);
}
#endif
/**
* virDomainGetVcpus:
......@@ -3457,7 +3441,6 @@ xenHypervisorPinVcpu(virDomainPtr domain, unsigned int vcpu,
*
* Returns the number of info filled in case of success, -1 in case of failure.
*/
#ifndef PROXY
int
xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
unsigned char *cpumaps, int maplen)
......@@ -3523,7 +3506,6 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
}
return nbinfo;
}
#endif /* PROXY */
/**
* xenHypervisorGetVcpuMax:
......
......@@ -22,7 +22,6 @@ int xenHypervisorInit (void);
virCapsPtr xenHypervisorMakeCapabilities (virConnectPtr conn);
/* The following calls are made directly by the Xen proxy: */
int
xenHypervisorHasDomain(virConnectPtr conn,
int id);
......
......@@ -51,15 +51,11 @@
#define VIR_FROM_THIS VIR_FROM_XEND
#ifndef PROXY
/*
* The number of Xen scheduler parameters
*/
# define XEN_SCHED_SEDF_NPARAM 6
# define XEN_SCHED_CRED_NPARAM 2
#endif /* PROXY */
#define XEN_SCHED_SEDF_NPARAM 6
#define XEN_SCHED_CRED_NPARAM 2
#ifdef WITH_RHEL5_API
# define XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU 0
......@@ -71,7 +67,6 @@
#define XEND_RCV_BUF_MAX_LEN 65536
#ifndef PROXY
static int
xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainDiskDefPtr def,
......@@ -97,7 +92,6 @@ virDomainXMLDevID(virDomainPtr domain,
char *class,
char *ref,
int ref_len);
#endif
#define virXendError(code, ...) \
virReportErrorHelper(NULL, VIR_FROM_XEND, code, __FILE__, \
......@@ -399,7 +393,6 @@ xend_get(virConnectPtr xend, const char *path,
return ret;
}
#ifndef PROXY
/**
* xend_post:
* @xend: pointer to the Xen Daemon structure
......@@ -460,7 +453,6 @@ xend_post(virConnectPtr xend, const char *path, const char *ops)
VIR_FREE(err_buf);
return ret;
}
#endif /* ! PROXY */
/**
......@@ -495,7 +487,6 @@ http2unix(int ret)
return -1;
}
#ifndef PROXY
/**
* xend_op_ext:
* @xend: pointer to the Xen Daemon structure
......@@ -570,7 +561,6 @@ xend_op(virConnectPtr xend, const char *name, const char *key, ...)
return ret;
}
#endif /* ! PROXY */
/**
* sexpr_get:
......@@ -698,7 +688,6 @@ sexpr_uuid(unsigned char *ptr, const struct sexpr *node, const char *path)
}
#ifndef PROXY
/**
* urlencode:
* @string: the input URL
......@@ -737,7 +726,6 @@ urlencode(const char *string)
return buffer;
}
#endif /* ! PROXY */
/* PUBLIC FUNCTIONS */
......@@ -779,7 +767,7 @@ xenDaemonOpen_unix(virConnectPtr conn, const char *path)
return (0);
}
#ifndef PROXY
/**
* xenDaemonOpen_tcp:
* @conn: an existing virtual connection block
......@@ -879,9 +867,6 @@ xend_wait_for_devices(virConnectPtr xend, const char *name)
}
#endif /* PROXY */
/**
* xenDaemonListDomainsOld:
* @xend: pointer to the Xen Daemon block
......@@ -946,7 +931,7 @@ xenDaemonListDomainsOld(virConnectPtr xend)
return ret;
}
#ifndef PROXY
/**
* xenDaemonDomainCreateXML:
* @xend: A xend instance
......@@ -983,7 +968,7 @@ xenDaemonDomainCreateXML(virConnectPtr xend, const char *sexpr)
return ret;
}
#endif /* ! PROXY */
/**
* xenDaemonDomainLookupByName_ids:
......@@ -1090,7 +1075,6 @@ error:
}
#ifndef PROXY
static int
xend_detect_config_version(virConnectPtr conn) {
struct sexpr *root;
......@@ -1121,7 +1105,6 @@ xend_detect_config_version(virConnectPtr conn) {
return (0);
}
#endif /* PROXY */
/*****************************************************************
******
......@@ -1767,9 +1750,7 @@ xenDaemonParseSxprGraphicsOld(virConnectPtr conn,
int hvm,
int xendConfigVersion)
{
#ifndef PROXY
xenUnifiedPrivatePtr priv = conn->privateData;
#endif
const char *tmp;
virDomainGraphicsDefPtr graphics = NULL;
......@@ -1858,9 +1839,7 @@ xenDaemonParseSxprGraphicsNew(virConnectPtr conn,
virDomainDefPtr def,
const struct sexpr *root)
{
#ifndef PROXY
xenUnifiedPrivatePtr priv = conn->privateData;
#endif
virDomainGraphicsDefPtr graphics = NULL;
const struct sexpr *cur, *node;
const char *tmp;
......@@ -2099,9 +2078,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
int xendConfigVersion,
const char *cpus)
{
#ifndef PROXY
xenUnifiedPrivatePtr priv = conn->privateData;
#endif
const char *tmp;
virDomainDefPtr def;
int hvm = 0;
......@@ -2624,7 +2601,6 @@ sexpr_to_xend_topology(const struct sexpr *root,
}
#ifndef PROXY
/**
* sexpr_to_domain:
* @conn: an existing virtual connection block
......@@ -2678,7 +2654,7 @@ error:
virUnrefDomain(ret);
return(NULL);
}
#endif /* !PROXY */
/*****************************************************************
******
......@@ -2691,7 +2667,6 @@ error:
******
******
*****************************************************************/
#ifndef PROXY
/**
* xenDaemonOpen:
* @conn: an existing virtual connection block
......@@ -3053,7 +3028,7 @@ xenDaemonDomainRestore(virConnectPtr conn, const char *filename)
}
return xend_op(conn, "", "op", "restore", "file", filename, NULL);
}
#endif /* !PROXY */
/**
* xenDaemonDomainGetMaxMemory:
......@@ -3091,7 +3066,7 @@ xenDaemonDomainGetMaxMemory(virDomainPtr domain)
return(ret);
}
#ifndef PROXY
/**
* xenDaemonDomainSetMaxMemory:
* @domain: pointer to the Domain block
......@@ -3161,7 +3136,6 @@ xenDaemonDomainSetMemory(virDomainPtr domain, unsigned long memory)
"target", buf, NULL);
}
#endif /* ! PROXY */
virDomainDefPtr
xenDaemonDomainFetch(virConnectPtr conn,
......@@ -3199,7 +3173,6 @@ cleanup:
}
#ifndef PROXY
/**
* xenDaemonDomainDumpXML:
* @domain: a domain object
......@@ -3241,7 +3214,7 @@ xenDaemonDomainDumpXML(virDomainPtr domain, int flags, const char *cpus)
return xml;
}
#endif /* !PROXY */
/**
* xenDaemonDomainGetInfo:
......@@ -3280,7 +3253,7 @@ xenDaemonDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
return (ret);
}
#ifndef PROXY
/**
* xenDaemonLookupByName:
* @conn: A xend instance
......@@ -3313,7 +3286,7 @@ error:
sexpr_free(root);
return(ret);
}
#endif /* ! PROXY */
/**
* xenDaemonNodeGetInfo:
......@@ -3420,7 +3393,7 @@ xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer)
return(0);
}
#ifndef PROXY
/**
* xenDaemonListDomains:
* @conn: pointer to the hypervisor connection
......@@ -3500,9 +3473,8 @@ error:
sexpr_free(root);
return(ret);
}
#endif /* ! PROXY */
#ifndef PROXY
/**
* xenDaemonLookupByID:
* @conn: pointer to the hypervisor connection
......@@ -6130,5 +6102,3 @@ virDomainXMLDevID(virDomainPtr domain,
return 0;
}
#endif /* ! PROXY */
......@@ -38,7 +38,6 @@
#define VIR_FROM_THIS VIR_FROM_XEN
#ifndef PROXY
static char *xenStoreDomainGetOSType(virDomainPtr domain);
static void xenStoreWatchEvent(int watch, int fd, int events, void *data);
static void xenStoreWatchListFree(xenStoreWatchListPtr list);
......@@ -83,8 +82,6 @@ struct xenUnifiedDriver xenStoreDriver = {
NULL, /* domainSetSchedulerParameters */
};
#endif /* ! PROXY */
#define virXenStoreError(code, ...) \
virReportErrorHelper(NULL, VIR_FROM_XENSTORE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
......@@ -94,7 +91,6 @@ struct xenUnifiedDriver xenStoreDriver = {
* Helper internal APIs *
* *
************************************************************************/
#ifndef PROXY
/**
* virConnectDoStoreList:
* @conn: pointer to the hypervisor connection
......@@ -120,7 +116,6 @@ virConnectDoStoreList(virConnectPtr conn, const char *path,
return xs_directory (priv->xshandle, 0, path, nb);
}
#endif /* ! PROXY */
/**
* virDomainDoStoreQuery:
......@@ -152,7 +147,6 @@ virDomainDoStoreQuery(virConnectPtr conn, int domid, const char *path)
return xs_read(priv->xshandle, 0, &s[0], &len);
}
#ifndef PROXY
/**
* virDomainDoStoreWrite:
* @domain: a domain object
......@@ -254,7 +248,6 @@ virDomainGetVMInfo(virDomainPtr domain, const char *vm, const char *name)
return (ret);
}
#endif /* ! PROXY */
/************************************************************************
* *
......@@ -278,14 +271,10 @@ xenStoreOpen(virConnectPtr conn,
{
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
#ifdef PROXY
priv->xshandle = xs_daemon_open_readonly();
#else
if (flags & VIR_CONNECT_RO)
priv->xshandle = xs_daemon_open_readonly();
else
priv->xshandle = xs_daemon_open();
#endif /* ! PROXY */
if (priv->xshandle == NULL) {
/*
......@@ -300,7 +289,6 @@ xenStoreOpen(virConnectPtr conn,
return (-1);
}
#ifndef PROXY
/* Init activeDomainList */
if (VIR_ALLOC(priv->activeDomainList) < 0) {
virReportOOMError();
......@@ -341,7 +329,6 @@ xenStoreOpen(virConnectPtr conn,
NULL)) < 0)
DEBUG0("Failed to add event handle, disabling events");
#endif //PROXY
return 0;
}
......@@ -365,7 +352,6 @@ xenStoreClose(virConnectPtr conn)
priv = (xenUnifiedPrivatePtr) conn->privateData;
#ifndef PROXY
if (xenStoreRemoveWatch(conn, "@introduceDomain", "introduceDomain") < 0) {
DEBUG0("Warning, could not remove @introduceDomain watch");
/* not fatal */
......@@ -380,21 +366,19 @@ xenStoreClose(virConnectPtr conn)
priv->xsWatchList = NULL;
xenUnifiedDomainInfoListFree(priv->activeDomainList);
priv->activeDomainList = NULL;
#endif
if (priv->xshandle == NULL)
return(-1);
#ifndef PROXY
if (priv->xsWatch != -1)
virEventRemoveHandle(priv->xsWatch);
#endif
xs_daemon_close(priv->xshandle);
priv->xshandle = NULL;
return (0);
}
#ifndef PROXY
/**
* xenStoreGetDomainInfo:
* @domain: pointer to the domain block
......@@ -444,7 +428,7 @@ xenStoreGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info)
info->memory = 0;
info->maxMem = 0;
}
# if 0
#if 0
/* doesn't seems to work */
tmp = virDomainDoStoreQuery(domain->conn, domain->id, "cpu_time");
if (tmp != NULL) {
......@@ -453,7 +437,7 @@ xenStoreGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info)
} else {
info->cpuTime = 0;
}
# endif
#endif
snprintf(request, 199, "/local/domain/%d/cpu", domain->id);
request[199] = 0;
tmp2 = virConnectDoStoreList(domain->conn, request, &nb_vcpus);
......@@ -685,10 +669,10 @@ xenStoreLookupByName(virConnectPtr conn, const char *name)
if ((endptr == idlist[i]) || (*endptr != 0)) {
goto done;
}
# if 0
#if 0
if (virConnectCheckStoreID(conn, (int) id) < 0)
continue;
# endif
#endif
snprintf(prop, 199, "/local/domain/%s/name", idlist[i]);
prop[199] = 0;
tmp = xs_read(priv->xshandle, 0, prop, &len);
......@@ -811,7 +795,6 @@ xenStoreDomainGetOSType(virDomainPtr domain) {
return (str);
}
#endif /* ! PROXY */
/**
* xenStoreDomainGetVNCPort:
......@@ -860,52 +843,6 @@ char * xenStoreDomainGetConsolePath(virConnectPtr conn, int domid) {
return virDomainDoStoreQuery(conn, domid, "console/tty");
}
#ifdef PROXY
/*
* xenStoreDomainGetOSTypeID:
* @conn: pointer to the connection.
* @id: the domain id
*
* Get the type of domain operation system.
*
* The caller must hold the lock on the privateData
* associated with the 'conn' parameter.
*
* Returns the new string or NULL in case of error, the string must be
* freed by the caller.
*/
char *
xenStoreDomainGetOSTypeID(virConnectPtr conn, int id) {
char *vm, *str = NULL;
char query[200];
unsigned int len;
xenUnifiedPrivatePtr priv;
if (id < 0)
return(NULL);
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->xshandle == NULL)
return (NULL);
snprintf(query, 199, "/local/domain/%d/vm", id);
query[199] = 0;
vm = xs_read(priv->xshandle, 0, &query[0], &len);
if (vm) {
snprintf(query, 199, "%s/image/ostype", vm);
str = xs_read(priv->xshandle, 0, &query[0], &len);
VIR_FREE(vm);
}
if (str == NULL)
str = strdup("linux");
if (str == NULL)
virReportOOMError();
return (str);
}
#endif /* PROXY */
/*
* xenStoreDomainGetNetworkID:
......@@ -1122,7 +1059,6 @@ char *xenStoreDomainGetName(virConnectPtr conn,
return xs_read(priv->xshandle, 0, prop, &len);
}
#ifndef PROXY
/*
* The caller must hold the lock on the privateData
* associated with the 'conn' parameter.
......@@ -1496,5 +1432,3 @@ retry:
}
return 0;
}
#endif //PROXY
......@@ -37,13 +37,10 @@ int xenStoreDomainShutdown (virDomainPtr domain);
int xenStoreDomainReboot (virDomainPtr domain,
unsigned int flags);
/* those are entry point for the proxy */
int xenStoreDomainGetVNCPort(virConnectPtr conn,
int domid);
char * xenStoreDomainGetConsolePath(virConnectPtr conn,
int domid);
char * xenStoreDomainGetOSTypeID(virConnectPtr conn,
int id);
char * xenStoreDomainGetNetworkID(virConnectPtr conn,
int id,
const char *mac);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册