[libvirt] [PATCH] storage: Fix a NULL ptr dereference in virStorageBackendCreateQemuImg
by Erik Skultety
There was a missing check for vol->target.encryption being NULL
at one particular place (modified by commit a48c71411) which caused a crash
when user attempted to create a raw volume using a non-raw file volume as
source.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1363636
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
src/storage/storage_backend.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 1f33181..d4334dc 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1459,6 +1459,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
goto cleanup;
if (vol->target.format == VIR_STORAGE_FILE_RAW &&
+ vol->target.encryption &&
vol->target.encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) {
if (!(secretPath =
virStorageBackendCreateQemuImgSecretPath(conn, pool, vol)))
--
2.5.5
8 years, 4 months
[libvirt] [PATCH 00/10] New vCPU hotplug prequel
by Peter Krempa
A few patches that are standalone enough which originated from my work in
progress on new way to do vcpu hotplug.
Peter Krempa (10):
qemu: monitor: Add monitor API for device_add supporting JSON objects
internal: Introduce macro for stealing pointers
qemu: monitor: Add do-while block to QEMU_CHECK_MONITOR_FULL
qemu: Improve error message in virDomainGetVcpus
qemu: domain: Rename qemuDomainDetectVcpuPids to
qemuDomainRefreshVcpuInfo
qemu: monitor: Rename qemuMonitor(JSON|Text)GetCPUInfo
qemu: domain: Improve vCPU data checking in qemuDomainDetectVcpuPids
qemu: domain: Simplify return values of qemuDomainRefreshVcpuInfo
qemu: monitor: Return structures from qemuMonitorGetCPUInfo
qemu: monitor: Return struct from qemuMonitor(Text|Json)QueryCPUs
src/internal.h | 12 +++++
src/qemu/qemu_domain.c | 95 ++++++++++++++++++++++++-------------
src/qemu/qemu_domain.h | 6 ++-
src/qemu/qemu_driver.c | 25 +++++-----
src/qemu/qemu_monitor.c | 110 ++++++++++++++++++++++++++++++++++++-------
src/qemu/qemu_monitor.h | 21 ++++++++-
src/qemu/qemu_monitor_json.c | 103 ++++++++++++++++++++++------------------
src/qemu/qemu_monitor_json.h | 6 ++-
src/qemu/qemu_monitor_text.c | 40 ++++++++--------
src/qemu/qemu_monitor_text.h | 4 +-
src/qemu/qemu_process.c | 12 +++--
tests/qemumonitorjsontest.c | 35 ++++++++++----
12 files changed, 316 insertions(+), 153 deletions(-)
--
2.9.2
8 years, 4 months
[libvirt] [PATCH v2 0/8] Introducing node device lifecycle event APIs
by Jovanka Gulicoska
Introducing implementation of node device event APIs. Code changes
follow network/storage pool event APIs.
Implemented functions: virNodeDeviceEventRegisterAny(),
virNodeDeviceEventDeregisterAny(), virNodeDeviceLifeCycleEventNew(),
introduced CREATED and DELETED.
There are also test as well as unittests for the new functions and signals.
This is part of a GSOC project: Asynchronous lifecycle events for storage objects
Jovanka Gulicoska (8):
Introduce node device lifecycle event APIs
conf: add node_device_event handling
test: implement node device lifecycle event APIs
remote: implement node device lifecycle event APIs
node_device: implement node device lifecycle event APIs
node_device: Implement event queue in udev
event-test: support node device lifecycle event APIs
virsh: Introduce nodedev-event command
daemon/libvirtd.h | 2 +
daemon/remote.c | 206 ++++++++++++++++++++++++++++++
examples/object-events/event-test.c | 68 ++++++++++
include/libvirt/libvirt-nodedev.h | 90 ++++++++++++++
po/POTFILES.in | 1 +
src/Makefile.am | 5 +
src/conf/node_device_conf.h | 4 +
src/conf/node_device_event.c | 234 +++++++++++++++++++++++++++++++++++
src/conf/node_device_event.h | 59 +++++++++
src/datatypes.h | 13 ++
src/driver-nodedev.h | 14 +++
src/libvirt-nodedev.c | 127 +++++++++++++++++++
src/libvirt_private.syms | 5 +
src/libvirt_public.syms | 6 +
src/node_device/node_device_driver.c | 42 +++++++
src/node_device/node_device_driver.h | 10 ++
src/node_device/node_device_udev.c | 46 +++++--
src/remote/remote_driver.c | 139 +++++++++++++++++++++
src/remote/remote_protocol.x | 43 ++++++-
src/remote_protocol-structs | 19 +++
src/test/test_driver.c | 48 +++++++
tests/objecteventtest.c | 72 +++++++++++
tools/virsh-nodedev.c | 182 +++++++++++++++++++++++++++
tools/virsh.pod | 18 +++
24 files changed, 1443 insertions(+), 10 deletions(-)
create mode 100644 src/conf/node_device_event.c
create mode 100644 src/conf/node_device_event.h
--
2.7.4
8 years, 4 months
[libvirt] [PATCH v4 0/4] perf: add more perf events support
by Qiaowei Ren
With current perf framework, this patchset refactor virPerfEventEnable()
for general purpose and add more perf events support based on this change,
including cache misses, cache references, cpu cycles, instrctions, etc..
Changes since v3:
* separate the patch into 4 patches.
* update virsh.pod for new perf events.
* introduce a static attr table that would be able to convert the
VIR_PERF_EVENT_* into their respective "attr.type" and "attr.config".
Qiaowei Ren (4):
perf: rename qemuDomainGetStatsPerfRdt()
perf: introduce a static attr table and refactor virPerfEventEnable()
for general purpose
perf: add more perf events support
perf: add description for new events in virsh.pod
docs/formatdomain.html.in | 24 ++++
docs/schemas/domaincommon.rng | 4 +
include/libvirt/libvirt-domain.h | 39 ++++++
src/libvirt-domain.c | 8 ++
src/qemu/qemu_driver.c | 23 ++--
src/util/virperf.c | 176 +++++++++++++++++-----------
src/util/virperf.h | 11 ++
tests/genericxml2xmlindata/generic-perf.xml | 4 +
tools/virsh.pod | 4 +
9 files changed, 211 insertions(+), 82 deletions(-)
--
1.9.1
8 years, 4 months
[libvirt] Examples of QEMU machine-type-specific code in libvirt?
by Eduardo Habkost
Hi,
I am collecting some material for my KVM Forum talk, and I am
interested in hearing from libvirt developers about instances
where machine-type-specific information is needed by libvirt, and
the info is not provided by QEMU.
I found some instances where machine-type capabilities are
hardcoded in libvirt itself (see below[1]), but I would like to
know if you have other examples. They may be about things that
are already done by libvirt today, or about things that you would
like to do in the future.
[1] Examples where machine-type names are hardcoded in libvirt:
src/qemu/qemu_capabilities.c: STREQ(def->os.machine, "ppce500"))
src/qemu/qemu_capabilities.c: STREQ(def->os.machine, "prep"))
src/qemu/qemu_capabilities.c: STREQ(def->os.machine, "bamboo"))
src/qemu/qemu_capabilities.c: if (STREQ(def->os.machine, "mpc8544ds"))
src/qemu/qemu_capabilities.c: if (STREQ(machines[i]->name, "none"))
src/qemu/qemu_capabilities.c: STREQ(def->os.machine, "isapc");
src/qemu/qemu_capabilities.c: (STRNEQ(machine, "pseries") && !STRPREFIX(machine, "pseries-")))
src/qemu/qemu_capabilities.c: (STRNEQ(machine, "pseries") && !STRPREFIX(machine, "pseries-")))
src/qemu/qemu_capabilities.c: if (STRNEQ(domCaps->machine, "virt") &&
src/qemu/qemu_capabilities.c: !STRPREFIX(domCaps->machine, "virt-"))
src/qemu/qemu_command.c: if (STRPREFIX(def->os.machine, "s390-virtio") &&
src/qemu/qemu_domain.c: if (STREQ(def->os.machine, "isapc")) {
src/qemu/qemu_domain.c: if (STREQ(def->os.machine, "versatilepb"))
src/qemu/qemu_domain.c: return (STRPREFIX(def->os.machine, "pc-q35") ||
src/qemu/qemu_domain.c: STREQ(def->os.machine, "q35"));
src/qemu/qemu_domain.c: return (STREQ(def->os.machine, "pc") ||
src/qemu/qemu_domain.c: STRPREFIX(def->os.machine, "pc-0.") ||
src/qemu/qemu_domain.c: STRPREFIX(def->os.machine, "pc-1.") ||
src/qemu/qemu_domain.c: STRPREFIX(def->os.machine, "pc-i440") ||
src/qemu/qemu_domain.c: STRPREFIX(def->os.machine, "rhel"));
src/qemu/qemu_domain.c: char *p = STRSKIP(def->os.machine, "pc-q35-");
src/qemu/qemu_domain.c: return STRPREFIX(def->os.machine, "s390-ccw");
src/qemu/qemu_domain.c: if (STRNEQ(def->os.machine, "virt") &&
src/qemu/qemu_domain.c: !STRPREFIX(def->os.machine, "virt-"))
src/qemu/qemu_domain.c: if (STRNEQ(def->os.machine, "pseries") &&
src/qemu/qemu_domain.c: !STRPREFIX(def->os.machine, "pseries-"))
src/qemu/qemu_domain.c: STREQ(def->os.machine, "malta") ||
src/qemu/qemu_domain.c: STREQ(def->os.machine, "sun4u") ||
src/qemu/qemu_domain.c: STREQ(def->os.machine, "g3beige");
src/qemu/qemu_domain_address.c: if (!(STRPREFIX(def->os.machine, "vexpress-") ||
src/qemu/qemu_domain_address.c: if (STREQ(def->os.machine, "versatilepb"))
--
Eduardo
8 years, 4 months
[libvirt] [PATCH] libxl: allow libxl to calculate shadow mem requirements
by Jim Fehlig
Long, long ago before libxl_get_required_shadow_memory() was
made publicly available, its code was copied to the libxl driver
for calculating shadow memory requirements of HVM domains.
Long ago, libxl_get_required_shadow_memory() was exported in
libxl_utils.h and included in xen-devel packages everywhere.
Remove the copied code, which has become stale, and let libxl
provode a proper shadow memory value.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
I ensured libxl_get_required_shadow_memory() was available
as far back as Xen 4.4, which is the minimum version supported
by the libxl driver.
src/libxl/libxl_conf.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 1344604..5202ca1 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -493,15 +493,10 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
}
}
- /*
- * The following comment and calculation were taken directly from
- * libxenlight's internal function libxl_get_required_shadow_memory():
- *
- * 256 pages (1MB) per vcpu, plus 1 page per MiB of RAM for the P2M map,
- * plus 1 page per MiB of RAM to shadow the resident processes.
- */
- b_info->shadow_memkb = 4 * (256 * libxl_bitmap_count_set(&b_info->avail_vcpus) +
- 2 * (b_info->max_memkb / 1024));
+ /* Allow libxl to calculate shadow memory requirements */
+ b_info->shadow_memkb =
+ libxl_get_required_shadow_memory(b_info->max_memkb,
+ b_info->max_vcpus);
} else {
/*
* For compatibility with the legacy xen toolstack, default to pygrub
--
2.1.4
8 years, 4 months
[libvirt] [gconfig v2 0/4] Add support for changing listen address
by Visarion Alexandru
From: Visarion Alexandru <viorel.visarion(a)gmail.com>
libvirt-domain-graphics-listen defines an abstract class used
to represent one listen node.
libvirt-domain-graphics-liste-address defines a class that
represents a listen node of type 'address', for the
graphics device.
We have to first remove the 'listen' attribute of the
graphics device before adding child 'listen' nodes,
to avoid inconsistencies check.
Visarion Alexandru (4):
Introduce libvirt-domain-graphics-listen
Introduce libvirt-gconfig-domain-graphics-listen-address
config: Add vnc host setter
config: Add spice host setter
libvirt-gconfig/Makefile.am | 4 ++
...ibvirt-gconfig-domain-graphics-listen-address.c | 79 ++++++++++++++++++++++
...ibvirt-gconfig-domain-graphics-listen-address.h | 67 ++++++++++++++++++
.../libvirt-gconfig-domain-graphics-listen.c | 48 +++++++++++++
.../libvirt-gconfig-domain-graphics-listen.h | 64 ++++++++++++++++++
.../libvirt-gconfig-domain-graphics-spice.c | 28 ++++++++
.../libvirt-gconfig-domain-graphics-spice.h | 3 +
.../libvirt-gconfig-domain-graphics-vnc.c | 28 ++++++++
.../libvirt-gconfig-domain-graphics-vnc.h | 3 +
libvirt-gconfig/libvirt-gconfig.h | 2 +
libvirt-gconfig/libvirt-gconfig.sym | 6 ++
11 files changed, 332 insertions(+)
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.h
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.c
create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h
--
2.7.4
8 years, 4 months
[libvirt] [PATCH] libxl: add serial list support
by Bob Liu
Add support for multi serial devices, after this patch virsh can be used to
connect different serial devices of running domains. E.g.
vish # console <xxx> --devname serial<xxx>
Signed-off-by: Bob Liu <bob.liu(a)oracle.com>
---
src/libxl/libxl_conf.c | 25 ++++++++++++++++++-------
src/libxl/libxl_domain.c | 23 +++++++++++++++++++++++
src/libxl/libxl_driver.c | 17 +++++++++--------
3 files changed, 50 insertions(+), 15 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 146e08a..685a5ad 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -431,14 +431,25 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
}
if (def->nserials) {
- if (def->nserials > 1) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- "%s",
- _("Only one serial device is supported by libxl"));
- return -1;
+ if (def->nserials == 1) {
+ if (libxlMakeChrdevStr(def->serials[0], &b_info->u.hvm.serial) <
+ 0)
+ return -1;
+ } else {
+ if (VIR_ALLOC_N(b_info->u.hvm.serial_list, def->nserials + 1) <
+ 0)
+ return -1;
+
+ for (i = 0; i < def->nserials; i++) {
+ if (libxlMakeChrdevStr(def->serials[i],
+ &b_info->u.hvm.serial_list[i]) < 0)
+ {
+ libxl_string_list_dispose(&b_info->u.hvm.serial_list);
+ return -1;
+ }
+ }
+ b_info->u.hvm.serial_list[i] = NULL;
}
- if (libxlMakeChrdevStr(def->serials[0], &b_info->u.hvm.serial) < 0)
- return -1;
}
if (def->nparallels) {
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 0e26b91..82fe9e8 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -989,6 +989,29 @@ libxlConsoleCallback(libxl_ctx *ctx, libxl_event *ev, void *for_callback)
VIR_FREE(console);
}
}
+ for (i = 0; i < vm->def->nserials; i++) {
+ virDomainChrDefPtr chr = vm->def->serials[i];
+ char *console = NULL;
+ int ret;
+
+ if (chr->source.type == VIR_DOMAIN_CHR_TYPE_PTY) {
+ ignore_value(virAsprintf(&chr->info.alias, "serial%zd", i));
+ if (chr->source.data.file.path)
+ continue;
+ ret = libxl_console_get_tty(ctx, ev->domid,
+ chr->target.port,
+ LIBXL_CONSOLE_TYPE_SERIAL,
+ &console);
+ if (!ret) {
+ VIR_FREE(chr->source.data.file.path);
+ if (console && console[0] != '\0') {
+ ignore_value(VIR_STRDUP(chr->source.data.file.path,
+ console));
+ }
+ }
+ VIR_FREE(console);
+ }
+ }
virObjectUnlock(vm);
libxl_event_free(ctx, ev);
}
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index f153f69..a34eb02 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -4450,13 +4450,6 @@ libxlDomainOpenConsole(virDomainPtr dom,
virCheckFlags(VIR_DOMAIN_CONSOLE_FORCE, -1);
- if (dev_name) {
- /* XXX support device aliases in future */
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Named device aliases are not supported"));
- goto cleanup;
- }
-
if (!(vm = libxlDomObjFromDomain(dom)))
goto cleanup;
@@ -4472,8 +4465,16 @@ libxlDomainOpenConsole(virDomainPtr dom,
}
priv = vm->privateData;
+ if (dev_name) {
+ size_t i;
- if (vm->def->nconsoles) {
+ for (i = 0; !chr && i < vm->def->nserials; i++) {
+ if (STREQ(dev_name, vm->def->serials[i]->info.alias)) {
+ chr = vm->def->serials[i];
+ break;
+ }
+ }
+ } else if (vm->def->nconsoles) {
chr = vm->def->consoles[0];
if (chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL)
chr = vm->def->serials[0];
--
2.6.5
8 years, 4 months
[libvirt] [PATCH 0/2] Add ability to set specific IOThread scheduler quota/period
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1356937
John Ferlan (2):
conf: Add IOThread quota and period scheduler/cputune defs
qemu: Add support to get/set IOThread period and quota cgroup values
docs/formatdomain.html.in | 25 ++++
docs/schemas/domaincommon.rng | 10 ++
include/libvirt/libvirt-domain.h | 32 ++++++
src/conf/domain_conf.c | 42 +++++++
src/conf/domain_conf.h | 2 +
src/qemu/qemu_command.c | 3 +-
src/qemu/qemu_driver.c | 127 ++++++++++++++++++++-
src/qemu/qemu_process.c | 4 +-
tests/qemuxml2argvdata/qemuxml2argv-cputune.xml | 2 +
.../qemuxml2xmloutdata/qemuxml2xmlout-cputune.xml | 2 +
tools/virsh.pod | 9 +-
11 files changed, 249 insertions(+), 9 deletions(-)
--
2.5.5
8 years, 4 months
[libvirt] [PATCH python 0/2] Bindings for node device lifecycle events
by Jovanka Gulicoska
Python buindings and tests for node device lifecycle events API.
Jovanka Gulicoska (2):
Python binding for node poll lifecycle events API
event-test: Add node device lifecycle event tests
examples/event-test.py | 16 +++++
generator.py | 2 +
libvirt-override-virConnect.py | 45 ++++++++++++
libvirt-override.c | 153 +++++++++++++++++++++++++++++++++++++++++
sanitytest.py | 3 +
5 files changed, 219 insertions(+)
--
2.7.4
8 years, 4 months