[libvirt] [PATCH v3 0/7] qemu: Introduce support for new the block_set_io_throttle parameters add in the version 1.7 of qemu.
by Matthias Gatto
This series of patches add support for bps_max, bps_rd_max, bps_wr_max,
bps_max, bps_rd_max, bps_wr_max, and iops_size in the functions qemuDomainSetBlockIoTune and qemuDomainGetBlockIoTune.
The last patch add support for these parameters to the virsh blkdeviotune command.
v2: spellfix
v3: Merge patch 1/9,2/9,5/9 together.
Change the capability detection.(patch 2/7 and 3/7).
Try to make the usage of QEMU_NB_BLOCK_IO_TUNE_PARAM_MAX more explicit(patch 3/7).
Matthias Gatto (7):
qemu: Add defines for the news throttle options and modify the
structure _virDomainBlockIoTuneInfo.
qemu: Add the capability to detect if the qemu binary have the
capability to use bps_max and friends
qemu: Add bps_max and friends qemu driver
qemu: Add bps_max and friends QMP suport
qemu: Add bps_max and friends "text" support
qemu: add bps_max and friends to qemu command generation
virsh: Add bps_max and friends to virsh
include/libvirt/libvirt.h.in | 54 +++++++++++++++
src/conf/domain_conf.c | 89 +++++++++++++++++++++++-
src/conf/domain_conf.h | 7 ++
src/qemu/qemu_capabilities.c | 4 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 49 +++++++++++++
src/qemu/qemu_driver.c | 162 ++++++++++++++++++++++++++++++++++++++++---
src/qemu/qemu_monitor.c | 14 ++--
src/qemu/qemu_monitor.h | 6 +-
src/qemu/qemu_monitor_json.c | 70 +++++++++++++++----
src/qemu/qemu_monitor_json.h | 6 +-
src/qemu/qemu_monitor_text.c | 89 +++++++++++++++++++++---
src/qemu/qemu_monitor_text.h | 6 +-
tests/qemumonitorjsontest.c | 6 +-
tools/virsh-domain.c | 119 +++++++++++++++++++++++++++++++
tools/virsh.pod | 11 ++-
16 files changed, 643 insertions(+), 50 deletions(-)
--
1.8.3.1
10 years, 3 months
[libvirt] [PATCH] qemu: save domain status after set the blkio parameters
by Shanzhi Yu
After set the blkio parameters for running domain, save the change into
live xml is needed to survive restarting the libvirtd
Same story with bug 1146511
Signed-off-by: Shanzhi Yu <shyu(a)redhat.com>
---
src/qemu/qemu_driver.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6606154..9c96dea 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8090,6 +8090,8 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
}
if (ret < 0)
goto cleanup;
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ goto cleanup;
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
/* Clang can't see that if we get here, persistentDef was set. */
sa_assert(persistentDef);
--
1.9.3
10 years, 3 months
[libvirt] [PATCH] virsh: Fix help message of allocpages
by Tomoki Sekiyama
Fix info in the command definition of allocpages, which is currently
pointing info for 'capabilities'.
Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama(a)hds.com>
---
tools/virsh-host.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index a857a3b..4a3ff28 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -1326,7 +1326,7 @@ const vshCmdDef hostAndHypervisorCmds[] = {
{.name = "allocpages",
.handler = cmdAllocpages,
.opts = opts_allocpages,
- .info = info_capabilities,
+ .info = info_allocpages,
.flags = 0
},
{.name = "capabilities",
10 years, 3 months
[libvirt] Running the test fails virnetmessagetest with libvirt 1.2.8
by Stefano Ricci
Hello
I apologize in advance for my English.
I compiled the new version of libvirt 1.2.8 on an environment Development
Linux from Scratch with the following configure:
configure: Configuration summary
configure: =====================
configure:
configure: Drivers
configure:
configure: Xen: no
configure: QEMU: yes
configure: UML: yes
configure: OpenVZ: no
configure: VMware: no
configure: VBox: yes
configure: XenAPI: no
configure: xenlight: no
configure: LXC: no
configure: PHYP: yes
configure: ESX: no
configure: Hyper-V: no
configure: Parallels: no
configure: Bhyve: no
configure: Test: yes
configure: Remote: yes
configure: Network: yes
configure: Libvirtd: yes
configure: Interface: yes
configure: macvtap: yes
configure: virtport: yes
configure:
configure: Storage Drivers
configure:
configure: Dir: yes
configure: FS: no
configure: NetFS: no
configure: LVM: yes
configure: iSCSI: yes
configure: SCSI: yes
configure: mpath: yes
configure: Disk: no
configure: RBD: no
configure: Sheepdog: no
configure: Gluster: no
configure: ZFS: no
configure:
configure: Security Drivers
configure:
configure: SELinux: yes (/sys/fs/selinux)
configure: AppArmor: no (install profiles: no)
configure:
configure: Driver Loadable Modules
configure:
configure: dlopen: -ldl
configure:
configure: Libraries
configure:
configure: apparmor: no
configure: attr: yes (CFLAGS='' LIBS='-lattr')
configure: audit: no
configure: avahi: no
configure: blkid: yes (CFLAGS='-I/install/include/blkid
-I/install/include/uuid ' LIBS='-L/install/lib -lblkid ')
configure: capng: no
configure: curl: no
configure: dbus: yes (CFLAGS='-I/usr/include/dbus-1.0
-I/usr/lib/dbus-1.0/include ' LIBS='-ldbus-1 ')
configure: fuse: yes (CFLAGS='-D_FILE_OFFSET_BITS=64
-I/usr/include/fuse ' LIBS='-lfuse -pthread ')
configure: glusterfs: no
configure: hal: no
configure: netcf: no
configure: numactl: no
configure: openwsman: no
configure: pciaccess: yes (CFLAGS='' LIBS='-lpciaccess ')
configure: readline: yes (CFLAGS='' LIBS='-lreadline')
configure: sanlock: no
configure: sasl: yes (CFLAGS='' LIBS='-lsasl2')
configure: selinux: yes (CFLAGS='' LIBS='-lselinux')
configure: ssh2: yes (CFLAGS='' LIBS='-lssh2 ')
configure: systemd_daemon: no
configure: udev: yes (CFLAGS='' LIBS='-ludev ')
configure: yajl: yes (CFLAGS='' LIBS='-lyajl')
configure: libxml: -I/usr/include/libxml2 -lxml2
configure: dlopen: -ldl
configure: openwsman: no
configure: gnutls: -lgnutls
configure: firewalld: no
configure: polkit: no
configure: xen: no
configure: xenapi: no
configure: xenlight: no
configure: pcap: -I/usr/include -L/usr/lib -lpcap
configure: nl: -I/usr/include/libnl3 -I/usr/include/libnl3 -lnl-3
-lnl-route-3 -lnl-3
configure: mscom: no
configure: xdr:
configure: rbd: no
configure: pm-utils: yes
configure:
configure: Test suite
configure:
configure: Coverage: no
configure: Alloc OOM: no
configure:
configure: Miscellaneous
configure:
configure: Debug: yes
configure: Use -Werror: no
configure: Warning Flags: -W -Waddress -Waggressive-loop-optimizations
-Wall -Warray-bounds -Wattributes -Wbad-function-cast
-Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wclobbered
-Wcomment -Wcomments -Wcoverage-mismatch -Wcpp -Wdeprecated-declarations
-Wdisabled-optimization -Wdiv-by-zero -Wdouble-promotion -Wempty-body
-Wendif-labels -Wextra -Wformat-contains-nul -Wformat-extra-args
-Wformat-security -Wformat-y2k -Wformat-zero-length -Wfree-nonheap-object
-Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration
-Wimplicit-int -Winit-self -Winline -Wint-to-pointer-cast
-Winvalid-memory-model -Winvalid-pch -Wjump-misses-init -Wlogical-op -Wmain
-Wmaybe-uninitialized -Wmissing-braces -Wmissing-declarations
-Wmissing-field-initializers -Wmissing-include-dirs
-Wmissing-parameter-type -Wmissing-prototypes -Wmultichar -Wnarrowing
-Wnested-externs -Wnonnull -Wnormalized=nfc -Wold-style-declaration
-Wold-style-definition -Woverflow -Woverride-init -Wpacked-bitfield-compat
-Wparentheses -Wpointer-arith -Wpointer-sign -Wpointer-to-int-cast
-Wpragmas -Wreturn-local-addr -Wreturn-type -Wsequence-point -Wshadow
-Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-prototypes
-Wsuggest-attribute=const -Wsuggest-attribute=format
-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wswitch -Wsync-nand
-Wtrampolines -Wtrigraphs -Wtype-limits -Wuninitialized -Wunknown-pragmas
-Wunused -Wunused-but-set-parameter -Wunused-but-set-variable
-Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-parameter
-Wunused-result -Wunused-value -Wunused-variable -Wvarargs
-Wvariadic-macros -Wvector-operation-performance -Wvolatile-register-var
-Wwrite-strings -fdiagnostics-show-option -funit-at-a-time
-Wno-sign-compare -Wjump-misses-init -Wno-format-nonliteral
-Wframe-larger-than=4096 -fstack-protector-strong -fexceptions
-fasynchronous-unwind-tables -fipa-pure-const -Wno-suggest-attribute=pure
-Wno-suggest-attribute=const
configure: DTrace: no
configure: numad: no
configure: XML Catalog: /etc/xml/catalog
configure: Init script: check
configure: Char device locks: /var/lock
configure:
configure: Developer Tools
configure:
configure: Wireshark dissector: no
configure:
configure: Privileges
configure:
configure: QEMU: root:root
The compilation finishes without any problems but in the execution of the
tests fails virnetmessagetest.
When i tried using the libvirtd running without any problems but I can not
run the Connection with the virsh command virsh -c qemu:///system that
returns the following error:
"Unable to encode message header"
and the log shows the error:
"virNetSocketReadWire: 1523: End of file while reading dates: Error of
input / output".
There 's someone who can give me a hand to solve the problem?
thanks
Stefano
10 years, 3 months
[libvirt] [RFC PATCH] qcow2: Fix race in cache invalidation
by Alexey Kardashevskiy
On 09/19/2014 06:47 PM, Kevin Wolf wrote:> Am 16.09.2014 um 14:59 hat Paolo Bonzini geschrieben:
>> Il 16/09/2014 14:52, Kevin Wolf ha scritto:
>>> Yes, that's true. We can't fix this problem in qcow2, though, because
>>> it's a more general one. I think we must make sure that
>>> bdrv_invalidate_cache() doesn't yield.
>>>
>>> Either by forbidding to run bdrv_invalidate_cache() in a coroutine and
>>> moving the problem to the caller (where and why is it even called from a
>>> coroutine?), or possibly by creating a new coroutine for the driver
>>> callback and running that in a nested event loop that only handles
>>> bdrv_invalidate_cache() callbacks, so that the NBD server doesn't get a
>>> chance to process new requests in this thread.
>>
>> Incoming migration runs in a coroutine (the coroutine entry point is
>> process_incoming_migration_co). But everything after qemu_fclose() can
>> probably be moved into a separate bottom half, so that it gets out of
>> coroutine context.
>
> Alexey, you should probably rather try this (and add a bdrv_drain_all()
> in bdrv_invalidate_cache) than messing around with qcow2 locks. This
> isn't a problem that can be completely fixed in qcow2.
Ok. Tried :) Not very successful though. The patch is below.
Is that the correct bottom half? When I did it, I started getting crashes
in various sport on accesses to s->l1_cache which is NULL after qcow2_close.
Normally the code would check s->l1_size and then use but they are out of sync.
So I clear it in qcow2_close(). This allowed migrated guest to work and not
to crash until I shut it down when it aborted at "HERE IT FAILS ON SHUTDOWN".
Here I realized I am missing something in this picture again, what is it?
Thanks!
---
block.c | 2 ++
block/qcow2-cache.c | 2 +-
block/qcow2.c | 50 ++++++++++++++++++++++++++++++++++++--------------
block/qcow2.h | 4 ++++
4 files changed, 43 insertions(+), 15 deletions(-)
diff --git a/block.c b/block.c
index d06dd51..1e6dfd1 100644
--- a/block.c
+++ b/block.c
@@ -5044,6 +5044,8 @@ void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp)
error_setg_errno(errp, -ret, "Could not refresh total sector count");
return;
}
+
+ bdrv_drain_all();
}
void bdrv_invalidate_cache_all(Error **errp)
diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c
index 904f6b1..59ff48c 100644
--- a/block/qcow2-cache.c
+++ b/block/qcow2-cache.c
@@ -259,7 +259,7 @@ static int qcow2_cache_find_entry_to_replace(Qcow2Cache *c)
if (min_index == -1) {
/* This can't happen in current synchronous code, but leave the check
* here as a reminder for whoever starts using AIO with the cache */
- abort();
+ abort(); // <==== HERE IT FAILS ON SHUTDOWN
}
return min_index;
}
diff --git a/block/qcow2.c b/block/qcow2.c
index f9e045f..2b84562 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1399,6 +1399,7 @@ static void qcow2_close(BlockDriverState *bs)
qemu_vfree(s->l1_table);
/* else pre-write overlap checks in cache_destroy may crash */
s->l1_table = NULL;
+ s->l1_size = 0;
if (!(bs->open_flags & BDRV_O_INCOMING)) {
qcow2_cache_flush(bs, s->l2_table_cache);
@@ -1419,16 +1420,11 @@ static void qcow2_close(BlockDriverState *bs)
qcow2_free_snapshots(bs);
}
+static void qcow2_invalidate_cache_bh_cb(void *opaque);
+
static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp)
{
BDRVQcowState *s = bs->opaque;
- int flags = s->flags;
- AES_KEY aes_encrypt_key;
- AES_KEY aes_decrypt_key;
- uint32_t crypt_method = 0;
- QDict *options;
- Error *local_err = NULL;
- int ret;
/*
* Backing files are read-only which makes all of their metadata immutable,
@@ -1436,13 +1432,28 @@ static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp)
*/
if (s->crypt_method) {
- crypt_method = s->crypt_method;
- memcpy(&aes_encrypt_key, &s->aes_encrypt_key, sizeof(aes_encrypt_key));
- memcpy(&aes_decrypt_key, &s->aes_decrypt_key, sizeof(aes_decrypt_key));
+ s->bh_crypt_method = s->crypt_method;
+ memcpy(&s->bh_aes_encrypt_key, &s->aes_encrypt_key, sizeof(s->bh_aes_encrypt_key));
+ memcpy(&s->bh_aes_decrypt_key, &s->aes_decrypt_key, sizeof(s->bh_aes_decrypt_key));
+ } else {
+ s->bh_crypt_method = 0;
}
qcow2_close(bs);
+ s->cache_inv_bh = aio_bh_new(bdrv_get_aio_context(bs),
+ qcow2_invalidate_cache_bh_cb,
+ bs);
+}
+
+static void qcow2_invalidate_cache_bh(BlockDriverState *bs, Error **errp)
+{
+ BDRVQcowState *s = bs->opaque;
+ int flags = s->flags;
+ QDict *options;
+ Error *local_err = NULL;
+ int ret;
+
bdrv_invalidate_cache(bs->file, &local_err);
if (local_err) {
error_propagate(errp, local_err);
@@ -1464,11 +1475,22 @@ static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp)
return;
}
- if (crypt_method) {
- s->crypt_method = crypt_method;
- memcpy(&s->aes_encrypt_key, &aes_encrypt_key, sizeof(aes_encrypt_key));
- memcpy(&s->aes_decrypt_key, &aes_decrypt_key, sizeof(aes_decrypt_key));
+ if (s->bh_crypt_method) {
+ s->crypt_method = s->bh_crypt_method;
+ memcpy(&s->aes_encrypt_key, &s->bh_aes_encrypt_key, sizeof(s->bh_aes_encrypt_key));
+ memcpy(&s->aes_decrypt_key, &s->bh_aes_decrypt_key, sizeof(s->bh_aes_decrypt_key));
}
+
+ qemu_bh_delete(s->cache_inv_bh);
+ s->cache_inv_bh = NULL;
+}
+
+static void qcow2_invalidate_cache_bh_cb(void *opaque)
+{
+ BlockDriverState *bs = opaque;
+ Error *local_err = NULL;
+
+ qcow2_invalidate_cache_bh(bs, &local_err);
}
static size_t header_ext_add(char *buf, uint32_t magic, const void *s,
diff --git a/block/qcow2.h b/block/qcow2.h
index 6aeb7ea..58d1859 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -271,6 +271,10 @@ typedef struct BDRVQcowState {
QLIST_HEAD(, Qcow2UnknownHeaderExtension) unknown_header_ext;
QTAILQ_HEAD (, Qcow2DiscardRegion) discards;
bool cache_discards;
+ QEMUBH *cache_inv_bh;
+ AES_KEY bh_aes_encrypt_key;
+ AES_KEY bh_aes_decrypt_key;
+ uint32_t bh_crypt_method;
} BDRVQcowState;
/* XXX: use std qcow open function ? */
--
2.0.0
10 years, 3 months
[libvirt] [PATCH] qemu: remove capabilities.monitor.sock when done
by Guido Günther
Prompted by
http://bugs.debian.org/761131
---
src/qemu/qemu_capabilities.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 49f5f75..dca00b2 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3306,6 +3306,7 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
virCommandAbort(cmd);
virCommandFree(cmd);
VIR_FREE(monarg);
+ ignore_value(unlink(monpath));
VIR_FREE(monpath);
virObjectUnref(vm);
virObjectUnref(xmlopt);
--
2.1.0
10 years, 3 months
[libvirt] [PATCH v2 0/3] Add support for shared memory devices
by Martin Kletzander
This is based on Maxime's patches, but leaving out the last one with
server starting, the last version was here:
https://www.redhat.com/archives/libvir-list/2014-August/msg01032.html
There were some points raised, some discussion went on. Basically
whatever we agreed is composed in, but feel free to raise questions
and further discussions. However it would be really great if this
could get into 1.2.9 release.
Martin Kletzander (2):
docs, conf, schema: add support for shmem device
qemu: Build command line for ivshmem device
Maxime Leroy (1):
qemu: add capability probing for ivshmem device
docs/formatdomain.html.in | 52 +++++
docs/schemas/domaincommon.rng | 39 ++++
src/conf/domain_conf.c | 210 ++++++++++++++++++++-
src/conf/domain_conf.h | 24 +++
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 118 +++++++++++-
src/qemu/qemu_command.h | 1 +
src/qemu/qemu_hotplug.c | 1 +
tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 +
tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 1 +
tests/qemuhelptest.c | 15 +-
.../qemuxml2argv-shmem-invalid-size.xml | 24 +++
.../qemuxml2argv-shmem-invalid.xml | 24 +++
.../qemuxml2argv-shmem-msi-only.xml | 24 +++
.../qemuxml2argv-shmem-small-size.xml | 24 +++
tests/qemuxml2argvdata/qemuxml2argv-shmem.args | 16 ++
tests/qemuxml2argvdata/qemuxml2argv-shmem.xml | 51 +++++
tests/qemuxml2argvtest.c | 8 +
tests/qemuxml2xmltest.c | 1 +
25 files changed, 635 insertions(+), 7 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-shmem-invalid-size.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-shmem-invalid.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-shmem-msi-only.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-shmem-small-size.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-shmem.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-shmem.xml
--
2.1.1
10 years, 3 months
[libvirt] [PATCH V2] conf: report error in virCPUDefParseXML
by Jincheng Miao
When detected invalid 'memAccess', virCPUDefParseXML should report error.
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1146334
Signed-off-by: Jincheng Miao <jmiao(a)redhat.com>
---
src/conf/cpu_conf.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 116aa58..9b7fbb0 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -507,17 +507,19 @@ virCPUDefParseXML(xmlNodePtr node,
memAccessStr = virXMLPropString(nodes[i], "memAccess");
if (memAccessStr) {
- def->cells[cur_cell].memAccess =
- virMemAccessTypeFromString(memAccessStr);
+ int rc = virMemAccessTypeFromString(memAccessStr);
- if (def->cells[cur_cell].memAccess <= 0) {
+ if (rc <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Invalid 'memAccess' attribute "
"value '%s'"),
memAccessStr);
VIR_FREE(memAccessStr);
- goto cleanup;
+ goto error;
}
+
+ def->cells[cur_cell].memAccess = rc;
+
VIR_FREE(memAccessStr);
}
}
--
1.9.3
10 years, 3 months
[libvirt] [PATCHv2] qemu: numatune/domiftune no support in session mode
by Erik Skultety
Tuning NUMA or network interface parameters require root
privileges to manage cgroups, thus an attempt to set some of these
parameters in session mode on a running domain should be invalid
followed by an error.
As an example might be memory tuning which raises an error in such case.
Following behavior in session mode will be present after applying
this patch:
tuning | SET | GET |
------------|---------------|--------|
numatune | shut off only | always |
memtune | never | never |
domiftune | never | always |
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1126762
---
src/qemu/qemu_command.c | 14 +++++++++++++-
src/qemu/qemu_driver.c | 35 +++++++++++++++++++++++++----------
2 files changed, 38 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1ca98fb..5d4838e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7442,7 +7442,7 @@ qemuBuildCommandLine(virConnectPtr conn,
emulator = def->emulator;
if (!cfg->privileged) {
- /* If we have no cgroups than we can have no tunings that
+ /* If we have no cgroups then we can have no tunings that
* require them */
if (def->mem.hard_limit || def->mem.soft_limit ||
@@ -7465,6 +7465,18 @@ qemuBuildCommandLine(virConnectPtr conn,
_("CPU tuning is not available in session mode"));
goto error;
}
+
+ virDomainNetDefPtr *nets = def->nets;
+ size_t nnets = def->nnets;
+ for (i = 0; i < nnets; i++) {
+ if (nets[i]->bandwidth) {
+ if (nets[i]->bandwidth->in || nets[i]->bandwidth->out) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Network bandwidth tuning is not available in session mode"));
+ goto error;
+ }
+ }
+ }
}
for (i = 0; i < def->ngraphics; ++i) {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3c04678..ad02e68 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8786,6 +8786,13 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
&persistentDef) < 0)
goto cleanup;
+ if (!cfg->privileged &&
+ flags & VIR_DOMAIN_AFFECT_LIVE) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("NUMA tuning is not available in session mode"));
+ goto cleanup;
+ }
+
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
@@ -8870,6 +8877,7 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
size_t i;
virDomainObjPtr vm = NULL;
virDomainDefPtr persistentDef = NULL;
+ virQEMUDriverConfigPtr cfg = NULL;
char *nodeset = NULL;
int ret = -1;
virCapsPtr caps = NULL;
@@ -8888,6 +8896,7 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
return -1;
priv = vm->privateData;
+ cfg = virQEMUDriverGetConfig(driver);
if (virDomainGetNumaParametersEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
@@ -8905,14 +8914,6 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
goto cleanup;
}
- if (flags & VIR_DOMAIN_AFFECT_LIVE) {
- if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_MEMORY)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("cgroup memory controller is not mounted"));
- goto cleanup;
- }
- }
-
for (i = 0; i < QEMU_NB_NUMA_PARAM && i < *nparams; i++) {
virMemoryParameterPtr param = ¶ms[i];
@@ -8935,9 +8936,16 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
if (!nodeset)
goto cleanup;
} else {
- if (virCgroupGetCpusetMems(priv->cgroup, &nodeset) < 0)
- goto cleanup;
+ if (!virCgroupHasController(priv->cgroup,
+ VIR_CGROUP_CONTROLLER_MEMORY) ||
+ virCgroupGetCpusetMems(priv->cgroup, &nodeset) < 0) {
+ nodeset = virDomainNumatuneFormatNodeset(vm->def->numatune,
+ NULL, -1);
+ if (!nodeset)
+ goto cleanup;
+ }
}
+
if (virTypedParameterAssign(param, VIR_DOMAIN_NUMA_NODESET,
VIR_TYPED_PARAM_STRING, nodeset) < 0)
goto cleanup;
@@ -8962,6 +8970,7 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
if (vm)
virObjectUnlock(vm);
virObjectUnref(caps);
+ virObjectUnref(cfg);
return ret;
}
@@ -9889,6 +9898,12 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
if (virDomainSetInterfaceParametersEnsureACL(dom->conn, vm->def, flags) < 0)
goto cleanup;
+ if (!cfg->privileged) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("Network bandwidth tuning is not available in session mode"));
+ goto cleanup;
+ }
+
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup;
--
1.9.3
10 years, 3 months
[libvirt] [PATCH] Check for NULL in qemu monitor event filter
by Ján Tomko
When virConnectDomainQemuMonitorEventRegister is called with the
VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX flag,
ignore the flag instead of crashing.
https://bugzilla.redhat.com/show_bug.cgi?id=1144920
---
src/conf/domain_event.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 73ae289..c8f6830 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -1705,7 +1705,7 @@ virDomainQemuMonitorEventStateRegisterID(virConnectPtr conn,
if (VIR_ALLOC(data) < 0)
return -1;
data->flags = flags;
- if (flags != -1) {
+ if (event && flags != -1) {
int rflags = REG_NOSUB;
if (flags & VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_NOCASE)
--
1.8.5.5
10 years, 3 months