summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-03-28 22:00:17 +0200
committerGuido Günther <agx@sigxcpu.org>2011-03-28 22:00:17 +0200
commit02daf0bd75ecf132f6b8d88ac45ebe3ce27bdf63 (patch)
tree1c9d9eff21e72174e8e8783cab624f21e64dd508 /daemon
parentd9e4cad40d5ef2952dda66dbbcc09b4878a08b82 (diff)
New upstream version 0.9.0~rc1
Diffstat (limited to 'daemon')
-rw-r--r--daemon/Makefile.am36
-rw-r--r--daemon/Makefile.in146
-rw-r--r--daemon/dispatch.c17
-rw-r--r--daemon/event.c706
-rw-r--r--daemon/event.h134
-rw-r--r--daemon/libvirtd.8.in272
-rw-r--r--daemon/libvirtd.c191
-rw-r--r--daemon/libvirtd.conf7
-rw-r--r--daemon/libvirtd.h4
-rw-r--r--daemon/libvirtd.logrotate.in9
-rw-r--r--daemon/mdns.c33
-rw-r--r--daemon/remote.c509
-rw-r--r--daemon/remote_dispatch_args.h4
-rw-r--r--daemon/remote_dispatch_prototypes.h32
-rw-r--r--daemon/remote_dispatch_ret.h1
-rw-r--r--daemon/remote_dispatch_table.h20
-rw-r--r--daemon/stream.c24
17 files changed, 1000 insertions, 1145 deletions
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index cdf0f75bd..9e3a5574f 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -3,7 +3,6 @@
CLEANFILES =
DAEMON_SOURCES = \
- event.c event.h \
libvirtd.c libvirtd.h \
remote.c remote.h \
dispatch.c dispatch.h \
@@ -32,12 +31,14 @@ EXTRA_DIST = \
libvirtd.sasl \
libvirtd.sysconf \
libvirtd.aug \
+ libvirtd.logrotate.in \
libvirtd.qemu.logrotate.in \
libvirtd.lxc.logrotate.in \
libvirtd.uml.logrotate.in \
test_libvirtd.aug \
THREADING.txt \
libvirtd.pod.in \
+ libvirtd.8.in \
libvirtd.stp \
$(AVAHI_SOURCES) \
$(DAEMON_SOURCES)
@@ -46,7 +47,7 @@ BUILT_SOURCES =
if WITH_LIBVIRTD
-man_MANS = libvirtd.8
+man8_MANS = libvirtd.8
sbin_PROGRAMS = libvirtd
@@ -59,10 +60,7 @@ augeas_DATA = libvirtd.aug
augeastestsdir = $(datadir)/augeas/lenses/tests
augeastests_DATA = test_libvirtd.aug
-POD2MAN = pod2man -c "Virtualization Support" \
- -r "$(PACKAGE)-$(VERSION)" -s 8
-
-libvirtd.pod: libvirtd.pod.in
+libvirtd.8: $(srcdir)/libvirtd.8.in
sed \
-e 's![@]sysconfdir[@]!$(sysconfdir)!g' \
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
@@ -70,9 +68,6 @@ libvirtd.pod: libvirtd.pod.in
< $< > $@-t
mv $@-t $@
-libvirtd.8: libvirtd.pod
- $(AM_V_GEN)$(POD2MAN) $< $@
-
libvirtd_SOURCES = $(DAEMON_SOURCES)
#-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
@@ -111,6 +106,10 @@ if WITH_LXC
libvirtd_LDADD += ../src/libvirt_driver_lxc.la
endif
+if WITH_LIBXL
+ libvirtd_LDADD += ../src/libvirt_driver_libxl.la
+endif
+
if WITH_UML
libvirtd_LDADD += ../src/libvirt_driver_uml.la
endif
@@ -245,10 +244,16 @@ qemu_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl $(QEMU_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -r qemu $(QEMU_PROTOCOL) > $@
LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
- libvirtd.uml.logrotate
+ libvirtd.uml.logrotate libvirtd.logrotate
BUILT_SOURCES += $(LOGROTATE_CONFS)
+libvirtd.logrotate: libvirtd.logrotate.in
+ sed \
+ -e 's![@]localstatedir[@]!$(localstatedir)!g' \
+ < $< > $@-t
+ mv $@-t $@
+
libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in
sed \
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
@@ -272,6 +277,7 @@ install-logrotate: $(LOGROTATE_CONFS)
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/lxc/
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/uml/
mkdir -p $(DESTDIR)$(sysconfdir)/logrotate.d/
+ $(INSTALL_DATA) libvirtd.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd
$(INSTALL_DATA) libvirtd.qemu.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu
$(INSTALL_DATA) libvirtd.lxc.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc
$(INSTALL_DATA) libvirtd.uml.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml
@@ -322,6 +328,13 @@ install-data-local: install-data-sasl
uninstall-local:: uninstall-data-sasl
endif # WITH_LIBVIRTD
+# This is needed for 'make dist' too, so can't wrap in WITH_LIBVIRTD.
+POD2MAN = pod2man -c "Virtualization Support" \
+ -r "$(PACKAGE)-$(VERSION)" -s 8
+
+$(srcdir)/libvirtd.8.in: libvirtd.pod.in
+ $(AM_V_GEN)$(POD2MAN) $< $@
+
# This is needed for clients too, so can't wrap in
# the WITH_LIBVIRTD conditional
if HAVE_SASL
@@ -338,5 +351,6 @@ uninstall-data-sasl:
endif
-CLEANFILES += $(BUILT_SOURCES) $(man_MANS) libvirtd.pod
+CLEANFILES += $(BUILT_SOURCES) $(man8_MANS)
CLEANFILES += *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
+MAINTAINERCLEANFILES = $(srcdir)/libvirtd.8.in
diff --git a/daemon/Makefile.in b/daemon/Makefile.in
index 11ac83192..567e5944b 100644
--- a/daemon/Makefile.in
+++ b/daemon/Makefile.in
@@ -37,23 +37,24 @@ host_triplet = @host@
@WITH_LIBVIRTD_TRUE@sbin_PROGRAMS = libvirtd$(EXEEXT)
@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_QEMU_TRUE@am__append_1 = ../src/libvirt_driver_qemu.la
@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_LXC_TRUE@am__append_2 = ../src/libvirt_driver_lxc.la
-@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_UML_TRUE@am__append_3 = ../src/libvirt_driver_uml.la
-@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_ONE_TRUE@am__append_4 = ../src/libvirt_driver_one.la
-@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_STORAGE_DIR_TRUE@am__append_5 = ../src/libvirt_driver_storage.la
-@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_NETWORK_TRUE@am__append_6 = ../src/libvirt_driver_network.la
-@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_NETCF_TRUE@am__append_7 = ../src/libvirt_driver_interface.la
-@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_NODE_DEVICES_TRUE@am__append_8 = ../src/libvirt_driver_nodedev.la
-@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_SECRETS_TRUE@am__append_9 = ../src/libvirt_driver_secret.la
-@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_NWFILTER_TRUE@am__append_10 = ../src/libvirt_driver_nwfilter.la
-@HAVE_AVAHI_TRUE@@WITH_LIBVIRTD_TRUE@am__append_11 = $(AVAHI_SOURCES)
-@HAVE_AVAHI_TRUE@@WITH_LIBVIRTD_TRUE@am__append_12 = $(AVAHI_CFLAGS)
-@HAVE_AVAHI_TRUE@@WITH_LIBVIRTD_TRUE@am__append_13 = $(AVAHI_LIBS)
-@WITH_LIBVIRTD_TRUE@am__append_14 = probes.d libvirtd.stp
-@WITH_DTRACE_TRUE@@WITH_LIBVIRTD_TRUE@am__append_15 = probes.o
-@WITH_DTRACE_TRUE@@WITH_LIBVIRTD_TRUE@am__append_16 = probes.h
-@WITH_DTRACE_TRUE@@WITH_LIBVIRTD_TRUE@am__append_17 = probes.h probes.o
-@WITH_LIBVIRTD_TRUE@am__append_18 = $(LOGROTATE_CONFS)
-@LIBVIRT_INIT_SCRIPT_RED_HAT_TRUE@@WITH_LIBVIRTD_TRUE@am__append_19 = libvirtd.init
+@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_LIBXL_TRUE@am__append_3 = ../src/libvirt_driver_libxl.la
+@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_UML_TRUE@am__append_4 = ../src/libvirt_driver_uml.la
+@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_ONE_TRUE@am__append_5 = ../src/libvirt_driver_one.la
+@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_STORAGE_DIR_TRUE@am__append_6 = ../src/libvirt_driver_storage.la
+@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_NETWORK_TRUE@am__append_7 = ../src/libvirt_driver_network.la
+@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_NETCF_TRUE@am__append_8 = ../src/libvirt_driver_interface.la
+@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_NODE_DEVICES_TRUE@am__append_9 = ../src/libvirt_driver_nodedev.la
+@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_SECRETS_TRUE@am__append_10 = ../src/libvirt_driver_secret.la
+@WITH_DRIVER_MODULES_FALSE@@WITH_LIBVIRTD_TRUE@@WITH_NWFILTER_TRUE@am__append_11 = ../src/libvirt_driver_nwfilter.la
+@HAVE_AVAHI_TRUE@@WITH_LIBVIRTD_TRUE@am__append_12 = $(AVAHI_SOURCES)
+@HAVE_AVAHI_TRUE@@WITH_LIBVIRTD_TRUE@am__append_13 = $(AVAHI_CFLAGS)
+@HAVE_AVAHI_TRUE@@WITH_LIBVIRTD_TRUE@am__append_14 = $(AVAHI_LIBS)
+@WITH_LIBVIRTD_TRUE@am__append_15 = probes.d libvirtd.stp
+@WITH_DTRACE_TRUE@@WITH_LIBVIRTD_TRUE@am__append_16 = probes.o
+@WITH_DTRACE_TRUE@@WITH_LIBVIRTD_TRUE@am__append_17 = probes.h
+@WITH_DTRACE_TRUE@@WITH_LIBVIRTD_TRUE@am__append_18 = probes.h probes.o
+@WITH_LIBVIRTD_TRUE@am__append_19 = $(LOGROTATE_CONFS)
+@LIBVIRT_INIT_SCRIPT_RED_HAT_TRUE@@WITH_LIBVIRTD_TRUE@am__append_20 = libvirtd.init
subdir = daemon
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -68,7 +69,6 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib/m4/00gnulib.m4 \
$(top_srcdir)/gnulib/m4/configmake.m4 \
$(top_srcdir)/gnulib/m4/count-one-bits.m4 \
$(top_srcdir)/gnulib/m4/dirname.m4 \
- $(top_srcdir)/gnulib/m4/dos.m4 \
$(top_srcdir)/gnulib/m4/double-slash-root.m4 \
$(top_srcdir)/gnulib/m4/eealloc.m4 \
$(top_srcdir)/gnulib/m4/environ.m4 \
@@ -192,7 +192,6 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib/m4/00gnulib.m4 \
$(top_srcdir)/gnulib/m4/vasnprintf.m4 \
$(top_srcdir)/gnulib/m4/vasprintf.m4 \
$(top_srcdir)/gnulib/m4/waitpid.m4 \
- $(top_srcdir)/gnulib/m4/warn-on-use.m4 \
$(top_srcdir)/gnulib/m4/wchar_h.m4 \
$(top_srcdir)/gnulib/m4/write.m4 \
$(top_srcdir)/gnulib/m4/xalloc.m4 \
@@ -217,17 +216,17 @@ am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" \
"$(DESTDIR)$(augeasdir)" "$(DESTDIR)$(augeastestsdir)" \
"$(DESTDIR)$(confdir)" "$(DESTDIR)$(tapsetdir)"
PROGRAMS = $(sbin_PROGRAMS)
-am__libvirtd_SOURCES_DIST = event.c event.h libvirtd.c libvirtd.h \
- remote.c remote.h dispatch.c dispatch.h stream.c stream.h \
+am__libvirtd_SOURCES_DIST = libvirtd.c libvirtd.h remote.c remote.h \
+ dispatch.c dispatch.h stream.c stream.h \
remote_dispatch_prototypes.h remote_dispatch_table.h \
remote_dispatch_args.h remote_dispatch_ret.h \
qemu_dispatch_prototypes.h qemu_dispatch_table.h \
qemu_dispatch_args.h qemu_dispatch_ret.h \
../src/remote/remote_protocol.c ../src/remote/qemu_protocol.c \
mdns.c mdns.h
-am__objects_1 = libvirtd-event.$(OBJEXT) libvirtd-libvirtd.$(OBJEXT) \
- libvirtd-remote.$(OBJEXT) libvirtd-dispatch.$(OBJEXT) \
- libvirtd-stream.$(OBJEXT) libvirtd-remote_protocol.$(OBJEXT) \
+am__objects_1 = libvirtd-libvirtd.$(OBJEXT) libvirtd-remote.$(OBJEXT) \
+ libvirtd-dispatch.$(OBJEXT) libvirtd-stream.$(OBJEXT) \
+ libvirtd-remote_protocol.$(OBJEXT) \
libvirtd-qemu_protocol.$(OBJEXT)
am__objects_2 = libvirtd-mdns.$(OBJEXT)
@HAVE_AVAHI_TRUE@@WITH_LIBVIRTD_TRUE@am__objects_3 = $(am__objects_2)
@@ -247,9 +246,9 @@ am__DEPENDENCIES_1 =
@WITH_LIBVIRTD_TRUE@ $(am__append_4) $(am__append_5) \
@WITH_LIBVIRTD_TRUE@ $(am__append_6) $(am__append_7) \
@WITH_LIBVIRTD_TRUE@ $(am__append_8) $(am__append_9) \
-@WITH_LIBVIRTD_TRUE@ $(am__append_10) ../src/libvirt.la \
-@WITH_LIBVIRTD_TRUE@ $(am__DEPENDENCIES_2) $(am__append_15) \
-@WITH_LIBVIRTD_TRUE@ ../gnulib/lib/libgnu.la \
+@WITH_LIBVIRTD_TRUE@ $(am__append_10) $(am__append_11) \
+@WITH_LIBVIRTD_TRUE@ ../src/libvirt.la $(am__DEPENDENCIES_2) \
+@WITH_LIBVIRTD_TRUE@ $(am__append_16) ../gnulib/lib/libgnu.la \
@WITH_LIBVIRTD_TRUE@ $(am__DEPENDENCIES_1)
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
@@ -308,7 +307,7 @@ am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
man8dir = $(mandir)/man8
NROFF = nroff
-MANS = $(man_MANS)
+MANS = $(man8_MANS)
DATA = $(augeas_DATA) $(augeastests_DATA) $(conf_DATA) $(tapset_DATA)
ETAGS = etags
CTAGS = ctags
@@ -360,6 +359,7 @@ DEVMAPPER_CFLAGS = @DEVMAPPER_CFLAGS@
DEVMAPPER_LIBS = @DEVMAPPER_LIBS@
DLLTOOL = @DLLTOOL@
DLOPEN_LIBS = @DLOPEN_LIBS@
+DMSETUP = @DMSETUP@
DNSMASQ = @DNSMASQ@
DRIVER_MODULE_CFLAGS = @DRIVER_MODULE_CFLAGS@
DRIVER_MODULE_LIBS = @DRIVER_MODULE_LIBS@
@@ -471,6 +471,7 @@ GNULIB_MBSSEP = @GNULIB_MBSSEP@
GNULIB_MBSSPN = @GNULIB_MBSSPN@
GNULIB_MBSSTR = @GNULIB_MBSSTR@
GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
+GNULIB_MBTOWC = @GNULIB_MBTOWC@
GNULIB_MEMCHR = @GNULIB_MEMCHR@
GNULIB_MEMMEM = @GNULIB_MEMMEM@
GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
@@ -606,6 +607,7 @@ GNULIB_WCSTOK = @GNULIB_WCSTOK@
GNULIB_WCSWIDTH = @GNULIB_WCSWIDTH@
GNULIB_WCSXFRM = @GNULIB_WCSXFRM@
GNULIB_WCTOB = @GNULIB_WCTOB@
+GNULIB_WCTOMB = @GNULIB_WCTOMB@
GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
GNULIB_WMEMCHR = @GNULIB_WMEMCHR@
GNULIB_WMEMCMP = @GNULIB_WMEMCMP@
@@ -876,6 +878,8 @@ LIBVIRT_VERSION_INFO = @LIBVIRT_VERSION_INFO@
LIBVIRT_VERSION_NUMBER = @LIBVIRT_VERSION_NUMBER@
LIBXENSERVER_CFLAGS = @LIBXENSERVER_CFLAGS@
LIBXENSERVER_LIBS = @LIBXENSERVER_LIBS@
+LIBXL_CFLAGS = @LIBXL_CFLAGS@
+LIBXL_LIBS = @LIBXL_LIBS@
LIBXML_CFLAGS = @LIBXML_CFLAGS@
LIBXML_LIBS = @LIBXML_LIBS@
LIB_PTHREAD = @LIB_PTHREAD@
@@ -1052,6 +1056,7 @@ REPLACE_MBSINIT = @REPLACE_MBSINIT@
REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@
REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@
REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@
+REPLACE_MBTOWC = @REPLACE_MBTOWC@
REPLACE_MEMCHR = @REPLACE_MEMCHR@
REPLACE_MEMMEM = @REPLACE_MEMMEM@
REPLACE_MKDIR = @REPLACE_MKDIR@
@@ -1117,6 +1122,7 @@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@
REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@
REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@
REPLACE_WCTOB = @REPLACE_WCTOB@
+REPLACE_WCTOMB = @REPLACE_WCTOMB@
REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
REPLACE_WRITE = @REPLACE_WRITE@
RPCGEN = @RPCGEN@
@@ -1241,11 +1247,9 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-CLEANFILES = $(am__append_17) $(BUILT_SOURCES) $(man_MANS) \
- libvirtd.pod *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno \
- *.gcda
+CLEANFILES = $(am__append_18) $(BUILT_SOURCES) $(man8_MANS) *.cov \
+ *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
DAEMON_SOURCES = \
- event.c event.h \
libvirtd.c libvirtd.h \
remote.c remote.h \
dispatch.c dispatch.h \
@@ -1267,23 +1271,21 @@ AVAHI_SOURCES = \
DISTCLEANFILES =
EXTRA_DIST = remote_generate_stubs.pl libvirtd.conf libvirtd.init.in \
libvirtd.policy-0 libvirtd.policy-1 libvirtd.sasl \
- libvirtd.sysconf libvirtd.aug libvirtd.qemu.logrotate.in \
- libvirtd.lxc.logrotate.in libvirtd.uml.logrotate.in \
- test_libvirtd.aug THREADING.txt libvirtd.pod.in libvirtd.stp \
- $(AVAHI_SOURCES) $(DAEMON_SOURCES) $(am__append_14)
-BUILT_SOURCES = $(am__append_16) $(am__append_18) $(am__append_19)
-@WITH_LIBVIRTD_TRUE@man_MANS = libvirtd.8
+ libvirtd.sysconf libvirtd.aug libvirtd.logrotate.in \
+ libvirtd.qemu.logrotate.in libvirtd.lxc.logrotate.in \
+ libvirtd.uml.logrotate.in test_libvirtd.aug THREADING.txt \
+ libvirtd.pod.in libvirtd.8.in libvirtd.stp $(AVAHI_SOURCES) \
+ $(DAEMON_SOURCES) $(am__append_15)
+BUILT_SOURCES = $(am__append_17) $(am__append_19) $(am__append_20)
+@WITH_LIBVIRTD_TRUE@man8_MANS = libvirtd.8
@WITH_LIBVIRTD_TRUE@confdir = $(sysconfdir)/libvirt/
@WITH_LIBVIRTD_TRUE@conf_DATA = libvirtd.conf
@WITH_LIBVIRTD_TRUE@augeasdir = $(datadir)/augeas/lenses
@WITH_LIBVIRTD_TRUE@augeas_DATA = libvirtd.aug
@WITH_LIBVIRTD_TRUE@augeastestsdir = $(datadir)/augeas/lenses/tests
@WITH_LIBVIRTD_TRUE@augeastests_DATA = test_libvirtd.aug
-@WITH_LIBVIRTD_TRUE@POD2MAN = pod2man -c "Virtualization Support" \
-@WITH_LIBVIRTD_TRUE@ -r "$(PACKAGE)-$(VERSION)" -s 8
-
@WITH_LIBVIRTD_TRUE@libvirtd_SOURCES = $(DAEMON_SOURCES) \
-@WITH_LIBVIRTD_TRUE@ $(am__append_11)
+@WITH_LIBVIRTD_TRUE@ $(am__append_12)
#-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
@WITH_LIBVIRTD_TRUE@libvirtd_CFLAGS = -I$(top_srcdir)/gnulib/lib \
@@ -1298,7 +1300,7 @@ BUILT_SOURCES = $(am__append_16) $(am__append_18) $(am__append_19)
@WITH_LIBVIRTD_TRUE@ $(WARN_CFLAGS) $(COVERAGE_CFLAGS) \
@WITH_LIBVIRTD_TRUE@ -DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\"" \
@WITH_LIBVIRTD_TRUE@ -DREMOTE_PID_FILE="\"$(REMOTE_PID_FILE)\"" \
-@WITH_LIBVIRTD_TRUE@ $(am__append_12)
+@WITH_LIBVIRTD_TRUE@ $(am__append_13)
@WITH_LIBVIRTD_TRUE@libvirtd_LDFLAGS = \
@WITH_LIBVIRTD_TRUE@ $(WARN_CFLAGS) \
@WITH_LIBVIRTD_TRUE@ $(COVERAGE_LDFLAGS)
@@ -1313,9 +1315,10 @@ BUILT_SOURCES = $(am__append_16) $(am__append_18) $(am__append_19)
@WITH_LIBVIRTD_TRUE@ $(am__append_4) $(am__append_5) \
@WITH_LIBVIRTD_TRUE@ $(am__append_6) $(am__append_7) \
@WITH_LIBVIRTD_TRUE@ $(am__append_8) $(am__append_9) \
-@WITH_LIBVIRTD_TRUE@ $(am__append_10) ../src/libvirt.la \
-@WITH_LIBVIRTD_TRUE@ $(am__append_13) $(am__append_15) \
-@WITH_LIBVIRTD_TRUE@ ../gnulib/lib/libgnu.la $(LIBSOCKET)
+@WITH_LIBVIRTD_TRUE@ $(am__append_10) $(am__append_11) \
+@WITH_LIBVIRTD_TRUE@ ../src/libvirt.la $(am__append_14) \
+@WITH_LIBVIRTD_TRUE@ $(am__append_16) ../gnulib/lib/libgnu.la \
+@WITH_LIBVIRTD_TRUE@ $(LIBSOCKET)
@HAVE_POLKIT0_FALSE@@HAVE_POLKIT_TRUE@@WITH_LIBVIRTD_TRUE@policydir = $(datadir)/polkit-1/actions
@HAVE_POLKIT0_TRUE@@HAVE_POLKIT_TRUE@@WITH_LIBVIRTD_TRUE@policydir = $(datadir)/PolicyKit/policy
@HAVE_POLKIT0_FALSE@@HAVE_POLKIT_TRUE@@WITH_LIBVIRTD_TRUE@policyfile = libvirtd.policy-1
@@ -1326,8 +1329,14 @@ BUILT_SOURCES = $(am__append_16) $(am__append_18) $(am__append_19)
@WITH_LIBVIRTD_TRUE@REMOTE_PROTOCOL = $(top_srcdir)/src/remote/remote_protocol.x
@WITH_LIBVIRTD_TRUE@QEMU_PROTOCOL = $(top_srcdir)/src/remote/qemu_protocol.x
@WITH_LIBVIRTD_TRUE@LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
-@WITH_LIBVIRTD_TRUE@ libvirtd.uml.logrotate
+@WITH_LIBVIRTD_TRUE@ libvirtd.uml.logrotate libvirtd.logrotate
+
+
+# This is needed for 'make dist' too, so can't wrap in WITH_LIBVIRTD.
+POD2MAN = pod2man -c "Virtualization Support" \
+ -r "$(PACKAGE)-$(VERSION)" -s 8
+MAINTAINERCLEANFILES = $(srcdir)/libvirtd.8.in
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -1417,7 +1426,6 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirtd-dispatch.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirtd-event.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirtd-libvirtd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirtd-mdns.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirtd-qemu_protocol.Po@am__quote@
@@ -1449,22 +1457,6 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-libvirtd-event.o: event.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvirtd_CFLAGS) $(CFLAGS) -MT libvirtd-event.o -MD -MP -MF $(DEPDIR)/libvirtd-event.Tpo -c -o libvirtd-event.o `test -f 'event.c' || echo '$(srcdir)/'`event.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvirtd-event.Tpo $(DEPDIR)/libvirtd-event.Po
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='event.c' object='libvirtd-event.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvirtd_CFLAGS) $(CFLAGS) -c -o libvirtd-event.o `test -f 'event.c' || echo '$(srcdir)/'`event.c
-
-libvirtd-event.obj: event.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvirtd_CFLAGS) $(CFLAGS) -MT libvirtd-event.obj -MD -MP -MF $(DEPDIR)/libvirtd-event.Tpo -c -o libvirtd-event.obj `if test -f 'event.c'; then $(CYGPATH_W) 'event.c'; else $(CYGPATH_W) '$(srcdir)/event.c'; fi`
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvirtd-event.Tpo $(DEPDIR)/libvirtd-event.Po
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='event.c' object='libvirtd-event.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvirtd_CFLAGS) $(CFLAGS) -c -o libvirtd-event.obj `if test -f 'event.c'; then $(CYGPATH_W) 'event.c'; else $(CYGPATH_W) '$(srcdir)/event.c'; fi`
-
libvirtd-libvirtd.o: libvirtd.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvirtd_CFLAGS) $(CFLAGS) -MT libvirtd-libvirtd.o -MD -MP -MF $(DEPDIR)/libvirtd-libvirtd.Tpo -c -o libvirtd-libvirtd.o `test -f 'libvirtd.c' || echo '$(srcdir)/'`libvirtd.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvirtd-libvirtd.Tpo $(DEPDIR)/libvirtd-libvirtd.Po
@@ -1582,13 +1574,11 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-install-man8: $(man_MANS)
+install-man8: $(man8_MANS)
@$(NORMAL_INSTALL)
test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
- @list=''; test -n "$(man8dir)" || exit 0; \
+ @list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \
{ for i in $$list; do echo "$$i"; done; \
- l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
- sed -n '/\.8[a-z]*$$/p'; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
@@ -1611,10 +1601,8 @@ install-man8: $(man_MANS)
uninstall-man8:
@$(NORMAL_UNINSTALL)
- @list=''; test -n "$(man8dir)" || exit 0; \
+ @list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
- l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
- sed -n '/\.8[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
test -z "$$files" || { \
@@ -1836,6 +1824,7 @@ maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool clean-sbinPROGRAMS \
@@ -1934,7 +1923,7 @@ uninstall-man: uninstall-man8
uninstall-man8 uninstall-sbinPROGRAMS uninstall-tapsetDATA
-@WITH_LIBVIRTD_TRUE@libvirtd.pod: libvirtd.pod.in
+@WITH_LIBVIRTD_TRUE@libvirtd.8: $(srcdir)/libvirtd.8.in
@WITH_LIBVIRTD_TRUE@ sed \
@WITH_LIBVIRTD_TRUE@ -e 's![@]sysconfdir[@]!$(sysconfdir)!g' \
@WITH_LIBVIRTD_TRUE@ -e 's![@]localstatedir[@]!$(localstatedir)!g' \
@@ -1942,9 +1931,6 @@ uninstall-man: uninstall-man8
@WITH_LIBVIRTD_TRUE@ < $< > $@-t
@WITH_LIBVIRTD_TRUE@ mv $@-t $@
-@WITH_LIBVIRTD_TRUE@libvirtd.8: libvirtd.pod
-@WITH_LIBVIRTD_TRUE@ $(AM_V_GEN)$(POD2MAN) $< $@
-
@WITH_DTRACE_TRUE@@WITH_LIBVIRTD_TRUE@probes.h: probes.d
@WITH_DTRACE_TRUE@@WITH_LIBVIRTD_TRUE@ $(AM_V_GEN)$(DTRACE) -o $@ -h -s $<
@@ -2006,6 +1992,12 @@ uninstall-man: uninstall-man8
@WITH_LIBVIRTD_TRUE@qemu_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl $(QEMU_PROTOCOL)
@WITH_LIBVIRTD_TRUE@ $(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -r qemu $(QEMU_PROTOCOL) > $@
+@WITH_LIBVIRTD_TRUE@libvirtd.logrotate: libvirtd.logrotate.in
+@WITH_LIBVIRTD_TRUE@ sed \
+@WITH_LIBVIRTD_TRUE@ -e 's![@]localstatedir[@]!$(localstatedir)!g' \
+@WITH_LIBVIRTD_TRUE@ < $< > $@-t
+@WITH_LIBVIRTD_TRUE@ mv $@-t $@
+
@WITH_LIBVIRTD_TRUE@libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in
@WITH_LIBVIRTD_TRUE@ sed \
@WITH_LIBVIRTD_TRUE@ -e 's![@]localstatedir[@]!$(localstatedir)!g' \
@@ -2029,6 +2021,7 @@ uninstall-man: uninstall-man8
@WITH_LIBVIRTD_TRUE@ mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/lxc/
@WITH_LIBVIRTD_TRUE@ mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/uml/
@WITH_LIBVIRTD_TRUE@ mkdir -p $(DESTDIR)$(sysconfdir)/logrotate.d/
+@WITH_LIBVIRTD_TRUE@ $(INSTALL_DATA) libvirtd.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd
@WITH_LIBVIRTD_TRUE@ $(INSTALL_DATA) libvirtd.qemu.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu
@WITH_LIBVIRTD_TRUE@ $(INSTALL_DATA) libvirtd.lxc.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc
@WITH_LIBVIRTD_TRUE@ $(INSTALL_DATA) libvirtd.uml.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml
@@ -2066,6 +2059,9 @@ uninstall-man: uninstall-man8
@WITH_LIBVIRTD_FALSE@install-data-local: install-data-sasl
@WITH_LIBVIRTD_FALSE@uninstall-local:: uninstall-data-sasl
+$(srcdir)/libvirtd.8.in: libvirtd.pod.in
+ $(AM_V_GEN)$(POD2MAN) $< $@
+
# This is needed for clients too, so can't wrap in
# the WITH_LIBVIRTD conditional
@HAVE_SASL_TRUE@install-data-sasl:
diff --git a/daemon/dispatch.c b/daemon/dispatch.c
index bf2ac7341..48140171f 100644
--- a/daemon/dispatch.c
+++ b/daemon/dispatch.c
@@ -26,7 +26,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
-#include <stdbool.h>
#include "dispatch.h"
#include "remote.h"
@@ -114,14 +113,10 @@ void remoteDispatchOOMError (remote_error *rerr)
void remoteDispatchConnError (remote_error *rerr,
- virConnectPtr conn)
+ virConnectPtr conn ATTRIBUTE_UNUSED)
{
- virErrorPtr verr;
+ virErrorPtr verr = virGetLastError();
- if (conn)
- verr = virConnGetLastError(conn);
- else
- verr = virGetLastError();
if (verr)
remoteDispatchCopyError(rerr, verr);
else
@@ -141,7 +136,7 @@ remoteSerializeError(struct qemud_client *client,
unsigned int len;
struct qemud_client_message *msg = NULL;
- DEBUG("prog=%d ver=%d proc=%d type=%d serial=%d, msg=%s",
+ VIR_DEBUG("prog=%d ver=%d proc=%d type=%d serial=%d, msg=%s",
program, version, procedure, type, serial,
rerr->message ? *rerr->message : "(none)");
@@ -372,7 +367,7 @@ remoteDispatchClientRequest(struct qemud_server *server,
remote_error rerr;
bool qemu_call;
- DEBUG("prog=%d ver=%d type=%d status=%d serial=%d proc=%d",
+ VIR_DEBUG("prog=%d ver=%d type=%d status=%d serial=%d proc=%d",
msg->hdr.prog, msg->hdr.vers, msg->hdr.type,
msg->hdr.status, msg->hdr.serial, msg->hdr.proc);
@@ -631,7 +626,7 @@ remoteSendStreamData(struct qemud_client *client,
struct qemud_client_message *msg;
XDR xdr;
- DEBUG("client=%p stream=%p data=%p len=%d", client, stream, data, len);
+ VIR_DEBUG("client=%p stream=%p data=%p len=%d", client, stream, data, len);
if (VIR_ALLOC(msg) < 0) {
return -1;
@@ -682,7 +677,7 @@ remoteSendStreamData(struct qemud_client *client,
xdr_destroy (&xdr);
- DEBUG("Total %d", msg->bufferOffset);
+ VIR_DEBUG("Total %d", msg->bufferOffset);
}
if (data)
msg->streamTX = 1;
diff --git a/daemon/event.c b/daemon/event.c
deleted file mode 100644
index 4c97fb921..000000000
--- a/daemon/event.c
+++ /dev/null
@@ -1,706 +0,0 @@
-/*
- * event.c: event loop for monitoring file handles
- *
- * Copyright (C) 2007, 2010-2011 Red Hat, Inc.
- * Copyright (C) 2007 Daniel P. Berrange
- *
- * 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: Daniel P. Berrange <berrange@redhat.com>
- */
-
-#include <config.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <poll.h>
-#include <sys/time.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include "threads.h"
-#include "logging.h"
-#include "event.h"
-#include "memory.h"
-#include "util.h"
-#include "ignore-value.h"
-
-#define EVENT_DEBUG(fmt, ...) DEBUG(fmt, __VA_ARGS__)
-
-static int virEventInterruptLocked(void);
-
-/* State for a single file handle being monitored */
-struct virEventHandle {
- int watch;
- int fd;
- int events;
- virEventHandleCallback cb;
- virFreeCallback ff;
- void *opaque;
- int deleted;
-};
-
-/* State for a single timer being generated */
-struct virEventTimeout {
- int timer;
- int frequency;
- unsigned long long expiresAt;
- virEventTimeoutCallback cb;
- virFreeCallback ff;
- void *opaque;
- int deleted;
-};
-
-/* Allocate extra slots for virEventHandle/virEventTimeout
- records in this multiple */
-#define EVENT_ALLOC_EXTENT 10
-
-/* State for the main event loop */
-struct virEventLoop {
- virMutex lock;
- int running;
- virThread leader;
- int wakeupfd[2];
- size_t handlesCount;
- size_t handlesAlloc;
- struct virEventHandle *handles;
- size_t timeoutsCount;
- size_t timeoutsAlloc;
- struct virEventTimeout *timeouts;
-};
-
-/* Only have one event loop */
-static struct virEventLoop eventLoop;
-
-/* Unique ID for the next FD watch to be registered */
-static int nextWatch = 1;
-
-/* Unique ID for the next timer to be registered */
-static int nextTimer = 1;
-
-/*
- * Register a callback for monitoring file handle events.
- * NB, it *must* be safe to call this from within a callback
- * For this reason we only ever append to existing list.
- */
-int virEventAddHandleImpl(int fd, int events,
- virEventHandleCallback cb,
- void *opaque,
- virFreeCallback ff) {
- int watch;
- EVENT_DEBUG("Add handle fd=%d events=%d cb=%p opaque=%p", fd, events, cb, opaque);
- virMutexLock(&eventLoop.lock);
- if (eventLoop.handlesCount == eventLoop.handlesAlloc) {
- EVENT_DEBUG("Used %zu handle slots, adding at least %d more",
- eventLoop.handlesAlloc, EVENT_ALLOC_EXTENT);
- if (VIR_RESIZE_N(eventLoop.handles, eventLoop.handlesAlloc,
- eventLoop.handlesCount, EVENT_ALLOC_EXTENT) < 0) {
- virMutexUnlock(&eventLoop.lock);
- return -1;
- }
- }
-
- watch = nextWatch++;
-
- eventLoop.handles[eventLoop.handlesCount].watch = watch;
- eventLoop.handles[eventLoop.handlesCount].fd = fd;
- eventLoop.handles[eventLoop.handlesCount].events =
- virEventHandleTypeToPollEvent(events);
- eventLoop.handles[eventLoop.handlesCount].cb = cb;
- eventLoop.handles[eventLoop.handlesCount].ff = ff;
- eventLoop.handles[eventLoop.handlesCount].opaque = opaque;
- eventLoop.handles[eventLoop.handlesCount].deleted = 0;
-
- eventLoop.handlesCount++;
-
- virEventInterruptLocked();
- virMutexUnlock(&eventLoop.lock);
-
- return watch;
-}
-
-void virEventUpdateHandleImpl(int watch, int events) {
- int i;
- EVENT_DEBUG("Update handle w=%d e=%d", watch, events);
-
- if (watch <= 0) {
- VIR_WARN("Ignoring invalid update watch %d", watch);
- return;
- }
-
- virMutexLock(&eventLoop.lock);
- for (i = 0 ; i < eventLoop.handlesCount ; i++) {
- if (eventLoop.handles[i].watch == watch) {
- eventLoop.handles[i].events =
- virEventHandleTypeToPollEvent(events);
- virEventInterruptLocked();
- break;
- }
- }
- virMutexUnlock(&eventLoop.lock);
-}
-
-/*
- * Unregister a callback from a file handle
- * NB, it *must* be safe to call this from within a callback
- * For this reason we only ever set a flag in the existing list.
- * Actual deletion will be done out-of-band
- */
-int virEventRemoveHandleImpl(int watch) {
- int i;
- EVENT_DEBUG("Remove handle w=%d", watch);
-
- if (watch <= 0) {
- VIR_WARN("Ignoring invalid remove watch %d", watch);
- return -1;
- }
-
- virMutexLock(&eventLoop.lock);
- for (i = 0 ; i < eventLoop.handlesCount ; i++) {
- if (eventLoop.handles[i].deleted)
- continue;
-
- if (eventLoop.handles[i].watch == watch) {
- EVENT_DEBUG("mark delete %d %d", i, eventLoop.handles[i].fd);
- eventLoop.handles[i].deleted = 1;
- virEventInterruptLocked();
- virMutexUnlock(&eventLoop.lock);
- return 0;
- }
- }
- virMutexUnlock(&eventLoop.lock);
- return -1;
-}
-
-
-/*
- * Register a callback for a timer event
- * NB, it *must* be safe to call this from within a callback
- * For this reason we only ever append to existing list.
- */
-int virEventAddTimeoutImpl(int frequency,
- virEventTimeoutCallback cb,
- void *opaque,
- virFreeCallback ff) {
- struct timeval now;
- int ret;
- EVENT_DEBUG("Adding timer %d with %d ms freq", nextTimer, frequency);
- if (gettimeofday(&now, NULL) < 0) {
- return -1;
- }
-
- virMutexLock(&eventLoop.lock);
- if (eventLoop.timeoutsCount == eventLoop.timeoutsAlloc) {
- EVENT_DEBUG("Used %zu timeout slots, adding at least %d more",
- eventLoop.timeoutsAlloc, EVENT_ALLOC_EXTENT);
- if (VIR_RESIZE_N(eventLoop.timeouts, eventLoop.timeoutsAlloc,
- eventLoop.timeoutsCount, EVENT_ALLOC_EXTENT) < 0) {
- virMutexUnlock(&eventLoop.lock);
- return -1;
- }
- }
-
- eventLoop.timeouts[eventLoop.timeoutsCount].timer = nextTimer++;
- eventLoop.timeouts[eventLoop.timeoutsCount].frequency = frequency;
- eventLoop.timeouts[eventLoop.timeoutsCount].cb = cb;
- eventLoop.timeouts[eventLoop.timeoutsCount].ff = ff;
- eventLoop.timeouts[eventLoop.timeoutsCount].opaque = opaque;
- eventLoop.timeouts[eventLoop.timeoutsCount].deleted = 0;
- eventLoop.timeouts[eventLoop.timeoutsCount].expiresAt =
- frequency >= 0 ? frequency +
- (((unsigned long long)now.tv_sec)*1000) +
- (((unsigned long long)now.tv_usec)/1000) : 0;
-
- eventLoop.timeoutsCount++;
- ret = nextTimer-1;
- virEventInterruptLocked();
- virMutexUnlock(&eventLoop.lock);
- return ret;
-}
-
-void virEventUpdateTimeoutImpl(int timer, int frequency) {
- struct timeval tv;
- int i;
- EVENT_DEBUG("Updating timer %d timeout with %d ms freq", timer, frequency);
-
- if (timer <= 0) {
- VIR_WARN("Ignoring invalid update timer %d", timer);
- return;
- }
-
- if (gettimeofday(&tv, NULL) < 0) {
- return;
- }
-
- virMutexLock(&eventLoop.lock);
- for (i = 0 ; i < eventLoop.timeoutsCount ; i++) {
- if (eventLoop.timeouts[i].timer == timer) {
- eventLoop.timeouts[i].frequency = frequency;
- eventLoop.timeouts[i].expiresAt =
- frequency >= 0 ? frequency +
- (((unsigned long long)tv.tv_sec)*1000) +
- (((unsigned long long)tv.tv_usec)/1000) : 0;
- virEventInterruptLocked();
- break;
- }
- }
- virMutexUnlock(&eventLoop.lock);
-}
-
-/*
- * Unregister a callback for a timer
- * NB, it *must* be safe to call this from within a callback
- * For this reason we only ever set a flag in the existing list.
- * Actual deletion will be done out-of-band
- */
-int virEventRemoveTimeoutImpl(int timer) {
- int i;
- EVENT_DEBUG("Remove timer %d", timer);
-
- if (timer <= 0) {
- VIR_WARN("Ignoring invalid remove timer %d", timer);
- return -1;
- }
-
- virMutexLock(&eventLoop.lock);
- for (i = 0 ; i < eventLoop.timeoutsCount ; i++) {
- if (eventLoop.timeouts[i].deleted)
- continue;
-
- if (eventLoop.timeouts[i].timer == timer) {
- eventLoop.timeouts[i].deleted = 1;
- virEventInterruptLocked();
- virMutexUnlock(&eventLoop.lock);
- return 0;
- }
- }
- virMutexUnlock(&eventLoop.lock);
- return -1;
-}
-
-/* Iterates over all registered timeouts and determine which
- * will be the first to expire.
- * @timeout: filled with expiry time of soonest timer, or -1 if
- * no timeout is pending
- * returns: 0 on success, -1 on error
- */
-static int virEventCalculateTimeout(int *timeout) {
- unsigned long long then = 0;
- int i;
- EVENT_DEBUG("Calculate expiry of %zu timers", eventLoop.timeoutsCount);
- /* Figure out if we need a timeout */
- for (i = 0 ; i < eventLoop.timeoutsCount ; i++) {
- if (eventLoop.timeouts[i].frequency < 0)
- continue;
-
- EVENT_DEBUG("Got a timeout scheduled for %llu", eventLoop.timeouts[i].expiresAt);
- if (then == 0 ||
- eventLoop.timeouts[i].expiresAt < then)
- then = eventLoop.timeouts[i].expiresAt;
- }
-
- /* Calculate how long we should wait for a timeout if needed */
- if (then > 0) {
- struct timeval tv;
-
- if (gettimeofday(&tv, NULL) < 0) {
- return -1;
- }
-
- *timeout = then -
- ((((unsigned long long)tv.tv_sec)*1000) +
- (((unsigned long long)tv.tv_usec)/1000));
-
- if (*timeout < 0)
- *timeout = 0;
- } else {
- *timeout = -1;
- }
-
- EVENT_DEBUG("Timeout at %llu due in %d ms", then, *timeout);
-
- return 0;
-}
-
-/*
- * Allocate a pollfd array containing data for all registered
- * file handles. The caller must free the returned data struct
- * returns: the pollfd array, or NULL on error
- */
-static struct pollfd *virEventMakePollFDs(int *nfds) {
- struct pollfd *fds;
- int i;
-
- *nfds = 0;
- for (i = 0 ; i < eventLoop.handlesCount ; i++) {
- if (eventLoop.handles[i].events)
- (*nfds)++;
- }
-
- /* Setup the poll file handle data structs */
- if (VIR_ALLOC_N(fds, *nfds) < 0)
- return NULL;
-
- *nfds = 0;
- for (i = 0 ; i < eventLoop.handlesCount ; i++) {
- EVENT_DEBUG("Prepare n=%d w=%d, f=%d e=%d", i,
- eventLoop.handles[i].watch,
- eventLoop.handles[i].fd,
- eventLoop.handles[i].events);
- if (!eventLoop.handles[i].events)
- continue;
- fds[*nfds].fd = eventLoop.handles[i].fd;
- fds[*nfds].events = eventLoop.handles[i].events;
- fds[*nfds].revents = 0;
- (*nfds)++;
- //EVENT_DEBUG("Wait for %d %d", eventLoop.handles[i].fd, eventLoop.handles[i].events);
- }
-
- return fds;
-}
-
-
-/*
- * Iterate over all timers and determine if any have expired.
- * Invoke the user supplied callback for each timer whose
- * expiry time is met, and schedule the next timeout. Does
- * not try to 'catch up' on time if the actual expiry time
- * was later than the requested time.
- *
- * This method must cope with new timers being registered
- * by a callback, and must skip any timers marked as deleted.
- *
- * Returns 0 upon success, -1 if an error occurred
- */
-static int virEventDispatchTimeouts(void) {
- struct timeval tv;
- unsigned long long now;
- int i;
- /* Save this now - it may be changed during dispatch */
- int ntimeouts = eventLoop.timeoutsCount;
- DEBUG("Dispatch %d", ntimeouts);
-
- if (gettimeofday(&tv, NULL) < 0) {
- return -1;
- }
- now = (((unsigned long long)tv.tv_sec)*1000) +
- (((unsigned long long)tv.tv_usec)/1000);
-
- for (i = 0 ; i < ntimeouts ; i++) {
- if (eventLoop.timeouts[i].deleted || eventLoop.timeouts[i].frequency < 0)
- continue;
-
- /* Add 20ms fuzz so we don't pointlessly spin doing
- * <10ms sleeps, particularly on kernels with low HZ
- * it is fine that a timer expires 20ms earlier than
- * requested
- */
- if (eventLoop.timeouts[i].expiresAt <= (now+20)) {
- virEventTimeoutCallback cb = eventLoop.timeouts[i].cb;
- int timer = eventLoop.timeouts[i].timer;
- void *opaque = eventLoop.timeouts[i].opaque;
- eventLoop.timeouts[i].expiresAt =
- now + eventLoop.timeouts[i].frequency;
-
- virMutexUnlock(&eventLoop.lock);
- (cb)(timer, opaque);
- virMutexLock(&eventLoop.lock);
- }
- }
- return 0;
-}
-
-
-/* Iterate over all file handles and dispatch any which
- * have pending events listed in the poll() data. Invoke
- * the user supplied callback for each handle which has
- * pending events
- *
- * This method must cope with new handles being registered
- * by a callback, and must skip any handles marked as deleted.
- *
- * Returns 0 upon success, -1 if an error occurred
- */
-static int virEventDispatchHandles(int nfds, struct pollfd *fds) {
- int i, n;
- DEBUG("Dispatch %d", nfds);
-
- /* NB, use nfds not eventLoop.handlesCount, because new
- * fds might be added on end of list, and they're not
- * in the fds array we've got */
- for (i = 0, n = 0 ; n < nfds && i < eventLoop.handlesCount ; n++) {
- while ((eventLoop.handles[i].fd != fds[n].fd ||
- eventLoop.handles[i].events == 0) &&
- i < eventLoop.handlesCount) {
- i++;
- }
- if (i == eventLoop.handlesCount)
- break;
-
- DEBUG("i=%d w=%d", i, eventLoop.handles[i].watch);
- if (eventLoop.handles[i].deleted) {
- EVENT_DEBUG("Skip deleted n=%d w=%d f=%d", i,
- eventLoop.handles[i].watch, eventLoop.handles[i].fd);
- continue;
- }
-
- if (fds[n].revents) {
- virEventHandleCallback cb = eventLoop.handles[i].cb;
- int watch = eventLoop.handles[i].watch;
- void *opaque = eventLoop.handles[i].opaque;
- int hEvents = virPollEventToEventHandleType(fds[n].revents);
- EVENT_DEBUG("Dispatch n=%d f=%d w=%d e=%d %p", i,
- fds[n].fd, watch, fds[n].revents, opaque);
- virMutexUnlock(&eventLoop.lock);
- (cb)(watch, fds[n].fd, hEvents, opaque);
- virMutexLock(&eventLoop.lock);
- }
- }
-
- return 0;
-}
-
-
-/* Used post dispatch to actually remove any timers that
- * were previously marked as deleted. This asynchronous
- * cleanup is needed to make dispatch re-entrant safe.
- */
-static int virEventCleanupTimeouts(void) {
- int i;
- size_t gap;
- DEBUG("Cleanup %zu", eventLoop.timeoutsCount);
-
- /* Remove deleted entries, shuffling down remaining
- * entries as needed to form contiguous series
- */
- for (i = 0 ; i < eventLoop.timeoutsCount ; ) {
- if (!eventLoop.timeouts[i].deleted) {
- i++;
- continue;
- }
-
- EVENT_DEBUG("Purging timeout %d with id %d", i,
- eventLoop.timeouts[i].timer);
- if (eventLoop.timeouts[i].ff)
- (eventLoop.timeouts[i].ff)(eventLoop.timeouts[i].opaque);
-
- if ((i+1) < eventLoop.timeoutsCount) {
- memmove(eventLoop.timeouts+i,
- eventLoop.timeouts+i+1,
- sizeof(struct virEventTimeout)*(eventLoop.timeoutsCount
- -(i+1)));
- }
- eventLoop.timeoutsCount--;
- }
-
- /* Release some memory if we've got a big chunk free */
- gap = eventLoop.timeoutsAlloc - eventLoop.timeoutsCount;
- if (eventLoop.timeoutsCount == 0 ||
- (gap > eventLoop.timeoutsCount && gap > EVENT_ALLOC_EXTENT)) {
- EVENT_DEBUG("Found %zu out of %zu timeout slots used, releasing %zu",
- eventLoop.timeoutsCount, eventLoop.timeoutsAlloc, gap);
- VIR_SHRINK_N(eventLoop.timeouts, eventLoop.timeoutsAlloc, gap);
- }
- return 0;
-}
-
-/* Used post dispatch to actually remove any handles that
- * were previously marked as deleted. This asynchronous
- * cleanup is needed to make dispatch re-entrant safe.
- */
-static int virEventCleanupHandles(void) {
- int i;
- size_t gap;
- DEBUG("Cleanup %zu", eventLoop.handlesCount);
-
- /* Remove deleted entries, shuffling down remaining
- * entries as needed to form contiguous series
- */
- for (i = 0 ; i < eventLoop.handlesCount ; ) {
- if (!eventLoop.handles[i].deleted) {
- i++;
- continue;
- }
-
- if (eventLoop.handles[i].ff)
- (eventLoop.handles[i].ff)(eventLoop.handles[i].opaque);
-
- if ((i+1) < eventLoop.handlesCount) {
- memmove(eventLoop.handles+i,
- eventLoop.handles+i+1,
- sizeof(struct virEventHandle)*(eventLoop.handlesCount
- -(i+1)));
- }
- eventLoop.handlesCount--;
- }
-
- /* Release some memory if we've got a big chunk free */
- gap = eventLoop.handlesAlloc - eventLoop.handlesCount;
- if (eventLoop.handlesCount == 0 ||
- (gap > eventLoop.handlesCount && gap > EVENT_ALLOC_EXTENT)) {
- EVENT_DEBUG("Found %zu out of %zu handles slots used, releasing %zu",
- eventLoop.handlesCount, eventLoop.handlesAlloc, gap);
- VIR_SHRINK_N(eventLoop.handles, eventLoop.handlesAlloc, gap);
- }
- return 0;
-}
-
-/*
- * Run a single iteration of the event loop, blocking until
- * at least one file handle has an event, or a timer expires
- */
-int virEventRunOnce(void) {
- struct pollfd *fds = NULL;
- int ret, timeout, nfds;
-
- virMutexLock(&eventLoop.lock);
- eventLoop.running = 1;
- virThreadSelf(&eventLoop.leader);
-
- if (virEventCleanupTimeouts() < 0 ||
- virEventCleanupHandles() < 0)
- goto error;
-
- if (!(fds = virEventMakePollFDs(&nfds)) ||
- virEventCalculateTimeout(&timeout) < 0)
- goto error;
-
- virMutexUnlock(&eventLoop.lock);
-
- retry:
- EVENT_DEBUG("Poll on %d handles %p timeout %d", nfds, fds, timeout);
- ret = poll(fds, nfds, timeout);
- if (ret < 0) {
- EVENT_DEBUG("Poll got error event %d", errno);
- if (errno == EINTR) {
- goto retry;
- }
- goto error_unlocked;
- }
- EVENT_DEBUG("Poll got %d event(s)", ret);
-
- virMutexLock(&eventLoop.lock);
- if (virEventDispatchTimeouts() < 0)
- goto error;
-
- if (ret > 0 &&
- virEventDispatchHandles(nfds, fds) < 0)
- goto error;
-
- if (virEventCleanupTimeouts() < 0 ||
- virEventCleanupHandles() < 0)
- goto error;
-
- eventLoop.running = 0;
- virMutexUnlock(&eventLoop.lock);
- VIR_FREE(fds);
- return 0;
-
-error:
- virMutexUnlock(&eventLoop.lock);
-error_unlocked:
- VIR_FREE(fds);
- return -1;
-}
-
-
-static void virEventHandleWakeup(int watch ATTRIBUTE_UNUSED,
- int fd,
- int events ATTRIBUTE_UNUSED,
- void *opaque ATTRIBUTE_UNUSED)
-{
- char c;
- virMutexLock(&eventLoop.lock);
- ignore_value(saferead(fd, &c, sizeof(c)));
- virMutexUnlock(&eventLoop.lock);
-}
-
-int virEventInit(void)
-{
- if (virMutexInit(&eventLoop.lock) < 0)
- return -1;
-
- if (pipe(eventLoop.wakeupfd) < 0 ||
- virSetNonBlock(eventLoop.wakeupfd[0]) < 0 ||
- virSetNonBlock(eventLoop.wakeupfd[1]) < 0 ||
- virSetCloseExec(eventLoop.wakeupfd[0]) < 0 ||
- virSetCloseExec(eventLoop.wakeupfd[1]) < 0)
- return -1;
-
- if (virEventAddHandleImpl(eventLoop.wakeupfd[0],
- VIR_EVENT_HANDLE_READABLE,
- virEventHandleWakeup, NULL, NULL) < 0)
- return -1;
-
- return 0;
-}
-
-static int virEventInterruptLocked(void)
-{
- char c = '\0';
-
- if (!eventLoop.running ||
- virThreadIsSelf(&eventLoop.leader)) {
- VIR_DEBUG("Skip interrupt, %d %d", eventLoop.running,
- virThreadID(&eventLoop.leader));
- return 0;
- }
-
- VIR_DEBUG0("Interrupting");
- if (safewrite(eventLoop.wakeupfd[1], &c, sizeof(c)) != sizeof(c))
- return -1;
- return 0;
-}
-
-int virEventInterrupt(void)
-{
- int ret;
- virMutexLock(&eventLoop.lock);
- ret = virEventInterruptLocked();
- virMutexUnlock(&eventLoop.lock);
- return ret;
-}
-
-int
-virEventHandleTypeToPollEvent(int events)
-{
- int ret = 0;
- if(events & VIR_EVENT_HANDLE_READABLE)
- ret |= POLLIN;
- if(events & VIR_EVENT_HANDLE_WRITABLE)
- ret |= POLLOUT;
- if(events & VIR_EVENT_HANDLE_ERROR)
- ret |= POLLERR;
- if(events & VIR_EVENT_HANDLE_HANGUP)
- ret |= POLLHUP;
- return ret;
-}
-
-int
-virPollEventToEventHandleType(int events)
-{
- int ret = 0;
- if(events & POLLIN)
- ret |= VIR_EVENT_HANDLE_READABLE;
- if(events & POLLOUT)
- ret |= VIR_EVENT_HANDLE_WRITABLE;
- if(events & POLLERR)
- ret |= VIR_EVENT_HANDLE_ERROR;
- if(events & POLLNVAL) /* Treat NVAL as error, since libvirt doesn't distinguish */
- ret |= VIR_EVENT_HANDLE_ERROR;
- if(events & POLLHUP)
- ret |= VIR_EVENT_HANDLE_HANGUP;
- return ret;
-}
diff --git a/daemon/event.h b/daemon/event.h
deleted file mode 100644
index dc0358997..000000000
--- a/daemon/event.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * event.h: event loop for monitoring file handles
- *
- * Copyright (C) 2007 Daniel P. Berrange
- * Copyright (C) 2007 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: Daniel P. Berrange <berrange@redhat.com>
- */
-
-#ifndef __VIRTD_EVENT_H__
-# define __VIRTD_EVENT_H__
-
-# include "internal.h"
-
-/**
- * virEventAddHandleImpl: register a callback for monitoring file handle events
- *
- * @fd: file handle to monitor for events
- * @events: bitset of events to watch from POLLnnn constants
- * @cb: callback to invoke when an event occurs
- * @opaque: user data to pass to callback
- *
- * returns -1 if the file handle cannot be registered, 0 upon success
- */
-int virEventAddHandleImpl(int fd, int events,
- virEventHandleCallback cb,
- void *opaque,
- virFreeCallback ff);
-
-/**
- * virEventUpdateHandleImpl: change event set for a monitored file handle
- *
- * @watch: watch whose handle to update
- * @events: bitset of events to watch from POLLnnn constants
- *
- * Will not fail if fd exists
- */
-void virEventUpdateHandleImpl(int watch, int events);
-
-/**
- * virEventRemoveHandleImpl: unregister a callback from a file handle
- *
- * @watch: watch whose handle to remove
- *
- * returns -1 if the file handle was not registered, 0 upon success
- */
-int virEventRemoveHandleImpl(int watch);
-
-/**
- * virEventAddTimeoutImpl: register a callback for a timer event
- *
- * @frequency: time between events in milliseconds
- * @cb: callback to invoke when an event occurs
- * @opaque: user data to pass to callback
- *
- * Setting frequency to -1 will disable the timer. Setting the frequency
- * to zero will cause it to fire on every event loop iteration.
- *
- * returns -1 if the file handle cannot be registered, a positive
- * integer timer id upon success
- */
-int virEventAddTimeoutImpl(int frequency,
- virEventTimeoutCallback cb,
- void *opaque,
- virFreeCallback ff);
-
-/**
- * virEventUpdateTimeoutImpl: change frequency for a timer
- *
- * @timer: timer id to change
- * @frequency: time between events in milliseconds
- *
- * Setting frequency to -1 will disable the timer. Setting the frequency
- * to zero will cause it to fire on every event loop iteration.
- *
- * Will not fail if timer exists
- */
-void virEventUpdateTimeoutImpl(int timer, int frequency);
-
-/**
- * virEventRemoveTimeoutImpl: unregister a callback for a timer
- *
- * @timer: the timer id to remove
- *
- * returns -1 if the timer was not registered, 0 upon success
- */
-int virEventRemoveTimeoutImpl(int timer);
-
-/**
- * virEventInit: Initialize the event loop
- *
- * returns -1 if initialization failed
- */
-int virEventInit(void);
-
-/**
- * virEventRunOnce: run a single iteration of the event loop.
- *
- * Blocks the caller until at least one file handle has an
- * event or the first timer expires.
- *
- * returns -1 if the event monitoring failed
- */
-int virEventRunOnce(void);
-
-int
-virEventHandleTypeToPollEvent(int events);
-int
-virPollEventToEventHandleType(int events);
-
-
-/**
- * virEventInterrupt: wakeup any thread waiting in poll()
- *
- * return -1 if wakup failed
- */
-int virEventInterrupt(void);
-
-
-#endif /* __VIRTD_EVENT_H__ */
diff --git a/daemon/libvirtd.8.in b/daemon/libvirtd.8.in
new file mode 100644
index 000000000..9d8010058
--- /dev/null
+++ b/daemon/libvirtd.8.in
@@ -0,0 +1,272 @@
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "LIBVIRTD.POD.IN 8"
+.TH LIBVIRTD.POD.IN 8 "2010-11-30" "libvirt-0.8.8" "Virtualization Support"
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+libvirtd \- libvirtd management daemon
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBlibvirtd\fR [ \-dlv ] [ \-f config_file ] [ \-p pid_file ] [ \-t timeout_seconds ]
+.PP
+\&\fBlibvirtd\fR \-\-version
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBlibvirtd\fR program is the server side daemon component of the libvirt
+virtualization management system.
+.PP
+This daemon runs on host servers and performs required management tasks for
+virtualized guests. This includes activities such as starting, stopping
+and migrating guests between host servers, configuring and manipulating
+networking, and managing storage for use by guests.
+.PP
+The libvirt client libraries and utilities connect to this daemon to issue
+tasks and collect information about the configuration and resources of the host
+system and guests.
+.PP
+By default, the libvirtd daemon listens for requests on a local Unix domain
+socket. Using the \fB\-l\fR|\fB\-\-listen\fR command line option, the libvirtd daemon
+can be instructed to additionally listen on a \s-1TCP/IP\s0 socket. The \s-1TCP/IP\s0 socket
+to use is defined in the libvirtd configuration file.
+.PP
+Restarting libvirtd does not impact running guests. Guests continue to operate
+and will be picked up automatically if their \s-1XML\s0 configuration has been
+defined. Any guests whose \s-1XML\s0 configuration has not been defined will be lost
+from the configuration.
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+.IP "\fB\-d, \-\-daemon\fR" 4
+.IX Item "-d, --daemon"
+Run as a daemon & write \s-1PID\s0 file.
+.IP "\fB\-f, \-\-config\fR \fI\s-1FILE\s0\fR" 4
+.IX Item "-f, --config FILE"
+Use this configuration file, overriding the default value.
+.IP "\fB\-l, \-\-listen\fR" 4
+.IX Item "-l, --listen"
+Listen for \s-1TCP/IP\s0 connections.
+.IP "\fB\-p, \-\-pid\-file\fR \fI\s-1FILE\s0\fR" 4
+.IX Item "-p, --pid-file FILE"
+Use this name for the \s-1PID\s0 file, overriding the default value.
+.IP "\fB\-t, \-\-timeout\fR \fI\s-1SECONDS\s0\fR" 4
+.IX Item "-t, --timeout SECONDS"
+Exit after timeout period (in seconds) expires.
+.IP "\fB\-v, \-\-verbose\fR" 4
+.IX Item "-v, --verbose"
+Enable output of verbose messages.
+.IP "\fB \-\-version\fR" 4
+.IX Item " --version"
+Display version information then exit.
+.SH "SIGNALS"
+.IX Header "SIGNALS"
+On receipt of \fB\s-1SIGHUP\s0\fR libvirtd will reload its configuration.
+.SH "FILES"
+.IX Header "FILES"
+.ie n .IP "\fI\fI@sysconfdir\fI@/libvirtd.conf\fR" 4
+.el .IP "\fI\f(CI@sysconfdir\fI@/libvirtd.conf\fR" 4
+.IX Item "@sysconfdir@/libvirtd.conf"
+The default configuration file used by libvirtd, unless overridden on the
+command line using the \fB\-f\fR|\fB\-\-config\fR option.
+.ie n .IP "\fI\fI@localstatedir\fI@/run/libvirt/libvirt\-sock\fR" 4
+.el .IP "\fI\f(CI@localstatedir\fI@/run/libvirt/libvirt\-sock\fR" 4
+.IX Item "@localstatedir@/run/libvirt/libvirt-sock"
+.PD 0
+.ie n .IP "\fI\fI@localstatedir\fI@/run/libvirt/libvirt\-sock\-ro\fR" 4
+.el .IP "\fI\f(CI@localstatedir\fI@/run/libvirt/libvirt\-sock\-ro\fR" 4
+.IX Item "@localstatedir@/run/libvirt/libvirt-sock-ro"
+.PD
+The sockets libvirtd will use when \fBrun as root\fR.
+.ie n .IP "\fI\fI$HOME\fI/.libvirt/libvirt\-sock\fR" 4
+.el .IP "\fI\f(CI$HOME\fI/.libvirt/libvirt\-sock\fR" 4
+.IX Item "$HOME/.libvirt/libvirt-sock"
+The socket libvirtd will use when run as a \fBnon-root\fR user.
+.ie n .IP "\fI\fI@sysconfdir\fI@/pki/CA/cacert.pem\fR" 4
+.el .IP "\fI\f(CI@sysconfdir\fI@/pki/CA/cacert.pem\fR" 4
+.IX Item "@sysconfdir@/pki/CA/cacert.pem"
+The \s-1TLS\s0 \fBCertificate Authority\fR certificate libvirtd will use.
+.ie n .IP "\fI\fI@sysconfdir\fI@/pki/libvirt/servercert.pem\fR" 4
+.el .IP "\fI\f(CI@sysconfdir\fI@/pki/libvirt/servercert.pem\fR" 4
+.IX Item "@sysconfdir@/pki/libvirt/servercert.pem"
+The \s-1TLS\s0 \fBServer\fR certificate libvirtd will use.
+.ie n .IP "\fI\fI@sysconfdir\fI@/pki/libvirt/private/serverkey.pem\fR" 4
+.el .IP "\fI\f(CI@sysconfdir\fI@/pki/libvirt/private/serverkey.pem\fR" 4
+.IX Item "@sysconfdir@/pki/libvirt/private/serverkey.pem"
+The \s-1TLS\s0 \fBServer\fR private key libvirtd will use.
+.ie n .IP "\fI\fI@remote_pid_file\fI@\fR" 4
+.el .IP "\fI\f(CI@remote_pid_file\fI@\fR" 4
+.IX Item "@remote_pid_file@"
+The \s-1PID\s0 file to use, unless overridden by the \fB\-p\fR|\fB\-\-pid\-file\fR option.
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+To retrieve the version of libvirtd:
+.PP
+.Vb 3
+\& # libvirtd \-\-version
+\& libvirtd (libvirt) 0.8.2
+\& #
+.Ve
+.PP
+To start libvirtd, instructing it to daemonize and create a \s-1PID\s0 file:
+.PP
+.Vb 4
+\& # libvirtd \-d
+\& # ls \-la @remote_pid_file@
+\& \-rw\-r\-\-r\-\- 1 root root 6 Jul 9 02:40 @remote_pid_file@
+\& #
+.Ve
+.SH "BUGS"
+.IX Header "BUGS"
+Please report all bugs you discover. This should be done via either:
+.IP "a) the mailing list" 4
+.IX Item "a) the mailing list"
+<http://libvirt.org/contact.html>
+.IP "or," 4
+.IX Item "or,"
+\&\fB\fR
+.IP "b) the bug tracker" 4
+.IX Item "b) the bug tracker"
+<http://libvirt.org/bugs.html>
+.IP "Alternatively, you may report bugs to your software distributor / vendor." 4
+.IX Item "Alternatively, you may report bugs to your software distributor / vendor."
+.SH "AUTHORS"
+.IX Header "AUTHORS"
+Please refer to the \s-1AUTHORS\s0 file distributed with libvirt.
+.SH "COPYRIGHT"
+.IX Header "COPYRIGHT"
+Copyright (C) 2006\-2010 Red Hat, Inc., and the authors listed in the
+libvirt \s-1AUTHORS\s0 file.
+.SH "LICENSE"
+.IX Header "LICENSE"
+libvirtd is distributed under the terms of the \s-1GNU\s0 \s-1LGPL\s0 v2.1+.
+This is free software; see the source for copying conditions. There
+is \s-1NO\s0 warranty; not even for \s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0
+\&\s-1PURPOSE\s0
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIvirsh\fR\|(1), \fIvirt\-install\fR\|(1), \fIvirt\-xml\-validate\fR\|(1), \fIvirt\-top\fR\|(1),
+\&\fIvirt\-df\fR\|(1), <http://www.libvirt.org/>
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index f4b332713..78183163a 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1,7 +1,7 @@
/*
* libvirtd.c: daemon start of day, guest process & i/o management
*
- * Copyright (C) 2006-2010 Red Hat, Inc.
+ * Copyright (C) 2006-2011 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -63,6 +63,7 @@
#include "remote_driver.h"
#include "conf.h"
#include "event.h"
+#include "event_poll.h"
#include "memory.h"
#include "stream.h"
#include "hooks.h"
@@ -80,6 +81,9 @@
# ifdef WITH_LXC
# include "lxc/lxc_driver.h"
# endif
+# ifdef WITH_LIBXL
+# include "libxl/libxl_driver.h"
+# endif
# ifdef WITH_UML
# include "uml/uml_driver.h"
# endif
@@ -246,6 +250,26 @@ static void sig_handler(int sig, siginfo_t * siginfo,
errno = origerrno;
}
+static void sig_fatal(int sig, siginfo_t * siginfo ATTRIBUTE_UNUSED,
+ void* context ATTRIBUTE_UNUSED) {
+ struct sigaction sig_action;
+ int origerrno;
+
+ origerrno = errno;
+ virLogEmergencyDumpAll(sig);
+
+ /*
+ * If the signal is fatal, avoid looping over this handler
+ * by desactivating it
+ */
+ if (sig != SIGUSR2) {
+ sig_action.sa_flags = SA_SIGINFO;
+ sig_action.sa_handler = SIG_IGN;
+ sigaction(sig, &sig_action, NULL);
+ }
+ errno = origerrno;
+}
+
static void qemudDispatchClientEvent(int watch, int fd, int events, void *opaque);
static void qemudDispatchServerEvent(int watch, int fd, int events, void *opaque);
static int qemudStartWorker(struct qemud_server *server, struct qemud_worker *worker);
@@ -310,7 +334,7 @@ remoteInitializeGnuTLS (void)
if (remoteCheckCertFile("CA certificate", ca_file) < 0)
return -1;
- qemudDebug ("loading CA cert from %s", ca_file);
+ VIR_DEBUG("loading CA cert from %s", ca_file);
err = gnutls_certificate_set_x509_trust_file (x509_cred, ca_file,
GNUTLS_X509_FMT_PEM);
if (err < 0) {
@@ -324,7 +348,7 @@ remoteInitializeGnuTLS (void)
if (remoteCheckCertFile("CA revocation list", crl_file) < 0)
return -1;
- DEBUG("loading CRL from %s", crl_file);
+ VIR_DEBUG("loading CRL from %s", crl_file);
err = gnutls_certificate_set_x509_crl_file (x509_cred, crl_file,
GNUTLS_X509_FMT_PEM);
if (err < 0) {
@@ -339,7 +363,7 @@ remoteInitializeGnuTLS (void)
return -1;
if (remoteCheckCertFile("server key", key_file) < 0)
return -1;
- DEBUG("loading cert and key from %s and %s", cert_file, key_file);
+ VIR_DEBUG("loading cert and key from %s and %s", cert_file, key_file);
err =
gnutls_certificate_set_x509_key_file (x509_cred,
cert_file, key_file,
@@ -582,6 +606,7 @@ static int qemudListenUnix(struct qemud_server *server,
if (bind(sock->fd, &sock->addr.data.sa, sock->addr.len) < 0) {
VIR_ERROR(_("Failed to bind socket to '%s': %s"),
path, virStrerror(errno, ebuf, sizeof ebuf));
+ umask(oldmask);
goto cleanup;
}
umask(oldmask);
@@ -872,8 +897,7 @@ static struct qemud_server *qemudInitialize(void) {
return NULL;
}
- if (virEventInit() < 0) {
- VIR_ERROR0(_("Failed to initialize event system"));
+ if (virEventRegisterDefaultImpl() < 0) {
virMutexDestroy(&server->lock);
if (virCondDestroy(&server->job) < 0)
{}
@@ -922,6 +946,9 @@ static struct qemud_server *qemudInitialize(void) {
# ifdef WITH_NWFILTER
nwfilterRegister();
# endif
+# ifdef WITH_LIBXL
+ libxlRegister();
+# endif
# ifdef WITH_QEMU
qemuRegister();
# endif
@@ -936,13 +963,6 @@ static struct qemud_server *qemudInitialize(void) {
# endif
#endif
- virEventRegisterImpl(virEventAddHandleImpl,
- virEventUpdateHandleImpl,
- virEventRemoveHandleImpl,
- virEventAddTimeoutImpl,
- virEventUpdateTimeoutImpl,
- virEventRemoveTimeoutImpl);
-
return server;
}
@@ -1084,12 +1104,12 @@ static int qemudNetworkEnable(struct qemud_server *server) {
sock = server->sockets;
while (sock) {
- if ((sock->watch = virEventAddHandleImpl(sock->fd,
- VIR_EVENT_HANDLE_READABLE |
- VIR_EVENT_HANDLE_ERROR |
- VIR_EVENT_HANDLE_HANGUP,
- qemudDispatchServerEvent,
- server, NULL)) < 0) {
+ if ((sock->watch = virEventAddHandle(sock->fd,
+ VIR_EVENT_HANDLE_READABLE |
+ VIR_EVENT_HANDLE_ERROR |
+ VIR_EVENT_HANDLE_HANGUP,
+ qemudDispatchServerEvent,
+ server, NULL)) < 0) {
VIR_ERROR0(_("Failed to add server event callback"));
return -1;
}
@@ -1150,7 +1170,7 @@ remoteCheckDN (const char *dname)
}
/* Print the client's DN. */
- DEBUG(_("remoteCheckDN: failed: client DN is %s"), dname);
+ VIR_DEBUG("remoteCheckDN: failed: client DN is %s", dname);
return 0; /* Not found. */
}
@@ -1521,7 +1541,7 @@ error:
*/
void qemudDispatchClientFailure(struct qemud_client *client) {
if (client->watch != -1) {
- virEventRemoveHandleImpl(client->watch);
+ virEventRemoveHandle(client->watch);
client->watch = -1;
}
@@ -1531,7 +1551,7 @@ void qemudDispatchClientFailure(struct qemud_client *client) {
for (i = 0 ; i < VIR_DOMAIN_EVENT_ID_LAST ; i++) {
if (client->domainEventCallbackID[i] != -1) {
- DEBUG("Deregistering to relay remote events %d", i);
+ VIR_DEBUG("Deregistering to relay remote events %d", i);
virConnectDomainEventDeregisterAny(client->conn,
client->domainEventCallbackID[i]);
}
@@ -1678,7 +1698,7 @@ static ssize_t qemudClientReadBuf(struct qemud_client *client,
return -1;
}
- /*qemudDebug ("qemudClientRead: len = %d", len);*/
+ /* VIR_DEBUG("qemudClientRead: len = %d", len);*/
if (!client->tlssession) {
char ebuf[1024];
@@ -1812,7 +1832,7 @@ static ssize_t qemudClientRead(struct qemud_client *client) {
*/
static void qemudDispatchClientRead(struct qemud_server *server,
struct qemud_client *client) {
- /*qemudDebug ("qemudDispatchClientRead: mode = %d", client->mode);*/
+ /* VIR_DEBUG("qemudDispatchClientRead: mode = %d", client->mode);*/
readmore:
if (qemudClientRead(client) < 0)
@@ -1830,14 +1850,14 @@ readmore:
if (!xdr_u_int(&x, &len)) {
xdr_destroy (&x);
- DEBUG0("Failed to decode packet length");
+ VIR_DEBUG0("Failed to decode packet length");
qemudDispatchClientFailure(client);
return;
}
xdr_destroy (&x);
if (len < REMOTE_MESSAGE_HEADER_XDR_LEN) {
- DEBUG("Packet length %u too small", len);
+ VIR_DEBUG("Packet length %u too small", len);
qemudDispatchClientFailure(client);
return;
}
@@ -1846,7 +1866,7 @@ readmore:
len -= REMOTE_MESSAGE_HEADER_XDR_LEN;
if (len > REMOTE_MESSAGE_MAX) {
- DEBUG("Packet length %u too large", len);
+ VIR_DEBUG("Packet length %u too large", len);
qemudDispatchClientFailure(client);
return;
}
@@ -2215,10 +2235,10 @@ int qemudRegisterClientEvent(struct qemud_server *server,
mode = qemudCalculateHandleMode(client);
- if ((client->watch = virEventAddHandleImpl(client->fd,
- mode,
- qemudDispatchClientEvent,
- server, NULL)) < 0)
+ if ((client->watch = virEventAddHandle(client->fd,
+ mode,
+ qemudDispatchClientEvent,
+ server, NULL)) < 0)
return -1;
return 0;
@@ -2232,7 +2252,7 @@ void qemudUpdateClientEvent(struct qemud_client *client) {
mode = qemudCalculateHandleMode(client);
- virEventUpdateHandleImpl(client->watch, mode);
+ virEventUpdateHandle(client->watch, mode);
}
@@ -2262,7 +2282,7 @@ qemudDispatchServerEvent(int watch, int fd, int events, void *opaque) {
static int qemudOneLoop(void) {
sig_atomic_t errors;
- if (virEventRunOnce() < 0)
+ if (virEventRunDefaultImpl() < 0)
return -1;
/* Check for any signal handling errors and log them. */
@@ -2283,10 +2303,10 @@ static void qemudInactiveTimer(int timerid, void *data) {
if (virStateActive() ||
server->clients) {
- DEBUG0("Timer expired but still active, not shutting down");
- virEventUpdateTimeoutImpl(timerid, -1);
+ VIR_DEBUG0("Timer expired but still active, not shutting down");
+ virEventUpdateTimeout(timerid, -1);
} else {
- DEBUG0("Timer expired and inactive, shutting down");
+ VIR_DEBUG0("Timer expired and inactive, shutting down");
server->quitEventThread = 1;
}
}
@@ -2327,9 +2347,9 @@ static void *qemudRunLoop(void *opaque) {
virMutexLock(&server->lock);
if (timeout > 0 &&
- (timerid = virEventAddTimeoutImpl(-1,
- qemudInactiveTimer,
- server, NULL)) < 0) {
+ (timerid = virEventAddTimeout(-1,
+ qemudInactiveTimer,
+ server, NULL)) < 0) {
VIR_ERROR0(_("Failed to register shutdown timeout"));
return NULL;
}
@@ -2357,15 +2377,15 @@ static void *qemudRunLoop(void *opaque) {
if (timeout > 0) {
if (timerActive) {
if (server->clients) {
- DEBUG("Deactivating shutdown timer %d", timerid);
- virEventUpdateTimeoutImpl(timerid, -1);
+ VIR_DEBUG("Deactivating shutdown timer %d", timerid);
+ virEventUpdateTimeout(timerid, -1);
timerActive = 0;
}
} else {
if (!virStateActive() &&
!server->clients) {
- DEBUG("Activating shutdown timer %d", timerid);
- virEventUpdateTimeoutImpl(timerid, timeout * 1000);
+ VIR_DEBUG("Activating shutdown timer %d", timerid);
+ virEventUpdateTimeout(timerid, timeout * 1000);
timerActive = 1;
}
}
@@ -2374,7 +2394,7 @@ static void *qemudRunLoop(void *opaque) {
virMutexUnlock(&server->lock);
if (qemudOneLoop() < 0) {
virMutexLock(&server->lock);
- DEBUG0("Loop iteration error, exiting");
+ VIR_DEBUG0("Loop iteration error, exiting");
break;
}
virMutexLock(&server->lock);
@@ -2481,7 +2501,7 @@ static void qemudCleanup(struct qemud_server *server) {
while (sock) {
struct qemud_socket *next = sock->next;
if (sock->watch)
- virEventRemoveHandleImpl(sock->watch);
+ virEventRemoveHandle(sock->watch);
VIR_FORCE_CLOSE(sock->fd);
/* Unlink unix domain sockets which are not in
@@ -2698,18 +2718,24 @@ remoteReadSaslAllowedUsernameList (virConfPtr conf ATTRIBUTE_UNUSED,
/*
* Set up the logging environment
- * By default if daemonized all errors go to syslog and the logging
- * is also saved onto the logfile libvird.log, but if verbose or error
- * debugging is asked for then output informations or debug.
+ * By default if daemonized all errors go to the logfile libvirtd.log,
+ * but if verbose or error debugging is asked for then also output
+ * informational and debug messages. Default size if 64 kB.
*/
static int
-qemudSetLogging(virConfPtr conf, const char *filename)
+qemudSetLogging(struct qemud_server *server, virConfPtr conf,
+ const char *filename)
{
int log_level = 0;
+ int log_buffer_size = 64;
char *log_filters = NULL;
char *log_outputs = NULL;
+ char *log_file = NULL;
int ret = -1;
+ GET_CONF_INT (conf, filename, log_buffer_size);
+ virLogSetBufferSize(log_buffer_size);
+
virLogReset();
/*
@@ -2743,19 +2769,30 @@ qemudSetLogging(virConfPtr conf, const char *filename)
}
/*
- * If no defined outputs, then direct to syslog when running
+ * If no defined outputs, then direct to libvirtd.log when running
* as daemon. Otherwise the default output is stderr.
*/
if (virLogGetNbOutputs() == 0) {
char *tmp = NULL;
+
if (godaemon) {
- if (virAsprintf (&tmp, "%d:syslog:libvirtd",
- virLogGetDefaultPriority()) < 0)
- goto free_and_fail;
+ if (server->privileged) {
+ if (virAsprintf(&tmp, "%d:file:%s/log/libvirt/libvirtd.log",
+ virLogGetDefaultPriority(),
+ LOCALSTATEDIR) == -1)
+ goto out_of_memory;
+ } else {
+ char *userdir = virGetUserDirectory(geteuid());
+ if (!userdir)
+ goto free_and_fail;
+
+ if (virAsprintf(&tmp, "%d:file:%s/.libvirt/libvirtd.log",
+ virLogGetDefaultPriority(), userdir) == -1)
+ goto out_of_memory;
+ }
} else {
- if (virAsprintf (&tmp, "%d:stderr",
- virLogGetDefaultPriority()) < 0)
- goto free_and_fail;
+ if (virAsprintf(&tmp, "%d:stderr", virLogGetDefaultPriority()) < 0)
+ goto out_of_memory;
}
virLogParseOutputs(tmp);
VIR_FREE(tmp);
@@ -2772,7 +2809,21 @@ qemudSetLogging(virConfPtr conf, const char *filename)
free_and_fail:
VIR_FREE(log_filters);
VIR_FREE(log_outputs);
+ VIR_FREE(log_file);
return(ret);
+
+out_of_memory:
+ virReportOOMError();
+ goto free_and_fail;
+}
+
+/*
+ * Stop logging
+ */
+static void
+qemudStopLogging(void)
+{
+ virLogShutdown();
}
/* Read the config file if it exists.
@@ -2805,7 +2856,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
/*
* First get all the logging settings and activate them
*/
- if (qemudSetLogging(conf, filename) < 0)
+ if (qemudSetLogging(server, conf, filename) < 0)
goto free_and_fail;
GET_CONF_INT (conf, filename, listen_tcp);
@@ -3019,13 +3070,25 @@ daemonSetupSignals(struct qemud_server *server)
sigaction(SIGQUIT, &sig_action, NULL);
sigaction(SIGTERM, &sig_action, NULL);
+ /*
+ * catch fatal errors to dump a log, also hook to USR2 for dynamic
+ * debugging purposes or testing
+ */
+ sig_action.sa_sigaction = sig_fatal;
+ sigaction(SIGFPE, &sig_action, NULL);
+ sigaction(SIGSEGV, &sig_action, NULL);
+ sigaction(SIGILL, &sig_action, NULL);
+ sigaction(SIGABRT, &sig_action, NULL);
+ sigaction(SIGBUS, &sig_action, NULL);
+ sigaction(SIGUSR2, &sig_action, NULL);
+
sig_action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &sig_action, NULL);
- if (virEventAddHandleImpl(sigpipe[0],
- VIR_EVENT_HANDLE_READABLE,
- qemudDispatchSignalEvent,
- server, NULL) < 0) {
+ if (virEventAddHandle(sigpipe[0],
+ VIR_EVENT_HANDLE_READABLE,
+ qemudDispatchSignalEvent,
+ server, NULL) < 0) {
VIR_ERROR0(_("Failed to register callback for signal pipe"));
goto error;
}
@@ -3225,16 +3288,20 @@ int main(int argc, char **argv) {
/* Ensure the rundir exists (on tmpfs on some systems) */
if (geteuid() == 0) {
const char *rundir = LOCALSTATEDIR "/run/libvirt";
+ mode_t old_umask;
+ old_umask = umask(022);
if (mkdir (rundir, 0755)) {
if (errno != EEXIST) {
char ebuf[1024];
VIR_ERROR(_("unable to create rundir %s: %s"), rundir,
virStrerror(errno, ebuf, sizeof(ebuf)));
ret = VIR_DAEMON_ERR_RUNDIR;
+ umask(old_umask);
goto error;
}
}
+ umask(old_umask);
}
/* Beyond this point, nothing should rely on using
@@ -3369,6 +3436,6 @@ error:
qemudCleanup(server);
if (pid_file)
unlink (pid_file);
- virLogShutdown();
+ qemudStopLogging();
return ret;
}
diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf
index 163a80fb0..3a071b0fc 100644
--- a/daemon/libvirtd.conf
+++ b/daemon/libvirtd.conf
@@ -313,6 +313,13 @@
# log_outputs="3:syslog:libvirtd"
# to log all warnings and errors to syslog under the libvirtd ident
+# Log debug buffer size: default 64
+# The daemon keeps an internal debug log buffer which will be dumped in case
+# of crash or upon receiving a SIGUSR2 signal. This setting allows to override
+# the default buffer size in kilobytes.
+# If value is 0 or less the debug log buffer is deactivated
+#log_buffer_size = 64
+
##################################################################
#
diff --git a/daemon/libvirtd.h b/daemon/libvirtd.h
index af20e565e..7da3cfd29 100644
--- a/daemon/libvirtd.h
+++ b/daemon/libvirtd.h
@@ -1,7 +1,7 @@
/*
* libvirtd.h: daemon data structure definitions
*
- * Copyright (C) 2006-2010 Red Hat, Inc.
+ * Copyright (C) 2006-2011 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -128,8 +128,6 @@
# endif
# endif
-# define qemudDebug DEBUG
-
/* Whether we're passing reads & writes through a sasl SSF */
enum qemud_sasl_ssf {
QEMUD_SASL_SSF_NONE = 0,
diff --git a/daemon/libvirtd.logrotate.in b/daemon/libvirtd.logrotate.in
new file mode 100644
index 000000000..4e02510c8
--- /dev/null
+++ b/daemon/libvirtd.logrotate.in
@@ -0,0 +1,9 @@
+@localstatedir@/log/libvirt/libvirtd.log {
+ weekly
+ missingok
+ rotate 4
+ compress
+ delaycompress
+ copytruncate
+ minsize 100k
+}
diff --git a/daemon/mdns.c b/daemon/mdns.c
index ae8dc40fd..03695fddb 100644
--- a/daemon/mdns.c
+++ b/daemon/mdns.c
@@ -40,9 +40,10 @@
#include "libvirtd.h"
#include "mdns.h"
#include "event.h"
+#include "event_poll.h"
#include "memory.h"
-#define AVAHI_DEBUG(fmt, ...) DEBUG(fmt, __VA_ARGS__)
+#define AVAHI_DEBUG(fmt, ...) VIR_DEBUG(fmt, __VA_ARGS__)
struct libvirtd_mdns_entry {
char *type;
@@ -230,7 +231,7 @@ static void libvirtd_mdns_client_callback(AvahiClient *c, AvahiClientState state
static void libvirtd_mdns_watch_dispatch(int watch, int fd, int events, void *opaque)
{
AvahiWatch *w = (AvahiWatch*)opaque;
- int fd_events = virEventHandleTypeToPollEvent(events);
+ int fd_events = virEventPollToNativeEvents(events);
AVAHI_DEBUG("Dispatch watch %d FD %d Event %d", watch, fd, fd_events);
w->revents = fd_events;
w->callback(w, fd, fd_events, w->userdata);
@@ -256,11 +257,11 @@ static AvahiWatch *libvirtd_mdns_watch_new(const AvahiPoll *api ATTRIBUTE_UNUSED
w->userdata = userdata;
AVAHI_DEBUG("New handle %p FD %d Event %d", w, w->fd, event);
- hEvents = virPollEventToEventHandleType(event);
- if ((w->watch = virEventAddHandleImpl(fd, hEvents,
- libvirtd_mdns_watch_dispatch,
- w,
- libvirtd_mdns_watch_dofree)) < 0) {
+ hEvents = virEventPollFromNativeEvents(event);
+ if ((w->watch = virEventAddHandle(fd, hEvents,
+ libvirtd_mdns_watch_dispatch,
+ w,
+ libvirtd_mdns_watch_dofree)) < 0) {
VIR_FREE(w);
return NULL;
}
@@ -271,7 +272,7 @@ static AvahiWatch *libvirtd_mdns_watch_new(const AvahiPoll *api ATTRIBUTE_UNUSED
static void libvirtd_mdns_watch_update(AvahiWatch *w, AvahiWatchEvent event)
{
AVAHI_DEBUG("Update handle %p FD %d Event %d", w, w->fd, event);
- virEventUpdateHandleImpl(w->watch, event);
+ virEventUpdateHandle(w->watch, event);
}
static AvahiWatchEvent libvirtd_mdns_watch_get_events(AvahiWatch *w)
@@ -283,14 +284,14 @@ static AvahiWatchEvent libvirtd_mdns_watch_get_events(AvahiWatch *w)
static void libvirtd_mdns_watch_free(AvahiWatch *w)
{
AVAHI_DEBUG("Free handle %p %d", w, w->fd);
- virEventRemoveHandleImpl(w->watch);
+ virEventRemoveHandle(w->watch);
}
static void libvirtd_mdns_timeout_dispatch(int timer ATTRIBUTE_UNUSED, void *opaque)
{
AvahiTimeout *t = (AvahiTimeout*)opaque;
AVAHI_DEBUG("Dispatch timeout %p %d", t, timer);
- virEventUpdateTimeoutImpl(t->timer, -1);
+ virEventUpdateTimeout(t->timer, -1);
t->callback(t, t->userdata);
}
@@ -329,10 +330,10 @@ static AvahiTimeout *libvirtd_mdns_timeout_new(const AvahiPoll *api ATTRIBUTE_UN
timeout = -1;
}
- t->timer = virEventAddTimeoutImpl(timeout,
- libvirtd_mdns_timeout_dispatch,
- t,
- libvirtd_mdns_timeout_dofree);
+ t->timer = virEventAddTimeout(timeout,
+ libvirtd_mdns_timeout_dispatch,
+ t,
+ libvirtd_mdns_timeout_dofree);
t->callback = cb;
t->userdata = userdata;
@@ -364,13 +365,13 @@ static void libvirtd_mdns_timeout_update(AvahiTimeout *t, const struct timeval *
timeout = -1;
}
- virEventUpdateTimeoutImpl(t->timer, timeout);
+ virEventUpdateTimeout(t->timer, timeout);
}
static void libvirtd_mdns_timeout_free(AvahiTimeout *t)
{
AVAHI_DEBUG("Free timeout %p", t);
- virEventRemoveTimeoutImpl(t->timer);
+ virEventRemoveTimeout(t->timer);
}
diff --git a/daemon/remote.c b/daemon/remote.c
index d53b46640..a343da58c 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -60,9 +60,10 @@
#include "uuid.h"
#include "network.h"
#include "libvirt/libvirt-qemu.h"
+#include "command.h"
#define VIR_FROM_THIS VIR_FROM_REMOTE
-#define REMOTE_DEBUG(fmt, ...) DEBUG(fmt, __VA_ARGS__)
+#define REMOTE_DEBUG(fmt, ...) VIR_DEBUG(fmt, __VA_ARGS__)
static virDomainPtr get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain);
static virNetworkPtr get_nonnull_network (virConnectPtr conn, remote_nonnull_network network);
@@ -757,8 +758,8 @@ remoteDispatchDomainGetSchedulerType (struct qemud_server *server ATTRIBUTE_UNUS
type = virDomainGetSchedulerType (dom, &nparams);
if (type == NULL) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -801,9 +802,9 @@ remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUT
r = virDomainGetSchedulerParameters (dom, params, &nparams);
if (r == -1) {
+ remoteDispatchConnError(rerr, conn);
virDomainFree(dom);
VIR_FREE(params);
- remoteDispatchConnError(rerr, conn);
return -1;
}
@@ -908,12 +909,13 @@ remoteDispatchDomainSetSchedulerParameters (struct qemud_server *server ATTRIBUT
}
r = virDomainSetSchedulerParameters (dom, params, nparams);
- virDomainFree(dom);
VIR_FREE(params);
if (r == -1) {
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
+ virDomainFree(dom);
return 0;
}
@@ -939,8 +941,8 @@ remoteDispatchDomainBlockStats (struct qemud_server *server ATTRIBUTE_UNUSED,
path = args->path;
if (virDomainBlockStats (dom, path, &stats, sizeof stats) == -1) {
- virDomainFree (dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree (dom);
return -1;
}
virDomainFree (dom);
@@ -975,8 +977,8 @@ remoteDispatchDomainInterfaceStats (struct qemud_server *server ATTRIBUTE_UNUSED
path = args->path;
if (virDomainInterfaceStats (dom, path, &stats, sizeof stats) == -1) {
- virDomainFree (dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree (dom);
return -1;
}
virDomainFree (dom);
@@ -1026,12 +1028,13 @@ remoteDispatchDomainMemoryStats (struct qemud_server *server ATTRIBUTE_UNUSED,
}
nr_stats = virDomainMemoryStats (dom, stats, args->maxStats, 0);
- virDomainFree (dom);
if (nr_stats == -1) {
VIR_FREE(stats);
remoteDispatchConnError(rerr, conn);
+ virDomainFree (dom);
return -1;
}
+ virDomainFree (dom);
/* Allocate return buffer */
if (VIR_ALLOC_N(ret->stats.stats_val, args->maxStats) < 0) {
@@ -1092,8 +1095,8 @@ remoteDispatchDomainBlockPeek (struct qemud_server *server ATTRIBUTE_UNUSED,
if (virDomainBlockPeek (dom, path, offset, size,
ret->buffer.buffer_val, flags) == -1) {
/* free (ret->buffer.buffer_val); - caller frees */
- virDomainFree (dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree (dom);
return -1;
}
virDomainFree (dom);
@@ -1141,8 +1144,8 @@ remoteDispatchDomainMemoryPeek (struct qemud_server *server ATTRIBUTE_UNUSED,
if (virDomainMemoryPeek (dom, offset, size,
ret->buffer.buffer_val, flags) == -1) {
/* free (ret->buffer.buffer_val); - caller frees */
- virDomainFree (dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree (dom);
return -1;
}
virDomainFree (dom);
@@ -1168,8 +1171,8 @@ remoteDispatchDomainAttachDevice (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainAttachDevice (dom, args->xml) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1194,8 +1197,8 @@ remoteDispatchDomainAttachDeviceFlags (struct qemud_server *server ATTRIBUTE_UNU
}
if (virDomainAttachDeviceFlags (dom, args->xml, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1220,8 +1223,8 @@ remoteDispatchDomainUpdateDeviceFlags (struct qemud_server *server ATTRIBUTE_UNU
}
if (virDomainUpdateDeviceFlags (dom, args->xml, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1246,8 +1249,8 @@ remoteDispatchDomainCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainCreate (dom) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1272,8 +1275,8 @@ remoteDispatchDomainCreateWithFlags (struct qemud_server *server ATTRIBUTE_UNUSE
}
if (virDomainCreateWithFlags (dom, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -1346,8 +1349,8 @@ remoteDispatchDomainDestroy (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainDestroy (dom) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1372,8 +1375,8 @@ remoteDispatchDomainDetachDevice (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainDetachDevice (dom, args->xml) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -1399,8 +1402,8 @@ remoteDispatchDomainDetachDeviceFlags (struct qemud_server *server ATTRIBUTE_UNU
}
if (virDomainDetachDeviceFlags (dom, args->xml, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -1428,8 +1431,8 @@ remoteDispatchDomainDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this. */
ret->xml = virDomainGetXMLDesc (dom, args->flags);
if (!ret->xml) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1497,8 +1500,8 @@ remoteDispatchDomainGetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainGetAutostart (dom, &ret->autostart) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1524,8 +1527,8 @@ remoteDispatchDomainGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainGetInfo (dom, &info) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -1559,8 +1562,8 @@ remoteDispatchDomainGetMaxMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
ret->memory = virDomainGetMaxMemory (dom);
if (ret->memory == 0) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1586,8 +1589,8 @@ remoteDispatchDomainGetMaxVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
ret->num = virDomainGetMaxVcpus (dom);
if (ret->num == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1614,8 +1617,8 @@ remoteDispatchDomainGetSecurityLabel(struct qemud_server *server ATTRIBUTE_UNUSE
memset(&seclabel, 0, sizeof seclabel);
if (virDomainGetSecurityLabel(dom, &seclabel) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -1686,8 +1689,8 @@ remoteDispatchDomainGetOsType (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this */
ret->type = virDomainGetOSType (dom);
if (ret->type == NULL) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1737,10 +1740,10 @@ remoteDispatchDomainGetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
info, args->maxinfo,
cpumaps, args->maplen);
if (info_len == -1) {
+ remoteDispatchConnError(rerr, conn);
VIR_FREE(info);
VIR_FREE(cpumaps);
virDomainFree(dom);
- remoteDispatchConnError(rerr, conn);
return -1;
}
@@ -1794,8 +1797,8 @@ remoteDispatchDomainGetVcpusFlags (struct qemud_server *server ATTRIBUTE_UNUSED,
ret->num = virDomainGetVcpusFlags (dom, args->flags);
if (ret->num == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1877,11 +1880,12 @@ remoteDispatchDomainMigratePerform (struct qemud_server *server ATTRIBUTE_UNUSED
args->cookie.cookie_len,
args->uri,
args->flags, dname, args->resource);
- virDomainFree (dom);
if (r == -1) {
remoteDispatchConnError(rerr, conn);
+ virDomainFree (dom);
return -1;
}
+ virDomainFree (dom);
return 0;
}
@@ -2013,8 +2017,8 @@ remoteDispatchDomainMigratePrepareTunnel(struct qemud_server *server ATTRIBUTE_U
args->flags, dname, args->resource,
args->dom_xml);
if (r == -1) {
- remoteFreeClientStream(client, stream);
remoteDispatchConnError(rerr, conn);
+ remoteFreeClientStream(client, stream);
return -1;
}
@@ -2175,8 +2179,8 @@ remoteDispatchDomainPinVcpu (struct qemud_server *server ATTRIBUTE_UNUSED,
(unsigned char *) args->cpumap.cpumap_val,
args->cpumap.cpumap_len);
if (rv == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2201,8 +2205,8 @@ remoteDispatchDomainReboot (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainReboot (dom, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2245,8 +2249,8 @@ remoteDispatchDomainResume (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainResume (dom) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2271,8 +2275,8 @@ remoteDispatchDomainSave (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainSave (dom, args->to) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2297,8 +2301,8 @@ remoteDispatchDomainCoreDump (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainCoreDump (dom, args->to, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2323,8 +2327,8 @@ remoteDispatchDomainSetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainSetAutostart (dom, args->autostart) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2349,8 +2353,8 @@ remoteDispatchDomainSetMaxMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainSetMaxMemory (dom, args->memory) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2375,8 +2379,8 @@ remoteDispatchDomainSetMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainSetMemory (dom, args->memory) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2384,6 +2388,32 @@ remoteDispatchDomainSetMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
}
static int
+remoteDispatchDomainSetMemoryFlags (struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_domain_set_memory_flags_args *args,
+ void *ret ATTRIBUTE_UNUSED)
+{
+ virDomainPtr dom;
+
+ dom = get_nonnull_domain (conn, args->dom);
+ if (dom == NULL) {
+ remoteDispatchConnError(rerr, conn);
+ return -1;
+ }
+
+ if (virDomainSetMemoryFlags (dom, args->memory, args->flags) == -1) {
+ remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
+ return -1;
+ }
+ virDomainFree(dom);
+ return 0;
+}
+
+static int
remoteDispatchDomainSetMemoryParameters(struct qemud_server *server
ATTRIBUTE_UNUSED,
struct qemud_client *client
@@ -2465,12 +2495,13 @@ remoteDispatchDomainSetMemoryParameters(struct qemud_server *server
}
r = virDomainSetMemoryParameters(dom, params, nparams, flags);
- virDomainFree(dom);
VIR_FREE(params);
if (r == -1) {
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
+ virDomainFree(dom);
return 0;
}
@@ -2515,9 +2546,9 @@ remoteDispatchDomainGetMemoryParameters(struct qemud_server *server
r = virDomainGetMemoryParameters(dom, params, &nparams, flags);
if (r == -1) {
+ remoteDispatchConnError(rerr, conn);
virDomainFree(dom);
VIR_FREE(params);
- remoteDispatchConnError(rerr, conn);
return -1;
}
/* In this case, we need to send back the number of parameters
@@ -2594,6 +2625,217 @@ remoteDispatchDomainGetMemoryParameters(struct qemud_server *server
}
static int
+remoteDispatchDomainSetBlkioParameters(struct qemud_server *server
+ ATTRIBUTE_UNUSED,
+ struct qemud_client *client
+ ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *
+ hdr ATTRIBUTE_UNUSED,
+ remote_error * rerr,
+ remote_domain_set_blkio_parameters_args
+ * args, void *ret ATTRIBUTE_UNUSED)
+{
+ virDomainPtr dom;
+ int i, r, nparams;
+ virBlkioParameterPtr params;
+ unsigned int flags;
+
+ nparams = args->params.params_len;
+ flags = args->flags;
+
+ if (nparams > REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX) {
+ remoteDispatchFormatError(rerr, "%s", _("nparams too large"));
+ return -1;
+ }
+ if (VIR_ALLOC_N(params, nparams) < 0) {
+ remoteDispatchOOMError(rerr);
+ return -1;
+ }
+
+ /* Deserialise parameters. */
+ for (i = 0; i < nparams; ++i) {
+ if (virStrcpyStatic
+ (params[i].field, args->params.params_val[i].field) == NULL) {
+ remoteDispatchFormatError(rerr,
+ _
+ ("Field %s too big for destination"),
+ args->params.params_val[i].field);
+ return -1;
+ }
+ params[i].type = args->params.params_val[i].value.type;
+ switch (params[i].type) {
+ case VIR_DOMAIN_BLKIO_PARAM_INT:
+ params[i].value.i =
+ args->params.params_val[i].value.
+ remote_blkio_param_value_u.i;
+ break;
+ case VIR_DOMAIN_BLKIO_PARAM_UINT:
+ params[i].value.ui =
+ args->params.params_val[i].value.
+ remote_blkio_param_value_u.ui;
+ break;
+ case VIR_DOMAIN_BLKIO_PARAM_LLONG:
+ params[i].value.l =
+ args->params.params_val[i].value.
+ remote_blkio_param_value_u.l;
+ break;
+ case VIR_DOMAIN_BLKIO_PARAM_ULLONG:
+ params[i].value.ul =
+ args->params.params_val[i].value.
+ remote_blkio_param_value_u.ul;
+ break;
+ case VIR_DOMAIN_BLKIO_PARAM_DOUBLE:
+ params[i].value.d =
+ args->params.params_val[i].value.
+ remote_blkio_param_value_u.d;
+ break;
+ case VIR_DOMAIN_BLKIO_PARAM_BOOLEAN:
+ params[i].value.b =
+ args->params.params_val[i].value.
+ remote_blkio_param_value_u.b;
+ break;
+ }
+ }
+
+ dom = get_nonnull_domain(conn, args->dom);
+ if (dom == NULL) {
+ VIR_FREE(params);
+ remoteDispatchConnError(rerr, conn);
+ return -1;
+ }
+
+ r = virDomainSetBlkioParameters(dom, params, nparams, flags);
+ VIR_FREE(params);
+ if (r == -1) {
+ remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
+ return -1;
+ }
+ virDomainFree(dom);
+
+ return 0;
+}
+
+static int
+remoteDispatchDomainGetBlkioParameters(struct qemud_server *server
+ ATTRIBUTE_UNUSED,
+ struct qemud_client *client
+ ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *
+ hdr ATTRIBUTE_UNUSED,
+ remote_error * rerr,
+ remote_domain_get_blkio_parameters_args
+ * args,
+ remote_domain_get_blkio_parameters_ret
+ * ret)
+{
+ virDomainPtr dom;
+ virBlkioParameterPtr params;
+ int i, r, nparams;
+ unsigned int flags;
+
+ nparams = args->nparams;
+ flags = args->flags;
+
+ if (nparams > REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX) {
+ remoteDispatchFormatError(rerr, "%s", _("nparams too large"));
+ return -1;
+ }
+ if (VIR_ALLOC_N(params, nparams) < 0) {
+ remoteDispatchOOMError(rerr);
+ return -1;
+ }
+
+ dom = get_nonnull_domain(conn, args->dom);
+ if (dom == NULL) {
+ VIR_FREE(params);
+ remoteDispatchConnError(rerr, conn);
+ return -1;
+ }
+
+ r = virDomainGetBlkioParameters(dom, params, &nparams, flags);
+ if (r == -1) {
+ remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
+ VIR_FREE(params);
+ return -1;
+ }
+ /* In this case, we need to send back the number of parameters
+ * supported
+ */
+ if (args->nparams == 0) {
+ ret->nparams = nparams;
+ goto success;
+ }
+
+ /* Serialise the blkio parameters. */
+ ret->params.params_len = nparams;
+ if (VIR_ALLOC_N(ret->params.params_val, nparams) < 0)
+ goto oom;
+
+ for (i = 0; i < nparams; ++i) {
+ // remoteDispatchClientRequest will free this:
+ ret->params.params_val[i].field = strdup(params[i].field);
+ if (ret->params.params_val[i].field == NULL)
+ goto oom;
+
+ ret->params.params_val[i].value.type = params[i].type;
+ switch (params[i].type) {
+ case VIR_DOMAIN_BLKIO_PARAM_INT:
+ ret->params.params_val[i].
+ value.remote_blkio_param_value_u.i =
+ params[i].value.i;
+ break;
+ case VIR_DOMAIN_BLKIO_PARAM_UINT:
+ ret->params.params_val[i].
+ value.remote_blkio_param_value_u.ui =
+ params[i].value.ui;
+ break;
+ case VIR_DOMAIN_BLKIO_PARAM_LLONG:
+ ret->params.params_val[i].
+ value.remote_blkio_param_value_u.l =
+ params[i].value.l;
+ break;
+ case VIR_DOMAIN_BLKIO_PARAM_ULLONG:
+ ret->params.params_val[i].
+ value.remote_blkio_param_value_u.ul =
+ params[i].value.ul;
+ break;
+ case VIR_DOMAIN_BLKIO_PARAM_DOUBLE:
+ ret->params.params_val[i].
+ value.remote_blkio_param_value_u.d =
+ params[i].value.d;
+ break;
+ case VIR_DOMAIN_BLKIO_PARAM_BOOLEAN:
+ ret->params.params_val[i].
+ value.remote_blkio_param_value_u.b =
+ params[i].value.b;
+ break;
+ default:
+ remoteDispatchFormatError(rerr, "%s", _("unknown type"));
+ goto cleanup;
+ }
+ }
+
+ success:
+ virDomainFree(dom);
+ VIR_FREE(params);
+
+ return 0;
+
+ oom:
+ remoteDispatchOOMError(rerr);
+ cleanup:
+ virDomainFree(dom);
+ for (i = 0; i < nparams; i++)
+ VIR_FREE(ret->params.params_val[i].field);
+ VIR_FREE(params);
+ return -1;
+}
+
+static int
remoteDispatchDomainSetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
@@ -2611,8 +2853,8 @@ remoteDispatchDomainSetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainSetVcpus (dom, args->nvcpus) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2637,8 +2879,8 @@ remoteDispatchDomainSetVcpusFlags (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainSetVcpusFlags (dom, args->nvcpus, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2663,8 +2905,8 @@ remoteDispatchDomainShutdown (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainShutdown (dom) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2689,8 +2931,8 @@ remoteDispatchDomainSuspend (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainSuspend (dom) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2715,8 +2957,8 @@ remoteDispatchDomainUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainUndefine (dom) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2808,8 +3050,8 @@ remoteDispatchDomainManagedSave (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainManagedSave (dom, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2835,8 +3077,8 @@ remoteDispatchDomainHasManagedSaveImage (struct qemud_server *server ATTRIBUTE_U
ret->ret = virDomainHasManagedSaveImage (dom, args->flags);
if (ret->ret == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2861,8 +3103,8 @@ remoteDispatchDomainManagedSaveRemove (struct qemud_server *server ATTRIBUTE_UNU
}
if (virDomainManagedSaveRemove (dom, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2921,8 +3163,8 @@ remoteDispatchNetworkCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNetworkCreate (net) == -1) {
- virNetworkFree(net);
remoteDispatchConnError(rerr, conn);
+ virNetworkFree(net);
return -1;
}
virNetworkFree(net);
@@ -2991,8 +3233,8 @@ remoteDispatchNetworkDestroy (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNetworkDestroy (net) == -1) {
- virNetworkFree(net);
remoteDispatchConnError(rerr, conn);
+ virNetworkFree(net);
return -1;
}
virNetworkFree(net);
@@ -3019,8 +3261,8 @@ remoteDispatchNetworkDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this. */
ret->xml = virNetworkGetXMLDesc (net, args->flags);
if (!ret->xml) {
- virNetworkFree(net);
remoteDispatchConnError(rerr, conn);
+ virNetworkFree(net);
return -1;
}
virNetworkFree(net);
@@ -3045,8 +3287,8 @@ remoteDispatchNetworkGetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNetworkGetAutostart (net, &ret->autostart) == -1) {
- virNetworkFree(net);
remoteDispatchConnError(rerr, conn);
+ virNetworkFree(net);
return -1;
}
virNetworkFree(net);
@@ -3073,8 +3315,8 @@ remoteDispatchNetworkGetBridgeName (struct qemud_server *server ATTRIBUTE_UNUSED
/* remoteDispatchClientRequest will free this. */
ret->name = virNetworkGetBridgeName (net);
if (!ret->name) {
- virNetworkFree(net);
remoteDispatchConnError(rerr, conn);
+ virNetworkFree(net);
return -1;
}
virNetworkFree(net);
@@ -3143,8 +3385,8 @@ remoteDispatchNetworkSetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNetworkSetAutostart (net, args->autostart) == -1) {
- virNetworkFree(net);
remoteDispatchConnError(rerr, conn);
+ virNetworkFree(net);
return -1;
}
virNetworkFree(net);
@@ -3169,8 +3411,8 @@ remoteDispatchNetworkUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNetworkUndefine (net) == -1) {
- virNetworkFree(net);
remoteDispatchConnError(rerr, conn);
+ virNetworkFree(net);
return -1;
}
virNetworkFree(net);
@@ -3406,8 +3648,8 @@ remoteDispatchInterfaceGetXmlDesc (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this. */
ret->xml = virInterfaceGetXMLDesc (iface, args->flags);
if (!ret->xml) {
- virInterfaceFree(iface);
remoteDispatchConnError(rerr, conn);
+ virInterfaceFree(iface);
return -1;
}
virInterfaceFree(iface);
@@ -3454,8 +3696,8 @@ remoteDispatchInterfaceUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virInterfaceUndefine (iface) == -1) {
- virInterfaceFree(iface);
remoteDispatchConnError(rerr, conn);
+ virInterfaceFree(iface);
return -1;
}
virInterfaceFree(iface);
@@ -3480,8 +3722,8 @@ remoteDispatchInterfaceCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virInterfaceCreate (iface, args->flags) == -1) {
- virInterfaceFree(iface);
remoteDispatchConnError(rerr, conn);
+ virInterfaceFree(iface);
return -1;
}
virInterfaceFree(iface);
@@ -3506,8 +3748,8 @@ remoteDispatchInterfaceDestroy (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virInterfaceDestroy (iface, args->flags) == -1) {
- virInterfaceFree(iface);
remoteDispatchConnError(rerr, conn);
+ virInterfaceFree(iface);
return -1;
}
virInterfaceFree(iface);
@@ -4127,8 +4369,10 @@ remoteDispatchAuthPolkit (struct qemud_server *server,
goto authfail;
}
if (status != 0) {
- VIR_ERROR(_("Policy kit denied action %s from pid %d, uid %d, result: %d"),
- action, callerPid, callerUid, status);
+ char *tmp = virCommandTranslateStatus(status);
+ VIR_ERROR(_("Policy kit denied action %s from pid %d, uid %d: %s"),
+ action, callerPid, callerUid, NULLSTR(tmp));
+ VIR_FREE(tmp);
goto authdeny;
}
PROBE(CLIENT_AUTH_ALLOW, "fd=%d, auth=%d, username=%s",
@@ -4420,8 +4664,8 @@ remoteDispatchStoragePoolCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStoragePoolCreate (pool, args->flags) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4490,8 +4734,8 @@ remoteDispatchStoragePoolBuild (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStoragePoolBuild (pool, args->flags) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4517,8 +4761,8 @@ remoteDispatchStoragePoolDestroy (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStoragePoolDestroy (pool) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4543,8 +4787,8 @@ remoteDispatchStoragePoolDelete (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStoragePoolDelete (pool, args->flags) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4569,8 +4813,8 @@ remoteDispatchStoragePoolRefresh (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStoragePoolRefresh (pool, args->flags) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4596,8 +4840,8 @@ remoteDispatchStoragePoolGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStoragePoolGetInfo (pool, &info) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
@@ -4631,8 +4875,8 @@ remoteDispatchStoragePoolDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this. */
ret->xml = virStoragePoolGetXMLDesc (pool, args->flags);
if (!ret->xml) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4657,8 +4901,8 @@ remoteDispatchStoragePoolGetAutostart (struct qemud_server *server ATTRIBUTE_UNU
}
if (virStoragePoolGetAutostart (pool, &ret->autostart) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4729,11 +4973,12 @@ remoteDispatchStoragePoolLookupByVolume (struct qemud_server *server ATTRIBUTE_U
}
pool = virStoragePoolLookupByVolume (vol);
- virStorageVolFree(vol);
if (pool == NULL) {
remoteDispatchConnError(rerr, conn);
+ virStorageVolFree(vol);
return -1;
}
+ virStorageVolFree(vol);
make_nonnull_storage_pool (&ret->pool, pool);
virStoragePoolFree(pool);
@@ -4758,8 +5003,8 @@ remoteDispatchStoragePoolSetAutostart (struct qemud_server *server ATTRIBUTE_UNU
}
if (virStoragePoolSetAutostart (pool, args->autostart) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4784,8 +5029,8 @@ remoteDispatchStoragePoolUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStoragePoolUndefine (pool) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4863,12 +5108,13 @@ remoteDispatchStoragePoolListVolumes (struct qemud_server *server ATTRIBUTE_UNUS
ret->names.names_len =
virStoragePoolListVolumes (pool,
ret->names.names_val, args->maxnames);
- virStoragePoolFree(pool);
if (ret->names.names_len == -1) {
VIR_FREE(ret->names.names_val);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
+ virStoragePoolFree(pool);
return 0;
}
@@ -4892,11 +5138,12 @@ remoteDispatchStoragePoolNumOfVolumes (struct qemud_server *server ATTRIBUTE_UNU
}
ret->num = virStoragePoolNumOfVolumes (pool);
- virStoragePoolFree(pool);
if (ret->num == -1) {
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
+ virStoragePoolFree(pool);
return 0;
}
@@ -4927,11 +5174,12 @@ remoteDispatchStorageVolCreateXml (struct qemud_server *server ATTRIBUTE_UNUSED,
}
vol = virStorageVolCreateXML (pool, args->xml, args->flags);
- virStoragePoolFree(pool);
if (vol == NULL) {
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
+ virStoragePoolFree(pool);
make_nonnull_storage_vol (&ret->vol, vol);
virStorageVolFree(vol);
@@ -4958,19 +5206,21 @@ remoteDispatchStorageVolCreateXmlFrom (struct qemud_server *server ATTRIBUTE_UNU
clonevol = get_nonnull_storage_vol (conn, args->clonevol);
if (clonevol == NULL) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
newvol = virStorageVolCreateXMLFrom (pool, args->xml, clonevol,
args->flags);
- virStorageVolFree(clonevol);
- virStoragePoolFree(pool);
if (newvol == NULL) {
remoteDispatchConnError(rerr, conn);
+ virStorageVolFree(clonevol);
+ virStoragePoolFree(pool);
return -1;
}
+ virStorageVolFree(clonevol);
+ virStoragePoolFree(pool);
make_nonnull_storage_vol (&ret->vol, newvol);
virStorageVolFree(newvol);
@@ -4995,8 +5245,8 @@ remoteDispatchStorageVolDelete (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStorageVolDelete (vol, args->flags) == -1) {
- virStorageVolFree(vol);
remoteDispatchConnError(rerr, conn);
+ virStorageVolFree(vol);
return -1;
}
virStorageVolFree(vol);
@@ -5054,8 +5304,8 @@ remoteDispatchStorageVolGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStorageVolGetInfo (vol, &info) == -1) {
- virStorageVolFree(vol);
remoteDispatchConnError(rerr, conn);
+ virStorageVolFree(vol);
return -1;
}
@@ -5088,8 +5338,8 @@ remoteDispatchStorageVolDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this. */
ret->xml = virStorageVolGetXMLDesc (vol, args->flags);
if (!ret->xml) {
- virStorageVolFree(vol);
remoteDispatchConnError(rerr, conn);
+ virStorageVolFree(vol);
return -1;
}
virStorageVolFree(vol);
@@ -5117,8 +5367,8 @@ remoteDispatchStorageVolGetPath (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this. */
ret->name = virStorageVolGetPath (vol);
if (!ret->name) {
- virStorageVolFree(vol);
remoteDispatchConnError(rerr, conn);
+ virStorageVolFree(vol);
return -1;
}
virStorageVolFree(vol);
@@ -5145,11 +5395,12 @@ remoteDispatchStorageVolLookupByName (struct qemud_server *server ATTRIBUTE_UNUS
}
vol = virStorageVolLookupByName (pool, args->name);
- virStoragePoolFree(pool);
if (vol == NULL) {
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
+ virStoragePoolFree(pool);
make_nonnull_storage_vol (&ret->vol, vol);
virStorageVolFree(vol);
@@ -5386,8 +5637,8 @@ remoteDispatchNodeDeviceNumOfCaps (struct qemud_server *server ATTRIBUTE_UNUSED,
ret->num = virNodeDeviceNumOfCaps(dev);
if (ret->num < 0) {
- virNodeDeviceFree(dev);
remoteDispatchConnError(rerr, conn);
+ virNodeDeviceFree(dev);
return -1;
}
@@ -5432,8 +5683,8 @@ remoteDispatchNodeDeviceListCaps (struct qemud_server *server ATTRIBUTE_UNUSED,
virNodeDeviceListCaps (dev, ret->names.names_val,
args->maxnames);
if (ret->names.names_len == -1) {
- virNodeDeviceFree(dev);
remoteDispatchConnError(rerr, conn);
+ virNodeDeviceFree(dev);
VIR_FREE(ret->names.names_val);
return -1;
}
@@ -5462,8 +5713,8 @@ remoteDispatchNodeDeviceDettach (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNodeDeviceDettach(dev) == -1) {
- virNodeDeviceFree(dev);
remoteDispatchConnError(rerr, conn);
+ virNodeDeviceFree(dev);
return -1;
}
@@ -5491,8 +5742,8 @@ remoteDispatchNodeDeviceReAttach (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNodeDeviceReAttach(dev) == -1) {
- virNodeDeviceFree(dev);
remoteDispatchConnError(rerr, conn);
+ virNodeDeviceFree(dev);
return -1;
}
@@ -5520,8 +5771,8 @@ remoteDispatchNodeDeviceReset (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNodeDeviceReset(dev) == -1) {
- virNodeDeviceFree(dev);
remoteDispatchConnError(rerr, conn);
+ virNodeDeviceFree(dev);
return -1;
}
@@ -5572,8 +5823,8 @@ remoteDispatchNodeDeviceDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNodeDeviceDestroy(dev) == -1) {
- virNodeDeviceFree(dev);
remoteDispatchConnError(rerr, conn);
+ virNodeDeviceFree(dev);
return -1;
}
@@ -5953,8 +6204,8 @@ static int remoteDispatchDomainIsActive(struct qemud_server *server ATTRIBUTE_UN
ret->active = virDomainIsActive(domain);
if (ret->active < 0) {
- virDomainFree(domain);
remoteDispatchConnError(err, conn);
+ virDomainFree(domain);
return -1;
}
@@ -5981,8 +6232,8 @@ static int remoteDispatchDomainIsPersistent(struct qemud_server *server ATTRIBUT
ret->persistent = virDomainIsPersistent(domain);
if (ret->persistent < 0) {
- virDomainFree(domain);
remoteDispatchConnError(err, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6009,8 +6260,8 @@ static int remoteDispatchDomainIsUpdated(struct qemud_server *server ATTRIBUTE_U
ret->updated = virDomainIsUpdated(domain);
if (ret->updated < 0) {
- virDomainFree(domain);
remoteDispatchConnError(err, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6037,8 +6288,8 @@ static int remoteDispatchInterfaceIsActive(struct qemud_server *server ATTRIBUTE
ret->active = virInterfaceIsActive(iface);
if (ret->active < 0) {
- virInterfaceFree(iface);
remoteDispatchConnError(err, conn);
+ virInterfaceFree(iface);
return -1;
}
@@ -6065,8 +6316,8 @@ static int remoteDispatchNetworkIsActive(struct qemud_server *server ATTRIBUTE_U
ret->active = virNetworkIsActive(network);
if (ret->active < 0) {
- virNetworkFree(network);
remoteDispatchConnError(err, conn);
+ virNetworkFree(network);
return -1;
}
@@ -6093,8 +6344,8 @@ static int remoteDispatchNetworkIsPersistent(struct qemud_server *server ATTRIBU
ret->persistent = virNetworkIsPersistent(network);
if (ret->persistent < 0) {
- virNetworkFree(network);
remoteDispatchConnError(err, conn);
+ virNetworkFree(network);
return -1;
}
@@ -6121,8 +6372,8 @@ static int remoteDispatchStoragePoolIsActive(struct qemud_server *server ATTRIBU
ret->active = virStoragePoolIsActive(pool);
if (ret->active < 0) {
- virStoragePoolFree(pool);
remoteDispatchConnError(err, conn);
+ virStoragePoolFree(pool);
return -1;
}
@@ -6149,8 +6400,8 @@ static int remoteDispatchStoragePoolIsPersistent(struct qemud_server *server ATT
ret->persistent = virStoragePoolIsPersistent(pool);
if (ret->persistent < 0) {
- virStoragePoolFree(pool);
remoteDispatchConnError(err, conn);
+ virStoragePoolFree(pool);
return -1;
}
@@ -6245,8 +6496,8 @@ remoteDispatchDomainGetJobInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainGetJobInfo (dom, &info) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -6287,8 +6538,8 @@ remoteDispatchDomainAbortJob (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainAbortJob (dom) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -6316,11 +6567,39 @@ remoteDispatchDomainMigrateSetMaxDowntime(struct qemud_server *server ATTRIBUTE_
}
if (virDomainMigrateSetMaxDowntime(dom, args->downtime, args->flags) == -1) {
+ remoteDispatchConnError(rerr, conn);
virDomainFree(dom);
+ return -1;
+ }
+
+ virDomainFree(dom);
+
+ return 0;
+}
+
+static int
+remoteDispatchDomainMigrateSetMaxSpeed(struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_domain_migrate_set_max_speed_args *args,
+ void *ret ATTRIBUTE_UNUSED)
+{
+ virDomainPtr dom;
+
+ dom = get_nonnull_domain(conn, args->dom);
+ if (dom == NULL) {
remoteDispatchConnError(rerr, conn);
return -1;
}
+ if (virDomainMigrateSetMaxSpeed(dom, args->bandwidth, args->flags) == -1) {
+ remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
+ return -1;
+ }
+
virDomainFree(dom);
return 0;
@@ -6346,8 +6625,8 @@ remoteDispatchDomainSnapshotCreateXml (struct qemud_server *server ATTRIBUTE_UNU
snapshot = virDomainSnapshotCreateXML(domain, args->xml_desc, args->flags);
if (snapshot == NULL) {
- virDomainFree(domain);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6388,12 +6667,12 @@ remoteDispatchDomainSnapshotDumpXml (struct qemud_server *server ATTRIBUTE_UNUSE
rc = 0;
cleanup:
+ if (rc < 0)
+ remoteDispatchConnError(rerr, conn);
if (snapshot)
virDomainSnapshotFree(snapshot);
if (domain)
virDomainFree(domain);
- if (rc < 0)
- remoteDispatchConnError(rerr, conn);
return rc;
}
@@ -6417,8 +6696,8 @@ remoteDispatchDomainSnapshotNum (struct qemud_server *server ATTRIBUTE_UNUSED,
ret->num = virDomainSnapshotNum(domain, args->flags);
if (ret->num == -1) {
- virDomainFree(domain);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6462,9 +6741,9 @@ remoteDispatchDomainSnapshotListNames (struct qemud_server *server ATTRIBUTE_UNU
args->nameslen,
args->flags);
if (ret->names.names_len == -1) {
+ remoteDispatchConnError(rerr, conn);
virDomainFree(domain);
VIR_FREE(ret->names.names_val);
- remoteDispatchConnError(rerr, conn);
return -1;
}
@@ -6493,8 +6772,8 @@ remoteDispatchDomainSnapshotLookupByName (struct qemud_server *server ATTRIBUTE_
snapshot = virDomainSnapshotLookupByName(domain, args->name, args->flags);
if (snapshot == NULL) {
- virDomainFree(domain);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6526,8 +6805,8 @@ remoteDispatchDomainHasCurrentSnapshot(struct qemud_server *server ATTRIBUTE_UNU
result = virDomainHasCurrentSnapshot(domain, args->flags);
if (result < 0) {
- virDomainFree(domain);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6558,8 +6837,8 @@ remoteDispatchDomainSnapshotCurrent(struct qemud_server *server ATTRIBUTE_UNUSED
snapshot = virDomainSnapshotCurrent(domain, args->flags);
if (snapshot == NULL) {
- virDomainFree(domain);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6598,12 +6877,12 @@ remoteDispatchDomainRevertToSnapshot (struct qemud_server *server ATTRIBUTE_UNUS
rc = 0;
cleanup:
+ if (rc < 0)
+ remoteDispatchConnError(rerr, conn);
if (snapshot)
virDomainSnapshotFree(snapshot);
if (domain)
virDomainFree(domain);
- if (rc < 0)
- remoteDispatchConnError(rerr, conn);
return rc;
}
@@ -6635,12 +6914,12 @@ remoteDispatchDomainSnapshotDelete (struct qemud_server *server ATTRIBUTE_UNUSED
rc = 0;
cleanup:
+ if (rc < 0)
+ remoteDispatchConnError(rerr, conn);
if (snapshot)
virDomainSnapshotFree(snapshot);
if (domain)
virDomainFree(domain);
- if (rc < 0)
- remoteDispatchConnError(rerr, conn);
return rc;
}
@@ -6805,8 +7084,8 @@ remoteDispatchNwfilterUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNWFilterUndefine (nwfilter) == -1) {
- virNWFilterFree(nwfilter);
remoteDispatchConnError(rerr, conn);
+ virNWFilterFree(nwfilter);
return -1;
}
virNWFilterFree(nwfilter);
@@ -6868,8 +7147,8 @@ remoteDispatchNwfilterGetXmlDesc (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this. */
ret->xml = virNWFilterGetXMLDesc (nwfilter, args->flags);
if (!ret->xml) {
- virNWFilterFree(nwfilter);
remoteDispatchConnError(rerr, conn);
+ virNWFilterFree(nwfilter);
return -1;
}
virNWFilterFree(nwfilter);
@@ -6916,8 +7195,8 @@ remoteDispatchDomainGetBlockInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainGetBlockInfo (dom, args->path, &info, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -6949,8 +7228,8 @@ qemuDispatchMonitorCommand (struct qemud_server *server ATTRIBUTE_UNUSED,
if (virDomainQemuMonitorCommand(domain, args->cmd, &ret->result,
args->flags) == -1) {
- virDomainFree(domain);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6993,15 +7272,15 @@ remoteDispatchDomainOpenConsole(struct qemud_server *server ATTRIBUTE_UNUSED,
stream->st,
args->flags);
if (r == -1) {
+ remoteDispatchConnError(rerr, conn);
virDomainFree(dom);
remoteFreeClientStream(client, stream);
- remoteDispatchConnError(rerr, conn);
return -1;
}
if (remoteAddClientStream(client, stream, 1) < 0) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
virStreamAbort(stream->st);
remoteFreeClientStream(client, stream);
return -1;
diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h
index 57962d10d..15fa1a01a 100644
--- a/daemon/remote_dispatch_args.h
+++ b/daemon/remote_dispatch_args.h
@@ -172,3 +172,7 @@
remote_domain_open_console_args val_remote_domain_open_console_args;
remote_domain_is_updated_args val_remote_domain_is_updated_args;
remote_get_sysinfo_args val_remote_get_sysinfo_args;
+ remote_domain_set_memory_flags_args val_remote_domain_set_memory_flags_args;
+ remote_domain_set_blkio_parameters_args val_remote_domain_set_blkio_parameters_args;
+ remote_domain_get_blkio_parameters_args val_remote_domain_get_blkio_parameters_args;
+ remote_domain_migrate_set_max_speed_args val_remote_domain_migrate_set_max_speed_args;
diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h
index e59701ac7..3fcf87c84 100644
--- a/daemon/remote_dispatch_prototypes.h
+++ b/daemon/remote_dispatch_prototypes.h
@@ -218,6 +218,14 @@ static int remoteDispatchDomainGetAutostart(
remote_error *err,
remote_domain_get_autostart_args *args,
remote_domain_get_autostart_ret *ret);
+static int remoteDispatchDomainGetBlkioParameters(
+ struct qemud_server *server,
+ struct qemud_client *client,
+ virConnectPtr conn,
+ remote_message_header *hdr,
+ remote_error *err,
+ remote_domain_get_blkio_parameters_args *args,
+ remote_domain_get_blkio_parameters_ret *ret);
static int remoteDispatchDomainGetBlockInfo(
struct qemud_server *server,
struct qemud_client *client,
@@ -474,6 +482,14 @@ static int remoteDispatchDomainMigrateSetMaxDowntime(
remote_error *err,
remote_domain_migrate_set_max_downtime_args *args,
void *ret);
+static int remoteDispatchDomainMigrateSetMaxSpeed(
+ struct qemud_server *server,
+ struct qemud_client *client,
+ virConnectPtr conn,
+ remote_message_header *hdr,
+ remote_error *err,
+ remote_domain_migrate_set_max_speed_args *args,
+ void *ret);
static int remoteDispatchDomainOpenConsole(
struct qemud_server *server,
struct qemud_client *client,
@@ -538,6 +554,14 @@ static int remoteDispatchDomainSetAutostart(
remote_error *err,
remote_domain_set_autostart_args *args,
void *ret);
+static int remoteDispatchDomainSetBlkioParameters(
+ struct qemud_server *server,
+ struct qemud_client *client,
+ virConnectPtr conn,
+ remote_message_header *hdr,
+ remote_error *err,
+ remote_domain_set_blkio_parameters_args *args,
+ void *ret);
static int remoteDispatchDomainSetMaxMemory(
struct qemud_server *server,
struct qemud_client *client,
@@ -554,6 +578,14 @@ static int remoteDispatchDomainSetMemory(
remote_error *err,
remote_domain_set_memory_args *args,
void *ret);
+static int remoteDispatchDomainSetMemoryFlags(
+ struct qemud_server *server,
+ struct qemud_client *client,
+ virConnectPtr conn,
+ remote_message_header *hdr,
+ remote_error *err,
+ remote_domain_set_memory_flags_args *args,
+ void *ret);
static int remoteDispatchDomainSetMemoryParameters(
struct qemud_server *server,
struct qemud_client *client,
diff --git a/daemon/remote_dispatch_ret.h b/daemon/remote_dispatch_ret.h
index 78e54694f..114e832e8 100644
--- a/daemon/remote_dispatch_ret.h
+++ b/daemon/remote_dispatch_ret.h
@@ -139,3 +139,4 @@
remote_domain_get_vcpus_flags_ret val_remote_domain_get_vcpus_flags_ret;
remote_domain_is_updated_ret val_remote_domain_is_updated_ret;
remote_get_sysinfo_ret val_remote_get_sysinfo_ret;
+ remote_domain_get_blkio_parameters_ret val_remote_domain_get_blkio_parameters_ret;
diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h
index 5d2739072..c5f6653d0 100644
--- a/daemon/remote_dispatch_table.h
+++ b/daemon/remote_dispatch_table.h
@@ -1022,3 +1022,23 @@
.args_filter = (xdrproc_t) xdr_remote_get_sysinfo_args,
.ret_filter = (xdrproc_t) xdr_remote_get_sysinfo_ret,
},
+{ /* DomainSetMemoryFlags => 204 */
+ .fn = (dispatch_fn) remoteDispatchDomainSetMemoryFlags,
+ .args_filter = (xdrproc_t) xdr_remote_domain_set_memory_flags_args,
+ .ret_filter = (xdrproc_t) xdr_void,
+},
+{ /* DomainSetBlkioParameters => 205 */
+ .fn = (dispatch_fn) remoteDispatchDomainSetBlkioParameters,
+ .args_filter = (xdrproc_t) xdr_remote_domain_set_blkio_parameters_args,
+ .ret_filter = (xdrproc_t) xdr_void,
+},
+{ /* DomainGetBlkioParameters => 206 */
+ .fn = (dispatch_fn) remoteDispatchDomainGetBlkioParameters,
+ .args_filter = (xdrproc_t) xdr_remote_domain_get_blkio_parameters_args,
+ .ret_filter = (xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret,
+},
+{ /* DomainMigrateSetMaxSpeed => 207 */
+ .fn = (dispatch_fn) remoteDispatchDomainMigrateSetMaxSpeed,
+ .args_filter = (xdrproc_t) xdr_remote_domain_migrate_set_max_speed_args,
+ .ret_filter = (xdrproc_t) xdr_void,
+},
diff --git a/daemon/stream.c b/daemon/stream.c
index cac54ea68..967aea228 100644
--- a/daemon/stream.c
+++ b/daemon/stream.c
@@ -82,7 +82,7 @@ remoteStreamEvent(virStreamPtr st, int events, void *opaque)
goto cleanup;
}
- DEBUG("st=%p events=%d", st, events);
+ VIR_DEBUG("st=%p events=%d", st, events);
if (events & VIR_STREAM_EVENT_WRITABLE) {
if (remoteStreamHandleWrite(client, stream) < 0) {
@@ -149,7 +149,7 @@ remoteStreamFilter(struct qemud_client *client,
if (msg->hdr.serial == stream->serial &&
msg->hdr.proc == stream->procedure &&
msg->hdr.type == REMOTE_STREAM) {
- DEBUG("Incoming rx=%p serial=%d proc=%d status=%d",
+ VIR_DEBUG("Incoming rx=%p serial=%d proc=%d status=%d",
stream->rx, msg->hdr.proc, msg->hdr.serial, msg->hdr.status);
/* If there are queued packets, we need to queue all further
@@ -207,7 +207,7 @@ remoteCreateClientStream(virConnectPtr conn,
{
struct qemud_client_stream *stream;
- DEBUG("proc=%d serial=%d", hdr->proc, hdr->serial);
+ VIR_DEBUG("proc=%d serial=%d", hdr->proc, hdr->serial);
if (VIR_ALLOC(stream) < 0)
return NULL;
@@ -241,7 +241,7 @@ void remoteFreeClientStream(struct qemud_client *client,
if (!stream)
return;
- DEBUG("proc=%d serial=%d", stream->procedure, stream->serial);
+ VIR_DEBUG("proc=%d serial=%d", stream->procedure, stream->serial);
msg = stream->rx;
while (msg) {
@@ -265,7 +265,7 @@ int remoteAddClientStream(struct qemud_client *client,
{
struct qemud_client_stream *tmp = client->streams;
- DEBUG("client=%p proc=%d serial=%d", client, stream->procedure, stream->serial);
+ VIR_DEBUG("client=%p proc=%d serial=%d", client, stream->procedure, stream->serial);
if (virStreamEventAddCallback(stream->st, 0,
remoteStreamEvent, client, NULL) < 0)
@@ -328,7 +328,7 @@ int
remoteRemoveClientStream(struct qemud_client *client,
struct qemud_client_stream *stream)
{
- DEBUG("client=%p proc=%d serial=%d", client, stream->procedure, stream->serial);
+ VIR_DEBUG("client=%p proc=%d serial=%d", client, stream->procedure, stream->serial);
struct qemud_client_stream *curr = client->streams;
struct qemud_client_stream *prev = NULL;
@@ -381,7 +381,7 @@ remoteStreamHandleWriteData(struct qemud_client *client,
remote_error rerr;
int ret;
- DEBUG("stream=%p proc=%d serial=%d len=%d offset=%d",
+ VIR_DEBUG("stream=%p proc=%d serial=%d len=%d offset=%d",
stream, msg->hdr.proc, msg->hdr.serial, msg->bufferLength, msg->bufferOffset);
memset(&rerr, 0, sizeof rerr);
@@ -426,7 +426,7 @@ remoteStreamHandleFinish(struct qemud_client *client,
remote_error rerr;
int ret;
- DEBUG("stream=%p proc=%d serial=%d",
+ VIR_DEBUG("stream=%p proc=%d serial=%d",
stream, msg->hdr.proc, msg->hdr.serial);
memset(&rerr, 0, sizeof rerr);
@@ -460,7 +460,7 @@ remoteStreamHandleAbort(struct qemud_client *client,
{
remote_error rerr;
- DEBUG("stream=%p proc=%d serial=%d",
+ VIR_DEBUG("stream=%p proc=%d serial=%d",
stream, msg->hdr.proc, msg->hdr.serial);
memset(&rerr, 0, sizeof rerr);
@@ -495,7 +495,7 @@ remoteStreamHandleWrite(struct qemud_client *client,
{
struct qemud_client_message *msg, *tmp;
- DEBUG("stream=%p", stream);
+ VIR_DEBUG("stream=%p", stream);
msg = stream->rx;
while (msg && !stream->closed) {
@@ -550,7 +550,7 @@ remoteStreamHandleRead(struct qemud_client *client,
size_t bufferLen = REMOTE_MESSAGE_PAYLOAD_MAX;
int ret;
- DEBUG("stream=%p", stream);
+ VIR_DEBUG("stream=%p", stream);
/* Shouldn't ever be called unless we're marked able to
* transmit, but doesn't hurt to check */
@@ -603,7 +603,7 @@ remoteStreamMessageFinished(struct qemud_client *client,
stream = stream->next;
}
- DEBUG("Message client=%p stream=%p proc=%d serial=%d", client, stream, msg->hdr.proc, msg->hdr.serial);
+ VIR_DEBUG("Message client=%p stream=%p proc=%d serial=%d", client, stream, msg->hdr.proc, msg->hdr.serial);
if (stream) {
stream->tx = 1;