[libvirt] [libvirt-glib] Use latest warnings.m4 from gnulib
by Christophe Fergeau
The one we were using does not work properly with clang, causing
the build process to try to use -f/-W options that are not
supported by clang.
---
m4/warnings.m4 | 82 ++++++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 62 insertions(+), 20 deletions(-)
diff --git a/m4/warnings.m4 b/m4/warnings.m4
index 69d05a6..e3d239b 100644
--- a/m4/warnings.m4
+++ b/m4/warnings.m4
@@ -1,5 +1,5 @@
-# warnings.m4 serial 5
-dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
+# warnings.m4 serial 11
+dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -14,24 +14,66 @@ m4_ifdef([AS_VAR_APPEND],
[m4_define([gl_AS_VAR_APPEND],
[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])])
-# gl_WARN_ADD(PARAMETER, [VARIABLE = WARN_CFLAGS])
-# ------------------------------------------------
-# Adds parameter to WARN_CFLAGS if the compiler supports it. For example,
-# gl_WARN_ADD([-Wparentheses]).
-AC_DEFUN([gl_WARN_ADD],
-dnl FIXME: gl_Warn must be used unquoted until we can assume
-dnl autoconf 2.64 or newer.
-[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl
-AC_CACHE_CHECK([whether compiler handles $1], m4_defn([gl_Warn]), [
- gl_save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="${CPPFLAGS} $1"
- AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
- [AS_VAR_SET(gl_Warn, [yes])],
- [AS_VAR_SET(gl_Warn, [no])])
- CPPFLAGS="$gl_save_CPPFLAGS"
+
+# gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED],
+# [PROGRAM = AC_LANG_PROGRAM()])
+# -----------------------------------------------------------------
+# Check if the compiler supports OPTION when compiling PROGRAM.
+#
+# FIXME: gl_Warn must be used unquoted until we can assume Autoconf
+# 2.64 or newer.
+AC_DEFUN([gl_COMPILER_OPTION_IF],
+[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl
+AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl
+AS_LITERAL_IF([$1],
+ [m4_pushdef([gl_Positive], m4_bpatsubst([$1], [^-Wno-], [-W]))],
+ [gl_positive="$1"
+case $gl_positive in
+ -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;;
+esac
+m4_pushdef([gl_Positive], [$gl_positive])])dnl
+AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [
+ gl_save_compiler_FLAGS="$gl_Flags"
+ gl_AS_VAR_APPEND(m4_defn([gl_Flags]),
+ [" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["])
+ AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])],
+ [AS_VAR_SET(gl_Warn, [yes])],
+ [AS_VAR_SET(gl_Warn, [no])])
+ gl_Flags="$gl_save_compiler_FLAGS"
])
-AS_VAR_IF(gl_Warn, [yes],
- [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])])
+AS_VAR_IF(gl_Warn, [yes], [$2], [$3])
+m4_popdef([gl_Positive])dnl
+AS_VAR_POPDEF([gl_Flags])dnl
AS_VAR_POPDEF([gl_Warn])dnl
-m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl
])
+
+# gl_UNKNOWN_WARNINGS_ARE_ERRORS
+# ------------------------------
+# Clang doesn't complain about unknown warning options unless one also
+# specifies -Wunknown-warning-option -Werror. Detect this.
+AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS],
+[gl_COMPILER_OPTION_IF([-Werror -Wunknown-warning-option],
+ [gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror'],
+ [gl_unknown_warnings_are_errors=])])
+
+# gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS],
+# [PROGRAM = AC_LANG_PROGRAM()])
+# ---------------------------------------------
+# Adds parameter to WARN_CFLAGS if the compiler supports it when
+# compiling PROGRAM. For example, gl_WARN_ADD([-Wparentheses]).
+#
+# If VARIABLE is a variable name, AC_SUBST it.
+AC_DEFUN([gl_WARN_ADD],
+[AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS])
+gl_COMPILER_OPTION_IF([$1],
+ [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])],
+ [],
+ [$3])
+m4_ifval([$2],
+ [AS_LITERAL_IF([$2], [AC_SUBST([$2])])],
+ [AC_SUBST([WARN_CFLAGS])])dnl
+])
+
+# Local Variables:
+# mode: autoconf
+# End:
--
1.8.3.1
11 years, 2 months
[libvirt] [PATCH]qemu: virDomainControllerFind may return 0 if controller found
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
The return value of virDomainControllerFind >=0 means that
the specific controller was found.
But some functions invoke it and treat 0 as not found.
This patch fix these incorrect invocation.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_hotplug.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 346a8f9..ccd9cc6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6626,7 +6626,7 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
case VIR_DOMAIN_DEVICE_CONTROLLER:
controller = dev->data.controller;
if (virDomainControllerFind(vmdef, controller->type,
- controller->idx) > 0) {
+ controller->idx) >= 0) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Target already exists"));
return -1;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 6cdee44..f06930e 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -358,7 +358,7 @@ int qemuDomainAttachPciControllerDevice(virQEMUDriverPtr driver,
qemuDomainObjPrivatePtr priv = vm->privateData;
bool releaseaddr = false;
- if (virDomainControllerFind(vm->def, controller->type, controller->idx) > 0) {
+ if (virDomainControllerFind(vm->def, controller->type, controller->idx) >= 0) {
virReportError(VIR_ERR_OPERATION_FAILED,
_("target %s:%d already exists"),
type, controller->idx);
--
1.8.2.1
11 years, 2 months
[libvirt] [PATCH 0/2] Fix crash in chardev source parsing
by Peter Krempa
Peter Krempa (2):
conf: Don't crash on invalid chardev source definition of RNGs and
other
conf: clean up virDomainChrSourceDefParseXML
src/conf/domain_conf.c | 68 +++++++++++-----------
.../qemuxml2argv-virtio-rng-egd-crash.xml | 27 +++++++++
tests/qemuxml2argvtest.c | 2 +
3 files changed, 64 insertions(+), 33 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-egd-crash.xml
--
1.8.3.2
11 years, 2 months
[libvirt] [PATCH] LXC start after shutdown didn't work
by Cédric Bosdonnat
The bug is that after shutting down an lxc full-distro container, start
always fails. It turns out that shutdown doesn't clean the machine on
the machined side. A workaround is to machinectl terminate the
container. A proper fix would be that machinectl tracks the state of the
init process and cleans the machine if that one disappears.
This fix is the reasonable fix we can have on the libvirt side: really
try to start the container manually if starting it with systemd failed.
It currently never calls the virCgroupNewMachineManual function.
---
src/util/vircgroup.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index e99caf5..466c170 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -1656,9 +1656,6 @@ virCgroupNewMachine(const char *name,
group)) == 0)
return 0;
- if (rv == -1)
- return -1;
-
return virCgroupNewMachineManual(name,
drivername,
pidleader,
--
1.8.4
11 years, 2 months
[libvirt] virDomainGetInfo() returns wrong domain state
by Panday Ritesh Sharma (rpanday)
Hi Team,
I have written below code to get the VM state at run time. I found, though the VM is in shut-off state, when I use the function virDomainGetInfo(); I get state as running. Could you please let me know what wrong I am doing. To know the actual VM state I used 'virsh list' and it clearly shows the VM is in shut-off state. Please find the log and code snippet below.
Log from virsh:
=================
[host:~]$ virsh list --all
Id Name State
----------------------------------------------------
1 calvados running
2 LCXR running
3 default-sdr--1 running
- test--2 shut off
Out put:
=========
04.03.06.698923264:INFO: vm_libvirt_state_to_vmm_state: state returned is 1
Note : Here 1 is actually running.
Code snippet:
===============
enum cidl_vmm_vm_state
vm_libvirt_state_to_vmm_state(unsigned char libvirt_state)
{
enum cidl_vmm_vm_state state;
INFO("%s: state returned is %u\n",__FUNCTION__, libvirt_state); <<<<<<<<<<<<<<<<<<
if (libvirt_state == VIR_DOMAIN_RUNNING) {
state = cidl_vm_state_running;
} else if ((libvirt_state == VIR_DOMAIN_PAUSED) ||
(libvirt_state == VIR_DOMAIN_BLOCKED)) {
state = cidl_vm_state_paused;
} else if (libvirt_state == VIR_DOMAIN_SHUTOFF) {
state = cidl_vm_state_defined;
} else {
state = cidl_vm_state_not_defined;
}
return state;
}
virDomainInfo res_util;
virDomainPtr dom = virDomainLookupByName(virt,
private_names[vm_idx]);
res = virDomainGetInfo(dom, &res_util);
vminfo[vm_idx].vm_state =
vm_libvirt_state_to_vmm_state(res_util.state);
Regards
Ritesh Sharma
11 years, 2 months
[libvirt] [PATCH 1/2] qemu: Add SPAPR_VFIO_BRIDGE capability for PPC platform
by Li Zhang
From: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
To support VFIO for PPC, it is needed spapr-vfio-pci-host-bridge in
QEMU. This patch is to add one capability for it.
Signed-off-by: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
---
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index d94188a..7cc02db 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -241,6 +241,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"usb-storage", /* 155 */
"usb-storage.removable",
"virtio-mmio",
+ "spapr-pci-vfio-host-bridge",
);
struct _virQEMUCaps {
@@ -1391,6 +1392,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "i82801b11-bridge", QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE },
{ "usb-storage", QEMU_CAPS_DEVICE_USB_STORAGE },
{ "virtio-mmio", QEMU_CAPS_DEVICE_VIRTIO_MMIO },
+ { "spapr-pci-vfio-host-bridge", QEMU_CAPS_SPAPR_VFIO_BRIDGE },
};
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index f3c8fa8..33d303e 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -196,6 +196,7 @@ enum virQEMUCapsFlags {
QEMU_CAPS_DEVICE_USB_STORAGE = 155, /* -device usb-storage */
QEMU_CAPS_USB_STORAGE_REMOVABLE = 156, /* usb-storage.removable */
QEMU_CAPS_DEVICE_VIRTIO_MMIO = 157, /* -device virtio-mmio */
+ QEMU_CAPS_SPAPR_VFIO_BRIDGE = 158, /* -device spapr-pci-vfio-host-bridge */
QEMU_CAPS_LAST, /* this must always be the last item */
};
--
1.8.1.4
11 years, 2 months
[libvirt] [PATCH 00/23] Fix yet more OOM errors
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
A nice mix of leaks and crashes and ignoring errors.
Daniel P. Berrange (23):
Fix crash on OOM in xenParseSxpr
Fix handling of OOM when getting Xen dom ID
Don't clobber return value in virInterfaceDefParseProtoIPv6
Fix crash on OOM in virDomainSnapshotDefParse
Don't clobber 'ret' in LXC XML test case
Fix double free of hostdev on OOM in xenParseSxprPCI
Fix crash on OOM parsing storage pool XML
Add missing check for OOM with virVMXEscapeHexPipe
Fix leak of comment string if virConfAddEntry fails on OOM
Don't print all test suite errors to stderr in vmx2xmltest
Fix leak of iterators in virDBusMessageIterEncode
Fix double-free in virJSONParserHandleStartMap on OOM
Fix leak of parser state in virJSONValueFromString
Fix leak in virLockSpaceResourceFree
Don't ignore errors parsing nwfilter rules
Fix leak on OOM in qemuMonitorCommonTestNew
Avoid double free in qemuMonitorCommonTestInit on OOM
Avoid uninitialized data in qemuMonitorTestNew
Avoid crash on OOM in virbuftest
Avoid crash on OOM in virlockspacetest
Avoid crash on OOM in virportallocatortest
Avoid crash on OOM in virnetmessagetest
Avoid use of uninitialized data in virnetmessagetest
src/conf/interface_conf.c | 16 ++++++--------
src/conf/nwfilter_conf.c | 16 +++++++-------
src/conf/snapshot_conf.c | 4 ++--
src/conf/storage_conf.c | 6 +++---
src/util/virconf.c | 5 ++++-
src/util/virdbus.c | 24 ++++++++++++++++++---
src/util/virjson.c | 2 +-
src/util/virlockspace.c | 1 +
src/vmx/vmx.c | 3 ++-
src/xen/xen_driver.c | 3 ++-
src/xen/xend_internal.c | 10 +++++----
src/xenxs/xen_sxpr.c | 23 ++++++++++----------
src/xenxs/xen_sxpr.h | 4 ++--
tests/lxcxml2xmltest.c | 13 +++++++----
tests/nwfilterxml2xmltest.c | 14 ++++++------
tests/qemumonitortestutils.c | 7 +++++-
tests/sexpr2xmltest.c | 3 ++-
tests/virbuftest.c | 14 ++++++++++++
tests/virlockspacetest.c | 21 ++++++++++++------
tests/virnetmessagetest.c | 9 +++++++-
tests/virportallocatortest.c | 6 ++++++
tests/vmx2xmltest.c | 51 +++++++++++++++++---------------------------
22 files changed, 154 insertions(+), 101 deletions(-)
--
1.8.3.1
11 years, 2 months
[libvirt] networking restart after redefinition
by Mihamina Rakotomandimby
Hi all,
Running Fedora 18 and the bundled libvirt and virt-tools. Desktop use.
As I like to access my guests with a hostname and not a numerical IP
address, I fix the IP addressing in the network configuration:
http://pastebin.com/rfMKn40j
Unfortunately, I cant find a way to add a host without loosing the whole
networking, as when I add a ahost, I destroy and redefine the network.
Restarting libvirtd is not the solution.
How would you recommend to have networking UP after network redefinition?
--
RMA.
11 years, 2 months
[libvirt] [PATCH 0/4] Rewrite the test OOM checking code
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
This rewrites the OOM checking code to be much much much
more scalable. Instead of looping running 'main' multiple
times, we loop running 'virtTestRun' multiple times. Although
the overall number of mallocs to be checked is basically the
same, checking them in small blocks is a massive efficiency
win, because the complexity is 'n * (n + 1) / 1'.
Although I've fixed many issues, there are still some big
problems remaining
- The APIs in virxml.h don't let the caller distinguish
between "attribute not found" and other errors. So
anywhere we have an attribute that is optional, we are
failing to diagnose & report OOM correctly (or indeed
other errors we might get from libxml)
- It is desirable to validate that we get VIR_ERR_NO_MEMORY
for each failure, but there are times where we won't
get this. In particular with any of the APIs which have
delayed error reporting such as virCommand and virBuffer.
You can see an OOM from those APIs, but there's a window
between that occurring & being reported, where another
error may be reported.
- We should not count allocs in virerror.c or virlog.c APIs
when doing OOM testing, since they're intentionally non-fatal
Daniel P. Berrange (4):
Don't clobber 'ret' variable in testCompareXMLToXMLHelper
Remove existing OOM test impl
Remove test case average timing
Introduce new OOM testing support
tests/commandtest.c | 2 +-
tests/cputest.c | 5 +-
tests/domainsnapshotxml2xmltest.c | 2 +-
tests/esxutilstest.c | 2 +-
tests/fchosttest.c | 10 +-
tests/fdstreamtest.c | 8 +-
tests/interfacexml2xmltest.c | 6 +-
tests/jsontest.c | 2 +-
tests/libvirtdconftest.c | 2 +-
tests/lxcxml2xmltest.c | 4 +-
tests/metadatatest.c | 6 +-
tests/networkxml2conftest.c | 2 +-
tests/networkxml2xmltest.c | 2 +-
tests/networkxml2xmlupdatetest.c | 2 +-
tests/nodedevxml2xmltest.c | 6 +-
tests/nodeinfotest.c | 2 +-
tests/nwfilterxml2xmltest.c | 2 +-
tests/openvzutilstest.c | 2 +-
tests/qemuagenttest.c | 4 +-
tests/qemuargv2xmltest.c | 18 +-
tests/qemuhelptest.c | 2 +-
tests/qemuhotplugtest.c | 2 +-
tests/qemumonitorjsontest.c | 8 +-
tests/qemumonitortest.c | 2 +-
tests/qemuxml2argvtest.c | 14 +-
tests/qemuxml2xmltest.c | 25 +--
tests/qemuxmlnstest.c | 20 +-
tests/securityselinuxlabeltest.c | 6 +-
tests/securityselinuxtest.c | 2 +-
tests/sexpr2xmltest.c | 2 +-
tests/sockettest.c | 16 +-
tests/statstest.c | 2 +-
tests/storagepoolxml2xmltest.c | 6 +-
tests/storagevolxml2argvtest.c | 2 +-
tests/storagevolxml2xmltest.c | 14 +-
tests/sysinfotest.c | 2 +-
tests/testutils.c | 386 ++++++++++++++++++++------------------
tests/testutils.h | 3 +-
tests/utiltest.c | 4 +-
tests/viratomictest.c | 4 +-
tests/virauthconfigtest.c | 2 +-
tests/virbitmaptest.c | 18 +-
tests/virbuftest.c | 2 +-
tests/vircgrouptest.c | 22 +--
tests/virdbustest.c | 10 +-
tests/virdrivermoduletest.c | 2 +-
tests/virendiantest.c | 4 +-
tests/virhashtest.c | 2 +-
tests/viridentitytest.c | 4 +-
tests/virkeycodetest.c | 4 +-
tests/virkeyfiletest.c | 2 +-
tests/virlockspacetest.c | 14 +-
tests/virnetmessagetest.c | 10 +-
tests/virnetserverclienttest.c | 2 +-
tests/virnetsockettest.c | 30 +--
tests/virnettlscontexttest.c | 2 +-
tests/virnettlssessiontest.c | 4 +-
tests/virportallocatortest.c | 4 +-
tests/virshtest.c | 36 ++--
tests/virstoragetest.c | 2 +-
tests/virstringtest.c | 8 +-
tests/virsystemdtest.c | 10 +-
tests/virtimetest.c | 2 +-
tests/viruritest.c | 2 +-
tests/vmwarevertest.c | 2 +-
tests/vmx2xmltest.c | 2 +-
tests/xencapstest.c | 22 +--
tests/xmconfigtest.c | 4 +-
tests/xml2sexprtest.c | 2 +-
tests/xml2vmxtest.c | 2 +-
70 files changed, 436 insertions(+), 407 deletions(-)
--
1.8.3.1
11 years, 2 months
[libvirt] [PATCH] spec: Clean up distribution of ChangeLog (and others)
by Cole Robinson
- Move COPYING* to libvirt-client, so every package pulls them in
- Move AUTHORS ChangeLog.gz NEWS README TODO from -daemon to -docs
- Drop duplicate distribution of docs in -python
---
libvirt.spec.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index f899149..d294aad 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1723,6 +1723,8 @@ fi
%files docs
%defattr(-, root, root)
+%doc AUTHORS ChangeLog.gz NEWS README TODO
+
# Website
%dir %{_datadir}/doc/libvirt-docs-%{version}
%dir %{_datadir}/doc/libvirt-docs-%{version}/html
@@ -1739,7 +1741,6 @@ fi
%files daemon
%defattr(-, root, root)
-%doc AUTHORS ChangeLog.gz NEWS README COPYING COPYING.LESSER TODO
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/
%if %{with_network}
@@ -2011,7 +2012,7 @@ fi
%files client -f %{name}.lang
%defattr(-, root, root)
-%doc AUTHORS ChangeLog.gz NEWS README COPYING COPYING.LESSER TODO
+%doc COPYING COPYING.LESSER
%config(noreplace) %{_sysconfdir}/libvirt/libvirt.conf
%if %{with_lxc}
@@ -2101,7 +2102,6 @@ fi
%files python
%defattr(-, root, root)
-%doc AUTHORS NEWS README COPYING COPYING.LESSER
%{_libdir}/python*/site-packages/libvirt.py*
%{_libdir}/python*/site-packages/libvirt_qemu.py*
%{_libdir}/python*/site-packages/libvirt_lxc.py*
--
1.8.3.1
11 years, 2 months