[libvirt] [libvirt-php][PATCH] m4: Check for php modules more wisely
by Michal Privoznik
I've got two version of PHP installed on my system, however one
of them has imagick the other one doesn't. During configure I've
noticed that wrong assumption has been made. Configure script
wrongly assumed the plugin missing. This is because for detecting
php plugins we use plain 'php -m | grep $module'. On my system,
php is a symlink and it defaults to the version without the
plugin. However, I am explicitly supplying 'php-config' from the
version that has the plugin installed:
./configure --with-php-config=/usr/lib64/php5.6/bin/php-config
The trick is to query provided php-config for path to php binary.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under php-auto-push rule.
m4/virt-php-extension.m4 | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/m4/virt-php-extension.m4 b/m4/virt-php-extension.m4
index 9040eb1..5aa3cb7 100644
--- a/m4/virt-php-extension.m4
+++ b/m4/virt-php-extension.m4
@@ -25,7 +25,18 @@ dnl
AC_DEFUN([LIBVIRT_CHECK_PHP_EXTENSION],[
AC_MSG_CHECKING([for php module $1])
- module="$(php -m | grep $1)"
+ phpbinary="$($PHPCONFIG --php-binary)"
+ if test "x$phpbinary" = "x"; then
+ phpbinary="$($PHPCONFIG --prefix)/bin/php"
+ fi
+
+ if test ! -x "$phpbinary"; then
+ AC_MSG_ERROR([php binary not found])
+ fi
+
+ AC_SUBST([phpbinary])
+
+ module="$($phpbinary -m | grep $1)"
if test "x$module" = "x"; then
AC_MSG_ERROR([php module $1 not found])
--
2.8.4
8 years, 2 months
[libvirt] [libvirt-glib 1/2] config: Fix gvir_config_xml_node_to_string() leak
by Christophe Fergeau
If xmlNodeDump() fails, we would be leaking the xmlBuffer we created.
This commit ensures we don't return early before this buffer is freed.
---
libvirt-gconfig/libvirt-gconfig-helpers.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-helpers.c b/libvirt-gconfig/libvirt-gconfig-helpers.c
index 0314a72..e8f9664 100644
--- a/libvirt-gconfig/libvirt-gconfig-helpers.c
+++ b/libvirt-gconfig/libvirt-gconfig-helpers.c
@@ -293,7 +293,7 @@ gvir_config_xml_node_to_string(xmlNodePtr node)
xmlbuf = xmlBufferCreate();
if (xmlNodeDump(xmlbuf, node->doc, node, 0, 1) < 0)
- return NULL;
+ xml = NULL;
else
xml = g_strndup((gchar *)xmlBufferContent(xmlbuf), xmlBufferLength(xmlbuf));
--
2.7.4
8 years, 2 months
[libvirt] [PATCH] qemu: fix state change lock held by remoteDispatchDomainBlockJobAbort forever
by Xiubo Li
When doing the snapshot using the script below:
=========================================
!#/bin/bash
virsh blockjob $instance_name vdX --abort
virsh undefine $instance_name
qemu-img create -f qcow2 -o backing_file=$diskfile,size=$size $path/$uuid.dlta
virsh blockcopy --domain $instance_name vdX $path/$uuid.dlta --wait --reuse-external --verbose
virsh blockjob $instance_name vdX --abort
qemu-img convert -f qcow2 -O qcow2 $path/$uuid.dlta $path/$uuid.qcow2
echo "start uploading at $(date)"
......
=========================================
Sometimes you can encounter the following warning and error logs:
+++++++++++++++++++++++++++++++++++++++++
2016-08-26 07:51:05.685+0000: 8916: warning : qemuDomainObjBeginJobInternal:1571 :
Cannot start job (query, none) for domain instance-00001b3a; current job is (modify,
none) owned by (8914 remoteDispatchDomainBlockJobAbort, 0 <null>) for (30s, 0s)
2016-08-26 07:51:05.685+0000: 8916: error : qemuDomainObjBeginJobInternal:1583 :
Timed out during operation: cannot acquire state change lock (held by
remoteDispatchDomainBlockJobAbort)
-----------------------------------------
Mostly it will be okay later. But sometimes the state change lock maybe hold by
remoteDispatchDomainBlockJobAbort forever, then the instance couldn't be connected
through the VNC or the network(ping,ssh...), expect after rebooting the instance.
>From the code, we find that after sending the --abort command, there will be two
steps by condition waiting the two reply signals:
+++++++++++++++++++++++++++++++++++++++++
The first condition wait is:
In qemuMonitorBlockJobCancel() --> qemuMonitoJSONBlockJobCancel() -->
qemuMonitorJSONCommand() --> qemuMonitorJSONCommandWithFd() -->
qemuMonitorSend() --> virCondWait(&mon->notify, &mon->parent.lock).
The second condition wait is:
In virDomainCondWait(vm) --> virCondWait(&vm->cond, &vm->parent.lock).
-----------------------------------------
The two corresponding replies are:
+++++++++++++++++++++++++++++++++++++++++
The "return" reply is:
QEMU_MONITOR_RECV_REPLY: mon=0x7ff3fc001020 reply={"return": [], "id": "libvirt-338"}
With the condition wakeup signal:
virCondBroadcast(&mon->notify)
The "event" reply is:
QEMU_MONITOR_RECV_EVENT: mon=0x7fe08401a3f0 event={"timestamp": {"seconds": 1472524518,
"microseconds": 360135}, "event": "BLOCK_JOB_CANCELLED", "data": {"device":
"drive-virtio-disk0", "len": 42949672960, "offset": 10485760, "speed": 0, "type": "mirror"}}
With the condition wakeup signal:
virDomainObjBroadcast(vm) --> virCondBroadcast(&vm->cond)
-----------------------------------------
But sometimes the qemu daemon will reply like:
+++++++++++++++++++++++++++++++++++++++++
The "event" reply is:
QEMU_MONITOR_RECV_EVENT: mon=0x7fe08401a3f0 event={"timestamp": {"seconds": 1472524518,
"microseconds": 360135}, "event": "BLOCK_JOB_CANCELLED", "data": {"device":
"drive-virtio-disk0", "len": 42949672960, "offset": 10485760, "speed": 0, "type": "mirror"}}
With the condition wakeup signal:
virDomainObjBroadcast(vm) --> virCondBroadcast(&vm->cond)
The "return" reply is:
QEMU_MONITOR_RECV_REPLY: mon=0x7ff3fc001020 reply={"return": [], "id": "libvirt-338"}
With the condition wakeup signal:
virCondBroadcast(&mon->notify)
-----------------------------------------
In this case, when in the first condition wait, the received "event" reply & signal will be
lost and still waiting for the "return" reply & signal. So the when in the second condition
wait step, it will wait forever by holding the lock.
This patch fix this bug.
Signed-off-by: Xiubo Li <lixiubo(a)cmss.chinamobile.com>
Signed-off-by: Zhuoyu Zhang <zhangzhuoyu(a)cmss.chinamobile.com>
Signed-off-by: Wei Tang <tangwei(a)cmss.chinamobile.com>
Signed-off-by: Yaowei Bai <baiyaowei(a)cmss.chinamobile.com>
Signed-off-by: Qide Chen <chenqide(a)cmss.chinamobile.com>
---
src/qemu/qemu_domain.h | 2 ++
src/qemu/qemu_driver.c | 8 +++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index c49f31c..2624c6d 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -61,6 +61,8 @@
(JOB_MASK(QEMU_JOB_DESTROY) | \
JOB_MASK(QEMU_JOB_ASYNC))
+# define BLOCK_JOB_ABORT_TIMEOUT 5000
+
/* Only 1 job is allowed at any time
* A job includes *all* monitor commands, even those just querying
* information, not merely actions */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f9a3b15..6ebaf6b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15929,6 +15929,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
bool pivot = !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT);
bool async = !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC);
virDomainObjPtr vm;
+ unsigned long long now;
int ret = -1;
virCheckFlags(VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC |
@@ -16018,7 +16019,12 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
qemuBlockJobUpdate(driver, vm, disk);
while (diskPriv->blockjob) {
- if (virDomainObjWait(vm) < 0) {
+ if (virTimeMillisNow(&now) < 0) {
+ ret = -1;
+ goto endjob;
+ }
+
+ if (virDomainObjWaitUntil(vm, now + BLOCK_JOB_ABORT_TIMEOUT) < 0) {
ret = -1;
goto endjob;
}
--
1.8.3.1
8 years, 2 months
[libvirt] [PATCH v5 0/8] perf: add more perf events support
by John Ferlan
v4: http://www.redhat.com/archives/libvir-list/2016-July/msg00607.html
Reworked/reworded the series slightly. The end result is mostly the
same as the original, but with the suggested tweaks.
John Ferlan (3):
virsh: Add a forward reference to perf command from domstats --perf
virsh: Rework the perf event names into a table.
util: Move virPerfNew and virPerfFree
Qiaowei Ren (5):
perf: rename qemuDomainGetStatsPerfRdt()
perf: Remove the switch from qemuDomainGetStatsPerf
util: Add some comment details for virPerfEventType
perf: Adjust the perf initialization
perf: add more perf events support
docs/formatdomain.html.in | 24 +++
docs/schemas/domaincommon.rng | 4 +
include/libvirt/libvirt-domain.h | 39 +++++
src/libvirt-domain.c | 9 ++
src/qemu/qemu_driver.c | 23 ++-
src/util/virperf.c | 230 +++++++++++++++++-----------
src/util/virperf.h | 14 +-
tests/genericxml2xmlindata/generic-perf.xml | 4 +
tools/virsh.pod | 40 +++--
9 files changed, 275 insertions(+), 112 deletions(-)
--
2.7.4
8 years, 2 months
[libvirt] DUID-LLT (DHCPv6 with time-based UUID generation) - how does it work in libvirt?
by Yaniv Kaul
Reading the examples, I'm not sure how to get DUID-LLT working (which is
unfortunate, as it seems to be the default of dhclient). I got DUID-LL
working, but DUID-LLT has a timestamp - which is generated, AFAIK, by the
client - how can the XML contain the correct DUID-LLT entry?
The examples in the docs:
<host id="0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66" ip="2001:db8:ca2:2:3::2"
/>
Somehow assumes the time is 18:aa - no idea how it 'guessed' this is what
the client would use.
DUID-LL was easy and worked, as it just a prefix + the MAC address.
TIA,
Y.
8 years, 2 months
[libvirt] [PATCH v2] virsh: use virConnectGetDomainCapabilities with maxvcpus
by Shivaprasad G Bhat
virsh maxvcpus --type kvm output is useless on PPC. Also, in
commit e6806d79 we documented not rely on virConnectGetMaxVcpus
output. Fix the maxvcpus to use virConnectGetDomainCapabilities
now to make it useful. The call is made to use the default emulator
binary and to check for the host machine and arch which is what the
command intends to show anyway.
Signed-off-by: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
---
tools/virsh-host.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 57f0c0e..dd6ff4e 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -606,15 +606,37 @@ static bool
cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd)
{
const char *type = NULL;
- int vcpus;
+ int vcpus = -1;
+ char *caps = NULL;
+ const unsigned int flags = 0; /* No flags so far */
+ xmlDocPtr xml = NULL;
+ xmlXPathContextPtr ctxt = NULL;
virshControlPtr priv = ctl->privData;
if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0)
return false;
+ caps = virConnectGetDomainCapabilities(priv->conn, NULL, NULL, NULL, type, flags);
+ if (!caps)
+ goto fallback;
+
+ xml = virXMLParseStringCtxt(caps, _("(domainCapabilities)"), &ctxt);
+ if (!xml) {
+ VIR_FREE(caps);
+ goto fallback;
+ }
+
+ virXPathInt("string(./vcpu[1]/@max)", ctxt, &vcpus);
+
+ xmlXPathFreeContext(ctxt);
+ xmlFreeDoc(xml);
+ if (vcpus > 0)
+ goto exit;
+
+ fallback:
if ((vcpus = virConnectGetMaxVcpus(priv->conn, type)) < 0)
return false;
-
+ exit:
vshPrint(ctl, "%d\n", vcpus);
return true;
8 years, 2 months
[libvirt] [PATCH v2 0/3] Introduce support for rx_queue_size
by Michal Privoznik
v2 of:
https://www.redhat.com/archives/libvir-list/2016-August/msg00960.html
diff to v1:
- rename attribute to rx_queue_size
- added more documentation and test cases
- Other small nits John found
Michal Privoznik (3):
conf: Add support for virtio-net.rx_queue_size
qemu_capabilities: Introduce virtio-net-*.rx_queue_size
qemu: Implement virtio-net rx_queue_size
docs/formatdomain.html.in | 16 ++++++++-
docs/schemas/domaincommon.rng | 5 +++
src/conf/domain_conf.c | 16 +++++++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 3 ++
src/qemu/qemu_capabilities.h | 3 ++
src/qemu/qemu_command.c | 8 +++++
src/qemu/qemu_domain.c | 7 ++++
...ml2argv-net-virtio-rxqueuesize-invalid-size.xml | 29 +++++++++++++++
.../qemuxml2argv-net-virtio-rxqueuesize.args | 25 +++++++++++++
.../qemuxml2argv-net-virtio-rxqueuesize.xml | 29 +++++++++++++++
tests/qemuxml2argvtest.c | 3 ++
.../qemuxml2xmlout-net-virtio-rxqueuesize.xml | 41 ++++++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
14 files changed, 186 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize-invalid-size.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-rxqueuesize.xml
--
2.8.4
8 years, 2 months
[libvirt] [PATCH v2] libxl: add memory attach support
by Bob Liu
Support for VIR_DOMAIN_DEVICE_MEMORY on domainAttachDeviceFlags API in libxl
driver, using libxl_set_memory_target in xen libxl.
With "virsh attach-device" command we can then hotplug memory to a domain:
<memory model='dimm'>
<target>
<size unit='MiB'>128</size>
<node>0</node>
</target>
</memory>
$ virsh attach-device domain_name this.xml --live
Signed-off-by: Bob Liu <bob.liu(a)oracle.com>
---
v2:
* Unlock virDomainObj while attaching.
* Fix memory leak of mem.
---
src/libxl/libxl_domain.c | 1 +
src/libxl/libxl_driver.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index f529a2e..3924ba0 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -414,6 +414,7 @@ virDomainDefParserConfig libxlDomainDefParserConfig = {
.macPrefix = { 0x00, 0x16, 0x3e },
.devicesPostParseCallback = libxlDomainDeviceDefPostParse,
.domainPostParseCallback = libxlDomainDefPostParse,
+ .features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG
};
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index a34eb02..b23c1d4 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -3085,6 +3085,34 @@ libxlDomainAttachHostUSBDevice(libxlDriverPrivatePtr driver,
#endif
static int
+libxlDomainAttachMemory(libxlDriverPrivatePtr driver,
+ virDomainObjPtr vm,
+ virDomainMemoryDefPtr mem)
+{
+ int res = -1;
+ libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+
+ if (mem->targetNode != 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Non-zero target node is not supported."));
+ goto out;
+ }
+
+ /* Unlock virDomainObj while attaching memory */
+ virObjectUnlock(vm);
+ res = libxl_set_memory_target(cfg->ctx, vm->def->id, mem->size, 1, 1);
+ virObjectLock(vm);
+ if (res < 0)
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to attach %lluKB memory for domain %d"),
+ mem->size, vm->def->id);
+
+ out:
+ virDomainMemoryDefFree(mem);
+ return res;
+}
+
+static int
libxlDomainAttachHostDevice(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
@@ -3284,6 +3312,13 @@ libxlDomainAttachDeviceLive(libxlDriverPrivatePtr driver,
dev->data.hostdev = NULL;
break;
+ case VIR_DOMAIN_DEVICE_MEMORY:
+ /* Note that libxlDomainAttachMemory always consumes
+ * dev->data.memory. */
+ ret = libxlDomainAttachMemory(driver, vm, dev->data.memory);
+ dev->data.memory = NULL;
+ break;
+
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("device type '%s' cannot be attached"),
--
2.6.5
8 years, 2 months