[libvirt] [PATCH] build: silence ar warnings on rawhide
by Eric Blake
Newer binutils 'ar' has added an option 'D' for deterministic
builds, and at least on rawhide, this option is enabled by default.
But it conflicts with the 'u' optimization where the linker only
modifies libraries based on file timestamps, but can result in
different library ordering based on which files were touched last.
Thus, it results in some noisy compilation, for every CCLD line:
CCLD libvirt_driver_qemu_impl.la
ar: `u' modifier ignored since `D' is the default (see `U')
Upstream automake has decided that defaulting ARFLAGS to 'cru' is
no longer beneficial, and that switching the default to 'cr' will
both silence the noise and not penalize modern build systems.
https://lists.gnu.org/archive/html/automake-patches/2015-06/msg00000.html
But rather than wait for newer automake to propagate to all systems
that already have newer binutils, we might as well just use the new
default ourselves, even on older platforms.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
This is bugging me even more now that Fedora 22 also suffers from
the same issue (we've been ignoring it in rawhide for several months
now). While it seems trivial, I'd like a review before pushing.
configure.ac | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/configure.ac b/configure.ac
index 0da3ae8..abf4436 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,6 +25,10 @@ AC_CONFIG_MACRO_DIR([m4])
dnl Make automake keep quiet about wildcards & other GNUmake-isms; also keep
dnl quiet about the fact that we intentionally cater to automake 1.9
AM_INIT_AUTOMAKE([-Wno-portability -Wno-obsolete tar-ustar subdir-objects])
+dnl older automake's default of ARFLAGS=cru is noisy on newer binutils;
+dnl we don't really need the 'u' even in older toolchains. Then there is
+dnl older libtool, which spelled it AR_FLAGS
+m4_divert_text([DEFAULTS], [: "${ARFLAGS=cr} ${AR_FLAGS=cr}"])
# Maintainer note - comment this line out if you plan to rerun
# GNULIB_POSIXCHECK testing to see if libvirt should be using more modules.
--
2.4.2
9 years, 5 months
[libvirt] [PATCH v4 0/6] virsh: Further improve handling of integer options
by Andrea Bolognani
As suggested by Michal: now that we have a generic error message for
failures related to the parsing of integer options, it makes sense to
perform the corresponding check in a single spot instead of replicating
it every time vshCommandOpt*() is used.
Andrea Bolognani (6):
tests: Add a bunch of new tests to virsh-optparse
virsh: Use standard error messages in vshCommandOptTimeoutToMs()
virsh: Improve vshCommandOptTimeoutToMs()
virsh: Make vshCommandOptScaledInt() use vshCommandOpt()
virsh: Pass vshControl to all vshCommandOpt*() calls
virsh: Move error messages inside vshCommandOpt*() functions
tests/vcpupin | 4 +-
tests/virsh-optparse | 179 ++++++++++++++++++++++++++++++
tools/virsh-domain-monitor.c | 17 +--
tools/virsh-domain.c | 226 ++++++++++++--------------------------
tools/virsh-host.c | 67 +++---------
tools/virsh-interface.c | 6 +-
tools/virsh-network.c | 10 +-
tools/virsh-nodedev.c | 4 +-
tools/virsh-snapshot.c | 2 +-
tools/virsh-volume.c | 26 +----
tools/virsh.c | 252 ++++++++++++++++++++++++++-----------------
tools/virsh.h | 66 ++++++------
12 files changed, 461 insertions(+), 398 deletions(-)
--
2.1.0
9 years, 5 months
[libvirt] [PATCH v2 0/2] storage: Fix error when deleting non-existent volumes
by Erik Skultety
Erik Skultety (2):
storage: Don't update volume objs list before we successfully create
one
storage: RBD: do not return error when deleting non-existent volume
src/storage/storage_backend_rbd.c | 6 +++---
src/storage/storage_driver.c | 31 +++++++++++++------------------
2 files changed, 16 insertions(+), 21 deletions(-)
--
1.9.3
9 years, 5 months
[libvirt] Bug 1227257
by 王松波
I report a bug [Bug 1227257] . In the environment libvirt-1.2.16.tar.gz
+ qemu-img version 2.1.2 + ceph version 0.94.1.
libvirt pool will become inactive after one client does vol.delete and the
other does pool.refresh in the same pool simultaneously.
The reason is that rbd_list and rbd_open are not wrapped in an atomic
operation, but two seperate operations.
For example, two clients are operating in the same pool at the same time.
One client does rbd_list, and got 10 rbd images, meanwhile, the other
client deletes one of the rbd image. In this situation, when the first
client does next operation, such as rbd_open , the command may fail,
because the rbd image has been removed.
I write a testcase in python to reproduce this problem as follow(also have
put it in the attachment):
##################################
import libvirt
import sys
import time
import sys
#coding:utf-8
QEMU_URL = 'qemu:///system'
VOL_TEMPLATE='''
<volume>
<name>{vol}</name>
<key>{pool}/{vol}</key>
<source>
</source>
<capacity unit='MB'>{cap_size}</capacity>
<allocation unit='MB'>{alloc_size}</allocation>
<target>
<path>rbd:{pool}/{vol}</path>
<format type='unknown'/>
<permissions>
<mode>00</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</volume>'''
def create_vol(pool_name, vol_name, cap_size, alloc_size):
conn = libvirt.open(QEMU_URL)
if conn == None:
print 'Failed to open connection to the hypervisor'
sys.exit(1)
try:
pool = conn.storagePoolLookupByName(pool_name)
pool.refresh()
template = VOL_TEMPLATE.format(pool=pool_name, vol=vol_name,
cap_size=cap_size, alloc_size=alloc_size)
pool.createXML(template, 0)
except:
print 'Failed to open pool'
sys.exit(1)
finally:
if conn is not None:
conn.close()
def destroy_vol(pool_name, vol_name):
conn = libvirt.open(QEMU_URL)
if conn == None:
sys.exit(1)
pool = conn.storagePoolLookupByName(pool_name)
pool.refresh(0)
vol = pool.storageVolLookupByName(vol_name)
if vol is not None:
vol.delete(0)
if conn is not None:
conn.close()
if sys.argv[2] == 'create':
for i in range(1, 20):
volname = 'pool-down-test-%s-%d' % (sys.argv[1], i)
print 'create %s' % volname
create_vol('capacity', volname, '500', '500')
elif sys.argv[2] == 'destroy':
for i in range(1, 20):
volname = 'pool-down-test-%s-%d' % (sys.argv[1], i)
print 'destroy %s' % volname
destroy_vol('capacity', volname)
else:
print 'Usage: python vol-test.py clientId OPER'
print ' '
print 'where clientId : a num/string used to distinguish different
client'
print ' OPER : create/destroy'
Patch for this is as fllow:
diff --git a/src/storage/storage_backend_rbd.c
b/src/storage/storage_backend_rbd.c
index ae4bcb3..24fbc84 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -266,6 +266,46 @@ static int
virStorageBackendRBDCloseRADOSConn(virStorageBackendRBDStatePtr ptr)
return ret;
}
+static int volStorageBackendRBDVolIsExist(char *volname,
virStorageBackendRBDStatePtr ptr)
+{
+ int ret = -1;
+ char *name, *names = NULL;
+ size_t max_size = 1024;
+ int len = -1;
+
+ while (true) {
+ if (VIR_ALLOC_N(names, max_size) < 0)
+ goto cleanup;
+
+ len = rbd_list(ptr->ioctx, names, &max_size);
+ if (len >= 0)
+ break;
+ if (len != -ERANGE) {
+ VIR_WARN("%s", _("A problem occurred while listing RBD
images"));
+ goto cleanup;
+ }
+ VIR_FREE(names);
+ }
+
+ for (name = names; name < names + max_size;) {
+
+ if (STREQ(name, ""))
+ break;
+
+ name += strlen(name) + 1;
+ if (STREQ(volname, name)) {
+ VIR_ERROR("RBD images '%s' is exist, but cannot open it",
volname);
+ ret = -2;
+ break;
+ }
+ }
+ ret = 0;
+
+cleanup:
+ VIR_FREE(names);
+ return ret;
+}
+
static int volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr vol,
virStoragePoolObjPtr pool,
virStorageBackendRBDStatePtr
ptr)
@@ -276,8 +316,15 @@ static int
volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr vol,
r = rbd_open(ptr->ioctx, vol->name, &image, NULL);
if (r < 0) {
- virReportSystemError(-r, _("failed to open the RBD image '%s'"),
- vol->name);
+ VIR_DEBUG("failed to open RBD image '%s', check if it was still
exist in its pool",\
+ vol->name);
+ if (volStorageBackendRBDVolIsExist(vol->name, ptr) == 0) {
+ VIR_DEBUG("vol '%s' may be removed by the other rbd client",
vol->name);
+ ret = 0;
+ } else {
+ virReportSystemError(-r, _("failed to open the RBD image
'%s'"),
+ vol->name);
+ }
return ret;
}
9 years, 5 months
[libvirt] [PATCH v3 0/5] virsh: Further improve handling of integer options
by Andrea Bolognani
As suggested by Michal: now that we have a generic error message for
failures related to the parsing of integer options, it makes sense to
perform the corresponding check in a single spot instead of replicating
it every time vshCommandOpt*() is used.
Andrea Bolognani (5):
virsh: Use standard error message in vshCommandOptTimeoutToMs().
virsh: Improve vshCommandOptTimeoutToMs().
virsh: Make vshCommandOptScaledInt() use vshCommandOpt().
virsh: Pass vshControl to all vshCommandOpt*() calls.
virsh: Move error messages inside vshCommandOpt*() functions.
tests/vcpupin | 4 +-
tools/virsh-domain-monitor.c | 17 +--
tools/virsh-domain.c | 226 ++++++++++++---------------------------
tools/virsh-host.c | 67 +++---------
tools/virsh-interface.c | 6 +-
tools/virsh-network.c | 10 +-
tools/virsh-nodedev.c | 4 +-
tools/virsh-snapshot.c | 2 +-
tools/virsh-volume.c | 26 +----
tools/virsh.c | 248 +++++++++++++++++++++++++------------------
tools/virsh.h | 66 ++++++------
11 files changed, 278 insertions(+), 398 deletions(-)
--
2.1.0
9 years, 5 months
[libvirt] [PATCH] nwfilter: Fix sscanf off-by-one error in virNWFilterSnoopLeaseFileLoad
by Erik Skultety
We allocate 16 bytes for IPv4 address and 55 bytes for interface
key, therefore we should read up to 15/54 bytes and let the last byte
reserved for terminating null byte in sscanf.
https://bugzilla.redhat.com/show_bug.cgi?id=1226400
---
src/nwfilter/nwfilter_dhcpsnoop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index 6da8983..f331e22 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -1958,8 +1958,8 @@ virNWFilterSnoopLeaseFileLoad(void)
break;
}
ln++;
- /* key len 55 = "VMUUID"+'-'+"MAC" */
- if (sscanf(line, "%u %55s %16s %16s", &ipl.timeout,
+ /* key len 54 = "VMUUID"+'-'+"MAC" */
+ if (sscanf(line, "%u %54s %15s %15s", &ipl.timeout,
ifkey, ipstr, srvstr) < 4) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("virNWFilterSnoopLeaseFileLoad lease file "
--
1.9.3
9 years, 5 months
[libvirt] [PATCH] qemu: fix unsuitable error report when get memory stats
by Wang Yufei
From: Zhang Bo <oscar.zhangbo(a)huawei.com>
when we run the command 'virsh dommemstat xxx',
althrough memballoon's model is set 'none' in vm's XML,
it still reports an error in libvirtd.log.
error : qemuMonitorFindBalloonObjectPath:1042 : internal error: Cannot determine balloon device path
Apparently, if we don't set memballoon, we don't need to
set balloon device path.
Signed-off-by: Wang Yufei <james.wangyufei(a)huawei.com>
Signed-off-by: Zhang Bo <oscar.zhangbo(a)huawei.com>
---
.gnulib | 2 +-
src/qemu/qemu_monitor.c | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/.gnulib b/.gnulib
index 875ec93..106a386 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 875ec93e1501d2d2a8bab1b64fa66b8ceb51dc67
+Subproject commit 106a3866d01f9dd57ab4f10dbeb0d5a8db73a9f7
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index f959b74..c72702d 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1711,7 +1711,9 @@ qemuMonitorGetMemoryStats(qemuMonitorPtr mon,
QEMU_CHECK_MONITOR(mon);
if (mon->json) {
- ignore_value(qemuMonitorFindBalloonObjectPath(mon, "/"));
+ if (mon->vm->def->memballoon &&
+ mon->vm->def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE)
+ ignore_value(qemuMonitorFindBalloonObjectPath(mon, "/"));
mon->ballooninit = true;
return qemuMonitorJSONGetMemoryStats(mon, mon->balloonpath,
stats, nr_stats);
--
1.7.12.4
9 years, 5 months
[libvirt] [PATCH] util: process: @pid in virProcessSetAffinity's BSD impl is not unused
by Peter Krempa
---
Pushed as trivial.
src/util/virprocess.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 7a79970..501569f 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -537,7 +537,7 @@ int virProcessGetAffinity(pid_t pid,
#elif defined(HAVE_BSD_CPU_AFFINITY)
-int virProcessSetAffinity(pid_t pid ATTRIBUTE_UNUSED,
+int virProcessSetAffinity(pid_t pid,
virBitmapPtr map)
{
size_t i;
--
2.4.1
9 years, 5 months