[libvirt] RFC: add Intel CMT feature support
by Ren, Qiaowei
Hi All,
Some Intel processor families (e.g. the Intel Xeon processor E5 v3 family) introduced some PQos (Platform Qos) features to monitor or control shared resource.
- CMT (Cache Monitoring Technology): measure the usage of cache by applications running on the platform.
- CAT (Cache Allocation Technology): enable an OS or Hypervisor/VMM to specify the amount of cache space into which an application can fill.
- MBM (Memory Bandwidth Monitoring): build on the CMT infrastructure to allow monitoring of bandwidth from one level of the cache hierarchy to the next - in this case focusing on the L3 cache, which is typically backed directly by system memory. As a result of this implementation, memory bandwidth can be monitored.
For more information, see "Intel 64 and IA-32 Architectures Software Developer's Manual".
Among these PQos features, currently CMT patches has been merged into Linux kernel mainline. So this patch series proposed in this mail will focus on CMT feature support in libvirt.
At the library API layer, I plan on adding cache related field into virDomainInfo and virNodeInfo:
Add "cache" member into virNodeInfo to get total size of cache in one node.
struct virNodeInfo {
...
unsigned int cores; /* number of cores per socket, total number of
processors in case of unusual NUMA topology*/
unsigned int threads; /* number of threads per core, 1 in case of
unusual numa topology */
+ unsigned int cache; /* cache size in bytes */
};
Add "cacheOcc" member into virDomainInfo to get cache occupancy for one VM.
struct virDomainInfo {
...
unsigned short nrVirtCpu; /* the number of virtual CPUs for the domain */
unsigned long long cpuTime; /* the CPU time used in nanoseconds */
+ unsigned long long cacheOcc; /* the cache occupancy in Bytes */
};
With this change, those applications like OpenStack based on libvirt can collect cache usage for metering and monitoring (e.g. any VM using more than X% of cache).
Because CMT implementation in Linux kernel is based on perf mechanism and there is no nice and public API library for perf, I have to wrapper system call for perf in libvirt to use CMT feature, and enable/disable perf event for CMT when VM is created/destroyed.
Any thoughts on this plan before I start submitting code patches? Do you think whether I need add several new APIs and XML element for CMT feature (or more PQos features)?
Thanks,
Qiaowei
9 years, 4 months
[libvirt] [PATCH] qemu: event: Fix retrieval of the "service" field from graphics events
by Peter Krempa
qemu's event has following format:
{
"timestamp": {
"seconds": 1435580974,
"microseconds": 82226
},
"event": "SPICE_INITIALIZED",
"data": {
"server": {
"auth": "none",
"port": "5900",
"family": "ipv4",
"host": "127.0.0.1"
},
"client": {
"port": "53224",
"family": "ipv4",
"channel-type": 3,
"connection-id": 1113096064,
"host": "127.0.0.1",
"channel-id": 0,
"tls": false
}
}
}
Our code tried to extract the "service" field but qemu reports it as
"port".
---
src/qemu/qemu_monitor_json.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index d3e98d4..bd73b05 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -652,7 +652,7 @@ static void qemuMonitorJSONHandleGraphics(qemuMonitorPtr mon, virJSONValuePtr da
VIR_WARN("missing local hostname in graphics event");
return;
}
- localService = virJSONValueObjectGetString(server, "service");
+ localService = virJSONValueObjectGetString(server, "port");
if (!localService)
localService = ""; /* Spice has multiple ports, so this isn't provided */
@@ -666,7 +666,7 @@ static void qemuMonitorJSONHandleGraphics(qemuMonitorPtr mon, virJSONValuePtr da
VIR_WARN("missing remote hostname in graphics event");
return;
}
- remoteService = virJSONValueObjectGetString(client, "service");
+ remoteService = virJSONValueObjectGetString(client, "port");
if (!remoteService)
remoteService = ""; /* Spice has multiple ports, so this isn't provided */
--
2.4.1
9 years, 4 months
[libvirt] [PATCH libvirt-python] virPyDictToTypedParams: packing lists of values
by Pavel Boldin
Pack a list or a tuple of values passed to a Python method to the
multi-value parameter.
---
libvirt-override.c | 228 ++++++++++++++++++++++++++++++-----------------------
1 file changed, 129 insertions(+), 99 deletions(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index 588dac1..45c8afc 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -278,6 +278,126 @@ typedef virPyTypedParamsHint *virPyTypedParamsHintPtr;
# define libvirt_PyString_Check PyString_Check
# endif
+static int
+virPyDictToTypedParamOne(virTypedParameterPtr *params,
+ int *n,
+ int *max,
+ virPyTypedParamsHintPtr hints,
+ int nhints,
+ const char *keystr,
+ PyObject *value)
+{
+ int rv = -1, type = -1;
+ size_t i;
+
+ for (i = 0; i < nhints; i++) {
+ if (STREQ(hints[i].name, keystr)) {
+ type = hints[i].type;
+ break;
+ }
+ }
+
+ if (type == -1) {
+ if (libvirt_PyString_Check(value)) {
+ type = VIR_TYPED_PARAM_STRING;
+ } else if (PyBool_Check(value)) {
+ type = VIR_TYPED_PARAM_BOOLEAN;
+ } else if (PyLong_Check(value)) {
+ unsigned long long ull = PyLong_AsUnsignedLongLong(value);
+ if (ull == (unsigned long long) -1 && PyErr_Occurred())
+ type = VIR_TYPED_PARAM_LLONG;
+ else
+ type = VIR_TYPED_PARAM_ULLONG;
+#if PY_MAJOR_VERSION < 3
+ } else if (PyInt_Check(value)) {
+ if (PyInt_AS_LONG(value) < 0)
+ type = VIR_TYPED_PARAM_LLONG;
+ else
+ type = VIR_TYPED_PARAM_ULLONG;
+#endif
+ } else if (PyFloat_Check(value)) {
+ type = VIR_TYPED_PARAM_DOUBLE;
+ }
+ }
+
+ if (type == -1) {
+ PyErr_Format(PyExc_TypeError,
+ "Unknown type of \"%s\" field", keystr);
+ goto cleanup;
+ }
+
+ switch ((virTypedParameterType) type) {
+ case VIR_TYPED_PARAM_INT:
+ {
+ int val;
+ if (libvirt_intUnwrap(value, &val) < 0 ||
+ virTypedParamsAddInt(params, n, max, keystr, val) < 0)
+ goto cleanup;
+ break;
+ }
+ case VIR_TYPED_PARAM_UINT:
+ {
+ unsigned int val;
+ if (libvirt_uintUnwrap(value, &val) < 0 ||
+ virTypedParamsAddUInt(params, n, max, keystr, val) < 0)
+ goto cleanup;
+ break;
+ }
+ case VIR_TYPED_PARAM_LLONG:
+ {
+ long long val;
+ if (libvirt_longlongUnwrap(value, &val) < 0 ||
+ virTypedParamsAddLLong(params, n, max, keystr, val) < 0)
+ goto cleanup;
+ break;
+ }
+ case VIR_TYPED_PARAM_ULLONG:
+ {
+ unsigned long long val;
+ if (libvirt_ulonglongUnwrap(value, &val) < 0 ||
+ virTypedParamsAddULLong(params, n, max, keystr, val) < 0)
+ goto cleanup;
+ break;
+ }
+ case VIR_TYPED_PARAM_DOUBLE:
+ {
+ double val;
+ if (libvirt_doubleUnwrap(value, &val) < 0 ||
+ virTypedParamsAddDouble(params, n, max, keystr, val) < 0)
+ goto cleanup;
+ break;
+ }
+ case VIR_TYPED_PARAM_BOOLEAN:
+ {
+ bool val;
+ if (libvirt_boolUnwrap(value, &val) < 0 ||
+ virTypedParamsAddBoolean(params, n, max, keystr, val) < 0)
+ goto cleanup;
+ break;
+ }
+ case VIR_TYPED_PARAM_STRING:
+ {
+ char *val;;
+ if (libvirt_charPtrUnwrap(value, &val) < 0 ||
+ !val ||
+ virTypedParamsAddString(params, n, max, keystr, val) < 0) {
+ VIR_FREE(val);
+ goto cleanup;
+ }
+ VIR_FREE(val);
+ break;
+ }
+ case VIR_TYPED_PARAM_LAST:
+ break; /* unreachable */
+ }
+
+ rv = 0;
+
+ cleanup:
+ return rv;
+}
+
+
/* Automatically convert dict into type parameters based on types reported
* by python. All integer types are converted into LLONG (in case of a negative
* value) or ULLONG (in case of a positive value). If you need different
@@ -300,7 +420,6 @@ virPyDictToTypedParams(PyObject *dict,
Py_ssize_t pos = 0;
#endif
virTypedParameterPtr params = NULL;
- size_t i;
int n = 0;
int max = 0;
int ret = -1;
@@ -313,112 +432,23 @@ virPyDictToTypedParams(PyObject *dict,
return -1;
while (PyDict_Next(dict, &pos, &key, &value)) {
- int type = -1;
-
if (libvirt_charPtrUnwrap(key, &keystr) < 0 ||
!keystr)
goto cleanup;
- for (i = 0; i < nhints; i++) {
- if (STREQ(hints[i].name, keystr)) {
- type = hints[i].type;
- break;
- }
- }
+ if (PyList_Check(value) || PyTuple_Check(value)) {
+ Py_ssize_t i, size = PySequence_Size(value);
- if (type == -1) {
- if (libvirt_PyString_Check(value)) {
- type = VIR_TYPED_PARAM_STRING;
- } else if (PyBool_Check(value)) {
- type = VIR_TYPED_PARAM_BOOLEAN;
- } else if (PyLong_Check(value)) {
- unsigned long long ull = PyLong_AsUnsignedLongLong(value);
- if (ull == (unsigned long long) -1 && PyErr_Occurred())
- type = VIR_TYPED_PARAM_LLONG;
- else
- type = VIR_TYPED_PARAM_ULLONG;
-#if PY_MAJOR_VERSION < 3
- } else if (PyInt_Check(value)) {
- if (PyInt_AS_LONG(value) < 0)
- type = VIR_TYPED_PARAM_LLONG;
- else
- type = VIR_TYPED_PARAM_ULLONG;
-#endif
- } else if (PyFloat_Check(value)) {
- type = VIR_TYPED_PARAM_DOUBLE;
+ for (i = 0; i < size; i++) {
+ PyObject *v = PySequence_ITEM(value, i);
+ if (virPyDictToTypedParamOne(¶ms, &n, &max,
+ hints, nhints, keystr, v) < 0)
+ goto cleanup;
}
- }
-
- if (type == -1) {
- PyErr_Format(PyExc_TypeError,
- "Unknown type of \"%s\" field", keystr);
+ } else if (virPyDictToTypedParamOne(¶ms, &n, &max,
+ hints, nhints, keystr, value) < 0)
goto cleanup;
- }
- switch ((virTypedParameterType) type) {
- case VIR_TYPED_PARAM_INT:
- {
- int val;
- if (libvirt_intUnwrap(value, &val) < 0 ||
- virTypedParamsAddInt(¶ms, &n, &max, keystr, val) < 0)
- goto cleanup;
- break;
- }
- case VIR_TYPED_PARAM_UINT:
- {
- unsigned int val;
- if (libvirt_uintUnwrap(value, &val) < 0 ||
- virTypedParamsAddUInt(¶ms, &n, &max, keystr, val) < 0)
- goto cleanup;
- break;
- }
- case VIR_TYPED_PARAM_LLONG:
- {
- long long val;
- if (libvirt_longlongUnwrap(value, &val) < 0 ||
- virTypedParamsAddLLong(¶ms, &n, &max, keystr, val) < 0)
- goto cleanup;
- break;
- }
- case VIR_TYPED_PARAM_ULLONG:
- {
- unsigned long long val;
- if (libvirt_ulonglongUnwrap(value, &val) < 0 ||
- virTypedParamsAddULLong(¶ms, &n, &max, keystr, val) < 0)
- goto cleanup;
- break;
- }
- case VIR_TYPED_PARAM_DOUBLE:
- {
- double val;
- if (libvirt_doubleUnwrap(value, &val) < 0 ||
- virTypedParamsAddDouble(¶ms, &n, &max, keystr, val) < 0)
- goto cleanup;
- break;
- }
- case VIR_TYPED_PARAM_BOOLEAN:
- {
- bool val;
- if (libvirt_boolUnwrap(value, &val) < 0 ||
- virTypedParamsAddBoolean(¶ms, &n, &max, keystr, val) < 0)
- goto cleanup;
- break;
- }
- case VIR_TYPED_PARAM_STRING:
- {
- char *val;;
- if (libvirt_charPtrUnwrap(value, &val) < 0 ||
- !val ||
- virTypedParamsAddString(¶ms, &n, &max, keystr, val) < 0) {
- VIR_FREE(val);
- goto cleanup;
- }
- VIR_FREE(val);
- break;
- }
- case VIR_TYPED_PARAM_LAST:
- break; /* unreachable */
- }
VIR_FREE(keystr);
}
--
1.9.1
9 years, 4 months
[libvirt] [[libvirt-php][PATCH v4] qemu-agent-command] add libvirt_domain_qemu_agent_command
by Vasiliy Tolstov
add another missing libvirt command
Signed-off-by: Vasiliy Tolstov <v.tolstov(a)selfip.ru>
---
configure.ac | 3 +++
src/Makefile.am | 5 +++--
src/libvirt-php.c | 29 +++++++++++++++++++++++++++++
src/libvirt-php.h | 2 ++
4 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 04ebbdc..b6ef27a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,9 @@ fi
LIBVIRT_REQUIRED=1.2.8
PKG_CHECK_MODULES(LIBVIRT, libvirt >= $LIBVIRT_REQUIRED)
+PKG_CHECK_MODULES(QEMU, libvirt-qemu)
+AC_SUBST([QEMU_CFLAGS])
+AC_SUBST([QEMU_LIBS])
dnl ==========================================================================
dnl required minimum version of libxml2
diff --git a/src/Makefile.am b/src/Makefile.am
index 8e6a800..f270ec2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,13 +27,14 @@ uninstall-local:
AM_CFLAGS = \
$(PHPINC) $(LIBXML_CFLAGS) \
- $(LIBVIRT_CFLAGS) $(DEFINES) \
+ $(LIBVIRT_CFLAGS) $(QEMU_CFLAGS) $(DEFINES) \
-I$(top_srcdir)/winsrc
AM_LDFLAGS = \
$(SHLIB_LDFLAGS) \
$(LIBXML_LIBS) \
- $(LIBVIRT_LIBS)
+ $(LIBVIRT_LIBS) \
+ $(QEMU_LIBS)
lib_LTLIBRARIES = libvirt-php.la
diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index d13e5b4..b018cb0 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -242,6 +242,8 @@ static zend_function_entry libvirt_functions[] = {
/* Debugging functions */
PHP_FE(libvirt_logfile_set, NULL)
PHP_FE(libvirt_print_binding_resources, NULL)
+ /* Agent functions */
+ PHP_FE(libvirt_domain_qemu_agent_command, NULL)
{NULL, NULL, NULL}
};
@@ -3611,6 +3613,33 @@ PHP_FUNCTION(libvirt_domain_lookup_by_uuid)
}
/*
+ * Function name: libvirt_domain_qemu_agent_command
+ * Since version: 0.5.2(-1)
+ * Description: Function is used to send qemu-ga command
+ * Arguments: @res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
+ * @timeout [int] timeout for waiting (-2 block, -1 default, 0 no wait, >0 wait specific time
+ * @flags [int]: unknown
+ * Returns: String on success and FALSE on error
+ */
+PHP_FUNCTION(libvirt_domain_qemu_agent_command)
+{
+ php_libvirt_domain *domain=NULL;
+ zval *zdomain;
+ const char *cmd;
+ int cmd_len;
+ char *ret;
+ long timeout = -1;
+ long flags = 0;
+
+ GET_DOMAIN_FROM_ARGS("rs|ll", &zdomain, &cmd, &cmd_len, &timeout, &flags);
+
+ ret = virDomainQemuAgentCommand(domain->domain, cmd, timeout, flags);
+ if (ret == NULL) RETURN_FALSE;
+
+ RETURN_STRING(ret, 1);
+}
+
+/*
* Function name: libvirt_domain_lookup_by_uuid_string
* Since version: 0.4.1(-1)
* Description: Function is used to get the domain by it's UUID that's accepted in string format
diff --git a/src/libvirt-php.h b/src/libvirt-php.h
index 8dc5927..eb4b7f4 100644
--- a/src/libvirt-php.h
+++ b/src/libvirt-php.h
@@ -80,6 +80,7 @@
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>
+#include <libvirt/libvirt-qemu.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <fcntl.h>
@@ -423,6 +424,7 @@ PHP_FUNCTION(libvirt_domain_send_keys);
PHP_FUNCTION(libvirt_domain_send_pointer_event);
PHP_FUNCTION(libvirt_domain_get_metadata);
PHP_FUNCTION(libvirt_domain_set_metadata);
+PHP_FUNCTION(libvirt_domain_qemu_agent_command);
/* Domain snapshot functions */
PHP_FUNCTION(libvirt_domain_has_current_snapshot);
PHP_FUNCTION(libvirt_domain_snapshot_create);
--
2.3.3
9 years, 4 months
[libvirt] [PATCH] util:qemu: fix IOThreadinfo always get failed when get running vm status
by Luyao Huang
When we use iothreadinfo to get iothread information, we will get
error like this:
# virsh iothreadinfo rhel7.0 --live
error: Unable to get domain IOThreads information
error: Unable to encode message payload
This is because virProcessGetAffinity() return a bitmap which map_len
is too big to send via rpc:
(gdb) p *map
$7 = {max_bit = 262144, map_len = 4096, map = 0x7f9b6c2c0a20}
To fix this issue add a new parameter &maxcpu to virProcessGetAffinity()
to let callers specify the maxcpu (also in most machine, no need loop
262144 times to check if cpu is set), if set &maxcpu to zero,
virProcessGetAffinity() will use default value (262144 or 1024) to
create bitmap. This issue was introduced in commit 825df8c.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/qemu/qemu_driver.c | 4 ++--
src/util/virprocess.c | 7 ++++---
src/util/virprocess.h | 2 +-
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2b530c8..e1ad696 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1459,7 +1459,7 @@ qemuDomainHelperGetVcpus(virDomainObjPtr vm, virVcpuInfoPtr info, int maxinfo,
unsigned char *cpumap = VIR_GET_CPUMAP(cpumaps, maplen, v);
virBitmapPtr map = NULL;
- if (!(map = virProcessGetAffinity(priv->vcpupids[v])))
+ if (!(map = virProcessGetAffinity(priv->vcpupids[v], hostcpus)))
return -1;
virBitmapToDataBuf(map, cpumap, maplen);
@@ -5619,7 +5619,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver,
goto endjob;
info_ret[i]->iothread_id = iothreads[i]->iothread_id;
- if (!(map = virProcessGetAffinity(iothreads[i]->thread_id)))
+ if (!(map = virProcessGetAffinity(iothreads[i]->thread_id, hostcpus)))
goto endjob;
if (virBitmapToData(map, &info_ret[i]->cpumap,
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 8fa7a9b..8800623 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -469,7 +469,8 @@ int virProcessSetAffinity(pid_t pid, virBitmapPtr map)
}
virBitmapPtr
-virProcessGetAffinity(pid_t pid)
+virProcessGetAffinity(pid_t pid,
+ int maxcpu)
{
size_t i;
cpu_set_t *mask;
@@ -504,10 +505,10 @@ virProcessGetAffinity(pid_t pid)
goto cleanup;
}
- if (!(ret = virBitmapNew(ncpus)))
+ if (!(ret = virBitmapNew(maxcpu ? maxcpu : ncpus)))
goto cleanup;
- for (i = 0; i < ncpus; i++) {
+ for (i = 0; i < (maxcpu ? maxcpu : ncpus); i++) {
# ifdef CPU_ALLOC
/* coverity[overrun-local] */
if (CPU_ISSET_S(i, masklen, mask))
diff --git a/src/util/virprocess.h b/src/util/virprocess.h
index 1768009..cc903ac 100644
--- a/src/util/virprocess.h
+++ b/src/util/virprocess.h
@@ -58,7 +58,7 @@ int virProcessKillPainfully(pid_t pid, bool force);
int virProcessSetAffinity(pid_t pid, virBitmapPtr map);
-virBitmapPtr virProcessGetAffinity(pid_t pid);
+virBitmapPtr virProcessGetAffinity(pid_t pid, int maxcpu);
int virProcessGetPids(pid_t pid, size_t *npids, pid_t **pids);
--
1.8.3.1
9 years, 4 months
[libvirt] [libvirt-php][PATCH v1] add libvirt_domain_qemu_agent_command
by Vasiliy Tolstov
add another missing libvirt command
Signed-off-by: Vasiliy Tolstov <v.tolstov(a)selfip.ru>
---
configure.ac | 3 +++
src/Makefile.am | 5 +++--
src/libvirt-php.c | 28 ++++++++++++++++++++++++++++
src/libvirt-php.h | 2 ++
4 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 9e9fee0..0afa2e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,6 +23,9 @@ PKG_PROG_PKG_CONFIG
LIBVIRT_REQUIRED=0.6.2
PKG_CHECK_MODULES(LIBVIRT, libvirt >= $LIBVIRT_REQUIRED)
+PKG_CHECK_MODULES(QEMU, libvirt-qemu)
+AC_SUBST([QEMU_CFLAGS])
+AC_SUBST([QEMU_LIBS])
dnl ==========================================================================
dnl required minimum version of libxml2
diff --git a/src/Makefile.am b/src/Makefile.am
index 8e6a800..f270ec2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,13 +27,14 @@ uninstall-local:
AM_CFLAGS = \
$(PHPINC) $(LIBXML_CFLAGS) \
- $(LIBVIRT_CFLAGS) $(DEFINES) \
+ $(LIBVIRT_CFLAGS) $(QEMU_CFLAGS) $(DEFINES) \
-I$(top_srcdir)/winsrc
AM_LDFLAGS = \
$(SHLIB_LDFLAGS) \
$(LIBXML_LIBS) \
- $(LIBVIRT_LIBS)
+ $(LIBVIRT_LIBS) \
+ $(QEMU_LIBS)
lib_LTLIBRARIES = libvirt-php.la
diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index d46fbb9..f9d5557 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -161,6 +161,7 @@ static zend_function_entry libvirt_functions[] = {
PHP_FE(libvirt_domain_send_keys, NULL)
PHP_FE(libvirt_domain_send_pointer_event, NULL)
PHP_FE(libvirt_domain_update_device, NULL)
+ PHP_FE(libvirt_domain_qemu_agent_command, NULL)
/* Domain snapshot functions */
PHP_FE(libvirt_domain_has_current_snapshot, NULL)
PHP_FE(libvirt_domain_snapshot_create, NULL)
@@ -3943,6 +3944,33 @@ PHP_FUNCTION(libvirt_domain_get_name)
}
/*
+ Function name: libvirt_domain_qemu_agent_command
+ Since version: 0.5.2(-1)
+ Description: Function is used to send qemu-ga command
+ Arguments: @res [resource]: libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
+ @timeout [int]: timeout for waiting (-2 block, -1 default, 0 no wait, >0 wait specific time
+ @flags [int]: ??
+ Returns: String on success and FALSE on error
+*/
+PHP_FUNCTION(libvirt_domain_qemu_agent_command)
+{
+ php_libvirt_domain *domain=NULL;
+ zval *zdomain;
+ const char *cmd;
+ int cmd_len;
+ char *ret;
+ long timeout = -1;
+ long flags = 0;
+
+ GET_DOMAIN_FROM_ARGS("rs|l|l", &zdomain, &cmd, &cmd_len, &timeout, &flags);
+
+ ret = virDomainQemuAgentCommand(domain->domain, cmd, timeout, flags);
+ if (ret == NULL) RETURN_FALSE;
+
+ RETURN_STRING(ret,1);
+}
+
+/*
Function name: libvirt_domain_get_uuid_string
Since version: 0.4.1(-1)
Description: Function is used to get the domain's UUID in string format
diff --git a/src/libvirt-php.h b/src/libvirt-php.h
index 7c9a229..1d9c6ab 100644
--- a/src/libvirt-php.h
+++ b/src/libvirt-php.h
@@ -80,6 +80,7 @@
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>
+#include <libvirt/libvirt-qemu.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <fcntl.h>
@@ -427,6 +428,7 @@ PHP_FUNCTION(libvirt_domain_send_keys);
PHP_FUNCTION(libvirt_domain_send_pointer_event);
PHP_FUNCTION(libvirt_domain_get_metadata);
PHP_FUNCTION(libvirt_domain_set_metadata);
+PHP_FUNCTION(libvirt_domain_qemu_agent_command);
/* Domain snapshot functions */
PHP_FUNCTION(libvirt_domain_has_current_snapshot);
PHP_FUNCTION(libvirt_domain_snapshot_create);
--
2.3.3
9 years, 4 months
[libvirt] [sandbox PATCH 00/10] Patches for Libvirt-sandbox
by Eren Yagdiran
Hello,
These patches provide disk support for libvirt-sandbox.
Implemented '--disk' parameter will be useful when integrating Docker image support for libvirt-sandbox.
--Main diffs compared to previous patches.
Since many hypervisors, including kvm, will not even honour requested
names for disk devices we link each device under /dev/disk/by-tag
e.g /dev/disk/by-tag/foobar -> /dev/sda
We populate disks.cfg with tag to device mapping when we build the sandbox.
After that, in each init-process {Common,Qemu}, we basically read the configuration
and populate the right symlinks under /dev/disk/by-tag
The common functions for modifying directories are moved under Init-util. {Common,Qemu} inits are using them.
Cédric Bosdonnat (2):
Add gvir_sandbox_config_has_disks function
qemu: use devtmpfs rather than tmpfs to auto-populate /dev
Eren Yagdiran (8):
Add an utility function for guessing filetype from file extension
Add configuration object for disk support
Add disk parameter to virt-sandbox
Add disk support to the container builder
Add disk support to machine builder
Init-util : Common directory functions for init-common and init-qemu
Common-init: Building symlink from disks.cfg
Common-builder: /dev/disk/by-tag/thetag to /dev/vdN
bin/virt-sandbox.c | 37 +++
libvirt-sandbox/Makefile.am | 7 +-
.../libvirt-sandbox-builder-container.c | 33 ++-
libvirt-sandbox/libvirt-sandbox-builder-machine.c | 44 ++-
libvirt-sandbox/libvirt-sandbox-builder.c | 73 ++++-
libvirt-sandbox/libvirt-sandbox-config-disk.c | 273 +++++++++++++++++++
libvirt-sandbox/libvirt-sandbox-config-disk.h | 82 ++++++
libvirt-sandbox/libvirt-sandbox-config.c | 300 +++++++++++++++++++++
libvirt-sandbox/libvirt-sandbox-config.h | 11 +
libvirt-sandbox/libvirt-sandbox-init-common.c | 54 +++-
libvirt-sandbox/libvirt-sandbox-init-qemu.c | 145 ++--------
libvirt-sandbox/libvirt-sandbox-init-util.c | 57 ++++
libvirt-sandbox/libvirt-sandbox-init-util.h | 40 +++
libvirt-sandbox/libvirt-sandbox-util.c | 72 +++++
libvirt-sandbox/libvirt-sandbox-util.h | 5 +
libvirt-sandbox/libvirt-sandbox.h | 1 +
libvirt-sandbox/libvirt-sandbox.sym | 5 +
libvirt-sandbox/tests/test-config.c | 11 +
po/POTFILES.in | 1 +
19 files changed, 1105 insertions(+), 146 deletions(-)
create mode 100644 libvirt-sandbox/libvirt-sandbox-config-disk.c
create mode 100644 libvirt-sandbox/libvirt-sandbox-config-disk.h
create mode 100644 libvirt-sandbox/libvirt-sandbox-init-util.c
create mode 100644 libvirt-sandbox/libvirt-sandbox-init-util.h
create mode 100644 libvirt-sandbox/libvirt-sandbox-util.c
--
2.1.0
9 years, 4 months
[libvirt] [PATCH 0/9] support multi-thread compress migration.
by ShaoHe Feng
These series patches support multi-thread compress during live migration.
Eli Qiao (4):
Add test cases for qemuMonitorJSONGetMigrationParameter
remote: Add support for set and get multil thread migration parameters
qemu_driver: Add support to set/get migration parameters.
virsh: Add set and get multi-thread migration parameters commands
ShaoHe Feng (5):
qemu_migration: Add support for mutil-thread compressed migration
enable
qemu: Add monitor API for get/set migration parameters
set multi-thread compress params for Migrate3 during live migration
virsh: add multi-thread migration option for live migrate command
Implement the public APIs for multi-thread compress parameters.
daemon/remote.c | 62 +++++++++++
include/libvirt/libvirt-domain.h | 31 ++++++
src/driver-hypervisor.h | 14 +++
src/libvirt-domain.c | 110 +++++++++++++++++++
src/libvirt_public.syms | 5 +
src/qemu/qemu_domain.h | 3 +
src/qemu/qemu_driver.c | 186 ++++++++++++++++++++++++++++++++
src/qemu/qemu_migration.c | 105 ++++++++++++++++++
src/qemu/qemu_migration.h | 18 +++-
src/qemu/qemu_monitor.c | 40 ++++++-
src/qemu/qemu_monitor.h | 11 ++
src/qemu/qemu_monitor_json.c | 93 ++++++++++++++++
src/qemu/qemu_monitor_json.h | 9 ++
src/qemu/qemu_monitor_text.c | 95 +++++++++++++++++
src/qemu/qemu_monitor_text.h | 10 ++
src/remote/remote_driver.c | 54 ++++++++++
src/remote/remote_protocol.x | 30 +++++-
src/remote_protocol-structs | 26 +++++
tests/qemumonitorjsontest.c | 53 +++++++++
tools/virsh-domain.c | 225 ++++++++++++++++++++++++++++++++++++++-
tools/virsh.pod | 36 +++++--
21 files changed, 1206 insertions(+), 10 deletions(-)
--
2.1.4
9 years, 4 months
[libvirt] [PATCH] qemu: Resolve Coverity RESOURCE_LEAK
by John Ferlan
Commit id '15fa84acb' added the alias fetch, but forgot to free it.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Pushing as trivial
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 b6e05fa..2b530c8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11805,7 +11805,7 @@ qemuDomainGetBlockInfo(virDomainPtr dom,
int rc;
virHashTablePtr stats = NULL;
qemuBlockStats *entry;
- char *alias;
+ char *alias = NULL;
virCheckFlags(0, -1);
@@ -11891,6 +11891,7 @@ qemuDomainGetBlockInfo(virDomainPtr dom,
endjob:
qemuDomainObjEndJob(driver, vm);
cleanup:
+ VIR_FREE(alias);
virHashFree(stats);
virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
--
2.1.0
9 years, 5 months