[libvirt] [PATCHv4 0/4] Introduce APIs to extract DHCP leases info
by Nehal J Wani
This API returns the leases information stored in the DHCP leases
file of dnsmasq for a given virtual network. It contacts the
bridge network driver, which parses the leases file.
It supports two methods:
1. Return info for all network interfaces connected to a given
virtual network
2. Return information for a particular network interface in a
given virtual network by providing its MAC Address
v4
* Added support for DHCPv6, updated lease file parsing method
v3
* Mostly small nits, change in MACRO names, use of virSocketAddrGetIpPrefix to
retrieve IP prefix from @dom XML.
Refer: https://www.redhat.com/archives/libvir-list/2013-September/msg00832.html
v2
* Since DHCPv6 is supposed to be suported in future, virNetworkGetDHCPLeasesForMAC
changed, prefix and virIPAddrType added in virNetworkDHCPLeases struct.
Refer: https://www.redhat.com/archives/libvir-list/2013-September/msg00732.html
v1
* Refer: https://www.redhat.com/archives/libvir-list/2013-September/msg00620.html
* The need for these APIs were result of a RFC was proposed on the list.
Refer: http://www.redhat.com/archives/libvir-list/2013-July/msg01603.html
Nehal J Wani (4):
net-dhcp-leases: Implement the remote protocol
net-dhcp-leases: Implement the remote protocol
net-dhcp-leases: Private implementation inside network driver
net-dhcp-leases: Add virsh support
daemon/remote.c | 157 ++++++++++++++++++++++++++++
include/libvirt/libvirt.h.in | 36 +++++++
python/generator.py | 3 +
src/driver.h | 13 +++
src/libvirt.c | 177 +++++++++++++++++++++++++++++++
src/libvirt_public.syms | 3 +
src/network/bridge_driver.c | 240 +++++++++++++++++++++++++++++++++++++++++++
src/remote/remote_driver.c | 169 +++++++++++++++++++++++++++++-
src/remote/remote_protocol.x | 59 ++++++++++-
src/remote_protocol-structs | 47 +++++++++
src/rpc/gendispatch.pl | 1 +
tools/virsh-network.c | 150 +++++++++++++++++++++++++++
tools/virsh.pod | 6 ++
13 files changed, 1057 insertions(+), 4 deletions(-)
--
1.7.11.7
11 years, 1 month
[libvirt] [PATCH] Ensure securityfs is mounted readonly in container
by Daniel P. Berrange
From: Dan Walsh <dwalsh(a)redhat.com>
If securityfs is available on the host, we should ensure to
mount it read-only in the container. This will avoid systemd
trying to mount it during startup causing SELinux AVCs.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/lxc/lxc_container.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index b910b10..a943b22 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -770,6 +770,8 @@ static int lxcContainerMountBasicFS(void)
{ "/proc/sys", "/proc/sys", NULL, NULL, MS_BIND|MS_REMOUNT|MS_RDONLY },
{ "sysfs", "/sys", "sysfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV },
{ "sysfs", "/sys", "sysfs", NULL, MS_BIND|MS_REMOUNT|MS_RDONLY },
+ { "securityfs", "/sys/kernel/security", "securityfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV },
+ { "securityfs", "/sys/kernel/security", "securityfs", NULL, MS_BIND|MS_REMOUNT|MS_RDONLY },
#if WITH_SELINUX
{ SELINUX_MOUNT, SELINUX_MOUNT, "selinuxfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV },
{ SELINUX_MOUNT, SELINUX_MOUNT, NULL, NULL, MS_BIND|MS_REMOUNT|MS_RDONLY },
--
1.8.3.1
11 years, 1 month
[libvirt] [PATCHv2 0/5] Refactor feature handling and add support for pvticketlocks
by Peter Krempa
Version 2 incorporates changes based on review feedback from Jan and Doug.
Peter Krempa (5):
schema: Rename option to make it reusable
conf: Refactor storing and usage of feature flags
qemu: Add support for paravirtual spinlocks in the guest
conf: Clean up few error messages
qemu: command: Fix macro indentation
docs/formatdomain.html.in | 7 +
docs/schemas/domaincommon.rng | 18 +-
src/conf/domain_conf.c | 200 +++++++++++++++------
src/conf/domain_conf.h | 3 +-
src/libxl/libxl_conf.c | 9 +-
src/lxc/lxc_container.c | 6 +-
src/qemu/qemu_command.c | 31 +++-
src/vbox/vbox_tmpl.c | 45 +++--
src/xenapi/xenapi_driver.c | 10 +-
src/xenapi/xenapi_utils.c | 22 ++-
src/xenxs/xen_sxpr.c | 20 +--
src/xenxs/xen_xm.c | 30 ++--
.../qemuxml2argv-pv-spinlock-disabled.args | 5 +
.../qemuxml2argv-pv-spinlock-disabled.xml | 26 +++
.../qemuxml2argv-pv-spinlock-enabled.args | 5 +
.../qemuxml2argv-pv-spinlock-enabled.xml | 26 +++
tests/qemuxml2argvtest.c | 2 +
tests/qemuxml2xmltest.c | 2 +
18 files changed, 326 insertions(+), 141 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pv-spinlock-disabled.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pv-spinlock-disabled.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pv-spinlock-enabled.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pv-spinlock-enabled.xml
--
1.8.3.2
11 years, 1 month
[libvirt] error: server response too large
by Claudio Bley
Hi.
When trying to do a screenshot of a remote domain connected via
qemu+tcp (for testing purposes only), I receive this error:
----------------------------------------------------------------------
virsh -c qemu+tcp://dev/system
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # version
Compiled against library: libvir 0.9.8
Using library: libvir 0.9.8
Using API: QEMU 0.9.8
Running hypervisor: QEMU 1.5.1
virsh # screenshot 2 /tmp/screendump
error: could not receive data from domain 2
error: packet 1048600 bytes received from server too large, want 262144
virsh # 2013-09-30 14:47:05.158+0000: 21646: info : libvirt version: 0.9.8
2013-09-30 14:47:05.158+0000: 21646: warning : virNetClientIncomingEvent:1660 : Something went wrong during async message processing
----------------------------------------------------------------------
I'm using Ubuntu LTS 12.04.3, latest version in the repo which is
0.9.8-2ubuntu17.13.
On the server side, I'm using a self-compiled libvirt from git master.
On the server, I receive:
2013-09-30 14:41:10.075+0000: 1203: info : libvirt version: 1.1.2
2013-09-30 14:41:10.075+0000: 1203: error : virNetSocketWriteWire:1446 : Cannot write data: Connection reset by peer
2013-09-30 14:41:10.077+0000: 1203: error : virFDStreamCloseInt:315 : internal error: I/O helper exited abnormally
2013-09-30 14:41:10.078+0000: 1203: error : virFDStreamUpdateCallback:133 : internal error: stream is not open
I've uploaded the logs produced with LIBVIRT_DEBUG=1 to sendspace:
http://www.sendspace.com/file/tevueo (libvirtd.log.gz) [1MB]
http://www.sendspace.com/file/rdpmrh (virsh.log.gz) [5KB]
When using a non-async virStream with client library version 1.1.2, it
works OK.
Is this a bug in libvirt 0.9.8 or is this a regression in >= 1.1.2?
I started to git bisect but ran out of time, I'm out of office till
next week.
Any help would be great. Thanks.
Claudio
--
AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany
Phone: +49 341 265 310 19
Web:<http://www.av-test.org>
Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern
11 years, 1 month
[libvirt] [PATCH] build: be smarter about building documentation
by Eric Blake
I'm tired of cryptic reports on IRC from people who build from
git, then type 'make install' and have it fail quite a ways down
the road because the documentation wasn't built. It's a feature
that documentation is not built during development if the toolchain
is not present (not all git developers build tarballs, and the
tarballs already contain pre-built docs); but this only works as
long as you don't try to install or make a tarball from that
setup. With this patch in place, and without xhtml1-dtds, I now
get this nice failure:
$ make install
cfg.mk:109: *** ERROR: missing doc toolchain (install xhtml1-dtds and xmllint). Stop.
and all with no impact to regular 'make' or 'make check'.
Along the way, I tried to discover why 'yum-builddeps libvirt'
doesn't always tell developers to install xhtml1-dtds - my conclusion
was that if the .srpm is unavailable, then yum-builddeps can't
figure out anything that is required. The spec file already has
a BuildRequires on the doc toolchain (and therefore, the docs shipped
with an rpm are up-to-date, even if the spec file applied patches
that affect the docs). So thankfully I don't have to make any
spec file changes in this patch.
* cfg.mk: Let 'make install' and 'make dist' error much earlier if
we detect a build from git without doc toolchain.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Heavily influenced by code in gnulib's GNUMakefile :)
cfg.mk | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/cfg.mk b/cfg.mk
index e6584e8..7e17b5c 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -88,6 +88,29 @@ else
distdir: sc_vulnerable_makefile_CVE-2012-3386.z
endif
+# We intentionally don't require the doc toolchain during 'make' during
+# development, but 'make dist' must ship pre-built docs, and 'make install'
+# from a git build fails if docs weren't built, both with awkward error
+# messages if we let the build run that far. Therefore, bail loud and
+# early if we detect a git tree but no doc toolchain.
+ifeq ($(MAKELEVEL),0)
+ _is-dist-target ?= $(filter-out %clean, \
+ $(filter maintainer-% dist% alpha beta stable,$(MAKECMDGOALS)))
+ _is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS)))
+ ifneq (,$(_is-dist-target)$(_is-install-target))
+ ifeq ($(shell \
+ if test -e $(srcdir)/.git; then \
+ if test -x $(XMLLINT) && test -x $(XMLCATALOG) && \
+ $(XMLCATALOG) '$(XML_CATALOG_FILE)' \
+ "-//W3C//DTD XHTML 1.0 Strict//EN" >/dev/null; then \
+ echo works; \
+ else echo oops; fi;\
+ else echo tarball; fi),oops)
+ $(error ERROR: missing doc toolchain (install xhtml1-dtds and xmllint))
+ endif
+ endif
+endif
+
# Files that should never cause syntax check failures.
VC_LIST_ALWAYS_EXCLUDE_REGEX = \
(^(HACKING|docs/(news\.html\.in|.*\.patch))|\.po)$$
--
1.8.3.1
11 years, 1 month
[libvirt] [PATCH v2]lxc: do cleanup when failed to bind fs as read-only
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
We forgot to do cleanup when lxcContainerMountFSTmpfs
failed to bind fs as read-only.
v2: fix an indentation issue
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
src/lxc/lxc_container.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index c60f5d8..b1f429c 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1451,6 +1451,7 @@ static int lxcContainerMountFSTmpfs(virDomainFSDefPtr fs,
virReportSystemError(errno,
_("Failed to make directory %s readonly"),
fs->dst);
+ goto cleanup;
}
}
--
1.8.2.1
11 years, 1 month
[libvirt] [PATCH] build: fix build --without-remote
by Eric Blake
I tried to test ./configure --without-lxc --without-remote.
First, the build failed with some odd errors, such as an
inability to build xen, or link failures for virNetTLSInit.
But when you think about it, once there is no remote code,
all of libvirtd is useless, any stateful driver that depends
on libvirtd is also not worth compiling, and any libraries
used only by RPC code are not needed. So I patched
configure.ac to make for some saner defaults when an
explicit disable is attempted. Similarly, since we have
migrated virnetdevbridge into generic code, the workaround
for Linux kernel stupidity must not depend on stateful
drivers being in use.
Then there's 'make check' that needs segragation.
Wow - quite a bit of cleanup to make --without-remote useful :)
* configure.ac: Let --without-remote toggle defaults on stateful
drivers and other libraries. Pick up Linux kernel workarounds
even when qemu and lxc are not being compiled.
* tests/Makefile.am (test_programs): Factor out programs that
require remote.
* src/libvirt_private.syms (rpc/virnet*.h): Move...
* src/libvirt_remote.syms: ...into new file.
* src/Makefile.am (SYM_FILES): Ship new syms file.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Looks big, but most of it is motion of text from splitting a file.
It fixes a build failure, but --enable-remote is not a regression
for this particular release (it's been broken for a while), so I'll
wait for a review even if it misses 1.1.3.
configure.ac | 16 +++-
src/Makefile.am | 6 ++
src/libvirt_private.syms | 199 --------------------------------------------
src/libvirt_remote.syms | 210 +++++++++++++++++++++++++++++++++++++++++++++++
tests/Makefile.am | 19 +++--
5 files changed, 243 insertions(+), 207 deletions(-)
create mode 100644 src/libvirt_remote.syms
diff --git a/configure.ac b/configure.ac
index 553015a..b82dc8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -198,8 +198,22 @@ fi
AM_CONDITIONAL([WITH_LINUX], [test "$with_linux" = "yes"])
AM_CONDITIONAL([WITH_FREEBSD], [test "$with_freebsd" = "yes"])
+# The daemon requires remote support. Likewise, if we are not using
+# RPC, we don't need several libraries.
+if test "$with_remote" = "no" ; then
+ with_libvirtd=no
+ with_gnutls=no
+ with_ssh2=no
+ with_sasl=no
+fi
+# Stateful drivers are useful only when building the daemon.
if test "$with_libvirtd" = "no" ; then
with_qemu=no
+ with_xen=no
+ with_lxc=no
+ with_libxl=no
+ with_uml=no
+ with_vbox=no
fi
# Check for compiler and library settings.
@@ -1053,7 +1067,6 @@ dnl
dnl check for kernel headers required by src/bridge.c
dnl
if test "$with_linux" = "yes"; then
- if test "$with_qemu" = "yes" || test "$with_lxc" = "yes" ; then
# Various kernel versions have headers that are not self-standing, but
# yet are incompatible with the corresponding glibc headers. In order
# to guarantee compilation across a wide range of versions (from RHEL 5
@@ -1087,7 +1100,6 @@ if test "$with_linux" = "yes"; then
#endif
#include <linux/in6.h>
]])
- fi
fi
diff --git a/src/Makefile.am b/src/Makefile.am
index 8632b18..201c268 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1756,6 +1756,12 @@ else ! WITH_LIBVIRTD
SYM_FILES += $(srcdir)/libvirt_daemon.syms
endif ! WITH_LIBVIRTD
+if WITH_REMOTE
+USED_SYM_FILES += $(srcdir)/libvirt_remote.syms
+else ! WITH_REMOTE
+SYM_FILES += $(srcdir)/libvirt_remote.syms
+endif ! WITH_REMOTE
+
if WITH_OPENVZ
USED_SYM_FILES += $(srcdir)/libvirt_openvz.syms
else ! WITH_OPENVZ
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 48e4b04..62aab9b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -831,205 +831,6 @@ nodeGetMemoryStats;
nodeSetMemoryParameters;
-# rpc/virnetclient.h
-virNetClientAddProgram;
-virNetClientAddStream;
-virNetClientClose;
-virNetClientDupFD;
-virNetClientGetFD;
-virNetClientHasPassFD;
-virNetClientIsEncrypted;
-virNetClientIsOpen;
-virNetClientKeepAliveIsSupported;
-virNetClientKeepAliveStart;
-virNetClientKeepAliveStop;
-virNetClientLocalAddrString;
-virNetClientNewExternal;
-virNetClientNewLibSSH2;
-virNetClientNewSSH;
-virNetClientNewTCP;
-virNetClientNewUNIX;
-virNetClientRegisterAsyncIO;
-virNetClientRegisterKeepAlive;
-virNetClientRemoteAddrString;
-virNetClientRemoveStream;
-virNetClientSendNonBlock;
-virNetClientSendNoReply;
-virNetClientSendWithReply;
-virNetClientSendWithReplyStream;
-virNetClientSetCloseCallback;
-
-
-# rpc/virnetclientprogram.h
-virNetClientProgramCall;
-virNetClientProgramDispatch;
-virNetClientProgramGetProgram;
-virNetClientProgramGetVersion;
-virNetClientProgramMatches;
-virNetClientProgramNew;
-
-
-# rpc/virnetclientstream.h
-virNetClientStreamEOF;
-virNetClientStreamEventAddCallback;
-virNetClientStreamEventRemoveCallback;
-virNetClientStreamEventUpdateCallback;
-virNetClientStreamMatches;
-virNetClientStreamNew;
-virNetClientStreamQueuePacket;
-virNetClientStreamRaiseError;
-virNetClientStreamRecvPacket;
-virNetClientStreamSendPacket;
-virNetClientStreamSetError;
-
-
-# rpc/virnetmessage.h
-virNetMessageClear;
-virNetMessageDecodeHeader;
-virNetMessageDecodeLength;
-virNetMessageDecodeNumFDs;
-virNetMessageDecodePayload;
-virNetMessageDupFD;
-virNetMessageEncodeHeader;
-virNetMessageEncodeNumFDs;
-virNetMessageEncodePayload;
-virNetMessageEncodePayloadRaw;
-virNetMessageFree;
-virNetMessageNew;
-virNetMessageQueuePush;
-virNetMessageQueueServe;
-virNetMessageSaveError;
-xdr_virNetMessageError;
-
-
-# rpc/virnetserver.h
-virNetServerAddProgram;
-virNetServerAddService;
-virNetServerAddShutdownInhibition;
-virNetServerAddSignalHandler;
-virNetServerAutoShutdown;
-virNetServerClose;
-virNetServerIsPrivileged;
-virNetServerKeepAliveRequired;
-virNetServerNew;
-virNetServerNewPostExecRestart;
-virNetServerPreExecRestart;
-virNetServerQuit;
-virNetServerRemoveShutdownInhibition;
-virNetServerRun;
-virNetServerUpdateServices;
-
-
-# rpc/virnetserverclient.h
-virNetServerClientAddFilter;
-virNetServerClientClose;
-virNetServerClientDelayedClose;
-virNetServerClientGetAuth;
-virNetServerClientGetFD;
-virNetServerClientGetIdentity;
-virNetServerClientGetPrivateData;
-virNetServerClientGetReadonly;
-virNetServerClientGetSELinuxContext;
-virNetServerClientGetUNIXIdentity;
-virNetServerClientImmediateClose;
-virNetServerClientInit;
-virNetServerClientInitKeepAlive;
-virNetServerClientIsClosed;
-virNetServerClientIsLocal;
-virNetServerClientIsSecure;
-virNetServerClientLocalAddrString;
-virNetServerClientNeedAuth;
-virNetServerClientNew;
-virNetServerClientNewPostExecRestart;
-virNetServerClientPreExecRestart;
-virNetServerClientRemoteAddrString;
-virNetServerClientRemoveFilter;
-virNetServerClientSendMessage;
-virNetServerClientSetAuth;
-virNetServerClientSetCloseHook;
-virNetServerClientSetDispatcher;
-virNetServerClientStartKeepAlive;
-virNetServerClientWantClose;
-
-
-# rpc/virnetservermdns.h
-virNetServerMDNSAddEntry;
-virNetServerMDNSAddGroup;
-virNetServerMDNSEntryFree;
-virNetServerMDNSFree;
-virNetServerMDNSGroupFree;
-virNetServerMDNSNew;
-virNetServerMDNSRemoveEntry;
-virNetServerMDNSRemoveGroup;
-virNetServerMDNSStart;
-virNetServerMDNSStop;
-
-
-# rpc/virnetserverprogram.h
-virNetServerProgramDispatch;
-virNetServerProgramGetID;
-virNetServerProgramGetPriority;
-virNetServerProgramGetVersion;
-virNetServerProgramMatches;
-virNetServerProgramNew;
-virNetServerProgramSendReplyError;
-virNetServerProgramSendStreamData;
-virNetServerProgramSendStreamError;
-virNetServerProgramUnknownError;
-
-
-# rpc/virnetserverservice.h
-virNetServerServiceClose;
-virNetServerServiceGetAuth;
-virNetServerServiceGetMaxRequests;
-virNetServerServiceGetPort;
-virNetServerServiceIsReadonly;
-virNetServerServiceNewFD;
-virNetServerServiceNewPostExecRestart;
-virNetServerServiceNewTCP;
-virNetServerServiceNewUNIX;
-virNetServerServicePreExecRestart;
-virNetServerServiceSetDispatcher;
-virNetServerServiceToggle;
-
-
-# rpc/virnetsocket.h
-virNetSocketAccept;
-virNetSocketAddIOCallback;
-virNetSocketClose;
-virNetSocketDupFD;
-virNetSocketGetFD;
-virNetSocketGetPort;
-virNetSocketGetSELinuxContext;
-virNetSocketGetUNIXIdentity;
-virNetSocketHasCachedData;
-virNetSocketHasPassFD;
-virNetSocketHasPendingData;
-virNetSocketIsLocal;
-virNetSocketListen;
-virNetSocketLocalAddrString;
-virNetSocketNewConnectCommand;
-virNetSocketNewConnectExternal;
-virNetSocketNewConnectLibSSH2;
-virNetSocketNewConnectSockFD;
-virNetSocketNewConnectSSH;
-virNetSocketNewConnectTCP;
-virNetSocketNewConnectUNIX;
-virNetSocketNewListenFD;
-virNetSocketNewListenTCP;
-virNetSocketNewListenUNIX;
-virNetSocketNewPostExecRestart;
-virNetSocketPreExecRestart;
-virNetSocketRead;
-virNetSocketRecvFD;
-virNetSocketRemoteAddrString;
-virNetSocketRemoveIOCallback;
-virNetSocketSendFD;
-virNetSocketSetBlocking;
-virNetSocketUpdateIOCallback;
-virNetSocketWrite;
-
-
# security/security_driver.h
virSecurityDriverLookup;
diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms
new file mode 100644
index 0000000..d482a55
--- /dev/null
+++ b/src/libvirt_remote.syms
@@ -0,0 +1,210 @@
+#
+# Private symbols used in RPC operations. Add symbols here, and see
+# Makefile.am for more details.
+#
+# Keep this file sorted by header name, then by symbols with each header.
+#
+
+# rpc/virnetclient.h
+virNetClientAddProgram;
+virNetClientAddStream;
+virNetClientClose;
+virNetClientDupFD;
+virNetClientGetFD;
+virNetClientHasPassFD;
+virNetClientIsEncrypted;
+virNetClientIsOpen;
+virNetClientKeepAliveIsSupported;
+virNetClientKeepAliveStart;
+virNetClientKeepAliveStop;
+virNetClientLocalAddrString;
+virNetClientNewExternal;
+virNetClientNewLibSSH2;
+virNetClientNewSSH;
+virNetClientNewTCP;
+virNetClientNewUNIX;
+virNetClientRegisterAsyncIO;
+virNetClientRegisterKeepAlive;
+virNetClientRemoteAddrString;
+virNetClientRemoveStream;
+virNetClientSendNonBlock;
+virNetClientSendNoReply;
+virNetClientSendWithReply;
+virNetClientSendWithReplyStream;
+virNetClientSetCloseCallback;
+
+
+# rpc/virnetclientprogram.h
+virNetClientProgramCall;
+virNetClientProgramDispatch;
+virNetClientProgramGetProgram;
+virNetClientProgramGetVersion;
+virNetClientProgramMatches;
+virNetClientProgramNew;
+
+
+# rpc/virnetclientstream.h
+virNetClientStreamEOF;
+virNetClientStreamEventAddCallback;
+virNetClientStreamEventRemoveCallback;
+virNetClientStreamEventUpdateCallback;
+virNetClientStreamMatches;
+virNetClientStreamNew;
+virNetClientStreamQueuePacket;
+virNetClientStreamRaiseError;
+virNetClientStreamRecvPacket;
+virNetClientStreamSendPacket;
+virNetClientStreamSetError;
+
+
+# rpc/virnetmessage.h
+virNetMessageClear;
+virNetMessageDecodeHeader;
+virNetMessageDecodeLength;
+virNetMessageDecodeNumFDs;
+virNetMessageDecodePayload;
+virNetMessageDupFD;
+virNetMessageEncodeHeader;
+virNetMessageEncodeNumFDs;
+virNetMessageEncodePayload;
+virNetMessageEncodePayloadRaw;
+virNetMessageFree;
+virNetMessageNew;
+virNetMessageQueuePush;
+virNetMessageQueueServe;
+virNetMessageSaveError;
+xdr_virNetMessageError;
+
+
+# rpc/virnetserver.h
+virNetServerAddProgram;
+virNetServerAddService;
+virNetServerAddShutdownInhibition;
+virNetServerAddSignalHandler;
+virNetServerAutoShutdown;
+virNetServerClose;
+virNetServerIsPrivileged;
+virNetServerKeepAliveRequired;
+virNetServerNew;
+virNetServerNewPostExecRestart;
+virNetServerPreExecRestart;
+virNetServerQuit;
+virNetServerRemoveShutdownInhibition;
+virNetServerRun;
+virNetServerUpdateServices;
+
+
+# rpc/virnetserverclient.h
+virNetServerClientAddFilter;
+virNetServerClientClose;
+virNetServerClientDelayedClose;
+virNetServerClientGetAuth;
+virNetServerClientGetFD;
+virNetServerClientGetIdentity;
+virNetServerClientGetPrivateData;
+virNetServerClientGetReadonly;
+virNetServerClientGetSELinuxContext;
+virNetServerClientGetUNIXIdentity;
+virNetServerClientImmediateClose;
+virNetServerClientInit;
+virNetServerClientInitKeepAlive;
+virNetServerClientIsClosed;
+virNetServerClientIsLocal;
+virNetServerClientIsSecure;
+virNetServerClientLocalAddrString;
+virNetServerClientNeedAuth;
+virNetServerClientNew;
+virNetServerClientNewPostExecRestart;
+virNetServerClientPreExecRestart;
+virNetServerClientRemoteAddrString;
+virNetServerClientRemoveFilter;
+virNetServerClientSendMessage;
+virNetServerClientSetAuth;
+virNetServerClientSetCloseHook;
+virNetServerClientSetDispatcher;
+virNetServerClientStartKeepAlive;
+virNetServerClientWantClose;
+
+
+# rpc/virnetservermdns.h
+virNetServerMDNSAddEntry;
+virNetServerMDNSAddGroup;
+virNetServerMDNSEntryFree;
+virNetServerMDNSFree;
+virNetServerMDNSGroupFree;
+virNetServerMDNSNew;
+virNetServerMDNSRemoveEntry;
+virNetServerMDNSRemoveGroup;
+virNetServerMDNSStart;
+virNetServerMDNSStop;
+
+
+# rpc/virnetserverprogram.h
+virNetServerProgramDispatch;
+virNetServerProgramGetID;
+virNetServerProgramGetPriority;
+virNetServerProgramGetVersion;
+virNetServerProgramMatches;
+virNetServerProgramNew;
+virNetServerProgramSendReplyError;
+virNetServerProgramSendStreamData;
+virNetServerProgramSendStreamError;
+virNetServerProgramUnknownError;
+
+
+# rpc/virnetserverservice.h
+virNetServerServiceClose;
+virNetServerServiceGetAuth;
+virNetServerServiceGetMaxRequests;
+virNetServerServiceGetPort;
+virNetServerServiceIsReadonly;
+virNetServerServiceNewFD;
+virNetServerServiceNewPostExecRestart;
+virNetServerServiceNewTCP;
+virNetServerServiceNewUNIX;
+virNetServerServicePreExecRestart;
+virNetServerServiceSetDispatcher;
+virNetServerServiceToggle;
+
+
+# rpc/virnetsocket.h
+virNetSocketAccept;
+virNetSocketAddIOCallback;
+virNetSocketClose;
+virNetSocketDupFD;
+virNetSocketGetFD;
+virNetSocketGetPort;
+virNetSocketGetSELinuxContext;
+virNetSocketGetUNIXIdentity;
+virNetSocketHasCachedData;
+virNetSocketHasPassFD;
+virNetSocketHasPendingData;
+virNetSocketIsLocal;
+virNetSocketListen;
+virNetSocketLocalAddrString;
+virNetSocketNewConnectCommand;
+virNetSocketNewConnectExternal;
+virNetSocketNewConnectLibSSH2;
+virNetSocketNewConnectSockFD;
+virNetSocketNewConnectSSH;
+virNetSocketNewConnectTCP;
+virNetSocketNewConnectUNIX;
+virNetSocketNewListenFD;
+virNetSocketNewListenTCP;
+virNetSocketNewListenUNIX;
+virNetSocketNewPostExecRestart;
+virNetSocketPreExecRestart;
+virNetSocketRead;
+virNetSocketRecvFD;
+virNetSocketRemoteAddrString;
+virNetSocketRemoveIOCallback;
+virNetSocketSendFD;
+virNetSocketSetBlocking;
+virNetSocketUpdateIOCallback;
+virNetSocketWrite;
+
+
+# Let emacs know we want case-insensitive sorting
+# Local Variables:
+# sort-fold-case: t
+# End:
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 17a2a72..9a6453b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -114,8 +114,8 @@ test_helpers = commandhelper ssh test_conf
test_programs = virshtest sockettest \
nodeinfotest virbuftest \
commandtest seclabeltest \
- virhashtest virnetmessagetest virnetsockettest \
- viratomictest virnetserverclienttest \
+ virhashtest \
+ viratomictest \
utiltest shunloadtest \
virtimetest viruritest virkeyfiletest \
virauthconfigtest \
@@ -131,6 +131,17 @@ test_programs = virshtest sockettest \
virstoragetest \
$(NULL)
+if WITH_REMOTE
+test_programs += \
+ virnetmessagetest \
+ virnetsockettest \
+ virnetserverclienttest \
+ $(NULL)
+if WITH_GNUTLS
+test_programs += virnettlscontexttest virnettlssessiontest
+endif WITH_GNUTLS
+endif WITH_REMOTE
+
if WITH_LINUX
test_programs += fchosttest
endif WITH_LINUX
@@ -144,10 +155,6 @@ test_programs += virdbustest \
virsystemdtest
endif WITH_DBUS
-if WITH_GNUTLS
-test_programs += virnettlscontexttest virnettlssessiontest
-endif WITH_GNUTLS
-
if WITH_SECDRIVER_SELINUX
if WITH_ATTR
test_programs += securityselinuxtest
--
1.8.3.1
11 years, 1 month
[libvirt] [PATCH] storage: fix file allocation behavior in file cloning
by Oskari Saarenmaa
Fixed the safezero call for allocating the rest of the file after cloning
an existing volume; it used to always use a zero offset, causing it to
only allocate the beginning of the file.
Also modified file creation to try to use fallocate(2) to pre-allocate
disk space before copying any data to make sure it fails early on if disk
is full and makes sure we can skip zero blocks when copying file contents.
If fallocate isn't available we will zero out the rest of the file after
cloning and only use sparse cloning if client requested a lower allocation
than the input volume's capacity.
Signed-off-by: Oskari Saarenmaa <os(a)ohmu.fi>
---
the safezero mmap issue fixed in my previous patch never showed up because
all safezero calls previously had 0 offset (or maybe everyone's using
posix_fallocate)
configure.ac | 8 ++++----
src/storage/storage_backend.c | 35 ++++++++++++++++++++++++++++++-----
2 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac
index 553015a..220d95b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -253,10 +253,10 @@ AC_CHECK_SIZEOF([long])
dnl Availability of various common functions (non-fatal if missing),
dnl and various less common threadsafe functions
-AC_CHECK_FUNCS_ONCE([cfmakeraw geteuid getgid getgrnam_r getmntent_r \
- getpwuid_r getuid kill mmap newlocale posix_fallocate posix_memalign \
- prlimit regexec sched_getaffinity setgroups setns setrlimit symlink \
- sysctlbyname])
+AC_CHECK_FUNCS_ONCE([cfmakeraw fallocate geteuid getgid getgrnam_r \
+ getmntent_r getpwuid_r getuid kill mmap newlocale posix_fallocate \
+ posix_memalign prlimit regexec sched_getaffinity setgroups setns \
+ setrlimit symlink sysctlbyname])
dnl Availability of pthread functions (if missing, win32 threading is
dnl assumed). Because of $LIB_PTHREAD, we cannot use AC_CHECK_FUNCS_ONCE.
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index b7edf85..5f1bc66 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -129,7 +129,7 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol,
virStorageVolDefPtr inputvol,
int fd,
unsigned long long *total,
- int is_dest_file)
+ int want_sparse)
{
int inputfd = -1;
int amtread = -1;
@@ -191,7 +191,7 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol,
interval = ((wbytes > amtleft) ? amtleft : wbytes);
int offset = amtread - amtleft;
- if (is_dest_file && memcmp(buf+offset, zerobuf, interval) == 0) {
+ if (want_sparse && memcmp(buf+offset, zerobuf, interval) == 0) {
if (lseek(fd, interval, SEEK_CUR) < 0) {
ret = -errno;
virReportSystemError(errno,
@@ -315,6 +315,7 @@ static int
createRawFile(int fd, virStorageVolDefPtr vol,
virStorageVolDefPtr inputvol)
{
+ int need_alloc = 1;
int ret = 0;
unsigned long long remain;
@@ -328,17 +329,41 @@ createRawFile(int fd, virStorageVolDefPtr vol,
goto cleanup;
}
+#ifdef HAVE_FALLOCATE
+ /* Try to preallocate all requested disk space, but fall back to
+ * other methods if this fails with ENOSYS or EOPNOTSUPP.
+ * NOTE: do not use posix_fallocate; posix_fallocate falls back
+ * to writing zeroes block by block in case fallocate isn't
+ * available, and since we're going to copy data from another
+ * file it doesn't make sense to write the file twice. */
+ if (fallocate(fd, 0, 0, vol->allocation) == 0) {
+ need_alloc = 0;
+ } else if (errno != ENOSYS && errno != EOPNOTSUPP) {
+ ret = -errno;
+ virReportSystemError(errno,
+ _("cannot allocate %llu bytes in file '%s'"),
+ vol->allocation, vol->target.path);
+ goto cleanup;
+ }
+#endif
+
remain = vol->allocation;
if (inputvol) {
- ret = virStorageBackendCopyToFD(vol, inputvol, fd, &remain, 1);
+ /* allow zero blocks to be skipped if we've requested sparse
+ * allocation (allocation < capacity) or we have already
+ * been able to allocate the required space. */
+ int want_sparse = (need_alloc == 0) ||
+ (vol->allocation < inputvol->capacity);
+
+ ret = virStorageBackendCopyToFD(vol, inputvol, fd, &remain, want_sparse);
if (ret < 0) {
goto cleanup;
}
}
- if (remain) {
- if (safezero(fd, 0, remain) < 0) {
+ if (remain && need_alloc) {
+ if (safezero(fd, vol->allocation - remain, remain) < 0) {
ret = -errno;
virReportSystemError(errno, _("cannot fill file '%s'"),
vol->target.path);
--
1.8.3.1
11 years, 1 month
[libvirt] [PATCH v3 0/8] test: Mock snapshot APIs and misc improvements
by Cole Robinson
This series implements snapshot and managed save APIs for the test driver,
and adds some misc improvements, like specifying domain transient state
in the driver XML.
v3:
Rebase
Validate that managedsave, transient, and runstate combo make sense
Use STREQ_NULLABLE to simplify a check
Cole Robinson (8):
test: Allow specifying object transient state in driver XML
test: Wire up managed save APIs
test: Implement readonly snapshot APIs
test: Implement snapshot create/delete/revert APIs
qemu: snapshots: Simplify REDEFINE flag check
qemu: snapshot: Break out redefine preparation to shared function
test: snapshot: Add REDEFINE support
test: Allow specifying domainsnapshot XML
src/conf/domain_conf.c | 2 +-
src/conf/snapshot_conf.c | 150 ++++++
src/conf/snapshot_conf.h | 7 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_driver.c | 145 +-----
src/test/test_driver.c | 1162 +++++++++++++++++++++++++++++++++++++++++++++-
tests/virshtest.c | 2 +-
7 files changed, 1328 insertions(+), 141 deletions(-)
--
1.8.3.1
11 years, 1 month
[libvirt] [PATCH] build: fix 'make -C src check' under subset builds
by Eric Blake
Another build failure detected on cygwin, where lxc is not built.
The lxc_monitor_protocol.c file requires the use of $(XDR_CFLAGS),
but should only be built on platforms where WITH_LXC is true;
however, 'make -C src check' was unconditionally trying to build
the .o file (and with the wrong CFLAGS) in order to validate the
matching -structs file. Rework the checks to only test files that
are built for the current configuration.
* src/Makefile.am (PROTOCOL_STRUCTS): Split list by which files
are currently being compiled.
(EXTRA_DIST): Ensure that -structs files are shipped even when not
built.
(check-protocol): Declare unconditionally, now that the condition
has been moved into PROTOCOL_STRUCTS.
(libvirt_driver_lxc_impl_la_CFLAGS): Add $(XDR_CFLAGS).
(libvirt_net_rpc_la_SOURCES): List generated files more compactly.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
This is a build-breaker, but I'm still in the middle of running
a (lengthy) 'make distcheck' on several platforms before pushing,
so a review wouldn't hurt.
src/Makefile.am | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 09311b7..20ba1c8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -428,18 +428,35 @@ check-symsorting:
EXTRA_DIST += check-symfile.pl check-symsorting.pl
# Keep this list synced with RPC_PROBE_FILES
-PROTOCOL_STRUCTS = \
+PROTOCOL_STRUCTS =
+if WITH_REMOTE
+PROTOCOL_STRUCTS += \
$(srcdir)/remote_protocol-structs \
$(srcdir)/lxc_protocol-structs \
$(srcdir)/qemu_protocol-structs \
+ $(NULL)
+endif WITH_REMOTE
+PROTOCOL_STRUCTS += \
$(srcdir)/virnetprotocol-structs \
$(srcdir)/virkeepaliveprotocol-structs \
+ $(NULL)
+if WITH_LXC
+PROTOCOL_STRUCTS += \
$(srcdir)/lxc_monitor_protocol-structs \
+ $(NULL)
+endif WITH_LXC
+if WITH_LIBVIRTD
+PROTOCOL_STRUCTS += \
$(srcdir)/lock_protocol-structs \
$(NULL)
+endif WITH_LIBVIRTD
+
+# The various -structs files live in git, because they are only
+# conditionally generated; ship one -structs file for each .x file.
+EXTRA_DIST += $(notdir $(RPC_PROBE_FILES:.x=-structs)))
-if WITH_REMOTE
check-protocol: $(PROTOCOL_STRUCTS) $(PROTOCOL_STRUCTS:structs=struct)
+.PHONY: check-protocol $(PROTOCOL_STRUCTS:structs=struct)
# The .o file that pdwtags parses is created as a side effect of running
# libtool; but from make's perspective we depend on the .lo file.
@@ -458,13 +475,6 @@ $(srcdir)/lock_protocol-struct: \
$(srcdir)/%-struct: locking/lockd_la-%.lo
$(PDWTAGS)
-else !WITH_REMOTE
-# The $(PROTOCOL_STRUCTS) files must live in git, because they cannot be
-# re-generated when configured --without-remote.
-check-protocol:
-endif !WITH_REMOTE
-EXTRA_DIST += $(PROTOCOL_STRUCTS)
-
check-drivername:
$(AM_V_GEN)$(PERL) $(srcdir)/check-drivername.pl \
$(srcdir)/driver.h \
@@ -538,7 +548,6 @@ EXTRA_DIST += check-driverimpls.pl check-aclrules.pl check-aclperms.pl
check-local: check-protocol check-symfile check-symsorting \
check-drivername check-driverimpls check-aclrules \
check-aclperms
-.PHONY: check-protocol $(PROTOCOL_STRUCTS:structs=struct)
# Mock driver, covering domains, storage, networks, etc
TEST_DRIVER_SOURCES = \
@@ -1183,6 +1192,7 @@ endif ! WITH_DRIVER_MODULES
libvirt_driver_lxc_impl_la_CFLAGS = \
$(LIBNL_CFLAGS) \
+ $(XDR_CFLAGS) \
$(FUSE_CFLAGS) \
-I$(top_srcdir)/src/access \
-I$(top_srcdir)/src/conf \
@@ -2203,10 +2213,9 @@ BUILT_SOURCES += $(VIR_NET_RPC_GENERATED)
libvirt_net_rpc_la_SOURCES = \
rpc/virnetmessage.h rpc/virnetmessage.c \
- rpc/virnetprotocol.h rpc/virnetprotocol.c \
rpc/virnetsocket.h rpc/virnetsocket.c \
- rpc/virkeepaliveprotocol.h rpc/virkeepaliveprotocol.c \
- rpc/virkeepalive.h rpc/virkeepalive.c
+ rpc/virkeepalive.h rpc/virkeepalive.c \
+ $(VIR_NET_RPC_GENERATED)
if WITH_SSH2
libvirt_net_rpc_la_SOURCES += \
rpc/virnetsshsession.h rpc/virnetsshsession.c
--
1.8.3.1
11 years, 1 month