提交 b1e03dad 编写于 作者: D Daniel P. Berrange 提交者: Daniel P. Berrangé

admin: move admins server impl/dispatch into src/admin directory

The admin server functionality is a generic concept that should be wired
up into all libvirt daemons, but is currently integrated with the
libvirtd code. Move it all into the src/admin directory to prepare for
broader reuse.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 08327dff
......@@ -123,6 +123,7 @@
/src/access/viraccessapicheckqemu.h
/src/admin/admin_client.h
/src/admin/admin_protocol.[ch]
/src/admin/admin_server_dispatch_stubs.h
/src/esx/*.generated.*
/src/hyperv/*.generated.*
/src/libvirt*.def
......
......@@ -32,8 +32,9 @@ gnulib_dir = $(srcdir)/.gnulib
# List of additional files that we want to pick up in our POTFILES.in
# This is all gnulib files, as well as generated files for RPC code.
generated_files = \
$(srcdir)/daemon/*_dispatch.h \
$(srcdir)/src/*/*_dispatch.h \
$(srcdir)/daemon/{lxc,qemu,remote}_dispatch.h \
$(srcdir)/src/*/{admin_server,log_daemon,lock_daemon}_dispatch_stubs.h \
$(srcdir)/src/lxc/{lxc_monitor,lxc_controller}_dispatch.h \
$(srcdir)/src/remote/*_client_bodies.h \
$(srcdir)/src/*/*_protocol.[ch] \
$(srcdir)/gnulib/lib/*.[ch]
......@@ -768,7 +769,7 @@ sc_prohibit_gettext_markup:
# lower-level code must not include higher-level headers.
cross_dirs=$(patsubst $(srcdir)/src/%.,%,$(wildcard $(srcdir)/src/*/.))
cross_dirs_re=($(subst / ,/|,$(cross_dirs)))
mid_dirs=access|conf|cpu|locking|logging|network|node_device|rpc|security|storage
mid_dirs=access|admin|conf|cpu|locking|logging|network|node_device|rpc|security|storage
sc_prohibit_cross_inclusion:
@for dir in $(cross_dirs); do \
case $$dir in \
......@@ -1119,7 +1120,7 @@ sc_po_check: \
$(srcdir)/daemon/remote_dispatch.h \
$(srcdir)/daemon/qemu_dispatch.h \
$(srcdir)/src/remote/remote_client_bodies.h \
$(srcdir)/daemon/admin_dispatch.h \
$(srcdir)/src/admin/admin_server_dispatch_stubs.h \
$(srcdir)/src/admin/admin_client.h
$(srcdir)/daemon/remote_dispatch.h: $(srcdir)/src/remote/remote_protocol.x
$(MAKE) -C daemon remote_dispatch.h
......@@ -1127,8 +1128,8 @@ $(srcdir)/daemon/qemu_dispatch.h: $(srcdir)/src/remote/qemu_protocol.x
$(MAKE) -C daemon qemu_dispatch.h
$(srcdir)/src/remote/remote_client_bodies.h: $(srcdir)/src/remote/remote_protocol.x
$(MAKE) -C src remote/remote_client_bodies.h
$(srcdir)/daemon/admin_dispatch.h: $(srcdir)/src/admin/admin_protocol.x
$(MAKE) -C daemon admin_dispatch.h
$(srcdir)/src/admin/admin_server_dispatch_stubs.h: $(srcdir)/src/admin/admin_protocol.x
$(MAKE) -C src admin/admin_server_dispatch_stubs.h
$(srcdir)/src/admin/admin_client.h: $(srcdir)/src/admin/admin_protocol.x
$(MAKE) -C src admin/admin_client.h
......
......@@ -37,7 +37,6 @@ DAEMON_GENERATED = \
remote_dispatch.h \
lxc_dispatch.h \
qemu_dispatch.h \
admin_dispatch.h \
$(NULL)
DAEMON_SOURCES = \
......@@ -61,7 +60,6 @@ EXTRA_DIST = \
remote_dispatch.h \
lxc_dispatch.h \
qemu_dispatch.h \
admin_dispatch.h \
libvirtd.conf \
libvirtd.init.in \
libvirtd.upstart \
......@@ -111,12 +109,6 @@ qemu_dispatch.h: $(top_srcdir)/src/rpc/gendispatch.pl \
--mode=server qemu QEMU $(QEMU_PROTOCOL) \
> $(srcdir)/qemu_dispatch.h
admin_dispatch.h: $(top_srcdir)/src/rpc/gendispatch.pl \
$(ADMIN_PROTOCOL)
$(AM_V_GEN)$(PERL) -w $(top_srcdir)/src/rpc/gendispatch.pl \
--mode=server admin ADMIN $(ADMIN_PROTOCOL) \
> $(srcdir)/admin_dispatch.h
if WITH_LIBVIRTD
# Build a convenience library, for reuse in tests/libvirtdconftest
......@@ -136,27 +128,6 @@ libvirtd_conf_la_LDFLAGS = \
$(NULL)
libvirtd_conf_la_LIBADD = $(LIBXML_LIBS)
noinst_LTLIBRARIES += libvirtd_admin.la
libvirtd_admin_la_SOURCES = \
admin.c admin.h admin_server.c admin_server.h
libvirtd_admin_la_CFLAGS = \
$(AM_CFLAGS) \
$(XDR_CFLAGS) \
$(PIE_CFLAGS) \
$(WARN_CFLAGS) \
$(LIBXML_CFLAGS) \
$(COVERAGE_CFLAGS) \
$(NULL)
libvirtd_admin_la_LDFLAGS = \
$(PIE_LDFLAGS) \
$(RELRO_LDFLAGS) \
$(COVERAGE_LDFLAGS) \
$(NO_INDIRECT_LDFLAGS) \
$(NULL)
libvirtd_admin_la_LIBADD = \
../src/libvirt-admin.la
man8_MANS = libvirtd.8
sbin_PROGRAMS = libvirtd
......@@ -202,7 +173,7 @@ endif WITH_DTRACE_PROBES
libvirtd_LDADD += \
libvirtd_conf.la \
libvirtd_admin.la \
../src/libvirt_driver_admin.la \
../src/libvirt-lxc.la \
../src/libvirt-qemu.la \
../src/libvirt_driver_remote.la \
......@@ -269,8 +240,6 @@ endif ! WITH_POLKIT
remote.c: $(DAEMON_GENERATED)
remote.h: $(DAEMON_GENERATED)
admin.c: $(DAEMON_GENERATED)
admin.h: $(DAEMON_GENERATED)
LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
libvirtd.libxl.logrotate libvirtd.uml.logrotate \
......
......@@ -43,7 +43,7 @@
#include "libvirtd.h"
#include "libvirtd-config.h"
#include "admin.h"
#include "admin/admin_server_dispatch.h"
#include "viruuid.h"
#include "remote_driver.h"
#include "viralloc.h"
......
......@@ -30,7 +30,6 @@
# include <rpc/types.h>
# include <rpc/xdr.h>
# include "remote_protocol.h"
# include "admin_protocol.h"
# include "lxc_protocol.h"
# include "qemu_protocol.h"
# include "virthread.h"
......@@ -44,8 +43,6 @@ typedef struct daemonClientStream daemonClientStream;
typedef daemonClientStream *daemonClientStreamPtr;
typedef struct daemonClientPrivate daemonClientPrivate;
typedef daemonClientPrivate *daemonClientPrivatePtr;
typedef struct daemonAdmClientPrivate daemonAdmClientPrivate;
typedef daemonAdmClientPrivate *daemonAdmClientPrivatePtr;
typedef struct daemonClientEventCallback daemonClientEventCallback;
typedef daemonClientEventCallback *daemonClientEventCallbackPtr;
......@@ -81,13 +78,6 @@ struct daemonClientPrivate {
daemonClientStreamPtr streams;
};
/* Separate private data for admin connection */
struct daemonAdmClientPrivate {
/* Just a placeholder, not that there is anything to be locked */
virMutex lock;
virNetDaemonPtr dmn;
};
# if WITH_SASL
extern virNetSASLContextPtr saslCtxt;
......
daemon/admin.c
daemon/admin_dispatch.h
daemon/admin_server.c
daemon/libvirtd-config.c
daemon/libvirtd.c
daemon/qemu_dispatch.h
......@@ -12,6 +9,9 @@ gnulib/lib/getopt.c
gnulib/lib/regcomp.c
src/access/viraccessdriverpolkit.c
src/access/viraccessmanager.c
src/admin/admin_server.c
src/admin/admin_server_dispatch.c
src/admin/admin_server_dispatch_stubs.h
src/bhyve/bhyve_capabilities.c
src/bhyve/bhyve_command.c
src/bhyve/bhyve_device.c
......
......@@ -546,7 +546,9 @@ ADMIN_PROTOCOL = $(srcdir)/admin/admin_protocol.x
ADMIN_PROTOCOL_GENERATED = \
admin/admin_protocol.c \
admin/admin_protocol.h \
admin/admin_client.h
admin/admin_client.h \
admin/admin_server_dispatch_stubs.h \
$(NULL)
admin/admin_client.h: $(srcdir)/rpc/gendispatch.pl \
$(ADMIN_PROTOCOL) Makefile.am
......@@ -554,6 +556,12 @@ admin/admin_client.h: $(srcdir)/rpc/gendispatch.pl \
admin ADMIN $(ADMIN_PROTOCOL) \
> $(srcdir)/admin/admin_client.h
admin/admin_server_dispatch_stubs.h: $(srcdir)/rpc/gendispatch.pl \
$(ADMIN_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=server \
admin ADMIN $(ADMIN_PROTOCOL) \
> $(srcdir)/admin/admin_server_dispatch_stubs.h
EXTRA_DIST += $(ADMIN_PROTOCOL) $(ADMIN_PROTOCOL_GENERATED)
BUILT_SOURCES += $(ADMIN_PROTOCOL_GENERATED)
MAINTAINERCLEANFILES += $(ADMIN_PROTOCOL_GENERATED)
......@@ -2312,6 +2320,27 @@ libvirt_admin.syms: libvirt_admin_public.syms $(ADMIN_SYM_FILES) \
chmod a-w $@-tmp && \
mv $@-tmp libvirt_admin.syms
admin/admin_server_dispatch.c: admin/admin_server_dispatch_stubs.h
noinst_LTLIBRARIES += libvirt_driver_admin.la
libvirt_driver_admin_la_SOURCES = \
admin/admin_protocol.c \
admin/admin_protocol.h \
admin/admin_server.c \
admin/admin_server.h \
admin/admin_server_dispatch.c \
admin/admin_server_dispatch.h \
admin/admin_server_dispatch_stubs.h \
$(NULL)
libvirt_driver_admin_la_CFLAGS = \
$(AM_CFLAGS) \
-I$(top_srcdir)/src/util \
-I$(top_srcdir)/src/admin \
$(NULL)
libvirt_driver_admin_la_LIBADD = ../gnulib/lib/libgnu.la
libvirt_driver_admin_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
# admin/admin_remote.c is being included in libvirt-admin.c, so we
# need to include it in the dist
EXTRA_DIST += admin/admin_remote.c
......
......@@ -29,8 +29,8 @@
#include "virerror.h"
#include "viridentity.h"
#include "virlog.h"
#include "virnetdaemon.h"
#include "virnetserver.h"
#include "rpc/virnetdaemon.h"
#include "rpc/virnetserver.h"
#include "virstring.h"
#include "virthreadpool.h"
#include "virtypedparam.h"
......
......@@ -21,8 +21,8 @@
* Martin Kletzander <mkletzan@redhat.com>
*/
#ifndef __LIBVIRTD_ADMIN_SERVER_H__
# define __LIBVIRTD_ADMIN_SERVER_H__
#ifndef __ADMIN_SERVER_H__
# define __ADMIN_SERVER_H__
# include "rpc/virnetdaemon.h"
# include "rpc/virnetserver.h"
......@@ -72,4 +72,4 @@ int adminServerSetClientLimits(virNetServerPtr srv,
int nparams,
unsigned int flags);
#endif /* __LIBVIRTD_ADMIN_SERVER_H__ */
#endif /* __ADMIN_SERVER_H__ */
/*
* admin.c: handlers for admin RPC method calls
* admin_server_dispatch.c: handlers for admin RPC method calls
*
* Copyright (C) 2014-2016 Red Hat, Inc.
*
......@@ -23,18 +23,16 @@
#include <config.h>
#include "internal.h"
#include "libvirtd.h"
#include "libvirt_internal.h"
#include "admin_protocol.h"
#include "admin.h"
#include "admin_server_dispatch.h"
#include "admin_server.h"
#include "datatypes.h"
#include "viralloc.h"
#include "virerror.h"
#include "virlog.h"
#include "virnetdaemon.h"
#include "virnetserver.h"
#include "rpc/virnetdaemon.h"
#include "rpc/virnetserver.h"
#include "virstring.h"
#include "virthreadjob.h"
#include "virtypedparam.h"
......@@ -43,6 +41,15 @@
VIR_LOG_INIT("daemon.admin");
typedef struct daemonAdmClientPrivate daemonAdmClientPrivate;
typedef daemonAdmClientPrivate *daemonAdmClientPrivatePtr;
/* Separate private data for admin connection */
struct daemonAdmClientPrivate {
/* Just a placeholder, not that there is anything to be locked */
virMutex lock;
virNetDaemonPtr dmn;
};
void
remoteAdmClientFreeFunc(void *data)
......@@ -487,4 +494,4 @@ adminDispatchConnectGetLoggingFilters(virNetServerPtr server ATTRIBUTE_UNUSED,
return 0;
}
#include "admin_dispatch.h"
#include "admin_server_dispatch_stubs.h"
/*
* admin.h: handlers for admin RPC method calls
* admin_server_dispatch.h: handlers for admin RPC method calls
*
* Copyright (C) 2014-2016 Red Hat, Inc.
*
......@@ -20,11 +20,12 @@
* Author: Martin Kletzander <mkletzan@redhat.com>
*/
#ifndef __LIBVIRTD_ADMIN_H__
# define __LIBVIRTD_ADMIN_H__
#ifndef __ADMIN_SERVER_DISPATCH_H__
# define __ADMIN_SERVER_DISPATCH_H__
# include "rpc/virnetserverprogram.h"
# include "rpc/virnetserverclient.h"
# include "admin/admin_protocol.h"
extern virNetServerProgramProc adminProcs[];
......@@ -33,4 +34,4 @@ extern size_t adminNProcs;
void remoteAdmClientFreeFunc(void *data);
void *remoteAdmClientInitHook(virNetServerClientPtr client, void *opaque);
#endif /* __ADMIN_REMOTE_H__ */
#endif /* __ADMIN_SERVER_DISPATCH_H__ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册