[libvirt] [PATCHv3] qemu: NUMA/network tuning shouldn't be supported 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 |
----------|---------------|--------|
NUMA | shut off only | always |
Memory | never | never |
Interface | never | always |
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1126762
---
src/qemu/qemu_command.c | 13 ++++++++++++-
src/qemu/qemu_driver.c | 35 +++++++++++++++++++++++++----------
2 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index eb72451..4c335dc 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7671,7 +7671,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 ||
@@ -7694,6 +7694,17 @@ qemuBuildCommandLine(virConnectPtr conn,
_("CPU tuning is not available in session mode"));
goto error;
}
+
+ virDomainNetDefPtr *nets = def->nets;
+ virNetDevBandwidthPtr bandwidth = NULL;
+ size_t nnets = def->nnets;
+ for (i = 0; i < nnets; i++) {
+ if ((bandwidth = virDomainNetGetActualBandwidth(nets[i])) != NULL) {
+ 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 6606154..c64d272 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8974,6 +8974,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",
@@ -9058,6 +9065,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;
@@ -9076,6 +9084,7 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
return -1;
priv = vm->privateData;
+ cfg = virQEMUDriverGetConfig(driver);
if (virDomainGetNumaParametersEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
@@ -9093,14 +9102,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];
@@ -9123,9 +9124,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;
@@ -9150,6 +9158,7 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
if (vm)
virObjectUnlock(vm);
virObjectUnref(caps);
+ virObjectUnref(cfg);
return ret;
}
@@ -10120,6 +10129,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, 1 month
[libvirt] [PATCH 00/12] Split up the libvirt.h.in file
by Daniel P. Berrange
Similar to the previous series, this splits up the
libvirt.h.in header file to many pieces. This is
backwards compatible as applications will continue
to use the main <libvirt/libvirt.h> header and are
forbidden from including the individual pieces (to
allow us to change them again if we want to in the
future).
Daniel P. Berrange (12):
Move virDomainSnapshot related APIs out of libvirt.h.in
Move virNetwork related APIs out of libvirt.h.in
Move virInterface related APIs out of libvirt.h.in
Move virNWFilter related APIs out of libvirt.h.in
Move virNodeDevice related APIs out of libvirt.h.in
Move virSecret related APIs out of libvirt.h.in
Move virStream related APIs out of libvirt.h.in
Move virStoragePool/Vol related APIs out of libvirt.h.in
Move virEvent related APIs out of libvirt.h.in
Move virDomain related APIs out of libvirt.h.in
Move virConnect related APIs out of libvirt.h.in
Fix preprocessor indentation in libvirt.h.in
cfg.mk | 4 +-
docs/apibuild.py | 11 +
include/libvirt/Makefile.am | 11 +
include/libvirt/libvirt-domain-snapshot.h | 212 ++
include/libvirt/libvirt-domain.h | 3496 +++++++++++++++++
include/libvirt/libvirt-event.h | 190 +
include/libvirt/libvirt-host.h | 892 +++++
include/libvirt/libvirt-interface.h | 110 +
include/libvirt/libvirt-network.h | 337 ++
include/libvirt/libvirt-nodedev.h | 125 +
include/libvirt/libvirt-nwfilter.h | 95 +
include/libvirt/libvirt-secret.h | 113 +
include/libvirt/libvirt-storage.h | 359 ++
include/libvirt/libvirt-stream.h | 152 +
include/libvirt/libvirt.h.in | 5837 +----------------------------
15 files changed, 6160 insertions(+), 5784 deletions(-)
create mode 100644 include/libvirt/libvirt-domain-snapshot.h
create mode 100644 include/libvirt/libvirt-domain.h
create mode 100644 include/libvirt/libvirt-event.h
create mode 100644 include/libvirt/libvirt-host.h
create mode 100644 include/libvirt/libvirt-interface.h
create mode 100644 include/libvirt/libvirt-network.h
create mode 100644 include/libvirt/libvirt-nodedev.h
create mode 100644 include/libvirt/libvirt-nwfilter.h
create mode 100644 include/libvirt/libvirt-secret.h
create mode 100644 include/libvirt/libvirt-storage.h
create mode 100644 include/libvirt/libvirt-stream.h
--
2.1.0
10 years, 1 month
[libvirt] [RFC] Add support for NIC offload discovery
by Chapman, James P
Currently libvirt provides lots of useful information on the HW capabilities of the host and its attached devices. I'm interested in extending the HW capability discovery of libvirt, to a point where it is capable of discovering the HW offload capabilities of host PCI devices. Take a NIC for example, this feature would enable libvirt discover the supported NIC offload features, csum, tso, etc.
So where might a feature like this be used. Consider an Openstack deployment, a VM may have a workload that depends on specific NIC HW offload capabilities in order to stay within certain throughput, CPU utilisation or latency thresholds. For this scenario, it's important that the VM is placed on a host with PCI devices that provide the required NIC HW offload capabilities. If libvirt could provide this functionality, this information could be used during the VM scheduling phase when all nodes are evaluated for their suitability.
>From what I understand, libvirt currently uses ioctl's to get the NIC state, MTU, etc. Could the ethtool ioctl framework be used to discover the HW offload features provided by the hosts network controllers.
E.g.
* ETHTOOL_GRXCSUM
* ETHTOOL_GTXCSUM
* ETHTOOL_GTSO
* ETHTOOL_GFLAGS
So I'm looking for your opinions on this feature proposal, does it make sense, is it already being worked on.
Thanks
James
10 years, 1 month
[libvirt] [PATCH] Show also short-ids when calling --list-{os, platform}
by Fabiano Fidêncio
As the short-id can be used to set the os/platform in the example
program, let's expose them to the user.
---
examples/virt-designer.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/examples/virt-designer.c b/examples/virt-designer.c
index 7628449..12faf04 100644
--- a/examples/virt-designer.c
+++ b/examples/virt-designer.c
@@ -107,8 +107,8 @@ print_oses(const gchar *option_name,
if (!db && !load_osinfo())
goto cleanup;
- printf(" Operating System ID\n"
- "-----------------------\n");
+ printf(" Operating System ID (short ID)\n"
+ "--------------------------------\n");
list = osinfo_db_get_os_list(db);
if (!list)
@@ -119,6 +119,8 @@ print_oses(const gchar *option_name,
OsinfoOs *os = OSINFO_OS(os_iter->data);
const char *id = osinfo_entity_get_param_value(OSINFO_ENTITY(os),
OSINFO_ENTITY_PROP_ID);
+ const char *short_id = osinfo_entity_get_param_value(OSINFO_ENTITY(os),
+ OSINFO_PRODUCT_PROP_SHORT_ID);
printf("%s\n", id);
}
@@ -148,8 +150,8 @@ print_platforms(const gchar *option_name,
if (!db && !load_osinfo())
goto cleanup;
- printf(" Platform ID\n"
- "---------------\n");
+ printf(" Platform ID (short ID)\n"
+ "------------------------\n");
list = osinfo_db_get_platform_list(db);
if (!list)
@@ -160,6 +162,8 @@ print_platforms(const gchar *option_name,
OsinfoPlatform *platform = OSINFO_PLATFORM(platform_iter->data);
const char *id = osinfo_entity_get_param_value(OSINFO_ENTITY(platform),
OSINFO_ENTITY_PROP_ID);
+ const char *short_id = osinfo_entity_get_param_value(OSINFO_ENTITY(platform),
+ OSINFO_PRODUCT_PROP_SHORT_ID);
printf("%s\n", id);
}
@@ -577,9 +581,9 @@ main(int argc, char *argv[])
{"connect", 'c', 0, G_OPTION_ARG_STRING, &connect_uri,
"libvirt connection URI used for querying capabilities", "URI"},
{"list-os", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, print_oses,
- "list IDs of known OSes", NULL},
+ "list IDs and short IDs of known OSes", NULL},
{"list-platform", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, print_platforms,
- "list IDs of known hypervisors", NULL},
+ "list IDs and short IDs of known hypervisors", NULL},
{"os", 'o', 0, G_OPTION_ARG_STRING, &os_str,
"set domain OS", "OS"},
{"platform", 'p', 0, G_OPTION_ARG_STRING, &platform_str,
--
2.1.0
10 years, 1 month
[libvirt] [PATCH 00/12] Split up large driver files
by Daniel P. Berrange
This patch series splits up the src/driver.h and src/libvirt.c
files into a number of smaller pieces.
The driver.h file gets split based on the the driver type,
while libvirt.c gets split slightly different based on the
object type. The reason for the difference is that the
hypervisor driver is rather large, so its useful to split
the domain, domain snapshot and connect/node APIs into
separate files.
There will be much more to follow this series. Just posting
this start now since it will be painful to rebase....
Daniel P. Berrange (12):
Rename virDriver to virHypervisorDriver
Split driver.h into multiple parts
Move virDomainSnapshot related APIs out of libvirt.c
Move virNetwork related APIs out of libvirt.c
Move virInterface related APIs out of libvirt.c
Move virNWFilter related APIs out of libvirt.c
Move virNodeDevice related APIs out of libvirt.c
Move virSecret related APIs out of libvirt.c
Move virStream related APIs out of libvirt.c
Move virStorage{Pool,Vol} related APIs out of libvirt.c
Move virDomain related APIs out of libvirt.c
Move virConnect/virNode related APIs out of libvirt.c
cfg.mk | 4 +-
docs/apibuild.py | 11 +
docs/hvsupport.pl | 2 +-
po/POTFILES.in | 8 +
src/Makefile.am | 20 +
src/bhyve/bhyve_driver.c | 4 +-
src/datatypes.h | 3 +-
src/driver-hypervisor.h | 1396 +++
src/driver-interface.h | 131 +
src/driver-network.h | 166 +
src/driver-nodedev.h | 112 +
src/driver-nwfilter.h | 94 +
src/driver-secret.h | 114 +
src/driver-state.h | 58 +
src/driver-storage.h | 265 +
src/driver-stream.h | 72 +
src/driver.h | 2172 +---
src/esx/esx_driver.c | 4 +-
src/hyperv/hyperv_driver.c | 4 +-
src/libvirt-domain-snapshot.c | 1222 +++
src/libvirt-domain.c | 11112 ++++++++++++++++++++
src/libvirt-host.c | 1515 +++
src/libvirt-interface.c | 835 ++
src/libvirt-network.c | 1251 +++
src/libvirt-nodedev.c | 756 ++
src/libvirt-nwfilter.c | 515 +
src/libvirt-secret.c | 695 ++
src/libvirt-storage.c | 2118 ++++
src/libvirt-stream.c | 704 ++
src/libvirt.c | 20537 +------------------------------------
src/libvirt_internal.h | 6 +
src/libvirt_private.syms | 2 +-
src/libxl/libxl_driver.c | 4 +-
src/lxc/lxc_driver.c | 4 +-
src/openvz/openvz_driver.c | 4 +-
src/parallels/parallels_driver.c | 4 +-
src/phyp/phyp_driver.c | 4 +-
src/qemu/qemu_driver.c | 4 +-
src/remote/remote_driver.c | 7 +-
src/test/test_driver.c | 4 +-
src/uml/uml_driver.c | 4 +-
src/vbox/vbox_common.c | 4 +-
src/vbox/vbox_driver.c | 14 +-
src/vbox/vbox_get_driver.h | 2 +-
src/vbox/vbox_tmpl.c | 4 +-
src/vbox/vbox_uniformed_api.h | 2 +-
src/vmware/vmware_driver.c | 4 +-
src/xen/xen_driver.c | 4 +-
src/xenapi/xenapi_driver.c | 4 +-
49 files changed, 23289 insertions(+), 22696 deletions(-)
create mode 100644 src/driver-hypervisor.h
create mode 100644 src/driver-interface.h
create mode 100644 src/driver-network.h
create mode 100644 src/driver-nodedev.h
create mode 100644 src/driver-nwfilter.h
create mode 100644 src/driver-secret.h
create mode 100644 src/driver-state.h
create mode 100644 src/driver-storage.h
create mode 100644 src/driver-stream.h
create mode 100644 src/libvirt-domain-snapshot.c
create mode 100644 src/libvirt-domain.c
create mode 100644 src/libvirt-host.c
create mode 100644 src/libvirt-interface.c
create mode 100644 src/libvirt-network.c
create mode 100644 src/libvirt-nodedev.c
create mode 100644 src/libvirt-nwfilter.c
create mode 100644 src/libvirt-secret.c
create mode 100644 src/libvirt-storage.c
create mode 100644 src/libvirt-stream.c
--
2.1.0
10 years, 1 month
[libvirt] [PATCH] Fix indentation of sysinfo data
by Daniel P. Berrange
The <sysinfo> data block was indented by 2 spaces too many.
This was missed because we never had any test validating
the XML formatting.
---
src/conf/domain_conf.c | 13 +------------
tests/qemuxml2argvdata/qemuxml2argv-smbios-date.xml | 16 ++++++++++------
tests/qemuxml2xmltest.c | 1 +
3 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 73c199e..39befb0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17668,17 +17668,6 @@ virDomainNVRAMDefFormat(virBufferPtr buf,
return 0;
}
-static int
-virDomainSysinfoDefFormat(virBufferPtr buf,
- virSysinfoDefPtr def)
-{
- int ret;
- virBufferAdjustIndent(buf, 2);
- ret = virSysinfoFormat(buf, def);
- virBufferAdjustIndent(buf, -2);
- return ret;
-}
-
static int
virDomainWatchdogDefFormat(virBufferPtr buf,
@@ -18890,7 +18879,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
virDomainResourceDefFormat(buf, def->resource);
if (def->sysinfo)
- virDomainSysinfoDefFormat(buf, def->sysinfo);
+ virSysinfoFormat(buf, def->sysinfo);
if (def->os.bootloader) {
virBufferEscapeString(buf, "<bootloader>%s</bootloader>\n",
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smbios-date.xml b/tests/qemuxml2argvdata/qemuxml2argv-smbios-date.xml
index 7b2f33a..88f953f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-smbios-date.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smbios-date.xml
@@ -4,20 +4,24 @@
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>1</vcpu>
- <os>
- <type arch='i686' machine='pc'>hvm</type>
- <smbios mode="sysinfo"/>
- </os>
- <sysinfo type="smbios">
+ <sysinfo type='smbios'>
<bios>
- <entry name="date">999/999/123</entry>
+ <entry name='date'>11/21/1923</entry>
</bios>
</sysinfo>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ <smbios mode='sysinfo'/>
+ </os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu</emulator>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
</devices>
</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 978e5f1..4c2b928 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -405,6 +405,7 @@ mymain(void)
DO_TEST("tap-vhost");
DO_TEST("shmem");
+ DO_TEST("smbios-date");
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);
--
2.1.0
10 years, 1 month
[libvirt] [PATCH] qemu: command: Allow UEFI for non-x86
by Cole Robinson
It's supported on aarch64 and armv7l as well, so just drop the restriction
entirely since it doesn't add much.
---
src/qemu/qemu_command.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 8cb0865..2872e47 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7672,14 +7672,6 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
break;
case VIR_DOMAIN_LOADER_TYPE_PFLASH:
- /* UEFI is supported only for x86_64 currently */
- if (def->os.arch != VIR_ARCH_X86_64) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("pflash is not supported for %s guest architecture"),
- virArchToString(def->os.arch));
- goto cleanup;
- }
-
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("this QEMU binary doesn't support -drive"));
--
2.1.0
10 years, 1 month
[libvirt] [PATCH 0/3] Fix handling of data returned by XML hooks
by Peter Krempa
Peter Krempa (3):
util: string: Add helper to check whether string is empty
qemu: restore: Fix restoring of VM when the restore hook returns empty
XML
qemu: migration: Make check for empty hook XML robust
src/libvirt_private.syms | 1 +
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_migration.c | 2 +-
src/util/virstring.c | 16 ++++++++++++++++
src/util/virstring.h | 2 ++
5 files changed, 21 insertions(+), 2 deletions(-)
--
2.1.0
10 years, 1 month
[libvirt] [PATCH] docs: fix an improper git browsable address
by Chen Hanxiao
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
docs/hacking.html.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index 4ab0179..b1553a5 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -14,7 +14,7 @@
<li>Official upstream repository is kept in git
(<code>git://libvirt.org/libvirt.git</code>) and is browsable
along with other libvirt-related repositories
- (e.g. libvirt-python) <a href="http://libvirt.org">online</a>.</li>
+ (e.g. libvirt-python) <a href="http://libvirt.org/git/">online</a>.</li>
<li><p>Post patches in unified diff format, with git rename
detection enabled. You need a one-time setup of:</p>
--
1.9.3
10 years, 1 month