[libvirt] [PATCH v2] bridge driver: implement networkEnableIpForwarding for BSD
by Roman Bogorodskiy
Implement networkEnableIpForwarding() using BSD style sysctl.
---
configure.ac | 7 ++++---
src/network/bridge_driver.c | 13 +++++++++++++
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index d3219ce..cc2213d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -207,7 +207,8 @@ 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])
+ 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.
@@ -220,8 +221,8 @@ LIBS=$old_libs
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 \
- sys/un.h sys/syscall.h netinet/tcp.h ifaddrs.h libtasn1.h \
- sys/ucred.h sys/mount.h])
+ sys/un.h sys/syscall.h sys/sysctl.h netinet/tcp.h ifaddrs.h \
+ libtasn1.h sys/ucred.h sys/mount.h])
dnl Check whether endian provides handy macros.
AC_CHECK_DECLS([htole64], [], [], [[#include <endian.h>]])
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index dd30244..80a5bc0 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -41,6 +41,9 @@
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <net/if.h>
+#if HAVE_SYS_SYSCTL_H
+# include <sys/sysctl.h>
+#endif
#include "virerror.h"
#include "datatypes.h"
@@ -1537,10 +1540,20 @@ static int
networkEnableIpForwarding(bool enableIPv4, bool enableIPv6)
{
int ret = 0;
+#ifdef HAVE_SYSCTLBYNAME
+ int enabled = 1;
+ if (enableIPv4)
+ ret = sysctlbyname("net.inet.ip.forwarding", NULL, 0,
+ &enabled, sizeof(enabled));
+ if (enableIPv6 && ret == 0)
+ ret = sysctlbyname("net.inet6.ip6.forwarding", NULL, 0,
+ &enabled, sizeof(enabled));
+#else
if (enableIPv4)
ret = virFileWriteStr("/proc/sys/net/ipv4/ip_forward", "1\n", 0);
if (enableIPv6 && ret == 0)
ret = virFileWriteStr("/proc/sys/net/ipv6/conf/all/forwarding", "1\n", 0);
+#endif
return ret;
}
--
1.8.2.3
11 years, 3 months
[libvirt] [PATCHv2 0/5] Introduce API to query IP addresses for given domain
by nehaljwani
This feature has been requested for a very long time. Since qemu guest
agent gives us reliable results, now the wait is over.
The RFC was first proposed by Michal Privoznik:
http://www.mail-archive.com/libvir-list@redhat.com/msg51857.html
A patch was submitted, using structs:
http://www.mail-archive.com/libvir-list@redhat.com/msg57141.html
Another patch was submitted, using XML:
http://www.mail-archive.com/libvir-list@redhat.com/msg57829.html
Neither of the patches were accepted, probably due to lack of extensibility
and usability. Hence, we thought of using virTypedParameters for reporting
list of interfaces along with their MAC address and IP addresses. The RFC
can be found here:
http://www.mail-archive.com/libvir-list@redhat.com/msg79793.html
The idea of extensibility was rejected and rendered out of scope of
libvirt. Hence, we were back to structs.
This API is called virDomainInterfacesAddresses which returns a dynamically
allocated array of virDomainInterface struct. The great disadvantage is
once this gets released, it's written in stone and we cannot change
or add an item into it.
The API supports two methods:
* Return information (list of all associated interfaces with MAC address
and IP addresses) of all of the domain interfaces by default (if
no interface name is provided)
* Return information for the specified interface (if an interface name
is provided)
nehaljwani (5):
domifaddr: Implement the public API
domifaddr: Implement the remote protocol
domifaddr: Implement the API for qemu
domifaddr: Add virsh support
domifaddr: Expose python binding
daemon/remote.c | 122 ++++++++++++++++++++++++++++++++
examples/python/Makefile.am | 2 +-
examples/python/README | 1 +
examples/python/domipaddrs.py | 50 +++++++++++++
include/libvirt/libvirt.h.in | 32 +++++++++
python/generator.py | 1 +
python/libvirt-override-api.xml | 8 ++-
python/libvirt-override.c | 117 +++++++++++++++++++++++++++++++
src/driver.h | 7 ++
src/libvirt.c | 99 ++++++++++++++++++++++++++
src/libvirt_public.syms | 5 ++
src/qemu/qemu_agent.c | 151 ++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_agent.h | 4 ++
src/qemu/qemu_driver.c | 56 +++++++++++++++
src/remote/remote_driver.c | 88 +++++++++++++++++++++++
src/remote/remote_protocol.x | 30 +++++++-
src/remote_protocol-structs | 24 +++++++
tools/virsh-domain-monitor.c | 102 +++++++++++++++++++++++++++
tools/virsh.pod | 10 +++
19 files changed, 906 insertions(+), 3 deletions(-)
create mode 100755 examples/python/domipaddrs.py
--
1.7.11.7
11 years, 3 months
[libvirt] [PATCH 0/2] Support setting the 'removable' flag for USB disks
by Fred A. Kemp
From: "Fred A. Kemp" <anonym(a)riseup.net>
The commit message of patch #2 explains the purpose of this patch set.
A review would be greatly appreciated!
Note that I've only added the new capability for usb-storage.removable
to the qemu help tests of qemu(-kvm) version 1.2.0, since that's what I
had easily available to get the output of `-device usb-storage,?` from.
I hope that's not an issue, otherwise, is there a way to obtain these
outputs without having to hunt down and install all supported versions?
Previous submissions of this patch set to this list:
http://www.redhat.com/archives/libvir-list/2013-March/msg01051.html
http://www.redhat.com/archives/libvir-list/2013-May/msg02039.html
https://www.redhat.com/archives/libvir-list/2013-July/msg01635.html
Fred A. Kemp (2):
qemu: Add capability flag for usb-storage
qemu: Support setting the 'removable' flag for USB disks
docs/formatdomain.html.in | 8 +++--
docs/schemas/domaincommon.rng | 8 +++++
src/conf/domain_conf.c | 31 ++++++++++++++++++--
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 10 +++++++
src/qemu/qemu_capabilities.h | 2 ++
src/qemu/qemu_command.c | 23 +++++++++++++--
tests/qemuhelpdata/qemu-1.2.0-device | 11 +++++++
tests/qemuhelpdata/qemu-kvm-1.2.0-device | 11 +++++++
tests/qemuhelptest.c | 20 +++++++++----
.../qemuxml2argv-disk-usb-device-removable.args | 8 +++++
.../qemuxml2argv-disk-usb-device-removable.xml | 27 +++++++++++++++++
tests/qemuxml2argvtest.c | 6 +++-
13 files changed, 151 insertions(+), 15 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-usb-device-removable.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-usb-device-removable.xml
--
1.7.10.4
11 years, 3 months
[libvirt] [PATCH] Allow a HTTP URL for cdrom ISO image
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
Hi all,
qemu/KVM has support to iso streaming, allowing a HTTP UTL for cdrom iso image.
I just added it to libvirt as well.
Aline Manera (1):
Allow a HTTP URL for cdrom ISO image
src/conf/domain_conf.c | 3 +-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 20 +++++++++--
.../qemuxml2argv-disk-cdrom-network.args | 5 +++
.../qemuxml2argv-disk-cdrom-network.xml | 37 ++++++++++++++++++++
tests/qemuxml2argvtest.c | 2 ++
6 files changed, 65 insertions(+), 3 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-network.xml
--
1.7.10.4
11 years, 3 months
[libvirt] [PATCH] libxl: fix libvirtd crash when reconnecting domains
by Jim Fehlig
More fallout from commit d72ef888. When reconnecting to running
domains, the libxl_ctx in libxlDomainObjPrivate was used before
initializing it, causing a segfault in libxl and consequently
crashing libvirtd.
Initialize the libxlDomainObjPrivate libxl_ctx in libxlReconnectDomain,
and while at it use this ctx in libxlReconnectDomain instead of the
driver-wide ctx.
---
src/libxl/libxl_driver.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index f09ad61..9fb4fa5 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1118,6 +1118,7 @@ libxlReconnectDomain(virDomainObjPtr vm,
void *opaque)
{
libxlDriverPrivatePtr driver = opaque;
+ libxlDomainObjPrivatePtr priv = vm->privateData;
int rc;
libxl_dominfo d_info;
int len;
@@ -1125,8 +1126,9 @@ libxlReconnectDomain(virDomainObjPtr vm,
virObjectLock(vm);
+ libxlDomainObjPrivateInitCtx(vm);
/* Does domain still exist? */
- rc = libxl_domain_info(driver->ctx, &d_info, vm->def->id);
+ rc = libxl_domain_info(priv->ctx, &d_info, vm->def->id);
if (rc == ERROR_INVAL) {
goto out;
} else if (rc != 0) {
@@ -1136,7 +1138,7 @@ libxlReconnectDomain(virDomainObjPtr vm,
}
/* Is this a domain that was under libvirt control? */
- if (libxl_userdata_retrieve(driver->ctx, vm->def->id,
+ if (libxl_userdata_retrieve(priv->ctx, vm->def->id,
"libvirt-xml", &data, &len)) {
VIR_DEBUG("libxl_userdata_retrieve failed, ignoring domain %d", vm->def->id);
goto out;
--
1.8.1.4
11 years, 3 months
Re: [libvirt] [Qemu-devel] [ANNOUNCE] Key Signing Party at KVM Forum 2013
by Eric Blake
FYI for those libvirt developers attending KVM Forum in October.
On 07/24/2013 06:50 AM, Anthony Liguori wrote:
>
> I will be hosting a key signing party at this year's KVM Forum.
>
> http://wiki.qemu.org/KeySigningParty2013
>
> Starting for the 1.7 release (begins in December), I will only accepted
> signed pull requests so please try to attend this event or make
> alternative arrangements to have someone sign your key who will attend
> the event.
>
> I will also be attending LinuxCon/CloudOpen/Plumbers North America if
> anyone wants to have another key signing party at that event and cannot
> attend KVM Forum.
>
> Regards,
>
> Anthony Liguori
>
>
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
11 years, 3 months
[libvirt] [PATCH] migration: do not restore labels on failed migration
by Eric Blake
https://bugzilla.redhat.com/show_bug.cgi?id=822052
When doing a live migration, if the destination fails for any
reason after the point in which files should be labeled, then
the cleanup of the destination would restore the labels to their
defaults, even though the source is still trying to continue
running with the image open. Bug 822052 mentioned one source
of live migration failure - a mismatch in SELinux virt_use_nfs
settings (on for source, off for destination); but I found other
situations that would also trigger it (for example, having a
graphics device tied to port 5999 on the source, and a different
domain on the destination already using that port, so that the
destination cannot reuse the port).
In short, just as cleanup of the source on a successful migration
must not relabel files (because the destination would be crippled
by the relabel), cleanup of the destination on a failed migraion
must not relabel files (because the source would be crippled).
* src/qemu/qemu_process.c (qemuProcessStart): Set flag to avoid
label restoration when cleaning up on failed migration.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/qemu/qemu_process.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 31de759..d727fc4 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3466,6 +3466,10 @@ int qemuProcessStart(virConnectPtr conn,
* restore any security label as we would overwrite labels
* we did not set. */
stop_flags = VIR_QEMU_PROCESS_STOP_NO_RELABEL;
+ /* If we fail while doing incoming migration, then we must not
+ * relabel, as the source is still using the files. */
+ if (migrateFrom)
+ stop_flags |= VIR_QEMU_PROCESS_STOP_MIGRATED;
hookData.conn = conn;
hookData.vm = vm;
--
1.8.3.1
11 years, 3 months
[libvirt] [[libvirt-cim PATCH]] libvirt-cim.spec.in: Uninstall open-pegasus-specific providers
by Ján Tomko
Older libvirt-cim might've installed these in the sblim-sfcb
repository, causing errors when calling sfcbrepos on libvirt-cim update.
---
libvirt-cim.spec.in | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in
index a027246..cd399b1 100644
--- a/libvirt-cim.spec.in
+++ b/libvirt-cim.spec.in
@@ -84,6 +84,13 @@ rm -fr $RPM_BUILD_ROOT
-n @CIM_VIRT_NS@ \
-r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true
+# Remove open-pegasus-specific providers installed in sfcb repository
+# by older libvirt-cim packages
+%{_datadir}/%{name}/provider-register.sh -d -t sfcb \
+ -n root/PG_InterOp \
+ -r %{PGINTEROP_REG} -m %{PGINTEROP_MOF} >/dev/null 2>&1 || true
+
+
%post
/sbin/ldconfig
--
1.8.1.5
11 years, 3 months
[libvirt] [PATCH] tests: fix building without xattr support
by Claudio Bley
Only compile securityselinuxhelper.c if xattr support was detected to
avoid this error:
securityselinuxhelper.c:34:24: fatal error: attr/xattr.h: No such file
or directory compilation terminated.
Since all SELinux tests depend upon the securityselinuxhelper library,
these test programs are now only build when xattr support is
available.
Signed-off-by: Claudio Bley <cbley(a)av-test.de>
---
I'm by no means an automake/SELinux expert and thus I am unsure whether this
is the right thing to do.
Especially since in commit 95577af442e5 Eric commented that the
"Makefile already guaranteed xattr support." which is obviously not the
the case, but maybe I'm just missing something...
tests/Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9098dec..09144d6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -131,23 +131,23 @@ test_programs = virshtest sockettest \
if WITH_DBUS
test_programs += virdbustest \
virsystemdtest
endif
if WITH_GNUTLS
test_programs += virnettlscontexttest virnettlssessiontest
endif
if WITH_SECDRIVER_SELINUX
+if WITH_ATTR
test_programs += securityselinuxtest
if WITH_QEMU
-if WITH_ATTR
test_programs += securityselinuxlabeltest
endif
endif
endif
if WITH_DRIVER_MODULES
test_programs += virdrivermoduletest
endif
# This is a fake SSH we use from virnetsockettest
@@ -702,39 +702,39 @@ virkeyfiletest_LDADD = $(LDADDS)
virauthconfigtest_SOURCES = \
virauthconfigtest.c testutils.h testutils.c
virauthconfigtest_LDADD = $(LDADDS)
seclabeltest_SOURCES = \
seclabeltest.c
seclabeltest_LDADD = $(LDADDS)
if WITH_SECDRIVER_SELINUX
+if WITH_ATTR
if WITH_TESTS
noinst_LTLIBRARIES += libsecurityselinuxhelper.la
else
check_LTLIBRARIES += libsecurityselinuxhelper.la
endif
libsecurityselinuxhelper_la_SOURCES = \
securityselinuxhelper.c
libsecurityselinuxhelper_la_LDFLAGS = -module -avoid-version \
-rpath /evil/libtool/hack/to/force/shared/lib/creation
securityselinuxtest_SOURCES = \
securityselinuxtest.c testutils.h testutils.c
securityselinuxtest_LDADD = $(LDADDS) $(SELINUX_LIBS)
securityselinuxtest_DEPENDENCIES = libsecurityselinuxhelper.la \
../src/libvirt.la
if WITH_QEMU
-if WITH_ATTR
securityselinuxlabeltest_SOURCES = \
securityselinuxlabeltest.c testutils.h testutils.c \
testutilsqemu.h testutilsqemu.c
securityselinuxlabeltest_LDADD = $(qemu_LDADDS) $(SELINUX_LIBS)
securityselinuxlabeltest_DEPENDENCIES = libsecurityselinuxhelper.la \
../src/libvirt.la
endif
endif
endif
EXTRA_DIST += securityselinuxtest.c securityselinuxlabeltest.c \
--
1.7.9.5
11 years, 3 months
[libvirt] [PATCHv2 0/2] Fix error reporting of virBitmapParse
by Peter Krempa
Please see notes in individual patches.
Peter Krempa (2):
virBitmapParse: Fix behavior in case of error
virBitmapParse: Don't shadow errors
po/POTFILES.in | 1 +
src/conf/domain_conf.c | 5 +----
src/conf/network_conf.c | 3 ---
src/nodeinfo.c | 5 +----
src/qemu/qemu_driver.c | 2 --
src/util/virbitmap.c | 18 +++++++++---------
src/xenxs/xen_sxpr.c | 5 +----
tests/cpuset | 2 +-
8 files changed, 14 insertions(+), 27 deletions(-)
--
1.8.3.2
11 years, 3 months