[libvirt] [PATCH] build: fix build with latest rawhide kernel headers
by Eric Blake
Bother those kernel developers. In the latest rawhide, kernel
and glibc have now been unified so that <netinet/in.h> and
<linux/in6.h> no longer clash; but <linux/if_bridge.h> is still
not self-contained. Because of the latest header change, the
build is failing with:
checking for linux/param.h... no
configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support
with details:
In file included from conftest.c:561:0:
/usr/include/linux/in6.h:71:18: error: field 'flr_dst' has incomplete type
struct in6_addr flr_dst;
We need a workaround to avoid our workaround :)
* configure.ac (KERNEL_HEADERS_WORKAROUND): New test.
* src/util/virnetdevbridge.c (includes): Use it.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
This qualifies as a build-breaker; but last time I pushed a patch
in this area of code without review, it got reverted, so I'll wait
for the review.
I've tested on RHEL 5, RHEL 6, Fedora 19 (all of which have glibc
and kernel differences, although not the same error messages) and
rawhide (where glibc and kernel finally agree, but where the kernel
headers _still_ assume that the caller already declared ipv6 structs).
configure.ac | 38 ++++++++++++++++++++++++++++----------
src/util/virnetdevbridge.c | 24 ++++++++++++++----------
2 files changed, 42 insertions(+), 20 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8426863..8acccdd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1051,18 +1051,36 @@ 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
+ # to rawhide), we first have to probe whether glibc and kernel can be
+ # used in tandem; and if not, provide workarounds that ensure that
+ # ABI-compatible IPv6 types are present for use by the kernel headers.
+ # These probes mirror the usage in virnetdevbridge.c
+ AC_CACHE_CHECK([whether kernel and glibc headers are compatible],
+ [lv_cv_kernel_glibc_compatible],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <netinet/in.h>
+ #include <linux/in6.h>
+ ]])],
+ [lv_cv_kernel_glibc_compatible=yes],
+ [lv_cv_kernel_glibc_compatible=no])])
+ if test "x$lv_cv_kernel_glibc_compatible" != xyes; then
+ AC_DEFINE([KERNEL_HEADERS_WORKAROUND], [1],
+ [define to 1 if Linux kernel headers require a workaround to avoid
+ compilation errors when mixed with glibc headers])
+ fi
AC_CHECK_HEADERS([linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h],,
[AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt with QEMU or LXC support])],
- [[/* The kernel folks broke their headers when used with particular
- * glibc versions; although the structs are ABI compatible, the
- * C type system doesn't like struct redefinitions. We work around
- * the problem here in the same manner as in virnetdevbridge.c. */
- #include <netinet/in.h>
- #define in6_addr in6_addr_
- #define sockaddr_in6 sockaddr_in6_
- #define ipv6_mreq ipv6_mreq_
- #define in6addr_any in6addr_any_
- #define in6addr_loopback in6addr_loopback_
+ [[#include <netinet/in.h>
+ #if KERNEL_HEADERS_WORKAROUND
+ # define in6_addr in6_addr_
+ # define sockaddr_in6 sockaddr_in6_
+ # define ipv6_mreq ipv6_mreq_
+ # define in6addr_any in6addr_any_
+ # define in6addr_loopback in6addr_loopback_
+ #endif
#include <linux/in6.h>
]])
fi
diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
index e4daa27..b78ab07 100644
--- a/src/util/virnetdevbridge.c
+++ b/src/util/virnetdevbridge.c
@@ -39,22 +39,26 @@
#ifdef __linux__
# include <linux/sockios.h>
# include <linux/param.h> /* HZ */
+# if KERNEL_HEADERS_WORKAROUND
/* Depending on the version of kernel vs. glibc, there may be a collision
* between <net/in.h> and kernel IPv6 structures. The different types
* are ABI compatible, but choke the C type system; work around it by
* using temporary redefinitions. */
-# define in6_addr in6_addr_
-# define sockaddr_in6 sockaddr_in6_
-# define ipv6_mreq ipv6_mreq_
-# define in6addr_any in6addr_any_
-# define in6addr_loopback in6addr_loopback_
+# define in6_addr in6_addr_
+# define sockaddr_in6 sockaddr_in6_
+# define ipv6_mreq ipv6_mreq_
+# define in6addr_any in6addr_any_
+# define in6addr_loopback in6addr_loopback_
+# endif
# include <linux/in6.h>
# include <linux/if_bridge.h> /* SYSFS_BRIDGE_ATTR */
-# undef in6_addr
-# undef sockaddr_in6
-# undef ipv6_mreq
-# undef in6addr_any
-# undef in6addr_loopback
+# if KERNEL_HEADERS_WORKAROUND
+# undef in6_addr
+# undef sockaddr_in6
+# undef ipv6_mreq
+# undef in6addr_any
+# undef in6addr_loopback
+# endif
# define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
# define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
--
1.8.3.1
11 years, 7 months
[libvirt] [PATCH] build: make autobuild require rpm build deps
by Eric Blake
I spent far too long on a new machine trying to figure out why
./autobuild.sh failed during the rpm build failure (complaining
that libvirt_parthelper was supposed to be packaged but was not
built), and finally traced it to a missing parted-devel
installation. I don't know why we have --nodeps in place, but
removing it would make rpmbuild error out much sooner, and with
a much less cryptic failure case.
* autobuild.sh: Drop --nodeps from rpmbuild lines.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
I'm okay ditching this patch if someone can explain why the
--nodeps line should be there.
autobuild.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/autobuild.sh b/autobuild.sh
index e5aa35c..0ab5f5e 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -60,7 +60,7 @@ else
fi
if test -f /usr/bin/rpmbuild ; then
- rpmbuild --nodeps \
+ rpmbuild \
--define "extra_release $EXTRA_RELEASE" \
--define "_sourcedir `pwd`" \
-ba --clean libvirt.spec
@@ -111,7 +111,7 @@ fi
if test -x /usr/bin/i686-w64-mingw32-gcc && test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
if test -f /usr/bin/rpmbuild ; then
- rpmbuild --nodeps \
+ rpmbuild \
--define "extra_release $EXTRA_RELEASE" \
--define "_sourcedir `pwd`" \
-ba --clean mingw-libvirt.spec
--
1.8.3.1
11 years, 7 months
[libvirt] [PATCHv3 RESEND 0/5] Handling of undefine and redefine snapshots with VirtualBox 4.2
by Manuel VIVES
Hi,
This is a serie of patches in order to support undefining and redefining
snapshots with VirtualBox 4.2.
The serie of patches is rather big, and adds among other things some utility functions unrelated to VirtualBox in patches 1 & 2.
The code review could be done in several parts: e.g. patches 1 & 2 separately to validate the utility functions.
The VirtualBox API provides only high level operations to manipulate snapshots,
so it not possible to support flags like VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE and
VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY with only API calls.
Following an IRC talk with Eric Blake, the decision was taken to emulate these
behaviours by manipulating directly the .vbox XML files.
The first two patches are some util methods for handling uuid and strings that
will be used after.
The third patch brings more details in the snapshot XML returned by libvirt.
We will need those modifications in order to redefine the snapshots.
The fourth patch brings the support of the VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE
and VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT flags in virDomainSnapshotCreateXML.
The fifth and last patch brings the support of the VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY
flag in virDomainSnapshotDelete.
The patches are only for Virtualbox 4.2
Regards,
Manuel VIVES
V3:
* Use of STREQ_NULLABLE instead of STREQ in one case
* Fix the method for finding uuids according to Ján Tomko review
V2:
* Fix a licence problem with the method for string replacement
Manuel VIVES (5):
viruuid.h/c: Util method for finding uuid patterns in some strings
virstring.h/c: Util method for making some find and replace in
strings
vbox_tmpl.c: Better XML description for snapshots
vbox_tmpl.c: Patch for redefining snapshots
vbox_tmpl.c: Add methods for undefining snapshots
po/POTFILES.in | 1 +
src/conf/domain_conf.c | 2 +-
src/libvirt_private.syms | 2 +
src/util/virstring.c | 48 ++
src/util/virstring.h | 2 +
src/util/viruuid.c | 81 ++
src/util/viruuid.h | 1 +
src/vbox/vbox_tmpl.c | 1846 +++++++++++++++++++++++++++++++++++++++++++---
8 files changed, 1871 insertions(+), 112 deletions(-)
--
1.7.10.4
11 years, 7 months
[libvirt] One question about ACS for pci passthrough
by Li Zhang
Hi all,
In libvirt, it doesn't allow non-ACS switch to assign devices to guests.
Is this required for X86 to support PCI passthrough?
On my power machine, ACS capability can't be found. I think HW doesn't
support it.
I don't know whether this is a special situation, and I have to set
relaxed_acs_check = 1.
Thanks.
--Li
11 years, 7 months
[libvirt] [PATCH 0/3] Clean up usage of access(PATH, F_OK)
by Peter Krempa
Peter Krempa (3):
util: Declare that virFileExists shall honor errno
cgroup: Move [qemu|lxc]GetCpuBWStatus to vicgroup.c and refactor it
cleanup: Kill usage of access(PATH, F_OK) in favor of virFileExists()
src/libvirt_private.syms | 1 +
src/lxc/lxc_driver.c | 52 ++++-------------------------------
src/openvz/openvz_conf.c | 2 +-
src/parallels/parallels_storage.c | 2 +-
src/qemu/qemu_capabilities.c | 4 +--
src/qemu/qemu_cgroup.c | 6 ++--
src/qemu/qemu_driver.c | 51 ++++------------------------------
src/qemu/qemu_process.c | 2 +-
src/storage/storage_backend_fs.c | 2 +-
src/storage/storage_backend_logical.c | 2 +-
src/storage/storage_backend_mpath.c | 8 +-----
src/storage/storage_backend_scsi.c | 3 +-
src/util/vircgroup.c | 31 ++++++++++++++++++++-
src/util/vircgroup.h | 2 ++
src/util/virfile.c | 8 +++++-
src/util/virpci.c | 2 +-
src/util/virscsi.c | 2 +-
src/util/virutil.c | 6 ++--
18 files changed, 67 insertions(+), 119 deletions(-)
--
1.8.3.2
11 years, 7 months
Re: [libvirt] [Users] Live Migration failed oVirt 3.3 Nightly
by Dan Kenigsberg
On Sun, Sep 15, 2013 at 09:57:47PM +1000, Andrew Lau wrote:
> On Sun, Sep 15, 2013 at 9:34 PM, Dan Kenigsberg <danken(a)redhat.com> wrote:
>
> > On Sun, Sep 15, 2013 at 08:44:18PM +1000, Andrew Lau wrote:
> > > On Sun, Sep 15, 2013 at 8:00 PM, Dan Kenigsberg <danken(a)redhat.com>
> > wrote:
> > >
> > > > On Sun, Sep 15, 2013 at 06:48:41PM +1000, Andrew Lau wrote:
> > > > > Hi Dan,
> > > > >
> > > > > Certainly, I've uploaded them to fedora's paste bin and tried to snip
> > > > just
> > > > > the relevant details.
> > > > >
> > > > > Sender (hv01.melb.domain.net):
> > > > > http://paste.fedoraproject.org/39660/92339651/
> > > >
> > > > This one has
> > > >
> > > > libvirtError: operation failed: Failed to connect to remote libvirt
> > > > URI qemu+tls://hv02.melb.domain.net/system
> > > >
> > > > which is most often related to firewall issues, and some time to key
> > > > mismatch.
> > > >
> > > > Does
> > > > virsh -c qemu+tls://hv02.melb.domain.net/system capabilities
> > > > work when run from the command line of hv01?
> > > >
> > > > Dan.
> > > > > Receiver (hv02.melb.domain.net): `
> > > > > http://paste.fedoraproject.org/39661/23406913/
> > > > >
> > > > > VM being transfered is ovirt_guest_vm
> > > > >
> > > > > Thanks,
> > > > > Andrew
> > > >
> > >
> > > virsh -c qemu+tls://hv02.melb.domain.net/system
> > > 2013-09-15 10:41:10.620+0000: 23994: info : libvirt version: 0.10.2,
> > > package: 18.el6_4.9 (CentOS BuildSystem <http://bugs.centos.org>,
> > > 2013-07-02-11:19:29, c6b8.bsys.dev.centos.org)
> > > 2013-09-15 10:41:10.620+0000: 23994: warning :
> > > virNetTLSContextCheckCertificate:1102 : Certificate check failed
> > > Certificate failed validation: The certificate hasn't got a known issuer.
> >
> > Would you share your
> >
> >
> > openssl x509 -in
> > /etc/pki/vdsm/certs/cacert.pem -text
> >
> > openssl x509 -in /etc/pki/vdsm/certs/vdsmcert.pem -text
> >
> > on both hosts? This content may be sensitive, and may not
> > provide an answer why libvirt on src cannot contact libvirtd on the
> > other host. So before you do that, would you test if
> >
> >
> > vdsClient -s hv02.melb.domain.net getVdsCapabilities
> >
> > works when run on hv01? It may be that the certificates are fine, but
> > libvirt is not configured to use the correct ones.
> >
> > Dan.
> >
> >
> vdsClient -s hv02.melb.domain.net getVdsCapabilities runs fine
>
> I did a quick comparison between the files on both hosts, they seem to have
> the right details (host names, authority etc.)
> cacert.pem matches
>
> /etc/libvirt/libvirtd.conf
>
> ca_file="/etc/pki/vdsm/certs/cacert.pem"
> cert_file="/etc/pki/vdsm/certs/vdsmcert.pem"
> key_file="/etc/pki/vdsm/keys/vdsmkey.pem"
Maybe someone on libvir-list could guess why this could be happening?
11 years, 7 months
[libvirt] [PATCH] virsh: move command maxvcpus from domain group to host group.
by yangdongsheng
Since the maxvcpus command query the maximum number of virtual
CPUs supported for a guest VM on this connection, it should be
in virsh-host.c but not virsh-domain.c.
Signed-off-by: yangdongsheng <yangds.fnst(a)cn.fujitsu.com>
---
tools/virsh-domain.c | 44 --------------------------------------------
tools/virsh-host.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 4f85f5f..50a57ee 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -5172,44 +5172,6 @@ cmdDomjobabort(vshControl *ctl, const vshCmd *cmd)
}
/*
- * "maxvcpus" command
- */
-static const vshCmdInfo info_maxvcpus[] = {
- {.name = "help",
- .data = N_("connection vcpu maximum")
- },
- {.name = "desc",
- .data = N_("Show maximum number of virtual CPUs for guests on this connection.")
- },
- {.name = NULL}
-};
-
-static const vshCmdOptDef opts_maxvcpus[] = {
- {.name = "type",
- .type = VSH_OT_STRING,
- .help = N_("domain type")
- },
- {.name = NULL}
-};
-
-static bool
-cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd)
-{
- const char *type = NULL;
- int vcpus;
-
- if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0)
- return false;
-
- if ((vcpus = virConnectGetMaxVcpus(ctl->conn, type)) < 0)
- return false;
-
- vshPrint(ctl, "%d\n", vcpus);
-
- return true;
-}
-
-/*
* "vcpucount" command
*/
static const vshCmdInfo info_vcpucount[] = {
@@ -10637,12 +10599,6 @@ const vshCmdDef domManagementCmds[] = {
.info = info_managedsaveremove,
.flags = 0
},
- {.name = "maxvcpus",
- .handler = cmdMaxvcpus,
- .opts = opts_maxvcpus,
- .info = info_maxvcpus,
- .flags = 0
- },
{.name = "memtune",
.handler = cmdMemtune,
.opts = opts_memtune,
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 880ae4b..f69ab79 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -193,6 +193,44 @@ cleanup:
}
/*
+ * "maxvcpus" command
+ */
+static const vshCmdInfo info_maxvcpus[] = {
+ {.name = "help",
+ .data = N_("connection vcpu maximum")
+ },
+ {.name = "desc",
+ .data = N_("Show maximum number of virtual CPUs for guests on this connection.")
+ },
+ {.name = NULL}
+};
+
+static const vshCmdOptDef opts_maxvcpus[] = {
+ {.name = "type",
+ .type = VSH_OT_STRING,
+ .help = N_("domain type")
+ },
+ {.name = NULL}
+};
+
+static bool
+cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd)
+{
+ const char *type = NULL;
+ int vcpus;
+
+ if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0)
+ return false;
+
+ if ((vcpus = virConnectGetMaxVcpus(ctl->conn, type)) < 0)
+ return false;
+
+ vshPrint(ctl, "%d\n", vcpus);
+
+ return true;
+}
+
+/*
* "nodeinfo" command
*/
static const vshCmdInfo info_nodeinfo[] = {
@@ -863,6 +901,12 @@ const vshCmdDef hostAndHypervisorCmds[] = {
.info = info_hostname,
.flags = 0
},
+ {.name = "maxvcpus",
+ .handler = cmdMaxvcpus,
+ .opts = opts_maxvcpus,
+ .info = info_maxvcpus,
+ .flags = 0
+ },
{.name = "node-memory-tune",
.handler = cmdNodeMemoryTune,
.opts = opts_node_memory_tune,
--
1.7.10.1
11 years, 7 months
[libvirt] [PATCH RESEND 0/4] Pre-create storage on live migration
by Michal Privoznik
[Resending due to some list difficulties]
Currently users are required to pre-create storage on their own upon migration.
This patch set implements the feature for RAW, QCOW and QCOW2 images. While for
the RAW fallocate() is used (so we are guaranteed subsequent write() won't fail
with ENOSPC, for the latter two we have no other option than using qemu-img,
which uses ftruncate(). On the other hand, this is not such big deal. If the
spare runs out as a domain is migrating, the migration is aborted, and
pre-created storage unlink()-ed. There's no difference to what will happen if
user will pre-create storage by hand.
https://bugzilla.redhat.com/show_bug.cgi?id=927252
Michal Privoznik (4):
qemu: Expose file opening functions
qemu_domain: Introduce qemuDomainGetDiskBlockInfo
qemu_migration: Check size prerequisites
qemu_migration: Unlink pre-created storage on error
src/qemu/qemu_domain.c | 299 ++++++++++++++++++++++++++++++++++++++++++++-
src/qemu/qemu_domain.h | 16 +++
src/qemu/qemu_driver.c | 276 ++---------------------------------------
src/qemu/qemu_migration.c | 304 +++++++++++++++++++++++++++++++++++++++++++++-
src/qemu/qemu_process.c | 8 ++
5 files changed, 627 insertions(+), 276 deletions(-)
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCH] Explicitly link libvirt_net_rpc against SELINUX_LIBS
by Guido Günther
Since virnetsocket conditionally uses selinux we need to link against it
otherwise the build fails with:
CCLD libvirtd
/usr/bin/ld: ../src/.libs/libvirt-lxc.so: undefined reference to symbol 'freecon'
/lib/i386-linux-gnu/libselinux.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[3]: *** [libvirtd] Error 1
---
src/Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Makefile.am b/src/Makefile.am
index 711da32..1a74435 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2226,6 +2226,7 @@ libvirt_net_rpc_la_LDFLAGS = \
$(GNUTLS_LIBS) \
$(SASL_LIBS) \
$(SSH2_LIBS)\
+ $(SELINUX_LIBS) \
$(AM_LDFLAGS) \
$(CYGWIN_EXTRA_LDFLAGS) \
$(MINGW_EXTRA_LDFLAGS)
--
1.8.4.rc3
11 years, 8 months