[libvirt] [PATCH] src: test: remove unused variate @maxcpu in testDomainGetVcpus
by Wang King
The @maxcpu variate isn't used anymore.
---
src/test/test_driver.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 46ebdcc..919b265 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2467,7 +2467,7 @@ static int testDomainGetVcpus(virDomainPtr domain,
virDomainObjPtr privdom;
virDomainDefPtr def;
size_t i;
- int maxcpu, hostcpus;
+ int hostcpus;
int ret = -1;
struct timeval tv;
unsigned long long statbase;
@@ -2493,10 +2493,6 @@ static int testDomainGetVcpus(virDomainPtr domain,
statbase = (tv.tv_sec * 1000UL * 1000UL) + tv.tv_usec;
hostcpus = VIR_NODEINFO_MAXCPUS(privconn->nodeInfo);
- maxcpu = maplen * 8;
- if (maxcpu > hostcpus)
- maxcpu = hostcpus;
-
if (!(allcpumap = virBitmapNew(hostcpus)))
goto cleanup;
--
2.8.3
7 years, 8 months
[libvirt] [PATCH] esx: Fix incorrect memory compare size in esxStoragePoolLookupByUUID
by Wang King
Use MD5_DIGEST_SIZE or VIR_UUID_BUFLEN rather than VIR_UUID_STRING_BUFLEN
when compare @uuid with @md5.
---
src/esx/esx_storage_backend_iscsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/esx/esx_storage_backend_iscsi.c b/src/esx/esx_storage_backend_iscsi.c
index 96b472e..b106c51 100644
--- a/src/esx/esx_storage_backend_iscsi.c
+++ b/src/esx/esx_storage_backend_iscsi.c
@@ -220,7 +220,7 @@ esxStoragePoolLookupByUUID(virConnectPtr conn,
target; target = target->_next) {
md5_buffer(target->iScsiName, strlen(target->iScsiName), md5);
- if (memcmp(uuid, md5, VIR_UUID_STRING_BUFLEN) == 0)
+ if (memcmp(uuid, md5, VIR_UUID_BUFLEN) == 0)
break;
}
--
2.8.3
7 years, 8 months
[libvirt] [PATCH] esx: Fix memory leak
by Wang King
Variable def going out of scope leaks the storage def.source.hosts points to.
---
src/esx/esx_storage_backend_vmfs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backend_vmfs.c
index a1a660b..940e5d1 100644
--- a/src/esx/esx_storage_backend_vmfs.c
+++ b/src/esx/esx_storage_backend_vmfs.c
@@ -513,6 +513,7 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
xml = virStoragePoolDefFormat(&def);
cleanup:
+ VIR_FREE(def.source.hosts);
esxVI_String_Free(&propertyNameList);
esxVI_ObjectContent_Free(&datastore);
esxVI_DatastoreHostMount_Free(&hostMount);
--
2.8.3
7 years, 8 months
[libvirt] [PATCH] util: Fix resource leak
by Wang King
The virRotatingFileWriterAppend method leaks the file->entry
on the virRotatingFileWriterEntryNew failing path.
---
src/util/virrotatingfile.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/util/virrotatingfile.c b/src/util/virrotatingfile.c
index 9144729..83a695f 100644
--- a/src/util/virrotatingfile.c
+++ b/src/util/virrotatingfile.c
@@ -483,18 +483,19 @@ virRotatingFileWriterAppend(virRotatingFileWriterPtr file,
if ((file->entry->pos == file->maxlen && len) ||
forceRollover) {
- virRotatingFileWriterEntryPtr tmp = file->entry;
+ virRotatingFileWriterEntryPtr tmp;
VIR_DEBUG("Hit max size %zu on %s (force=%d)\n",
file->maxlen, file->basepath, forceRollover);
if (virRotatingFileWriterRollover(file) < 0)
return -1;
- if (!(file->entry = virRotatingFileWriterEntryNew(file->basepath,
- file->mode)))
+ if (!(tmp = virRotatingFileWriterEntryNew(file->basepath,
+ file->mode)))
return -1;
- virRotatingFileWriterEntryFree(tmp);
+ virRotatingFileWriterEntryFree(file->entry);
+ file->entry = tmp;
}
}
--
2.8.3
7 years, 8 months
[libvirt] [PATCH] qemu: fix crash on getting block stats for empty cdrom
by Nikolay Shirokovskiy
Looks like it was introduced in c5f61513. Before this commit handling empty cdrom
was correct becase physical sizes of non block disks are not updated.
Now when all types are supported we need to check for empty drives.
[1] crash backtrace
0 __strrchr_sse42 () at ../sysdeps/x86_64/multiarch/strrchr.S:138
1 0x00007ffff7242192 in virFileIsSharedFSType (path=0x0, fstypes=63) at util/virfile.c:3351
2 0x00007ffff7242a5b in virFileIsSharedFS (path=0x0) at util/virfile.c:3557
3 0x00007fffdb835443 in qemuOpenFileAs (fallback_uid=0, fallback_gid=107, dynamicOwnership=true, path=0x0,
oflags=0, needUnlink=0x0, bypassSecurityDriver=0x0) at qemu/qemu_driver.c:2927
4 0x00007fffdb83539b in qemuOpenFile (driver=0x7fffcc1062f0, vm=0x7fffcc25aa50, path=0x0, oflags=0,
needUnlink=0x0, bypassSecurityDriver=0x0) at qemu/qemu_driver.c:2908
5 0x00007fffdb84d2d3 in qemuDomainStorageOpenStat (driver=0x7fffcc1062f0, cfg=0x7fffcc188880, vm=0x7fffcc25aa50,
src=0x7fffcc256920, ret_fd=0x7fffe6a49488, ret_sb=0x7fffe6a49490) at qemu/qemu_driver.c:11266
6 0x00007fffdb84d4ff in qemuDomainStorageUpdatePhysical (driver=0x7fffcc1062f0, cfg=0x7fffcc188880,
vm=0x7fffcc25aa50, src=0x7fffcc256920) at qemu/qemu_driver.c:11319
7 0x00007fffdb8661e7 in qemuDomainGetStatsOneBlock (driver=0x7fffcc1062f0, cfg=0x7fffcc188880, dom=0x7fffcc25aa50,
record=0x7fffa8000e70, maxparams=0x7fffe6a49790, disk=0x7fffcc2565a0, src=0x7fffcc256920, block_idx=7,
backing_idx=0, stats=0x7fffa8000e90) at qemu/qemu_driver.c:19223
8 0x00007fffdb86652b in qemuDomainGetStatsBlock (driver=0x7fffcc1062f0, dom=0x7fffcc25aa50, record=0x7fffa8000e70,
maxparams=0x7fffe6a49790, privflags=1) at qemu/qemu_driver.c:19282
9 0x00007fffdb8669f7 in qemuDomainGetStats (conn=0x7fffb80009a0, dom=0x7fffcc25aa50, stats=127,
record=0x7fffe6a49870, flags=1) at qemu/qemu_driver.c:19444
10 0x00007fffdb866dc8 in qemuConnectGetAllDomainStats (conn=0x7fffb80009a0, doms=0x0, ndoms=0, stats=127,
retStats=0x7fffe6a499a0, flags=1) at qemu/qemu_driver.c:19534
11 0x00007ffff7388376 in virConnectGetAllDomainStats (conn=0x7fffb80009a0, stats=0, retStats=0x7fffe6a499a0,
flags=1) at libvirt-domain.c:11311
---
src/qemu/qemu_driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bc5e448..16b435a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19170,6 +19170,7 @@ qemuDomainGetStatsOneBlock(virQEMUDriverPtr driver,
QEMU_ADD_NAME_PARAM(record, maxparams, "block", "name", block_idx,
disk->dst);
+
if (virStorageSourceIsLocalStorage(src) && src->path)
QEMU_ADD_NAME_PARAM(record, maxparams, "block", "path",
block_idx, src->path);
@@ -19216,7 +19217,7 @@ qemuDomainGetStatsOneBlock(virQEMUDriverPtr driver,
if (entry->capacity)
QEMU_ADD_BLOCK_PARAM_ULL(record, maxparams, block_idx,
"capacity", entry->capacity);
- if (entry->physical) {
+ if (entry->physical || virStorageSourceIsEmpty(src)) {
QEMU_ADD_BLOCK_PARAM_ULL(record, maxparams, block_idx,
"physical", entry->physical);
} else {
--
1.8.3.1
7 years, 8 months
[libvirt] [PATCH] test: virsh-optparse: Fix expected test output with new error checking
by Peter Krempa
Commit 4f4c3b1397c4b5d16af added code to remember errors during freeing
of domain objects. This changed the output when testing scaled numbers
parsing in virsh-optparse. Adjust the expected output.
---
I didn't run it with VIR_TEST_RUN_EXPENSIVE. I'll look into whether that
variable still makes sense.
Pushed under the build-breaker rule.
tests/virsh-optparse | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/virsh-optparse b/tests/virsh-optparse
index cb0f3d4f3..1aef8d8d9 100755
--- a/tests/virsh-optparse
+++ b/tests/virsh-optparse
@@ -212,6 +212,7 @@ compare exp-err err || fail=1
# Numeric value with invalid suffix
cat <<\EOF > exp-err || framework_failure
error: Scaled numeric value '42WB' for <size> option is malformed or out of range
+error: invalid argument: unknown suffix 'WB'
EOF
virsh -q -c $test_url setmaxmem test 42WB >out 2>err && fail=1
test -s out && fail=1
--
2.12.2
7 years, 8 months
[libvirt] question about virtlogd service restart
by Wang King
Hi all,
I found that virtlogd cannot write qemu log and serial log anymore after
restart it. It's because of the file descriptor which qemu connected to
the virtlogd is broken, and cannot be reconnect after virtlogd restarted.
Is this expected behavior or unresolved issue?
Thanks
Wang King
7 years, 8 months
[libvirt] [PATCH] qemu: do not crash on USB address with no port and invalid bus
by Ján Tomko
Properly error out when the user requests a port from a bus
that does not have a controller present in the domain XML.
https://bugzilla.redhat.com/show_bug.cgi?id=1441589
---
src/conf/domain_addr.c | 3 ++-
.../qemuxml2argv-usb-bus-missing.xml | 22 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 3 +++
3 files changed, 27 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-bus-missing.xml
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 35bdc34..8b61091 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -2009,7 +2009,8 @@ virDomainUSBAddressAssign(virDomainUSBAddressSetPtr addrs,
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) {
VIR_DEBUG("A USB port on bus %u was requested", info->addr.usb.bus);
- if (!addrs->buses[info->addr.usb.bus]) {
+ if (info->addr.usb.bus >= addrs->nbuses ||
+ !addrs->buses[info->addr.usb.bus]) {
virReportError(VIR_ERR_XML_ERROR,
_("USB bus %u requested but no controller "
"with that index is present"), info->addr.usb.bus);
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-bus-missing.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-bus-missing.xml
new file mode 100644
index 0000000..831a4c0
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-bus-missing.xml
@@ -0,0 +1,22 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-i686</emulator>
+ <controller type='usb' index='0'/>
+ <memballoon model='virtio'/>
+ <input type='mouse' bus='usb'>
+ <address type='usb' bus='0'/>
+ </input>
+ <hub type='usb'>
+ <address type='usb' bus='1'/>
+ </hub>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ed99c21..c1b014b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1341,6 +1341,9 @@ mymain(void)
DO_TEST("usb-port-missing",
QEMU_CAPS_CHARDEV, QEMU_CAPS_USB_HUB,
QEMU_CAPS_NODEFCONFIG);
+ DO_TEST_PARSE_ERROR("usb-bus-missing",
+ QEMU_CAPS_CHARDEV, QEMU_CAPS_USB_HUB,
+ QEMU_CAPS_NODEFCONFIG);
DO_TEST("usb-ports",
QEMU_CAPS_CHARDEV, QEMU_CAPS_USB_HUB,
QEMU_CAPS_NODEFCONFIG);
--
2.10.2
7 years, 8 months
[libvirt] [PATCH 0/5] Enable CI build testing with Travis
by Daniel P. Berrange
Since we already sync our repo to github, we can easily take advantage of
the free Travis CI system to improve our testing coverage. Our current CentOS
CI hardware doesn't have scope for running many more VMs than it already does
and even if it did, that imposes an administrative burden to manage the OS.
So this uses Travis to get us automated testing of Ubuntu Precise & Trusty,
with GCC and CLang, and OS-X with CLang.
Daniel P. Berrange (5):
annotate all mocked functions with noinline
Prevent test failures with ebtables/iptables/ip6tables are missing
Fix detection of required RBD version
Ignore SASL deprecation warnings on OS-X
Add travis build configuration
.travis.yml | 85 ++++++++++++++++++++++++++++++++++++++++
build-aux/mock-noinline.pl | 72 ++++++++++++++++++++++++++++++++++
cfg.mk | 6 ++-
m4/virt-storage-rbd.m4 | 16 +++++++-
src/internal.h | 22 +++++++++++
src/qemu/qemu_capspriv.h | 2 +-
src/rpc/virnetsaslcontext.c | 12 ++++++
src/rpc/virnetsocket.h | 6 ++-
src/util/vircommand.h | 2 +-
src/util/vircrypto.h | 2 +-
src/util/virfile.h | 2 +-
src/util/virhostcpu.h | 4 +-
src/util/virmacaddr.h | 2 +-
src/util/virnetdev.h | 9 +++--
src/util/virnetdevip.h | 2 +-
src/util/virnetdevopenvswitch.h | 2 +-
src/util/virnetdevtap.h | 6 +--
src/util/virnuma.h | 16 ++++----
src/util/virrandom.h | 6 +--
src/util/virscsi.h | 2 +-
src/util/virscsivhost.h | 2 +-
src/util/virtpm.h | 2 +-
src/util/virutil.h | 10 ++---
src/util/viruuid.h | 2 +-
tests/networkxml2firewalltest.c | 13 ++++++
tests/nwfilterebiptablestest.c | 13 ++++++
tests/nwfilterxml2firewalltest.c | 12 ++++++
tests/virfirewalltest.c | 13 ++++++
28 files changed, 302 insertions(+), 41 deletions(-)
create mode 100644 .travis.yml
create mode 100644 build-aux/mock-noinline.pl
--
2.9.3
7 years, 8 months