[libvirt] [PATCH] docs: Remove unused CSS rule
by Andrea Bolognani
Commit e14c5069c512 dropped the only user of the #sponsor CSS
rule, so we can drop it from the stylesheet as well.
---
docs/libvirt.css | 6 ------
1 file changed, 6 deletions(-)
diff --git a/docs/libvirt.css b/docs/libvirt.css
index c6f6d0d..2310b20 100644
--- a/docs/libvirt.css
+++ b/docs/libvirt.css
@@ -300,12 +300,6 @@ p.image {
color: #ccc;
}
-#sponsor {
- color: #757575;
- text-decoration: inherit;
- font-size: 1.2em;
-}
-
span.since {
color: #3c857c;
font-style: italic;
--
2.5.5
8 years, 9 months
[libvirt] [PATCH] Pass the correct cpu count when calling virDomainGetCPUStats.
by Nitesh Konkar
When using the --start option, the show_count should not be set to
max_id as the --start <cpu> means we dont need those many inital cpu
stats. Hence, show_count should be adjusted accordingly.
Signed-off-by: Nitesh Konkar <nitkon12(a)linux.vnet.ibm.com>
---
Before Patch:
virsh cpu-stats --domain 24 --start 158
CPU158:
cpu_time 0.073570788 seconds
vcpu_time 0.033277032 seconds
CPU159:
cpu_time 0.000000000 seconds
vcpu_time 0.000000000 seconds
error: Failed to retrieve CPU statistics for domain 24
error: invalid argument: start_cpu 280 larger than maximum of 159
After Patch:
virsh cpu-stats --domain 24 --start 158
CPU158:
cpu_time 0.073570788 seconds
vcpu_time 0.033277032 seconds
CPU159:
cpu_time 0.000000000 seconds
vcpu_time 0.000000000 seconds
tools/virsh-domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index bb1ee1c..7599bdc 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -7331,7 +7331,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
if (show_count < 0 || show_count > max_id) {
if (show_count > max_id)
vshPrint(ctl, _("Only %d CPUs available to show\n"), max_id);
- show_count = max_id;
+ show_count = max_id - cpu;
}
/* get percpu information */
--
1.8.3.1
8 years, 9 months
[libvirt] [PATCH v2] migration: convert speed from Mb/sec to bytes/sec in drive-mirror jobs
by Rudy Zhang
Commit id '7b7600b3' added qemuMigrationDriveMirror to handle NBD
mirroring, but passed the migrate_speed listed in MiB/s to be used for
the mirror_speed which expects a bytes/s value.
This patch will convert the migrate_speed value to its mirror_speed
equivalent.
Signed-off-by: Rudy Zhang <rudyflyzhang(a)gmail.com>
---
src/qemu/qemu_migration.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 8bc76bf..3d9a55f 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2093,12 +2093,21 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
char *diskAlias = NULL;
char *nbd_dest = NULL;
char *hoststr = NULL;
+ unsigned long long mirror_speed = speed;
unsigned int mirror_flags = VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT;
int rv;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
VIR_DEBUG("Starting drive mirrors for domain %s", vm->def->name);
+ if (mirror_speed > LLONG_MAX >> 20) {
+ virReportError(VIR_ERR_OVERFLOW,
+ _("bandwidth must be less than %llu"),
+ LLONG_MAX >> 20);
+ return ret;
+ }
+ mirror_speed <<= 20;
+
/* steal NBD port and thus prevent its propagation back to destination */
port = mig->nbd->port;
mig->nbd->port = 0;
@@ -2136,7 +2145,7 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
qemuBlockJobSyncBegin(disk);
/* Force "raw" format for NBD export */
mon_ret = qemuMonitorDriveMirror(priv->mon, diskAlias, nbd_dest,
- "raw", speed, 0, 0, mirror_flags);
+ "raw", mirror_speed, 0, 0, mirror_flags);
VIR_FREE(diskAlias);
VIR_FREE(nbd_dest);
--
2.6.4
8 years, 9 months
[libvirt] [PATCH 00/38] Introduce APIs to change daemon's logging settings
by Erik Skultety
This series implements administration APIs to modify daemon's logging settings
which include priority, filters, and outputs. It also performs all necessary
changes to enable this feature. Patches also involve some slight refactors
to the existing code as well as wiring up the APIs to virt-admin client.
The major change in internal code is how definition of filters and outputs is
achieved. Until now each filter/output has been defined and appended to the
global set of filters/outputs individually whilst holding a lock that was
repeatedly released after each filter/output. If modification to filters and
outputs should be exported through public APIs, all these setter operations
must be atomic, i.e. accomplished as a unit, not gradually. For filters and
priority, these are replaced normally, i.e. reset the original and replace it
with the new copy while having the lock. For outputs, there was a slight issue,
since resetting the global set of outputs would result in closing all the file
descriptors, which might not be exactly what we want, since the new set of
outputs that is meant to replace the original set might include outputs that
are also contained within the original set. The logic for such outputs is
following:
Each file-based output that already exists in the original set and
should continue existing in the new set will copy the existing FD from the
global set. For each syslog-based output, closelog and openlog must be called
anyway (because syslog keeps its FD private), but will be called at
the very last moment if such an output already exists to prevent from changing
before the lock for unit replaced is acquired, and thus breaking the atomicity
that we want. For journald-based outputs, the FD is global, we just need to
prevent it from being closed if such an output shall continue to exist.
All outputs that need to continue to exist are prevented from closing when
being destroyed-deallocated. On the other hand, all outputs that do not exist
in the new set of outputs shall be closed correctly.
Erik Skultety (38):
virlog: Return void instead of int in virLogReset<Foo> methods
virlog: Convert virLogOutputs to a list of pointers to outputs
virlog: Convert virLogFilters to a list of pointers to filters
virlog: Export virLogOutputPtr through header
virlog: Export virLogFilterPtr through header
virlog: Introduce virLogSetFilters
virlog: Introduce virLogSetOutputs
daemon: Replace virLogParseOutputs with virLogSetOutputs in callers
daemon: Replace virLogParseFilters with virLogSetFilters in callers
virlog: Introduce virLogDefineOutputs
virlog: Introduce virLogDefineFilters
virlog: Rename virLogAddOutputTo to virLogNewOutput
virlog: Rename virLogDefineOutput to virLogOutputNew
virlog: Rename virLogDefineFilter to virLogFilterNew
virlog: Introduce virLogOutputFree
virlog: Introduce virLogOutputListFree
virlog: Introduce virLogFilterFree
virlog: Introduce virLogFilterListFree
virlog: Make virLogReset methods use of virLog(Output|Filter)ListFree
virlog: Split output parsing and output defining to separate
operations
virlog: Split filter parsing and filter defining to separate
operations
virlog: Split parsing and setting priority
virlog: Introduce virLogOutputExists
virlog: Make use of virLogOutputExists
virlog: Take a special care of syslog when setting new set of log
outputs
virlog: Swap the new copy of outputs with the global existing one
virlog: Rename virLogFiltersSerial to virLogSerial
virlog: Make virLogSetDefaultPriority trigger source update as well
virlog: Introduce an API mutex that serializes all setters
virlog: Acquire virLogAPILock in each setter API
admin: Introduce virAdmConnectGetLoggingLevel
admin: Introduce virAdmConnectGetLoggingFilters
admin: Introduce virAdmConnectGetLoggingOutputs
admin: Introduce virAdmConnectSetLoggingLevel
admin: Introduce virAdmConnectSetLoggingFilters
admin: Introduce virAdmConnectSetLoggingOutputs
admin: Export logging level constants via libvirt-admin.h
virt-admin: Wire-up the logging APIs
daemon/admin.c | 125 +++++++
daemon/libvirtd.c | 8 +-
include/libvirt/libvirt-admin.h | 37 +++
src/admin/admin_protocol.x | 73 ++++-
src/admin/admin_remote.c | 86 +++++
src/admin_protocol-structs | 38 +++
src/libvirt-admin.c | 219 +++++++++++++
src/libvirt_admin_private.syms | 9 +
src/libvirt_admin_public.syms | 6 +
src/libvirt_private.syms | 14 +-
src/locking/lock_daemon.c | 8 +-
src/logging/log_daemon.c | 8 +-
src/util/virlog.c | 698 +++++++++++++++++++++++++++-------------
src/util/virlog.h | 50 +--
tests/eventtest.c | 3 +-
tests/testutils.c | 19 +-
tests/virlogtest.c | 12 +-
tools/virt-admin.c | 208 ++++++++++++
18 files changed, 1361 insertions(+), 260 deletions(-)
--
2.4.3
8 years, 9 months
[libvirt] [PATCH 0/5] Make all crashes non CVEs
by Michal Privoznik
Currently, whenever a crash occurs it may be very serious. It may
even get its own CVE. This patch set tries to resolve the problem.
Michal Privoznik (5):
Introduce virConnectCrash
virutil: Introduce virCrash
remote: Implement virConnectCrash
qemu: Implement virConnectCrash
virsh: Implement virConnectCrash
cfg.mk | 2 ++
daemon/remote.c | 30 +++++++++++++++++
include/libvirt/libvirt-host.h | 15 +++++++++
src/driver-hypervisor.h | 7 ++++
src/libvirt-host.c | 45 +++++++++++++++++++++++++
src/libvirt_private.syms | 1 +
src/libvirt_public.syms | 1 +
src/qemu/qemu_driver.c | 29 ++++++++++++++++
src/remote/remote_driver.c | 32 ++++++++++++++++++
src/remote/remote_protocol.x | 14 +++++++-
src/remote_protocol-structs | 5 +++
src/util/virutil.c | 32 ++++++++++++++++++
src/util/virutil.h | 2 ++
tools/virsh-host.c | 75 ++++++++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 9 +++++
15 files changed, 298 insertions(+), 1 deletion(-)
--
2.7.3
8 years, 9 months
[libvirt] [PATCH] qemu: perf: Tweak flags before using them
by Peter Krempa
@flags have a valid modification impact only after calling
virDomainObjUpdateModificationImpact. virDomainObjGetOneDef calls it but
doesn't update them in the caller.
---
CC: mprivozn(a)redhat.com
src/qemu/qemu_driver.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4aa1625..0434438 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10150,6 +10150,9 @@ qemuDomainGetPerfEvents(virDomainPtr dom,
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
goto cleanup;
+ if (virDomainObjUpdateModificationImpact(vm, &flags) < 0)
+ goto endjob;
+
if (!(def = virDomainObjGetOneDef(vm, flags)))
goto endjob;
--
2.8.0
8 years, 9 months
[libvirt] [PATCH] migration: convert speed from Mb/sec to bytes/sec in drive-mirror jobs
by Rudy Zhang
Commit id '7b7600b3' added qemuMigrationDriveMirror to handle NBD
mirroring, but passed the migrate_speed listed in MiB/s to be used for
the mirror_speed which expects a bytes/s value.
This patch will convert the migrate_speed value to its mirror_speed
equivalent.
Signed-off-by: Rudy Zhang <rudyflyzhang(a)gmail.com>
---
src/qemu/qemu_migration.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 8bc76bf..3d9a55f 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2093,12 +2093,21 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
char *diskAlias = NULL;
char *nbd_dest = NULL;
char *hoststr = NULL;
+ unsigned long long mirror_speed = speed;
unsigned int mirror_flags = VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT;
int rv;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
VIR_DEBUG("Starting drive mirrors for domain %s", vm->def->name);
+ if (mirror_speed > LLONG_MAX >> 20) {
+ virReportError(VIR_ERR_OVERFLOW,
+ _("bandwidth must be less than %llu"),
+ LLONG_MAX >> 20);
+ return ret;
+ }
+ mirror_speed <<= 20;
+
/* steal NBD port and thus prevent its propagation back to destination */
port = mig->nbd->port;
mig->nbd->port = 0;
@@ -2136,7 +2145,7 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
qemuBlockJobSyncBegin(disk);
/* Force "raw" format for NBD export */
mon_ret = qemuMonitorDriveMirror(priv->mon, diskAlias, nbd_dest,
- "raw", speed, 0, 0, mirror_flags);
+ "raw", mirror_speed, 0, 0, mirror_flags);
VIR_FREE(diskAlias);
VIR_FREE(nbd_dest);
--
2.6.4
8 years, 9 months
[libvirt] [PATCH] migration: convert speed from Mb/sec to bytes/sec in drive-mirror jobs
by Rudy Zhang
Block migration speed is differect from memory migration speed, because
it not convert speed from Mb/sec to bytes/sec in the drive-mirror job.
Signed-off-by: Rudy Zhang <rudyflyzhang(a)gmail.com>
---
src/qemu/qemu_migration.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 8bc76bf..7648d8c 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2135,8 +2135,8 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
qemuBlockJobSyncBegin(disk);
/* Force "raw" format for NBD export */
- mon_ret = qemuMonitorDriveMirror(priv->mon, diskAlias, nbd_dest,
- "raw", speed, 0, 0, mirror_flags);
+ mon_ret = qemuMonitorDriveMirror(priv->mon, diskAlias, nbd_dest,"raw",
+ (unsigned long long)speed << 20, 0, 0, mirror_flags);
VIR_FREE(diskAlias);
VIR_FREE(nbd_dest);
--
2.6.4
8 years, 9 months
[libvirt] [PATCH 1/1] python: add python binding for Perf API
by Qiaowei Ren
This patch adds the python binding for virDomainSetPerfEvents and
virDomainSetPerfEvents API.
Signed-off-by: Qiaowei Ren <qiaowei.ren(a)intel.com>
---
generator.py | 2 ++
libvirt-override-api.xml | 11 ++++++
libvirt-override.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 106 insertions(+)
diff --git a/generator.py b/generator.py
index d9ae17e..fb6a493 100755
--- a/generator.py
+++ b/generator.py
@@ -433,6 +433,8 @@ skip_impl = (
'virDomainGetMemoryParameters',
'virDomainSetNumaParameters',
'virDomainGetNumaParameters',
+ 'virDomainSetPerfEvents',
+ 'virDomainGetPerfEvents',
'virDomainGetVcpus',
'virDomainPinVcpu',
'virDomainPinVcpuFlags',
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index 1a0e314..54b45f7 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -344,6 +344,17 @@
<arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
<arg name='flags' type='int' info='an OR'ed set of virDomainModificationImpact'/>
</function>
+ <function name='virDomainSetPerfEvents' file='python'>
+ <info>Enable or disable the particular list of perf events</info>
+ <return type='int' info='-1 in case of error, 0 in case of success.'/>
+ <arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
+ <arg name='params' type='virTypedParameterPtr' info='pointer to perf events parameter object'/>
+ </function>
+ <function name='virDomainGetPerfEvents' file='python'>
+ <info>Get all perf events setting.</info>
+ <return type='char *' info='returns a dictionary of params in case of success, None in case of error'/>
+ <arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
+ </function>
<function name='virDomainSetInterfaceParameters' file='python'>
<info>Change the bandwidth tunables for a interface device</info>
<arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
diff --git a/libvirt-override.c b/libvirt-override.c
index ce36280..11ef15e 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -1059,6 +1059,97 @@ libvirt_virDomainGetNumaParameters(PyObject *self ATTRIBUTE_UNUSED,
}
static PyObject *
+libvirt_virDomainSetPerfEvents(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ virDomainPtr domain;
+ PyObject *pyobj_domain, *info;
+ PyObject *ret = NULL;
+ int i_retval;
+ int nparams = 0;
+ Py_ssize_t size = 0;
+ virTypedParameterPtr params = NULL, new_params = NULL;
+
+ if (!PyArg_ParseTuple(args,
+ (char *)"OO:virDomainSetNumaParameters",
+ &pyobj_domain, &info))
+ return NULL;
+ domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+ if ((size = PyDict_Size(info)) < 0)
+ return NULL;
+
+ if (size == 0) {
+ PyErr_Format(PyExc_LookupError,
+ "Need non-empty dictionary to set attributes");
+ return NULL;
+ }
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainGetPerfEvents(domain, ¶ms, &nparams);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0)
+ return VIR_PY_INT_FAIL;
+
+ if (nparams == 0) {
+ PyErr_Format(PyExc_LookupError,
+ "Domain has no settable attributes");
+ return NULL;
+ }
+
+ new_params = setPyVirTypedParameter(info, params, nparams);
+ if (!new_params)
+ goto cleanup;
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainSetPerfEvents(domain, new_params, size);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0) {
+ ret = VIR_PY_INT_FAIL;
+ goto cleanup;
+ }
+
+ ret = VIR_PY_INT_SUCCESS;
+
+ cleanup:
+ virTypedParamsFree(params, nparams);
+ virTypedParamsFree(new_params, size);
+ return ret;
+}
+
+static PyObject *
+libvirt_virDomainGetPerfEvents(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *pyobj_domain;
+ virDomainPtr domain;
+ virTypedParameterPtr params = NULL;
+ int nparams = 0;
+ PyObject *dict = NULL;
+ int rc;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:virDomainGetPerfEvents",
+ &pyobj_domain))
+ return NULL;
+ domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ rc = virDomainGetPerfEvents(domain, ¶ms, &nparams);
+ LIBVIRT_END_ALLOW_THREADS;
+ if (rc < 0)
+ return VIR_PY_NONE;
+
+ if (!(dict = getPyVirTypedParameter(params, nparams)))
+ goto cleanup;
+
+ cleanup:
+ virTypedParamsFree(params, nparams);
+ return dict;
+}
+
+static PyObject *
libvirt_virDomainSetInterfaceParameters(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args)
{
@@ -8686,6 +8777,8 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virDomainGetMemoryParameters", libvirt_virDomainGetMemoryParameters, METH_VARARGS, NULL},
{(char *) "virDomainSetNumaParameters", libvirt_virDomainSetNumaParameters, METH_VARARGS, NULL},
{(char *) "virDomainGetNumaParameters", libvirt_virDomainGetNumaParameters, METH_VARARGS, NULL},
+ {(char *) "virDomainSetPerfEvents", libvirt_virDomainSetPerfEvents, METH_VARARGS, NULL},
+ {(char *) "virDomainGetPerfEvents", libvirt_virDomainGetPerfEvents, METH_VARARGS, NULL},
{(char *) "virDomainSetInterfaceParameters", libvirt_virDomainSetInterfaceParameters, METH_VARARGS, NULL},
{(char *) "virDomainGetInterfaceParameters", libvirt_virDomainGetInterfaceParameters, METH_VARARGS, NULL},
{(char *) "virDomainGetVcpus", libvirt_virDomainGetVcpus, METH_VARARGS, NULL},
--
1.9.1
8 years, 9 months