[libvirt] [PATCH] Fix segfault in GetIOThreadInfo
by Leonid Podolny
The pointers calculation included a typo which caused segfaults.
Signed-off-by: Leonid Podolny <leonid(a)podolny.net>
---
domain.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/domain.go b/domain.go
index 515138a..74061c2 100644
--- a/domain.go
+++ b/domain.go
@@ -3887,7 +3887,7 @@ func (d *Domain) GetIOThreadInfo(flags DomainModificationImpact) ([]DomainIOThre
info := make([]DomainIOThreadInfo, int(ret))
for i := 0; i < int(ret); i++ {
- cinfo := (*(**C.virDomainIOThreadInfo)(unsafe.Pointer(uintptr(unsafe.Pointer(cinfolist)) + (unsafe.Sizeof(*cinfolist) + uintptr(i)))))
+ cinfo := (*(**C.virDomainIOThreadInfo)(unsafe.Pointer(uintptr(unsafe.Pointer(cinfolist)) + (unsafe.Sizeof(*cinfolist) * uintptr(i)))))
ncpus := int(cinfo.cpumaplen * 8)
cpumap := make([]bool, ncpus)
--
2.11.0
7 years, 10 months
[libvirt] [PATCH] qemu: Reset hostModelInfo in virQEMUCapsReset
by Jiri Denemark
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 89e9dd471..1e1b53b22 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3752,6 +3752,9 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps)
VIR_FREE(qemuCaps->gicCapabilities);
qemuCaps->ngicCapabilities = 0;
+ qemuMonitorCPUModelInfoFree(qemuCaps->hostCPUModelInfo);
+ qemuCaps->hostCPUModelInfo = NULL;
+
virCPUDefFree(qemuCaps->hostCPUModel);
qemuCaps->hostCPUModel = NULL;
}
--
2.11.0
7 years, 10 months
[libvirt] [PATCH 0/6] storage: Cleanups of the storage backends
by Peter Krempa
I'm working on splitting of the storage backend codebase into loadable modules
so that ceratin libraries (ceph, gluster) can be installed only when the
functionality is required.
This is a dump of cleanup patches, but they tend to get merge conflicts pretty
often so I'm sending them prior to finishing the driver module stuff.
Peter Krempa (6):
storage: Remove common code from specific driver backend
storage: Split utility functions from storage_backend.(ch)
storage: fs: Compile file backends even if filesystem support is
disabled
storage: scsi: Fix build if SCSI backend is disabled but iSCSI is
enabled
storage: scsi: Remove private constants from header
storage: sheepdog: Split out functions required for tests
po/POTFILES.in | 1 +
src/Makefile.am | 6 +-
src/storage/storage_backend.c | 2807 +---------------------
src/storage/storage_backend.h | 124 -
src/storage/storage_backend_disk.c | 153 +-
src/storage/storage_backend_disk.h | 3 -
src/storage/storage_backend_fs.c | 4 +-
src/storage/storage_backend_gluster.c | 1 +
src/storage/storage_backend_iscsi.c | 2 +-
src/storage/storage_backend_logical.c | 1 +
src/storage/storage_backend_mpath.c | 1 +
src/storage/storage_backend_rbd.c | 1 +
src/storage/storage_backend_scsi.c | 452 +---
src/storage/storage_backend_scsi.h | 8 -
src/storage/storage_backend_sheepdog.c | 2 +
src/storage/storage_backend_sheepdog.h | 5 -
src/storage/storage_backend_sheepdog_priv.h | 29 +
src/storage/storage_backend_zfs.c | 1 +
src/storage/storage_driver.c | 1 +
src/storage/storage_util.c | 3364 +++++++++++++++++++++++++++
src/storage/storage_util.h | 151 ++
tests/storagebackendsheepdogtest.c | 2 +-
tests/storagevolxml2argvtest.c | 2 +-
23 files changed, 3602 insertions(+), 3519 deletions(-)
create mode 100644 src/storage/storage_backend_sheepdog_priv.h
create mode 100644 src/storage/storage_util.c
create mode 100644 src/storage/storage_util.h
--
2.11.0
7 years, 10 months
[libvirt] [PATCH V2] tests: fix compilation of shunloadtest
by Jim Fehlig
While local builds succeed fine, a build worker building in a
chroot environment is encountering the following error with
libvirt 3.0.0 release candidates
[ 162s] shunloadtest.o: In function `main':
[ 162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:110: undefined reference to `dlopen'
[ 162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:114: undefined reference to `dlsym'
[ 162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:133: undefined reference to `dlclose'
[ 162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:111: undefined reference to `dlerror'
[ 162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:115: undefined reference to `dlerror'
[ 162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:116: undefined reference to `dlclose'
Fix by appending DLOPEN_LIBS to shunloadtest_LDADD.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
V2: Use DLOPEN_LIBS instead of LDADDS
tests/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c7d4748..bcc2d1e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1348,7 +1348,7 @@ libshunload_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
shunloadtest_SOURCES = \
shunloadtest.c
-shunloadtest_LDADD = $(LIB_PTHREAD)
+shunloadtest_LDADD = $(LIB_PTHREAD) $(DLOPEN_LIBS)
shunloadtest_DEPENDENCIES = libshunload.la
sysinfotest_SOURCES = \
--
2.9.2
7 years, 10 months
[libvirt] [PATCH] nss: Remove RES_USE_INET6 usage
by Andrea Bolognani
The recent deprecation in glibc (commit b76e065991ec) means the
module will fail to build entirely:
nss/libvirt_nss.c: In function '_nss_libvirt_gethostbyname_r':
nss/libvirt_nss.c:363:13: error: RES_USE_INET6 is deprecated [-Werror]
int af = ((_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This resolver option was removed shortly after being introduced,
and application using it are already broken anyway.
---
tools/nss/libvirt_nss.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index b69e62c..9904026 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -360,9 +360,7 @@ NSS_NAME(gethostbyname)(const char *name, struct hostent *result,
char *buffer, size_t buflen, int *errnop,
int *herrnop)
{
- int af = ((_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET);
-
- return NSS_NAME(gethostbyname3)(name, af, result, buffer, buflen,
+ return NSS_NAME(gethostbyname3)(name, AF_INET, result, buffer, buflen,
errnop, herrnop, NULL, NULL);
}
--
2.7.4
7 years, 10 months
[libvirt] [PATCH] storage_backend_rbd: always call rados_conf_read_file when connect a rbd pool
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
This patch fix a dead lock when try to read a rbd image
When trying to connect a rbd server
(ceph-0.94.7-1.el7.centos.x86_64),
rbd_list/rbd_open enter a dead lock state.
Backtrace:
Thread 30 (Thread 0x7fdb342d0700 (LWP 12105)):
#0 0x00007fdb40b16705 in pthread_cond_wait@(a)GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x00007fdb294273f1 in librados::IoCtxImpl::operate_read(object_t const&, ObjectOperation*, ceph::buffer::list*, int) () from /lib64/librados.so.2
#2 0x00007fdb29429fcc in librados::IoCtxImpl::read(object_t const&, ceph::buffer::list&, unsigned long, unsigned long) () from /lib64/librados.so.2
#3 0x00007fdb293e850c in librados::IoCtx::read(std::string const&, ceph::buffer::list&, unsigned long, unsigned long) () from /lib64/librados.so.2
#4 0x00007fdb2b9dd15e in librbd::list(librados::IoCtx&, std::vector<std::string, std::allocator<std::string> >&) () from /lib64/librbd.so.1
#5 0x00007fdb2b98c089 in rbd_list () from /lib64/librbd.so.1
#6 0x00007fdb2e1a8052 in virStorageBackendRBDRefreshPool (conn=<optimized out>, pool=0x7fdafc002d50) at storage/storage_backend_rbd.c:366
#7 0x00007fdb2e193833 in storagePoolCreate (obj=0x7fdb1c1fd5a0, flags=<optimized out>) at storage/storage_driver.c:876
#8 0x00007fdb43790ea1 in virStoragePoolCreate (pool=pool@entry=0x7fdb1c1fd5a0, flags=0) at libvirt-storage.c:695
#9 0x00007fdb443becdf in remoteDispatchStoragePoolCreate (server=0x7fdb45fb2ab0, msg=0x7fdb45fb3db0, args=0x7fdb1c0037d0, rerr=0x7fdb342cfc30, client=<optimized out>) at remote_dispatch.h:14383
#10 remoteDispatchStoragePoolCreateHelper (server=0x7fdb45fb2ab0, client=<optimized out>, msg=0x7fdb45fb3db0, rerr=0x7fdb342cfc30, args=0x7fdb1c0037d0, ret=0x7fdb1c1b3260) at remote_dispatch.h:14359
#11 0x00007fdb437d9c42 in virNetServerProgramDispatchCall (msg=0x7fdb45fb3db0, client=0x7fdb45fd1a80, server=0x7fdb45fb2ab0, prog=0x7fdb45fcd670) at rpc/virnetserverprogram.c:437
#12 virNetServerProgramDispatch (prog=0x7fdb45fcd670, server=server@entry=0x7fdb45fb2ab0, client=0x7fdb45fd1a80, msg=0x7fdb45fb3db0) at rpc/virnetserverprogram.c:307
#13 0x00007fdb437d4ebd in virNetServerProcessMsg (msg=<optimized out>, prog=<optimized out>, client=<optimized out>, srv=0x7fdb45fb2ab0) at rpc/virnetserver.c:135
#14 virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x7fdb45fb2ab0) at rpc/virnetserver.c:156
#15 0x00007fdb436cfb35 in virThreadPoolWorker (opaque=opaque@entry=0x7fdb45fa7650) at util/virthreadpool.c:145
#16 0x00007fdb436cf058 in virThreadHelper (data=<optimized out>) at util/virthread.c:206
#17 0x00007fdb40b12df5 in start_thread () from /lib64/libpthread.so.0
#18 0x00007fdb408401ad in clone () from /lib64/libc.so.6
366 len = rbd_list(ptr.ioctx, names, &max_size);
(gdb) n
[New Thread 0x7fdb20758700 (LWP 22458)]
[New Thread 0x7fdb20556700 (LWP 22459)]
[Thread 0x7fdb20758700 (LWP 22458) exited]
[New Thread 0x7fdb20455700 (LWP 22460)]
[Thread 0x7fdb20556700 (LWP 22459) exited]
[New Thread 0x7fdb20556700 (LWP 22461)]
infinite loop...
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
src/storage/storage_backend_rbd.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index b1c51ab..233737b 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -95,6 +95,9 @@ virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr ptr,
goto cleanup;
}
+ /* try default location, but ignore failure */
+ rados_conf_read_file(ptr->cluster, NULL);
+
if (!conn) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("'ceph' authentication not supported "
@@ -124,6 +127,10 @@ virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr ptr,
_("failed to create the RADOS cluster"));
goto cleanup;
}
+
+ /* try default location, but ignore failure */
+ rados_conf_read_file(ptr->cluster, NULL);
+
if (virStorageBackendRBDRADOSConfSet(ptr->cluster,
"auth_supported", "none") < 0)
goto cleanup;
--
2.7.4
7 years, 10 months
[libvirt] [PATCH] qemu_domain: add timestamp in tainting of guests log
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
We lacked of timestamp in tainting of guests log,
which bring troubles for finding guest issues:
such as whether a guest powerdown caused by qemu-monitor-command
or others issues inside guests.
If we had timestamp in tainting of guests log,
it would be helpful when checking guest's logs(eg. /var/log/messages).
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
src/qemu/qemu_domain.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 35baffb..21c90a9 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4001,6 +4001,7 @@ void qemuDomainObjTaint(virQEMUDriverPtr driver,
bool closeLog = false;
if (virDomainObjTaint(obj, taint)) {
+ char *timestamp = NULL;
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(obj->def->uuid, uuidstr);
@@ -4018,27 +4019,31 @@ void qemuDomainObjTaint(virQEMUDriverPtr driver,
logCtxt = qemuDomainLogContextNew(driver, obj,
QEMU_DOMAIN_LOG_CONTEXT_MODE_ATTACH);
if (!logCtxt) {
- if (orig_err) {
- virSetError(orig_err);
- virFreeError(orig_err);
- }
VIR_WARN("Unable to open domainlog");
- return;
+ goto cleanup;
}
closeLog = true;
}
+ if ((timestamp = virTimeStringNow()) == NULL)
+ goto cleanup;
+
if (qemuDomainLogContextWrite(logCtxt,
- "Domain id=%d is tainted: %s\n",
+ "%s: Domain id=%d is tainted: %s\n",
+ timestamp,
obj->def->id,
virDomainTaintTypeToString(taint)) < 0)
virResetLastError();
+
+ cleanup:
if (closeLog)
qemuDomainLogContextFree(logCtxt);
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
+
+ VIR_FREE(timestamp);
}
}
--
2.7.4
7 years, 10 months
[libvirt] [PATCH v2 0/3] virsh: pool-list: introduce option --name and --uuid
by Chen Hanxiao
virsh # pool-list --name
default
root
virsh # pool-list --uuid
76bd3b4d-2d23-4741-b6de-7377fa4320a1
f97964af-a3df-44ff-8664-886729035c09
virsh # pool-list --uuid --name
76bd3b4d-2d23-4741-b6de-7377fa4320a1 default
f97964af-a3df-44ff-8664-886729035c09 root
v2:
do something like 'virsh list`
Chen Hanxiao (3):
virsh: pool-list: introduce --uuid for printing pool's UUID only
virsh: pool-list: introduce --name for printing pool's name only
virsh: pool-list: allow both --uuid and --name in one cmd
tools/virsh-pool.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
tools/virsh.pod | 9 +++++++--
2 files changed, 53 insertions(+), 4 deletions(-)
--
2.5.5
7 years, 10 months
[libvirt] [PATCH] util: disallow resetting a pci-bridge device
by Shivaprasad G Bhat
It is distructive to attempt a reset on pci-bridge, the host can crash.
The bridges won't contain any guest data and neither they can be
passed through using vfio/stub. So, no point in allowing a reset for them.
Signed-off-by: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
---
src/util/virpci.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 0601f49..860f7aa 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -933,6 +933,16 @@ virPCIDeviceReset(virPCIDevicePtr dev,
char *drvName = NULL;
int ret = -1;
int fd = -1;
+ int hdrType = -1;
+
+ if (virPCIGetHeaderType(dev, &hdrType) < 0)
+ return -1;
+
+ if (hdrType == VIR_PCI_HEADER_PCI_BRIDGE) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Resetting a pci-bridge device is not allowed"));
+ return -1;
+ }
if (activeDevs && virPCIDeviceListFind(activeDevs, dev)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
7 years, 10 months