[libvirt] [PATCH 0/2] Rework RPC message buffer
by Michal Privoznik
This patch set tries to fix corner cases where libvirt runs on huge
system, e.g. 4K CPU monster. In these cases, capabilities XML is
enormously big, as we are transferring info about each singe CPU core
(to which NUMA node it belongs, etc.). This XML is bigger than our
RPC limit, therefore users cannot get it as it is dropped on server,
leaving them with inability to connect. Therefore we need to increase
those limits (whole RPC message and RPC string). However, simple
lifting up will work, but increase mem usage.
Therefore I've reworked RPC buffer handling: changed it from
'statically' to dynamically allocated.
So in most cases - when small messages are sent - this will even
decrease our memory consumption. Leaving us flexible for corner cases
described above.
On the other hand, I realize we've had our history with RPC breakage.
So I think I'll require more than 1 ACK before pushing.
What's your opinion?
Michal Privoznik (2):
rpc: Switch to dynamically allocated message buffer
rpc: Size up RPC limits
src/remote/remote_protocol.x | 2 +-
src/rpc/virnetclient.c | 16 ++-
src/rpc/virnetmessage.c | 12 ++-
src/rpc/virnetmessage.h | 6 +-
src/rpc/virnetprotocol.x | 6 +-
src/rpc/virnetserverclient.c | 20 ++-
tests/virnetmessagetest.c | 393 +++++++++++++++++++++++-------------------
7 files changed, 268 insertions(+), 187 deletions(-)
--
1.7.8.5
12 years, 6 months
[libvirt] [PATCH] docs: Serialize running apibuild.py
by Cole Robinson
Use a witness file approach like we do for python/generator.py,
as suggested by Eric. Fixes the build issue reported here:
https://www.redhat.com/archives/libvir-list/2012-April/msg01435.html
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
.gitignore | 1 +
docs/Makefile.am | 12 ++++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index 14a21d0..3cc30e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,6 +54,7 @@
/daemon/libvirtd.init
/daemon/libvirtd.pod
/daemon/libvirtd.service
+/docs/apibuild.py.stamp
/docs/devhelp/libvirt.devhelp
/docs/hvsupport.html.in
/docs/libvirt-api.xml
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 53328f7..9bcc866 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -200,12 +200,19 @@ python_generated_files = \
$(srcdir)/libvirt-qemu-api.xml \
$(srcdir)/libvirt-qemu-refs.xml
-$(python_generated_files): $(srcdir)/apibuild.py \
+APIBUILD="$(srcdir)/apibuild.py"
+APIBUILD_STAMP="$(APIBUILD).stamp"
+
+$(python_generated_files): $(APIBUILD_STAMP)
+
+$(APIBUILD_STAMP): $(srcdir)/apibuild.py \
$(srcdir)/../include/libvirt/*.h \
$(srcdir)/../src/libvirt.c \
$(srcdir)/../src/libvirt-qemu.c \
$(srcdir)/../src/util/virterror.c
- $(AM_V_GEN)srcdir=$(srcdir) $(PYTHON) $(srcdir)/apibuild.py
+ $(AM_V_GEN)srcdir=$(srcdir) $(PYTHON) $(APIBUILD)
+ touch $@
+
check-local: all
@@ -215,6 +222,7 @@ clean-local:
maintainer-clean-local: clean-local
rm -rf $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml todo.html.in hvsupport.html.in
rm -rf $(srcdir)/libvirt-qemu-api.xml $(srcdir)/libvirt-qemu-refs.xml
+ rm -rf $(APIBUILD_STAMP)
rebuild: api qemu_api all
--
1.7.7.6
12 years, 6 months
[libvirt] [PATCH] docs: mention migration issue of which credentials are used
by Eric Blake
Based on a report by Seth Vidal. Just because _you_ can use virsh
to connect to both source and destinations does not mean that libvirtd
on the source (aka _root_) can likewise connect to the destination;
this matters when setting up a peer-to-peer migration instead of a
native one.
* docs/migration.html.in: Mention that in peer-to-peer, the owner
of the source libvirtd (usually root) must be able to connect to
the destination.
---
docs/migration.html.in | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/docs/migration.html.in b/docs/migration.html.in
index 9d9d9b9..6a0483d 100644
--- a/docs/migration.html.in
+++ b/docs/migration.html.in
@@ -87,7 +87,13 @@
daemon controls the entire migration process itself, by directly
connecting the destination host libvirtd. If the client application crashes,
or otherwise loses its connection to libvirtd, the migration process
- will continue uninterrupted until completion.
+ will continue uninterrupted until completion. Note that the
+ source libvirtd uses its own credentials to connect to the
+ destination (typically root), rather than the credentials used
+ by the client to connect to the host; if these differ, it is
+ common to run into a situation where a client can connect to the
+ destination directly but the host cannot make the connection to
+ set up the peer-to-peer migration.
</p>
<p>
@@ -139,7 +145,9 @@
connection to the source host, where the virtual guest is
currently running. The second URI is that of the libvirt
connection to the destination host, where the virtual guest
- will be moved to. The third URI is a hypervisor specific
+ will be moved to (and in peer-to-peer migrations, this is from
+ the perspective of the source, not the client). The third URI is
+ a hypervisor specific
URI used to control how the guest will be migrated. With
any managed migration flow, the first and second URIs are
compulsory, while the third URI is optional. With the
@@ -533,7 +541,10 @@
destination libvirtd server will automatically determine
the native hypervisor URI for migration, based off the
primary hostname. There is no scope for forcing an alternative
- network interface for the native migration data with this method.
+ network interface for the native migration data with this
+ method. The destination URI must be reachable using the source
+ libvirtd credentials (which are not necessarily the same as the
+ credentials of the client in connecting to the source).
</p>
<pre>
@@ -571,7 +582,10 @@
in case it is not accessible using the same address that
the client uses to connect to the destination, or a different
encryption/auth scheme is required. The native hypervisor URI
- format is not used at all.
+ format is not used at all. The destination URI must be
+ reachable using the source libvirtd credentials (which are not
+ necessarily the same as the credentials of the client in
+ connecting to the source).
</p>
<pre>
--
1.7.7.6
12 years, 6 months
[libvirt] [PATCHv2 0/2] a new flag VIR_DOMAIN_CPU_STATS_VCPU
by Hu Tao
From: root <root(a)KERNEL-128.(none)>
This series adds a new flag VIR_DOMAIN_CPU_STATS_VCPU to
virDomainGetCPUStats, which is for getting statistics of
physical cpu time consumed by virtual cpus.
Changes:
v2:
- added detailed documentation
- added some error checks and fix some memleaks
- the two patches rearranged slightly
Hu Tao (2):
Add a new flag VIR_DOMAIN_CPU_STATS_VCPU to virDomainGetCPUStats
Adds support to VIR_DOMAIN_CPU_STATS_VCPU in qemu_driver.
include/libvirt/libvirt.h.in | 8 ++
src/libvirt.c | 9 ++-
src/qemu/qemu_driver.c | 186 ++++++++++++++++++++++++++++++++++++++----
src/util/cgroup.c | 4 +-
tools/virsh.c | 16 +++-
5 files changed, 199 insertions(+), 24 deletions(-)
12 years, 6 months
[libvirt] [PATCH libvirt 1/3] build: do not build shunloadtest if pthread missing
by Marc-André Lureau
Fixes build on Windows systems
---
configure.ac | 2 ++
tests/Makefile.am | 8 +++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 89fe818..347c48c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -154,6 +154,8 @@ AC_CHECK_FUNC([clock_gettime],[
LIBS=$old_libs
AC_SUBST(RT_LIBS)
+AM_CONDITIONAL([HAVE_PTHREAD], [test x"$HAVE_PTHREAD_H" = x"1"])
+
dnl Availability of various common headers (non-fatal if missing).
AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/un.h \
sys/poll.h syslog.h mntent.h net/ethernet.h linux/magic.h \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c4d550f..3d9235c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -98,7 +98,7 @@ test_programs = virshtest sockettest \
nodeinfotest virbuftest \
commandtest seclabeltest \
virhashtest virnetmessagetest virnetsockettest \
- utiltest virnettlscontexttest shunloadtest \
+ utiltest virnettlscontexttest \
virtimetest viruritest virkeyfiletest \
virauthconfigtest
@@ -106,6 +106,10 @@ test_programs = virshtest sockettest \
ssh_SOURCES = ssh.c
ssh_LDADD = $(COVERAGE_LDFLAGS)
+if HAVE_PTHREAD
+test_programs += shunloadtest
+endif
+
if WITH_XEN
test_programs += xml2sexprtest sexpr2xmltest \
xmconfigtest xencapstest statstest reconnect
@@ -527,10 +531,12 @@ libshunload_la_SOURCES = shunloadhelper.c
libshunload_la_LIBADD = ../src/libvirt.la
libshunload_la_LDFLAGS = -module -avoid-version -rpath /evil/libtool/hack/to/force/shared/lib/creation
+if HAVE_PTHREAD
shunloadtest_SOURCES = \
shunloadtest.c
shunloadtest_LDADD = -lpthread
shunloadtest_DEPENDENCIES = libshunload.la
+endif
if WITH_CIL
CILOPTFLAGS =
--
1.7.10
12 years, 6 months
[libvirt] [PATCHv6 0/8] live block migration
by Eric Blake
v5: https://www.redhat.com/archives/libvir-list/2012-April/msg00753.html
Differences in v6:
- rebased on top of accepted patches v5:1-4/23 and latest tree
- corresponds to patches v5:7-14/23
- patch 5/8 is new
- patch v5:12/23 is dropped; qemu is giving us something better, but
I still need to finish writing that patch
- patch v5:11/23 comments were incorporated, with better cleanup on error
- tweak series to deal with potential for qemu 1.1 to support copy
but not pivot
- limit series to just the bare minimum for now; patches from v5:15/23
are still on my tree, but not worth submitting until we know more about
what qemu will provide
I'm posting this more for reference for my efforts to backport this
to RHEL 6 where I have tested against a candidate qemu build, and
don't this is ready for upstream until we have confirmation that
actual patches have gone into at least the qemu block queue for 1.1.
Eric Blake (8):
blockjob: react to active block copy
blockjob: add qemu capabilities related to block jobs
blockjob: return appropriate event and info
blockjob: support pivot operation on cancel
blockjob: make drive-reopen safer
blockjob: implement block copy for qemu
blockjob: allow for existing files
blockjob: allow mirroring under SELinux
src/conf/domain_conf.c | 12 ++
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 3 +
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_driver.c | 396 +++++++++++++++++++++++++++++++++++++++++-
src/qemu/qemu_hotplug.c | 7 +
src/qemu/qemu_monitor.c | 37 ++++
src/qemu/qemu_monitor.h | 11 ++
src/qemu/qemu_monitor_json.c | 67 +++++++
src/qemu/qemu_monitor_json.h | 18 ++-
11 files changed, 549 insertions(+), 6 deletions(-)
--
1.7.7.6
12 years, 6 months
[libvirt] [PATCH 1/1] Support libnl-3 as well as libnl-1
by Serge Hallyn
configure.ac:
Check for libnl-3. If found, find libnl-route-3. If not found,
do the original check to look for libnl-1.
src/util/virnetlink.c:
support libnl3 api. I could play games to make the patch smaller,
but this would just hide what is actually needing to be done at
the expense of clarity.
src/Makefile.am and daemon/Makefile.am:
Add LIBNL_ROUTE3_{LIBS,CFLAGS}
Unfortunately libnl3 moves netlink/msg.h to /usr/include/libnl3/netlink/msg.h,
which is the reason why the LIBNL_CFLAGS need to be added to a bunch of
places where they weren't needed with libnl1. Those spots probaby don't
actually need to also have LIBNL*LIBS added, but while I may be looking at
it wrong, it seemed right to do so.
I haven't gotten as far as to compile this into a package on
ubuntu, but the source does build with libnl-3 as well as with
libnl-1.
Signed-off-by: Serge Hallyn <serge.hallyn(a)canonical.com>
---
configure.ac | 24 ++++++++++++-----
daemon/Makefile.am | 5 +++-
src/Makefile.am | 25 ++++++++++++------
src/util/virnetlink.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 108 insertions(+), 16 deletions(-)
diff --git a/configure.ac b/configure.ac
index a819898..ab40e1d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2626,19 +2626,29 @@ AM_CONDITIONAL([WITH_VIRTUALPORT], [test "$with_virtualport" = "yes"])
dnl netlink library
+LIBNL_ROUTE3_CFLAGS=""
+LIBNL_ROUTE3_LIBS=""
LIBNL_CFLAGS=""
LIBNL_LIBS=""
have_libnl=no
if test "$with_linux" = "yes"; then
- PKG_CHECK_MODULES([LIBNL], [libnl-1 >= $LIBNL_REQUIRED], [
+ PKG_CHECK_MODULES([LIBNL],[libnl-3.0],[
have_libnl=yes
- AC_DEFINE_UNQUOTED([HAVE_LIBNL], 1, [whether the netlink library is available])
- ], [
- if test "$with_macvtap" = "yes"; then
- AC_MSG_ERROR([libnl-devel >= $LIBNL_REQUIRED is required for macvtap support])
- fi
- ])
+ AC_DEFINE([HAVE_LIBNL3], [1], [Use libnl-3.0])
+ AC_DEFINE([HAVE_LIBNL], [1], [whether the netlink library is available])
+ PKG_CHECK_MODULES([LIBNL_ROUTE3],[libnl-route-3.0])
+ ],
+ PKG_CHECK_MODULES([LIBNL], [libnl-1 >= $LIBNL_REQUIRED], [
+ have_libnl=yes
+ AC_DEFINE_UNQUOTED([HAVE_LIBNL], 1, [whether the netlink library is available])
+ AC_DEFINE_UNQUOTED([HAVE_LIBNL1], 1, [whether the netlink v1 library is available])
+ ], [
+ if test "$with_macvtap" = "yes"; then
+ AC_MSG_ERROR([libnl-devel >= $LIBNL_REQUIRED is required for macvtap support])
+ fi
+ ])
+ )
fi
AM_CONDITIONAL([HAVE_LIBNL], [test "$have_libnl" = "yes"])
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 24cce8f..8074803 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -95,6 +95,7 @@ libvirtd_SOURCES = $(DAEMON_SOURCES)
libvirtd_CFLAGS = \
$(LIBXML_CFLAGS) $(GNUTLS_CFLAGS) $(SASL_CFLAGS) \
$(XDR_CFLAGS) $(POLKIT_CFLAGS) $(DBUS_CFLAGS) \
+ $(LIBNL_CFLAGS) $(LIBNL_ROUTE3_CFLAGS) \
$(WARN_CFLAGS) \
$(COVERAGE_CFLAGS) \
-DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\"" \
@@ -109,7 +110,9 @@ libvirtd_LDADD = \
$(GNUTLS_LIBS) \
$(SASL_LIBS) \
$(DBUS_LIBS) \
- $(POLKIT_LIBS)
+ $(POLKIT_LIBS) \
+ $(LIBNL_LIBS) \
+ $(LIBNL_ROUTE3_LIBS)
if WITH_DTRACE_PROBES
libvirtd_LDADD += ../src/probes.o
diff --git a/src/Makefile.am b/src/Makefile.am
index e48dfa5..c159c1e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -576,10 +576,10 @@ libvirt_util_la_SOURCES = \
$(UTIL_SOURCES)
libvirt_util_la_CFLAGS = $(CAPNG_CFLAGS) $(YAJL_CFLAGS) $(LIBNL_CFLAGS) \
$(AM_CFLAGS) $(AUDIT_CFLAGS) $(DEVMAPPER_CFLAGS) \
- $(DBUS_CFLAGS)
+ $(DBUS_CFLAGS) $(LIBNL_ROUTE3_CFLAGS)
libvirt_util_la_LIBADD = $(CAPNG_LIBS) $(YAJL_LIBS) $(LIBNL_LIBS) \
$(THREAD_LIBS) $(AUDIT_LIBS) $(DEVMAPPER_LIBS) \
- $(RT_LIBS) $(DBUS_LIBS)
+ $(RT_LIBS) $(DBUS_LIBS) $(LIBNL_ROUTE3_LIBS)
noinst_LTLIBRARIES += libvirt_conf.la
@@ -809,12 +809,16 @@ endif
libvirt_driver_qemu_la_CFLAGS = $(NUMACTL_CFLAGS) \
$(GNUTLS_CFLAGS) \
$(LIBXML_CFLAGS) \
+ $(LIBNL_CFLAGS) \
+ $(LIBNL_ROUTE3_CFLAGS) \
-I$(top_srcdir)/src/conf $(AM_CFLAGS)
libvirt_driver_qemu_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_qemu_la_LIBADD = $(NUMACTL_LIBS) \
$(CAPNG_LIBS) \
$(GNUTLS_LIBS) \
- $(LIBXML_LIBS)
+ $(LIBXML_LIBS) \
+ $(LIBNL_LIBS) \
+ $(LIBNL_ROUTE3_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_qemu_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_qemu_la_LDFLAGS += -module -avoid-version
@@ -840,8 +844,9 @@ noinst_LTLIBRARIES += libvirt_driver_lxc.la
#libvirt_la_BUILT_LIBADD += libvirt_driver_lxc.la
endif
libvirt_driver_lxc_la_CFLAGS = \
+ $(LIBNL_CFLAGS) $(LIBNL_ROUTE3_CFLAGS) \
-I$(top_srcdir)/src/conf $(AM_CFLAGS)
-libvirt_driver_lxc_la_LIBADD = $(CAPNG_LIBS)
+libvirt_driver_lxc_la_LIBADD = $(CAPNG_LIBS) $(LIBNL_LIBS) $(LIBNL_ROUTE3_LIBS)
if WITH_SECDRIVER_SELINUX
libvirt_driver_lxc_la_LIBADD += $(SELINUX_LIBS)
endif
@@ -941,9 +946,10 @@ noinst_LTLIBRARIES += libvirt_driver_network.la
#libvirt_la_BUILT_LIBADD += libvirt_driver_network.la
endif
libvirt_driver_network_la_CFLAGS = \
+ $(LIBNL_CFLAGS) $(LIBNL_ROUTE3_CFLAGS) \
-I$(top_srcdir)/src/conf $(AM_CFLAGS)
if WITH_DRIVER_MODULES
-libvirt_driver_network_la_LIBADD = ../gnulib/lib/libgnu.la
+libvirt_driver_network_la_LIBADD = ../gnulib/lib/libgnu.la $(LIBNL_LIBS) $(LIBNL_ROUTE3_LIBS)
libvirt_driver_network_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
endif
libvirt_driver_network_la_SOURCES = $(NETWORK_DRIVER_SOURCES)
@@ -1086,9 +1092,10 @@ libvirt_la_BUILT_LIBADD += libvirt_driver_nwfilter.la
noinst_LTLIBRARIES += libvirt_driver_nwfilter.la
endif
libvirt_driver_nwfilter_la_CFLAGS = $(LIBPCAP_CFLAGS) \
- -I$(top_srcdir)/src/conf $(AM_CFLAGS)
+ -I$(top_srcdir)/src/conf $(LIBNL_CFLAGS) \
+ $(LIBNL_ROUTE3_CFLAGS) $(AM_CFLAGS)
libvirt_driver_nwfilter_la_LDFLAGS = $(LD_AMFLAGS)
-libvirt_driver_nwfilter_la_LIBADD = $(LIBPCAP_LIBS)
+libvirt_driver_nwfilter_la_LIBADD = $(LIBPCAP_LIBS) $(LIBNL_LIBS) $(LIBNL_ROUTE3_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_nwfilter_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_nwfilter_la_LDFLAGS += -module -avoid-version
@@ -1522,7 +1529,7 @@ libvirt_lxc_LDFLAGS = $(WARN_CFLAGS) $(AM_LDFLAGS)
libvirt_lxc_LDADD = $(CAPNG_LIBS) $(YAJL_LIBS) \
$(LIBXML_LIBS) $(NUMACTL_LIBS) $(THREAD_LIBS) \
$(LIBNL_LIBS) $(AUDIT_LIBS) $(DEVMAPPER_LIBS) \
- $(RT_LIBS) $(DBUS_LIBS) \
+ $(RT_LIBS) $(DBUS_LIBS) $(LIBNL_ROUTE3_LIBS) \
../gnulib/lib/libgnu.la
if WITH_DTRACE_PROBES
libvirt_lxc_LDADD += probes.o
@@ -1540,6 +1547,8 @@ libvirt_lxc_CFLAGS = \
$(YAJL_CFLAGS) \
$(AUDIT_CFLAGS) \
$(DBUS_CFLAGS) \
+ $(LIBNL_CFLAGS) \
+ $(LIBNL_ROUTE3_CFLAGS) \
-I$(top_srcdir)/src/conf \
$(AM_CFLAGS)
if HAVE_LIBBLKID
diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index b2e9d51..1d3cd2e 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -67,7 +67,11 @@ struct _virNetlinkEventSrvPrivate {
virMutex lock;
int eventwatch;
int netlinkfd;
+#ifdef HAVE_LIBNL1
struct nl_handle *netlinknh;
+#else
+ struct nl_sock *netlinksock;
+#endif
/*Events*/
int handled;
size_t handlesCount;
@@ -121,15 +125,31 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
int fd;
int n;
struct nlmsghdr *nlmsg = nlmsg_hdr(nl_msg);
+#ifdef HAVE_LIBNL1
struct nl_handle *nlhandle = nl_handle_alloc();
+#else
+ struct nl_sock *nlsock = nl_socket_alloc();
+#endif
+#ifdef HAVE_LIBNL1
if (!nlhandle) {
+#else
+ if (!nlsock) {
+#endif
virReportSystemError(errno,
+#ifdef HAVE_LIBNL1
"%s", _("cannot allocate nlhandle for netlink"));
+#else
+ "%s", _("cannot allocate nlsock for netlink"));
+#endif
return -1;
}
+#ifdef HAVE_LIBNL1
if (nl_connect(nlhandle, NETLINK_ROUTE) < 0) {
+#else
+ if (nl_connect(nlsock, NETLINK_ROUTE) < 0) {
+#endif
virReportSystemError(errno,
"%s", _("cannot connect to netlink socket"));
rc = -1;
@@ -140,7 +160,11 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
nlmsg->nlmsg_pid = getpid();
+#ifdef HAVE_LIBNL1
nbytes = nl_send_auto_complete(nlhandle, nl_msg);
+#else
+ nbytes = nl_send_auto_complete(nlsock, nl_msg);
+#endif
if (nbytes < 0) {
virReportSystemError(errno,
"%s", _("cannot send to netlink socket"));
@@ -148,7 +172,11 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
goto error;
}
+#ifdef HAVE_LIBNL1
fd = nl_socket_get_fd(nlhandle);
+#else
+ fd = nl_socket_get_fd(nlsock);
+#endif
FD_ZERO(&readfds);
FD_SET(fd, &readfds);
@@ -165,7 +193,11 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
goto error;
}
+#ifdef HAVE_LIBNL1
*respbuflen = nl_recv(nlhandle, &nladdr, respbuf, NULL);
+#else
+ *respbuflen = nl_recv(nlsock, &nladdr, respbuf, NULL);
+#endif
if (*respbuflen <= 0) {
virReportSystemError(errno,
"%s", _("nl_recv failed"));
@@ -178,7 +210,11 @@ error:
*respbuflen = 0;
}
+#ifdef HAVE_LIBNL1
nl_handle_destroy(nlhandle);
+#else
+ nl_socket_free(nlsock);
+#endif
return rc;
}
@@ -233,7 +269,11 @@ virNetlinkEventCallback(int watch,
int i, length;
bool handled = false;
+#ifdef HAVE_LIBNL1
length = nl_recv(srv->netlinknh, &peer, &msg, &creds);
+#else
+ length = nl_recv(srv->netlinksock, &peer, &msg, &creds);
+#endif
if (length == 0)
return;
@@ -284,8 +324,13 @@ virNetlinkEventServiceStop(void)
return 0;
virNetlinkEventServerLock(srv);
+#ifdef HAVE_LIBNL1
nl_close(srv->netlinknh);
nl_handle_destroy(srv->netlinknh);
+#else
+ nl_close(srv->netlinksock);
+ nl_socket_free(srv->netlinksock);
+#endif
virEventRemoveHandle(srv->eventwatch);
/* free any remaining clients on the list */
@@ -346,21 +391,37 @@ virNetlinkEventServiceStart(void)
virNetlinkEventServerLock(srv);
/* Allocate a new socket and get fd */
+#ifdef HAVE_LIBNL1
srv->netlinknh = nl_handle_alloc();
+#else
+ srv->netlinksock = nl_socket_alloc();
+#endif
+#ifdef HAVE_LIBNL1
if (!srv->netlinknh) {
+#else
+ if (!srv->netlinksock) {
+#endif
virReportSystemError(errno,
"%s", _("cannot allocate nlhandle for virNetlinkEvent server"));
goto error_locked;
}
+#ifdef HAVE_LIBNL1
if (nl_connect(srv->netlinknh, NETLINK_ROUTE) < 0) {
+#else
+ if (nl_connect(srv->netlinksock, NETLINK_ROUTE) < 0) {
+#endif
virReportSystemError(errno,
"%s", _("cannot connect to netlink socket"));
goto error_server;
}
+#ifdef HAVE_LIBNL1
fd = nl_socket_get_fd(srv->netlinknh);
+#else
+ fd = nl_socket_get_fd(srv->netlinksock);
+#endif
if (fd < 0) {
virReportSystemError(errno,
@@ -368,7 +429,11 @@ virNetlinkEventServiceStart(void)
goto error_server;
}
+#ifdef HAVE_LIBNL1
if (nl_socket_set_nonblocking(srv->netlinknh)) {
+#else
+ if (nl_socket_set_nonblocking(srv->netlinksock)) {
+#endif
virReportSystemError(errno, "%s",
_("cannot set netlink socket nonblocking"));
goto error_server;
@@ -391,8 +456,13 @@ virNetlinkEventServiceStart(void)
error_server:
if (ret < 0) {
+#ifdef HAVE_LIBNL1
nl_close(srv->netlinknh);
nl_handle_destroy(srv->netlinknh);
+#else
+ nl_close(srv->netlinksock);
+ nl_socket_free(srv->netlinksock);
+#endif
}
error_locked:
virNetlinkEventServerUnlock(srv);
--
1.7.9.5
12 years, 6 months
[libvirt] [PATCH] Use XDG Base Directories instead of storing in home
by William Jon McCann
Hi,
New to the list so hopefully I'm following the correct protocol.
Attached is a patch (mostly untested at the moment) to change the
default storage location from .libvirt to the locations defined in the
XDG Base Directory Specification
(http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html).
This has a number of advantages for us:
It allows sharing a home directory between different machines, or
sessions (eg. using NFS)
Cleanly separates cache, runtime (eg. sockets), or app data from
user settings
Supports performing smart or selective migration of settings
between different OS versions
Supports reseting settings without breaking things
Makes it possible to clear cache data to make room when the disk
is filling up
Allows us to write a robust and efficient backup solution
Allows an admin flexibility to change where data and settings are stored
It dramatically reduces the complexity and incoherence of the
system for administrators
This is a pretty important set of features for both enterprise and
individual use cases.
I hope you will please consider the change.
Thanks,
Jon
PS. This is also related to a goal for upstream GNOME
https://live.gnome.org/GnomeGoals/XDGConfigFolders
12 years, 6 months
[libvirt] [PATCH v5 0/9] Add basic driver for Parallels Virtuozzo Server
by Dmitry Guryanov
Parallels Virtuozzo Server is a cloud-ready virtualization
solution that allows users to simultaneously run multiple virtual
machines and containers on the same physical server.
Current name of this product is Parallels Server Bare Metal and
more information about it can be found here -
http://www.parallels.com/products/server/baremetal/sp/.
This driver will work with PVS version 6.0 , beta version
scheduled at 2012 Q2.
changes in v5:
* rebased to current version
changes in v4:
* fix errors, found by 'make syntax-check'
Dmitry Guryanov (9):
pvs: add driver skeleton
util: add functions for interating over json object
pvs: add functions to list domains and get info
pvs: implement functions for domain life cycle management
pvs: get info about serial ports
pvs: add support of VNC remote display
pvs: implement virDomainDefineXML operation for existing domains
pvs: add storage driver
pvs: implement VM creation
AUTHORS | 1 +
cfg.mk | 1 +
configure.ac | 23 +
docs/drvpvs.html.in | 28 +
include/libvirt/virterror.h | 1 +
libvirt.spec.in | 7 +
mingw32-libvirt.spec.in | 6 +
po/POTFILES.in | 3 +
src/Makefile.am | 23 +
src/conf/domain_conf.c | 3 +-
src/conf/domain_conf.h | 1 +
src/driver.h | 1 +
src/libvirt.c | 12 +
src/pvs/pvs_driver.c | 1280 +++++++++++++++++++++++++++++++++++++
src/pvs/pvs_driver.h | 75 +++
src/pvs/pvs_storage.c | 1458 +++++++++++++++++++++++++++++++++++++++++++
src/pvs/pvs_utils.c | 143 +++++
src/util/json.c | 30 +
src/util/json.h | 4 +
src/util/virterror.c | 3 +
20 files changed, 3102 insertions(+), 1 deletions(-)
create mode 100644 docs/drvpvs.html.in
create mode 100644 src/pvs/pvs_driver.c
create mode 100644 src/pvs/pvs_driver.h
create mode 100644 src/pvs/pvs_storage.c
create mode 100644 src/pvs/pvs_utils.c
12 years, 6 months