question on vhost, limiting kernel threads and NPROC
by Mike Christie
Hi,
The goal of this email is to try and figure how we want to track/limit the
number of kernel threads created by vhost devices.
Background:
-----------
For vhost-scsi, we've hit a issue where the single vhost worker thread can't
handle all IO the being sent from multiple queues. IOPs is stuck at around
500K. To fix this, we did this patchset:
https://lore.kernel.org/linux-scsi/20210525180600.6349-1-michael.christie...
which allows userspace to create N threads and map them to a dev's virtqueues.
With this we can get around 1.4M IOPs.
Problem:
--------
While those patches were being reviewed, a concern about tracking all these
new possible threads was raised here:
https://lore.kernel.org/linux-scsi/YL45CfpHyzSEcAJv@stefanha-x1.localdomain/
To save you some time, the question is what does other kernel code using the
kthread API do to track the number of kernel threads created on behalf of
a userspace thread. The answer is they don't do anything so we will have to
add that code.
I started to do that here:
https://lkml.org/lkml/2021/6/23/1233
where those patches would charge/check the vhost device owner's RLIMIT_NPROC
value. But, the question of if we really want to do this has come up which is
why I'm bugging lists like libvirt now.
Question/Solution:
------------------
I'm bugging everyone so we can figure out:
If we need to specifically track the number of kernel threads being made
for the vhost kernel use case by the RLIMIT_NPROC limit?
Or, is it ok to limit the number of devices with the RLIMIT_NOFILE limit.
Then each device has a limit on the number of threads it can create.
3 years
[PATCH v4 for v7.6.0 00/14] Introduce virtio-mem <memory/> model
by Michal Privoznik
v4 of:
https://listman.redhat.com/archives/libvir-list/2021-April/msg01138.html
diff to v3:
- Rebased code on the top of master
- Tried to work in all Peter's review suggestions
- Fixed a bug where adjusting <requested/> was viewed as hotplug of new
<memory/> by XML validator and thus if <maxMemory/> was close enough to
<currentMemory/> the validator reported an error (this was reported by
David).
You can also find these patches on my branch:
https://gitlab.com/MichalPrivoznik/libvirt/-/tree/virtio_mem_v4
Michal Prívozník (14):
virhostmem: Introduce virHostMemGetTHPSize()
qemu_capabilities: Introduce QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI
conf: Introduce virtio-mem <memory/> model
qemu: Build command line for virtio-mem
qemu: Wire up <memory/> live update
Introduce <actual/> property to virtio-mem
conf: Introduce virDomainMemoryFindByDeviceAlias()
qemu: Wire up MEMORY_DEVICE_SIZE_CHANGE event
qemu: Refresh the actual size of virtio-mem on monitor reconnect
qemu: Account for both memballoon and virtio-mem
qemuDomainSetMemoryFlags: Take virtio-mem into consideration
virsh: Introduce update-memory-device command
news: document recent virtio memory addition
kbase: Document virtio-mem
NEWS.rst | 12 +
docs/formatdomain.rst | 45 +++-
docs/kbase/index.rst | 4 +
docs/kbase/memorydevices.rst | 150 +++++++++++
docs/kbase/meson.build | 1 +
docs/manpages/virsh.rst | 30 +++
docs/schemas/domaincommon.rng | 16 ++
examples/c/misc/event-test.c | 17 ++
include/libvirt/libvirt-domain.h | 23 ++
src/conf/domain_conf.c | 118 ++++++++-
src/conf/domain_conf.h | 15 ++
src/conf/domain_event.c | 84 ++++++
src/conf/domain_event.h | 10 +
src/conf/domain_validate.c | 39 +++
src/libvirt_private.syms | 5 +
src/qemu/qemu_alias.c | 10 +-
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 13 +-
src/qemu/qemu_domain.c | 33 ++-
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_domain_address.c | 38 ++-
src/qemu/qemu_driver.c | 240 +++++++++++++++++-
src/qemu/qemu_hotplug.c | 18 ++
src/qemu/qemu_hotplug.h | 5 +
src/qemu/qemu_monitor.c | 37 +++
src/qemu/qemu_monitor.h | 28 ++
src/qemu/qemu_monitor_json.c | 97 +++++--
src/qemu/qemu_monitor_json.h | 5 +
src/qemu/qemu_process.c | 72 ++++++
src/qemu/qemu_validate.c | 8 +
src/remote/remote_daemon_dispatch.c | 30 +++
src/remote/remote_driver.c | 32 +++
src/remote/remote_protocol.x | 14 +-
src/remote_protocol-structs | 7 +
src/security/security_apparmor.c | 1 +
src/security/security_dac.c | 2 +
src/security/security_selinux.c | 2 +
src/util/virhostmem.c | 54 ++++
src/util/virhostmem.h | 3 +
tests/domaincapsmock.c | 9 +
.../caps_5.1.0.x86_64.xml | 1 +
.../caps_5.2.0.x86_64.xml | 1 +
.../caps_6.0.0.x86_64.xml | 1 +
.../caps_6.1.0.x86_64.xml | 1 +
...mory-hotplug-virtio-mem.x86_64-latest.args | 41 +++
.../memory-hotplug-virtio-mem.xml | 67 +++++
tests/qemuxml2argvtest.c | 1 +
...emory-hotplug-virtio-mem.x86_64-latest.xml | 1 +
tests/qemuxml2xmltest.c | 1 +
tools/virsh-domain.c | 169 ++++++++++++
51 files changed, 1562 insertions(+), 53 deletions(-)
create mode 100644 docs/kbase/memorydevices.rst
create mode 100644 tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml
create mode 120000 tests/qemuxml2xmloutdata/memory-hotplug-virtio-mem.x86_64-latest.xml
--
2.31.1
3 years
[PATCH v2 0/4] Add support for two i386 pm options which control acpi hotplug
by Ani Sinha
Hi:
I added some negative xml2argv tests as well as new xml2xml tests. In the process,
I also fixed a bug where I had not added appropriate code to generate the output
xml correctly.
The patch series is sent again as v2. Kindly, please provide inputs and review them.
[PATCH v2 1/4] pm/i386: add support for two options that controls
[PATCH v2 2/4] tests: add positive xml2argv tests to exercize pm acpi
[PATCH v2 3/4] tests: add negative xml2argv tests to exercize pm acpi
[PATCH v2 4/4] tests: add xml2xml tests to exercize pm acpi hotplug
3 years
[PATCH 0/9] Fix image labels lost after migration with shared fs
by Peng Liang
When migrating using shared fs, the dst host will remember the image
labels again before launching the VM and the src host will remove the
image labels after migration. It leads to that the image labels lost
after migration.
Patch 7-9 are the real fix patches.
Peng Liang (9):
security: add virSecurityUpdateTimestampIfexists
security: add virSecurityManagerUpdateImageLabel
security: implement domainUpdateSecurityImageLabel for stack
security: implement domainUpdateSecurityImageLabel for DAC
qemu: add qemuSecurityUpdateImageLabel
security: rename virSecurityDACSetImageLabelInternal to
virSecurityDACSetImageLabelSingle
migration: don't remember image labels when migrating with shared fs
migration: don't remove image labels after migration
migration: update image labels in dst after migration
src/libvirt_private.syms | 1 +
src/qemu/qemu_migration.c | 12 +++++++
src/qemu/qemu_process.c | 5 ++-
src/qemu/qemu_security.c | 10 ++++++
src/qemu/qemu_security.h | 5 +++
src/security/security_dac.c | 58 +++++++++++++++++++++++++--------
src/security/security_driver.h | 5 +++
src/security/security_manager.c | 29 +++++++++++++++++
src/security/security_manager.h | 5 +++
src/security/security_stack.c | 20 ++++++++++++
src/security/security_util.c | 32 ++++++++++++++++++
src/security/security_util.h | 4 +++
12 files changed, 172 insertions(+), 14 deletions(-)
--
2.31.1
3 years
[libvirt PATCH v3 0/7] Enable autostarting mediated devices
by Jonathon Jongsma
This first version of this series was reviewed quite a while ago and all
patches were ACKed except the second one. I posted a second series with changes
noted below but it was never ACKed and I dropped the ball for a little while.
Subsequently there were questions about whether physical devices (e.g. pci,
usb, etc) should return 'true' or 'false' for the GetAutostart()/IsPersistent()
calls. I had initially marked them as persistent=true and autostart=true
because they superficially act a bit like persistently-defined devices. But
Boris convinced me that this is not a very accurate classification since if the
physical device is unplugged, there will be no record of it left behind. So
I've switched all non-mdev devices to be persistent=false and autostart=false.
This is also imperfect, but it seems relatively harmless. Comments welcome.
A reminder of what is included in this series:
- new API consistent with existing libvirt objects:
- virNodeDeviceGetAutostart()
- virNodeDeviceSetAutostart()
- virNodeDeviceIsPersistent()
- virNodeDeviceIsActive
- new virsh commands
- nodedev-info
- nodedev-autostart
Changes in version 2:
- Parse the autostart property from mdevctl output.
Changes in version 3:
- switch physical devices to autostart=false, persistent=false
- rebase to upstream
- update version numbers for new API, etc
- fix accidental copy-paste error in virsh command descriptions
Jonathon Jongsma (7):
api: add virNodeDevice(Get|Set)Autostart()
nodedev: implement virNodeDevice(Get|Set)Autostart()
nodedev: Add tests for mdevctl autostart command
virsh: add nodedev-autostart
api: add virNodeDeviceIsPersistent()/IsActive()
nodedev: Implement virNodeDeviceIsPersistent()/IsActive()
virsh: add nodedev-info
docs/manpages/virsh.rst | 27 +++
include/libvirt/libvirt-nodedev.h | 10 +
src/conf/node_device_conf.h | 1 +
src/conf/virnodedeviceobj.c | 16 ++
src/conf/virnodedeviceobj.h | 6 +
src/driver-nodedev.h | 18 ++
src/libvirt-nodedev.c | 141 +++++++++++++
src/libvirt_private.syms | 2 +
src/libvirt_public.syms | 4 +
src/node_device/node_device_driver.c | 189 +++++++++++++++++-
src/node_device/node_device_driver.h | 19 ++
src/node_device/node_device_udev.c | 22 +-
src/remote/remote_driver.c | 6 +-
src/remote/remote_protocol.x | 60 +++++-
src/remote_protocol-structs | 26 +++
.../nodedevmdevctldata/mdevctl-autostart.argv | 8 +
tests/nodedevmdevctltest.c | 55 +++++
tools/virsh-nodedev.c | 139 +++++++++++++
18 files changed, 740 insertions(+), 9 deletions(-)
create mode 100644 tests/nodedevmdevctldata/mdevctl-autostart.argv
--
2.31.1
3 years
[PATCH] qemu_driver:report guest interface informations
by scuzhanglei
Signed-off-by: scuzhanglei <greatzhanglei(a)gmail.com>
---
NEWS.rst | 5 ++
include/libvirt/libvirt-domain.h | 1 +
src/libvirt-domain.c | 12 +++++
src/qemu/qemu_agent.c | 9 ++--
src/qemu/qemu_agent.h | 3 +-
src/qemu/qemu_driver.c | 88 +++++++++++++++++++++++++++++++-
tests/qemuagenttest.c | 2 +-
tools/virsh-domain.c | 2 +
8 files changed, 115 insertions(+), 7 deletions(-)
diff --git a/NEWS.rst b/NEWS.rst
index 21df0e1602..fde781b320 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -19,6 +19,11 @@ v7.7.0 (unreleased)
* **Improvements**
+ * qemu: Report guest interfaces information in ``virDomainGetGuestInfo``
+
+ Libvirt is now able to report interfaces from the guest's
+ perspective (using guest agent).
+
* **Bug fixes**
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 7ef8ac51e5..b088847725 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -5074,6 +5074,7 @@ typedef enum {
VIR_DOMAIN_GUEST_INFO_HOSTNAME = (1 << 3), /* return hostname information */
VIR_DOMAIN_GUEST_INFO_FILESYSTEM = (1 << 4), /* return filesystem information */
VIR_DOMAIN_GUEST_INFO_DISKS = (1 << 5), /* return disks information */
+ VIR_DOMAIN_GUEST_INFO_INTERFACES = (1 << 6), /* return interfaces information */
} virDomainGuestInfoTypes;
int virDomainGetGuestInfo(virDomainPtr domain,
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index a8a386e839..dfd84b4744 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -12586,6 +12586,18 @@ virDomainSetVcpu(virDomainPtr domain,
* virTypedParamsFree to free memory returned in @params.
*
* Returns 0 on success, -1 on error.
+ * VIR_DOMAIN_GUEST_INFO_INTERFACES:
+ * Returns information about the interfaces within the domain. the typed
+ * parameter keys are in this format:
+ *
+ * "if.count" - the number of interfaces defined on this domain
+ * as an unsigned int
+ * "if.<num>.name" - interface name in the guest
+ * "if.<num>.hwaddr" - hardware address of interface
+ * "if.<num>.addr.count - the number of ip addresses of interface
+ * "if.<num>.addr.<num>.type" - the type of ip address(e.g. ipv4)
+ * "if.<num>.addr.<num>.addr" - the ip address
+ * "if.<num>.addr.<num>.prefix" - the number of bits of ip address prefix
*/
int virDomainGetGuestInfo(virDomainPtr domain,
unsigned int types,
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 5f421be6f6..a7f943e0dc 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -2245,17 +2245,20 @@ qemuAgentGetAllInterfaceAddresses(virDomainInterfacePtr **ifaces_ret,
*/
int
qemuAgentGetInterfaces(qemuAgent *agent,
- virDomainInterfacePtr **ifaces)
+ virDomainInterfacePtr **ifaces,
+ bool report_unsupported)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virJSONValue *ret_array = NULL;
+ int rc;
if (!(cmd = qemuAgentMakeCommand("guest-network-get-interfaces", NULL)))
return -1;
- if (qemuAgentCommand(agent, cmd, &reply, agent->timeout) < 0)
- return -1;
+ if ((rc = qemuAgentCommandFull(agent, cmd, &reply, agent->timeout,
+ report_unsupported)) < 0)
+ return rc;
if (!(ret_array = virJSONValueObjectGetArray(reply, "return"))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
diff --git a/src/qemu/qemu_agent.h b/src/qemu/qemu_agent.h
index 81b45b8e5d..94eab9de9f 100644
--- a/src/qemu/qemu_agent.h
+++ b/src/qemu/qemu_agent.h
@@ -151,7 +151,8 @@ int qemuAgentSetTime(qemuAgent *mon,
bool sync);
int qemuAgentGetInterfaces(qemuAgent *mon,
- virDomainInterfacePtr **ifaces);
+ virDomainInterfacePtr **ifaces,
+ bool report_unsupported);
int qemuAgentSetUserPassword(qemuAgent *mon,
const char *user,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f1f961c51c..0b803c392b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18957,7 +18957,7 @@ qemuDomainInterfaceAddresses(virDomainPtr dom,
goto endjob;
agent = qemuDomainObjEnterAgent(vm);
- ret = qemuAgentGetInterfaces(agent, ifaces);
+ ret = qemuAgentGetInterfaces(agent, ifaces, true);
qemuDomainObjExitAgent(vm, agent);
endjob:
@@ -19903,7 +19903,8 @@ static const unsigned int qemuDomainGetGuestInfoSupportedTypes =
VIR_DOMAIN_GUEST_INFO_TIMEZONE |
VIR_DOMAIN_GUEST_INFO_HOSTNAME |
VIR_DOMAIN_GUEST_INFO_FILESYSTEM |
- VIR_DOMAIN_GUEST_INFO_DISKS;
+ VIR_DOMAIN_GUEST_INFO_DISKS |
+ VIR_DOMAIN_GUEST_INFO_INTERFACES;
static int
qemuDomainGetGuestInfoCheckSupport(unsigned int types,
@@ -20102,6 +20103,69 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfo **fsinfo,
}
}
+static void
+virDomainInterfaceFormatParams(virDomainInterfacePtr *ifaces,
+int nifaces,
+virTypedParameterPtr *params,
+int *nparams, int * maxparams)
+{
+ size_t i, j;
+ const char *type = NULL;
+
+ if (virTypedParamsAddUInt(params, nparams, maxparams,
+ "if.count", nifaces) < 0)
+ return;
+
+ for (i = 0; i < nifaces; i++) {
+ char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
+ g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
+ "if.%zu.name", i);
+ if (virTypedParamsAddString(params, nparams, maxparams,
+ param_name, ifaces[i]->name) < 0)
+ return;
+
+ g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
+ "if.%zu.hwaddr", i);
+ if (virTypedParamsAddString(params, nparams, maxparams,
+ param_name, ifaces[i]->hwaddr) < 0)
+ return;
+
+ g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
+ "if.%zu.addr.count", i);
+ if (virTypedParamsAddUInt(params, nparams, maxparams,
+ param_name, ifaces[i]->naddrs) < 0)
+ return;
+
+ for (j = 0; j < ifaces[i]->naddrs; j++) {
+ switch (ifaces[i]->addrs[j].type) {
+ case VIR_IP_ADDR_TYPE_IPV4:
+ type = "ipv4";
+ break;
+ case VIR_IP_ADDR_TYPE_IPV6:
+ type = "ipv6";
+ break;
+ }
+
+ g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
+ "if.%zu.addr.%zu.type", i, j);
+ if (virTypedParamsAddString(params, nparams, maxparams,
+ param_name, type) < 0)
+ return;
+
+ g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
+ "if.%zu.addr.%zu.addr", i, j);
+ if (virTypedParamsAddString(params, nparams, maxparams,
+ param_name, ifaces[i]->addrs[j].addr) < 0)
+ return;
+
+ g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
+ "if.%zu.addr.%zu.prefix", i, j);
+ if (virTypedParamsAddUInt(params, nparams, maxparams,
+ param_name, ifaces[i]->addrs[j].prefix) < 0)
+ return;
+ }
+ }
+}
static int
qemuDomainGetGuestInfo(virDomainPtr dom,
@@ -20123,6 +20187,8 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
qemuAgentFSInfo **agentfsinfo = NULL;
size_t ndisks = 0;
qemuAgentDiskInfo **agentdiskinfo = NULL;
+ virDomainInterfacePtr *ifaces = NULL;
+ size_t nifaces = 0;
size_t i;
virCheckFlags(0, -1);
@@ -20188,6 +20254,15 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
}
}
+ if (supportedTypes & VIR_DOMAIN_GUEST_INFO_INTERFACES) {
+ rc = qemuAgentGetInterfaces(agent, &ifaces, report_unsupported);
+ if (rc == -1) {
+ goto exitagent;
+ } else if (rc >= 0) {
+ nifaces = rc;
+ }
+ }
+
qemuDomainObjExitAgent(vm, agent);
qemuDomainObjEndAgentJob(vm);
@@ -20210,6 +20285,10 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
qemuDomainObjEndJob(driver, vm);
}
+ if (nifaces > 0) {
+ virDomainInterfaceFormatParams(ifaces, nifaces, params, nparams, &maxparams);
+ }
+
ret = 0;
cleanup:
@@ -20219,6 +20298,11 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
for (i = 0; i < ndisks; i++)
qemuAgentDiskInfoFree(agentdiskinfo[i]);
g_free(agentdiskinfo);
+ if (ifaces && nifaces > 0) {
+ for (i = 0; i < nifaces; i++)
+ virDomainInterfaceFree(ifaces[i]);
+ }
+ g_free(ifaces);
virDomainObjEndAPI(&vm);
return ret;
diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c
index a447c93494..e0b22c042a 100644
--- a/tests/qemuagenttest.c
+++ b/tests/qemuagenttest.c
@@ -920,7 +920,7 @@ testQemuAgentGetInterfaces(const void *data)
goto cleanup;
if ((ifaces_count = qemuAgentGetInterfaces(qemuMonitorTestGetAgent(test),
- &ifaces)) < 0)
+ &ifaces, true)) < 0)
goto cleanup;
if (ifaces_count != 4) {
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index e5bd1fdd75..ea3ba58616 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -13854,6 +13854,8 @@ cmdGuestInfo(vshControl *ctl, const vshCmd *cmd)
types |= VIR_DOMAIN_GUEST_INFO_FILESYSTEM;
if (vshCommandOptBool(cmd, "disk"))
types |= VIR_DOMAIN_GUEST_INFO_DISKS;
+ if (vshCommandOptBool(cmd, "interface"))
+ types |= VIR_DOMAIN_GUEST_INFO_INTERFACES;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
return false;
--
2.31.1
3 years
[PATCH 0/1] qemu: add virtio-blk queue-size option
by Hiroki Narukawa
Hello,
The option "queue-size" in virtio-blk was added in qemu-2.12.0, and default value increased from qemu-5.0.0.
However, increasing this value may lead to drop of random access performance.
This is configurable value, so we want to use it via libvirt.
Sorry, my previous e-mail had wrong CC address that is rejected, please
reply to this message and not previous one.
Could you review this patch?
Hiroki Narukawa (1):
qemu: add virtio-blk queue-size option
docs/schemas/domaincommon.rng | 5 +++
src/conf/domain_conf.c | 6 ++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 5 +++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 3 ++
src/qemu/qemu_validate.c | 7 ++++
.../caps_2.12.0.aarch64.xml | 1 +
.../caps_2.12.0.s390x.xml | 1 +
.../qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 1 +
.../caps_3.0.0.riscv32.xml | 1 +
.../caps_3.0.0.riscv64.xml | 1 +
.../qemucapabilitiesdata/caps_3.0.0.s390x.xml | 1 +
.../caps_3.0.0.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 1 +
.../caps_3.1.0.x86_64.xml | 1 +
.../caps_4.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 1 +
.../caps_4.0.0.riscv32.xml | 1 +
.../caps_4.0.0.riscv64.xml | 1 +
.../qemucapabilitiesdata/caps_4.0.0.s390x.xml | 1 +
.../caps_4.0.0.x86_64.xml | 1 +
.../caps_4.1.0.x86_64.xml | 1 +
.../caps_4.2.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 +
.../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 +
.../caps_4.2.0.x86_64.xml | 1 +
.../caps_5.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 +
.../caps_5.0.0.riscv64.xml | 1 +
.../caps_5.0.0.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 +
.../caps_5.1.0.x86_64.xml | 1 +
.../caps_5.2.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 +
.../caps_5.2.0.riscv64.xml | 1 +
.../qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 +
.../caps_5.2.0.x86_64.xml | 1 +
.../caps_6.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 +
.../caps_6.0.0.x86_64.xml | 1 +
.../caps_6.1.0.x86_64.xml | 1 +
.../disk-virtio-queue-size.args | 29 +++++++++++++++
.../disk-virtio-queue-size.xml | 35 +++++++++++++++++++
tests/qemuxml2argvtest.c | 2 ++
.../disk-virtio-queue-size.xml | 35 +++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
47 files changed, 165 insertions(+)
create mode 100644 tests/qemuxml2argvdata/disk-virtio-queue-size.args
create mode 100644 tests/qemuxml2argvdata/disk-virtio-queue-size.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-virtio-queue-size.xml
--
2.17.1
3 years
[PATCH 2/2] qemu: support for virtio-blk-pci discard options
by yuxiating
DISCARD and WRITE_ZEROES features for machine type >= 4.0 is enabled by default since
commit 5c81161f804144b146607f890e84613a4cbad95c
virtio-blk: add "discard" and "write-zeroes" properties
Sometimes guestos has bugs DISCARD need to be disabled.
Signed-off-by: yuxiating <yuxiating(a)huawei.com>
---
src/conf/domain_conf.c | 15 +++++++++++++++
src/conf/domain_conf.h | 9 +++++++++
src/conf/domain_validate.c | 6 ++++++
src/libvirt_private.syms | 3 ++-
src/qemu/qemu_command.c | 11 +++++++++++
5 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6127513117..bfe4721e60 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1278,6 +1278,13 @@ VIR_ENUM_IMPL(virDomainDiskDiscard,
"ignore",
);
+VIR_ENUM_IMPL(virDomainDiskDiscardEnable,
+ VIR_DOMAIN_DISK_DISCARD_ENABLE_LAST,
+ "default",
+ "off",
+ "on",
+);
+
VIR_ENUM_IMPL(virDomainDiskDetectZeroes,
VIR_DOMAIN_DISK_DETECT_ZEROES_LAST,
"default",
@@ -8930,6 +8937,10 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def,
if (virXMLPropUInt(cur, "queues", 10, VIR_XML_PROP_NONE, &def->queues) < 0)
return -1;
+ if (virXMLPropEnum(cur, "discard_enable", virDomainDiskDiscardEnableTypeFromString,
+ VIR_XML_PROP_NONZERO, &def->discard_enable) < 0)
+ return -1;
+
return 0;
}
@@ -23416,6 +23427,10 @@ virDomainDiskDefFormatDriver(virBuffer *buf,
if (disk->queues)
virBufferAsprintf(&attrBuf, " queues='%u'", disk->queues);
+ if (disk->discard_enable)
+ virBufferAsprintf(&attrBuf, " discard_enable='%s'",
+ virDomainDiskDiscardEnableTypeToString(disk->discard_enable));
+
virDomainVirtioOptionsFormat(&attrBuf, disk->virtio);
if (disk->src->metadataCacheMaxSize > 0) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index c7e6df7981..c39694a19e 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -457,6 +457,13 @@ typedef enum {
VIR_DOMAIN_DISK_DISCARD_LAST
} virDomainDiskDiscard;
+typedef enum {
+ VIR_DOMAIN_DISK_DISCARD_ENABLE_DEFAULT = 0,
+ VIR_DOMAIN_DISK_DISCARD_ENABLE_OFF,
+ VIR_DOMAIN_DISK_DISCARD_ENABLE_ON,
+ VIR_DOMAIN_DISK_DISCARD_ENABLE_LAST
+} virDomainDiskDiscardEnable;
+
typedef enum {
VIR_DOMAIN_DISK_DETECT_ZEROES_DEFAULT = 0,
VIR_DOMAIN_DISK_DETECT_ZEROES_OFF,
@@ -589,6 +596,7 @@ struct _virDomainDiskDef {
bool diskElementAuth;
bool diskElementEnc;
+ virDomainDiskDiscardEnable discard_enable;
};
@@ -3838,6 +3846,7 @@ VIR_ENUM_DECL(virDomainDiskIo);
VIR_ENUM_DECL(virDomainDeviceSGIO);
VIR_ENUM_DECL(virDomainDiskTray);
VIR_ENUM_DECL(virDomainDiskDiscard);
+VIR_ENUM_DECL(virDomainDiskDiscardEnable);
VIR_ENUM_DECL(virDomainDiskDetectZeroes);
VIR_ENUM_DECL(virDomainDiskModel);
VIR_ENUM_DECL(virDomainDiskMirrorState);
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 60f7ccdddd..6eb346916a 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -612,6 +612,12 @@ virDomainDiskDefValidate(const virDomainDef *def,
return -1;
}
+ if (disk->discard_enable) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("discard_enable attribute in disk driver element is only supported by virtio-blk"));
+ return -1;
+ }
+
if (disk->event_idx != VIR_TRISTATE_SWITCH_ABSENT) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("disk event_idx mode supported only for virtio bus"));
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index ab8a6c00c3..52a74dd2d5 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1,5 +1,5 @@
-#
# General private symbols. Add symbols here, and see src/meson.build for
+# mainDiskDeviceTypeToString
# more details.
#
# Keep this file sorted by header name, then by symbols with each header.
@@ -377,6 +377,7 @@ virDomainDiskDefParseSource;
virDomainDiskDetectZeroesTypeFromString;
virDomainDiskDetectZeroesTypeToString;
virDomainDiskDeviceTypeToString;
+virDomainDiskDiscardEnableTypeToString;
virDomainDiskDiscardTypeToString;
virDomainDiskEmptySource;
virDomainDiskErrorPolicyTypeFromString;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b230314f7f..894c8b17b9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1739,6 +1739,17 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
virBufferAsprintf(&opt, ",num-queues=%u", disk->queues);
}
+ if (disk->discard_enable) {
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_DISCARD)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("virtio-blk discard property isn't supported by this "
+ "QEMU binary"));
+ return NULL;
+ }
+ virBufferAsprintf(&opt, ",discard=%s",
+ virDomainDiskDiscardEnableTypeToString(disk->discard_enable));
+ }
+
qemuBuildVirtioOptionsStr(&opt, disk->virtio);
if (qemuBuildDeviceAddressStr(&opt, def, &disk->info) < 0)
--
2.27.0
3 years
[PATCH 0/6] network create: add support for validation against schema
by Kristina Hanicova
Kristina Hanicova (6):
api: add public virNetworkCreateXMLFlags() and remote protocol
src: add driver support for networkCreateXMLFlags()
api: add virNetworkCreateFlags
network_conf: add validation against schema in create
network: allow VIR_NETWORK_CREATE_VALIDATE flag
virsh: add support for '--validate' option in create network
docs/manpages/virsh.rst | 4 ++-
include/libvirt/libvirt-network.h | 7 ++++++
src/conf/network_conf.c | 3 ++-
src/driver-network.h | 6 +++++
src/libvirt-network.c | 41 +++++++++++++++++++++++++++++++
src/libvirt_public.syms | 5 ++++
src/network/bridge_driver.c | 20 ++++++++++++---
src/remote/remote_driver.c | 1 +
src/remote/remote_protocol.x | 18 +++++++++++++-
src/remote_protocol-structs | 8 ++++++
src/test/test_driver.c | 15 +++++++++--
src/vbox/vbox_network.c | 10 +++++++-
tools/virsh-network.c | 13 +++++++++-
13 files changed, 140 insertions(+), 11 deletions(-)
--
2.31.1
3 years, 1 month
[PATCH 0/4] nwfilter-binding create: add support for validation against schema
by Kristina Hanicova
Kristina Hanicova (4):
api: add virNWFilterBindingCreateFlags
conf: virnwfilterbindingdef: add validation against schema in create
nwfilter_driver: allow VIR_NWFILTER_BINDING_CREATE_VALIDATE flag
virsh: add support for '--validate' option in create nwfilter-binding
docs/manpages/virsh.rst | 5 ++++-
include/libvirt/libvirt-nwfilter.h | 5 +++++
src/conf/virnwfilterbindingdef.c | 14 +++++++++-----
src/conf/virnwfilterbindingdef.h | 3 ++-
src/libvirt-nwfilter.c | 2 +-
src/nwfilter/nwfilter_driver.c | 4 ++--
tools/virsh-nwfilter.c | 10 +++++++++-
7 files changed, 32 insertions(+), 11 deletions(-)
--
2.31.1
3 years, 1 month