[libvirt] [PATCH 0/3] qemu: support -overcommit cpu-pm=on|off
by Menno Lageman
QEMU introduced a CPU power management feature with commit 6f131f13e68d
("kvm: support -overcommit cpu-pm=on|off").
With this flag, kvm allows guest to control host CPU power state. This
increases latency for other processes using same host CPU in an
unpredictable way, but if decreases idle entry/exit times for the
running VCPU, so to use it QEMU needs a hint about whether host CPU is
overcommitted, hence the flag name.
This patch series adds a new kvm feature 'cpu-pm' for controlling
"-overcommit cpu-pm=[on|off]"
<features>
<kvm>
<cpu-pm state='on'/>
</kvm>
</features>
Menno Lageman (2):
qemu: introduce qemuBuildOvercommitCommandLine()
tests: add tests for cpu-pm feature
Wim ten Have (1):
qemu: add hypervisor feature cpu-pm support for kvm
docs/formatdomain.html.in | 7 ++++
docs/schemas/domaincommon.rng | 5 +++
src/conf/domain_conf.c | 4 ++
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 39 +++++++++++++++++--
src/qemu/qemu_domain.c | 25 ++++++++----
tests/qemuxml2argvdata/kvm-features-off.args | 2 +-
tests/qemuxml2argvdata/kvm-features-off.xml | 1 +
tests/qemuxml2argvdata/kvm-features.args | 2 +-
tests/qemuxml2argvdata/kvm-features.xml | 1 +
tests/qemuxml2argvtest.c | 4 +-
tests/qemuxml2xmloutdata/kvm-features-off.xml | 1 +
tests/qemuxml2xmloutdata/kvm-features.xml | 1 +
14 files changed, 79 insertions(+), 15 deletions(-)
--
2.21.0
4 years, 8 months
[libvirt] [PATCH v4 0/2] introduction of migration_version attribute for VFIO live migration
by Yan Zhao
This patchset introduces a migration_version attribute under sysfs of VFIO
Mediated devices.
This migration_version attribute is used to check migration compatibility
between two mdev devices of the same mdev type.
Patch 1 defines migration_version attribute in
Documentation/vfio-mediated-device.txt
Patch 2 uses GVT as an example to show how to expose migration_version
attribute and check migration compatibility in vendor driver.
v4:
1. fixed indentation/spell errors, reworded several error messages
2. added a missing memory free for error handling in patch 2
v3:
1. renamed version to migration_version
2. let errno to be freely defined by vendor driver
3. let checking mdev_type be prerequisite of migration compatibility check
4. reworded most part of patch 1
5. print detailed error log in patch 2 and generate migration_version
string at init time
v2:
1. renamed patched 1
2. made definition of device version string completely private to vendor
driver
3. reverted changes to sample mdev drivers
4. described intent and usage of version attribute more clearly.
Yan Zhao (2):
vfio/mdev: add migration_version attribute for mdev device
drm/i915/gvt: export migration_version to mdev sysfs for Intel vGPU
Documentation/vfio-mediated-device.txt | 113 +++++++++++++
drivers/gpu/drm/i915/gvt/Makefile | 2 +-
drivers/gpu/drm/i915/gvt/gvt.c | 39 +++++
drivers/gpu/drm/i915/gvt/gvt.h | 5 +
drivers/gpu/drm/i915/gvt/migration_version.c | 168 +++++++++++++++++++
drivers/gpu/drm/i915/gvt/vgpu.c | 13 +-
6 files changed, 337 insertions(+), 3 deletions(-)
create mode 100644 drivers/gpu/drm/i915/gvt/migration_version.c
--
2.17.1
4 years, 8 months
[PATCH] util: virhostcpu: Fail when fetching CPU Stats for invalid cpu
by Mauro S. M. Rodrigues
virHostCPUGetStatsLinux walks through every cpu in /proc/stat until it
finds cpu%cpuNum that matches with the requested cpu.
If none is found it logs the error but it should return -1, instead of 0.
Otherwise virsh nodecpustats --cpu <invalid cpu number> and API bindings
don't fail properly, printing a blank line instead of an error message.
This patch also includes an additional test for virhostcputest to avoid
this regression to happen again in the future.
Reported-by: Satheesh Rajendran <satheera(a)in.ibm.com>
Signed-off-by: Mauro S. M. Rodrigues <maurosr(a)linux.vnet.ibm.com>
---
src/util/virhostcpu.c | 2 +-
tests/virhostcputest.c | 9 ++++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 81293eea8c..20c8d0ce6c 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -847,7 +847,7 @@ virHostCPUGetStatsLinux(FILE *procstat,
_("Invalid cpuNum in %s"),
__FUNCTION__);
- return 0;
+ return -1;
}
diff --git a/tests/virhostcputest.c b/tests/virhostcputest.c
index 7865b61578..2f569d8bd4 100644
--- a/tests/virhostcputest.c
+++ b/tests/virhostcputest.c
@@ -258,14 +258,17 @@ mymain(void)
if (virTestRun(nodeData[i].testName, linuxTestHostCPU, &nodeData[i]) != 0)
ret = -1;
-# define DO_TEST_CPU_STATS(name, ncpus) \
+# define DO_TEST_CPU_STATS(name, ncpus, shouldFail) \
do { \
static struct nodeCPUStatsData data = { name, ncpus }; \
- if (virTestRun("CPU stats " name, linuxTestNodeCPUStats, &data) < 0) \
+ if ((virTestRun("CPU stats " name, \
+ linuxTestNodeCPUStats, \
+ &data) < 0) != shouldFail) \
ret = -1; \
} while (0)
- DO_TEST_CPU_STATS("24cpu", 24);
+ DO_TEST_CPU_STATS("24cpu", 24, false);
+ DO_TEST_CPU_STATS("24cpu", 25, true);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--
2.24.1
4 years, 8 months
[libvirt PATCH v2 0/9] Second take on slirp-helper & dbus-vmstate
by marcandre.lureau@redhat.com
From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
Hi,
The series "[libvirt] [PATCH v2 00/23] Use a slirp helper process" has
been merged and partially reverted. Meanwhile, qemu dbus-vmstate
design has been changed and merged upstream.
This new series fixes the slirp-helper support. The significant change
is that dbus-vmstate now requires a bus (instead of the earlier
peer-to-peer connection). The current series doesn't attempt to
enforce strict policies on the bus. As long as you can connect to the
bus, you can send/receive from/to anyone. A follow-up series should
implement the recommendations from
https://qemu.readthedocs.io/en/latest/interop/dbus.html#security.
The libslirp-rs slirp-helper hasn't yet received an official release.
For testing, you may:
$ cargo install --features=all --git https://gitlab.freedesktop.org/slirp/libslirp-rs
The resulting binary should be ~/.cargo/bin/slirp-helper, so qemu.conf
slirp_helper location should be adjusted. With that in place, a VM
with user networking (slirp) should now start with the helper process.
thanks
v2:
- merge most suggestions/changes from Michal Privoznik review of v1.
- added "WIP: qemu_slirp: update to follow current spec"
Marc-André Lureau (9):
qemu: remove dbus-vmstate code
qemu-conf: add configurable dbus-daemon location
qemu-conf: add dbusStateDir
qemu: add a DBus daemon helper unit
domain: save/restore the state of dbus-daemon running
qemu: prepare and stop the dbus daemon
qemu: add dbus-vmstate helper migration support
qemu-slirp: register helper for migration
WIP: qemu-slirp: update to follow current spec
m4/virt-driver-qemu.m4 | 6 +
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 3 +
src/qemu/qemu_alias.c | 17 +-
src/qemu/qemu_alias.h | 3 +-
src/qemu/qemu_command.c | 81 +++------
src/qemu/qemu_command.h | 6 +-
src/qemu/qemu_conf.c | 7 +
src/qemu/qemu_conf.h | 2 +
src/qemu/qemu_dbus.c | 264 +++++++++++++++++++++++++----
src/qemu/qemu_dbus.h | 25 ++-
src/qemu/qemu_domain.c | 30 ++--
src/qemu/qemu_domain.h | 8 +-
src/qemu/qemu_extdevice.c | 4 +-
src/qemu/qemu_hotplug.c | 165 +++++++++---------
src/qemu/qemu_hotplug.h | 17 +-
src/qemu/qemu_migration.c | 57 ++++++-
src/qemu/qemu_monitor.c | 21 +++
src/qemu/qemu_monitor.h | 3 +
src/qemu/qemu_monitor_json.c | 15 ++
src/qemu/qemu_monitor_json.h | 5 +
src/qemu/qemu_process.c | 6 +
src/qemu/qemu_slirp.c | 157 +++--------------
src/qemu/qemu_slirp.h | 4 +-
src/qemu/test_libvirtd_qemu.aug.in | 1 +
25 files changed, 544 insertions(+), 364 deletions(-)
--
2.25.0.rc2.1.g09a9a1a997
4 years, 8 months
[libvirt] [PATCH] virt-host-validate: warn if kvm_hv is not loaded for POWER hosts
by Daniel Henrique Barboza
POWER hosts does not implement CPU virtualization extensions like
x86 or s390x. Instead, all bare-metal POWER hosts are considered
to be virtualization ready.
For POWER, the validation is done by checking the virtualization
kernel modules, kvm_hv and kvm_pr, to see if they are either not
installed or not loaded in the host. If the KVM modules aren't
present, we should not just warn but fail to validate.
This patch implements this support. If kvm_hv is not installed,
which can be determined by 'modinfo' returning not-zero return
code, fail the verification. If kvm_hv is installed but not
loaded, show a warning. The exception are POWER8 hosts, which can
work with kvm_pr. In its case, ACK the use of kvm_pr if kvm_hv
is not loaded/present.
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
tools/virt-host-validate-common.c | 136 ++++++++++++++++++++++++++++++
tools/virt-host-validate-common.h | 2 +
tools/virt-host-validate-qemu.c | 6 ++
3 files changed, 144 insertions(+)
diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index bce0f14917..e6d7986758 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -411,3 +411,139 @@ int virHostValidateIOMMU(const char *hvname,
virHostMsgPass();
return 0;
}
+
+
+static bool virHostCPUIsPower8(void)
+{
+ FILE *fp;
+ bool ret = false;
+
+ if (!(fp = fopen("/proc/cpuinfo", "r")))
+ return false;
+
+ do {
+ char line[1024];
+
+ if (!fgets(line, sizeof(line), fp))
+ break;
+
+ /* Looks for the 'model name' line. This is more common for
+ * Intel /proc/cpuinfo formats, but let's account for it
+ * too. */
+ if (STRPREFIX(line, "model name")) {
+ if (strstr(line, "POWER8"))
+ ret = true;
+ break;
+ }
+
+ /* Looks for the 'cpu:' line which is more commonly present
+ * in /proc/cpuinfo Power systems. To ensure this is not
+ * 'cpu id' or any other cpu attribute, peek at the next char
+ * after the first whitespace. A tab, whitespace or ':'
+ * indicates we're on the right line */
+ if (STRPREFIX(line, "cpu") &&
+ (line[3] == '\t' || line[3] == ':' || line[3] == ' ')) {
+ if (strstr(line, "POWER8"))
+ ret = true;
+ break;
+ }
+
+ } while (1);
+
+ VIR_FORCE_FCLOSE(fp);
+
+ return ret;
+}
+
+
+static bool virHostKernelModuleExists(const char *module)
+{
+ g_autofree char *cmd = g_strdup_printf("modinfo %s", module);
+ g_autofree char *stdout = NULL;
+ g_autofree char *stderr = NULL;
+ g_autoptr(GError) err = NULL;
+ int errStatus;
+
+ if (g_spawn_command_line_sync(cmd, &stdout, &stderr, &errStatus, &err))
+ return true;
+
+ return false;
+}
+
+
+static bool virHostKernelModuleIsLoaded(const char *module)
+{
+ FILE *fp;
+ bool ret = false;
+
+ if (!(fp = fopen("/proc/modules", "r")))
+ return false;
+
+ do {
+ char line[1024];
+
+ if (!fgets(line, sizeof(line), fp))
+ break;
+
+ if (STRPREFIX(line, module)) {
+ ret = true;
+ break;
+ }
+
+ } while (1);
+
+ VIR_FORCE_FCLOSE(fp);
+
+ return ret;
+}
+
+
+int virHostValidatePowerPCModules(void)
+{
+ bool kvm_pr_exists = virHostKernelModuleExists("kvm_pr");
+ bool kvm_pr_loaded = kvm_pr_exists && virHostKernelModuleIsLoaded("kvm_pr");
+ bool kvm_hv_exists = virHostKernelModuleExists("kvm_hv");
+ bool kvm_hv_loaded = kvm_hv_exists && virHostKernelModuleIsLoaded("kvm_hv");
+ bool hostIsP8 = virHostCPUIsPower8();
+
+ virHostMsgCheck("QEMU", "%s", _("for PowerPC KVM modules loaded"));
+
+ /* No Power KVM virtualization modules present on the host. */
+ if (!kvm_hv_exists && !kvm_pr_exists) {
+ virHostMsgFail(VIR_HOST_VALIDATE_FAIL,
+ _("No kvm_hv or kvm_pr module present in "
+ "the host"));
+ return -1;
+ }
+
+ /* Bail out for all non-Power8 CPUs if kvm_hv is not present. */
+ if (!kvm_hv_exists && !hostIsP8) {
+ virHostMsgFail(VIR_HOST_VALIDATE_FAIL,
+ _("No kvm_hv module present in the host"));
+ return -1;
+ }
+
+ /* Power8 CPUs virtualization works with any of kvm_hv and kvm_pr.
+ * Issue a warning if none are loaded. */
+ if (hostIsP8) {
+ if (!kvm_hv_loaded && !kvm_pr_loaded) {
+ virHostMsgFail(VIR_HOST_VALIDATE_WARN,
+ _("Load kvm_hv or kvm_pr module "
+ "for better performance"));
+ return 0;
+ }
+
+ virHostMsgPass();
+ return 0;
+ }
+
+ /* For non-Power8 hosts, show a warning if kvm_hv is not loaded. */
+ if (!kvm_hv_loaded) {
+ virHostMsgFail(VIR_HOST_VALIDATE_WARN,
+ _("Load kvm_hv for better performance"));
+ return 0;
+ }
+
+ virHostMsgPass();
+ return 0;
+}
diff --git a/tools/virt-host-validate-common.h b/tools/virt-host-validate-common.h
index 1b7e93e520..7a2933c8fd 100644
--- a/tools/virt-host-validate-common.h
+++ b/tools/virt-host-validate-common.h
@@ -83,3 +83,5 @@ int virHostValidateCGroupControllers(const char *hvname,
int virHostValidateIOMMU(const char *hvname,
virHostValidateLevel level);
+
+int virHostValidatePowerPCModules(void);
\ No newline at end of file
diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qemu.c
index ff3c1f0231..8753c6a31d 100644
--- a/tools/virt-host-validate-qemu.c
+++ b/tools/virt-host-validate-qemu.c
@@ -57,6 +57,12 @@ int virHostValidateQEMU(void)
if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SIE))
hasHwVirt = true;
break;
+ case VIR_ARCH_PPC64:
+ case VIR_ARCH_PPC64LE:
+ hasVirtFlag = true;
+ if (virHostValidatePowerPCModules() == 0)
+ hasHwVirt = true;
+ break;
default:
hasHwVirt = false;
}
--
2.23.0
4 years, 8 months
Re: [PATCH V4 0/5] Introduce Advanced Watch Dog module
by Zhang, Chen
On 2/12/2020 10:56 AM, Jason Wang wrote:
> On 2020/2/11 下午4:58, Zhang, Chen wrote:
>>> -----Original Message-----
>>> From: Jason Wang<jasowang(a)redhat.com>
>>> Sent: Monday, January 20, 2020 10:57 AM
>>> To: Zhang, Chen<chen.zhang(a)intel.com>; Paolo Bonzini
>>> <pbonzini(a)redhat.com>; Philippe Mathieu-Daudé<philmd(a)redhat.com>;
>>> qemu-dev<qemu-devel(a)nongnu.org>
>>> Cc: Zhang Chen<zhangckid(a)gmail.com>
>>> Subject: Re: [PATCH V4 0/5] Introduce Advanced Watch Dog module
>>>
>>>
>>> On 2020/1/19 下午5:10, Zhang, Chen wrote:
>>>> Hi~
>>>>
>>>> Anyone have comments about this module?
>>> Hi Chen:
>>>
>>> I will take a look at this series.
>> Sorry for slow reply due to CNY and extend leave.
>> OK, waiting your comments~ Thanks~
>>
>>> Two general questions:
>>>
>>> - if it can detect more than network stall, it should not belong to /net
>> This module use network connection status to detect all the issue(Host to Guest/Host to Host/Host to Admin...).
>> The target is more than network but all use network way. So it is looks a tricky problem.
>
> Ok.
>
>
>>> - need to convince libvirt guys for this proposal, since usually it's the duty of
>>> upper layer instead of qemu itself
>>>
>> Yes, It looks a upper layer responsibility, but In the cover latter I have explained the reason why we need this in Qemu.
>> try to make this module as simple as possible. This module give upper layer software a new way to connect/monitoring Qemu.
>> And due to all the COLO code implement in Qemu side, Many customer want to use this FT solution without other dependencies,
>> it is very easy to integrated to real product.
>>
>> Thanks
>> Zhang Chen
>
> I would like to hear from libvirt about such design.
Hi Jason,
OK. I add the libvirt mailing list in this thread.
The full mail discussion and patches:
https://lists.nongnu.org/archive/html/qemu-devel/2020-02/msg02611.html
By the way, I noticed Eric is libvirt maintianer.
Hi Eric and Paolo, Can you give some comments about this series?
Thanks
Zhang Chen
>
> Thanks
>
4 years, 8 months
[PATCH] conf: Don't generate machine names with a dot
by Michal Privoznik
According to the linked BZ, machined expects either valid
hostname or valid FQDN. While in case of multiple dots, a
trailing one doesn't violate FQDN, it does violate the rule in
case of something simple, like "domain.". But it's safe to remove
it in both cases.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1721804
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/conf/domain_conf.c | 4 ++--
tests/virsystemdtest.c | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 17867eeece..9371153618 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -30838,8 +30838,8 @@ virDomainMachineNameAppendValid(virBufferPtr buf,
virBufferAddChar(buf, *name);
}
- /* trailing dashes are not allowed */
- virBufferTrimChars(buf, "-");
+ /* trailing dashes or dots are not allowed */
+ virBufferTrimChars(buf, "-.");
}
#undef HOSTNAME_CHARS
diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c
index b7dfd64d06..9847f255ac 100644
--- a/tests/virsystemdtest.c
+++ b/tests/virsystemdtest.c
@@ -744,6 +744,7 @@ mymain(void)
"qemu-100-kstest-network-device-default-httpksc9eed63e-981e-48ec");
TEST_MACHINE("kstest-network-device-default-httpks_(c9eed63e-981e-48ec--cdc-56b3f8c5f678)", 10,
"qemu-10-kstest-network-device-default-httpksc9eed63e-981e-48ec");
+ TEST_MACHINE("demo.test.", 11, "qemu-11-demo.test");
# define TESTS_PM_SUPPORT_HELPER(name, function) \
do { \
--
2.24.1
4 years, 8 months
[libvirt] [PATCH] net: Remove deprecated [hub_id name] tuple of 'hostfwd_add' / 'hostfwd_remove'
by Thomas Huth
It's been deprecated since QEMU v3.1.0. Time to finally remove it now.
Signed-off-by: Thomas Huth <thuth(a)redhat.com>
---
hmp-commands.hx | 8 ++++----
net/hub.c | 23 -----------------------
net/hub.h | 2 --
net/slirp.c | 44 ++++++++++++--------------------------------
qemu-deprecated.texi | 13 ++++++++-----
5 files changed, 24 insertions(+), 66 deletions(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index cfcc044ce4..14ccc685d7 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1463,8 +1463,8 @@ ETEXI
#ifdef CONFIG_SLIRP
{
.name = "hostfwd_add",
- .args_type = "arg1:s,arg2:s?,arg3:s?",
- .params = "[hub_id name]|[netdev_id] [tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport",
+ .args_type = "arg1:s,arg2:s?",
+ .params = "[netdev_id] [tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport",
.help = "redirect TCP or UDP connections from host to guest (requires -net user)",
.cmd = hmp_hostfwd_add,
},
@@ -1478,8 +1478,8 @@ ETEXI
#ifdef CONFIG_SLIRP
{
.name = "hostfwd_remove",
- .args_type = "arg1:s,arg2:s?,arg3:s?",
- .params = "[hub_id name]|[netdev_id] [tcp|udp]:[hostaddr]:hostport",
+ .args_type = "arg1:s,arg2:s?",
+ .params = "[netdev_id] [tcp|udp]:[hostaddr]:hostport",
.help = "remove host-to-guest TCP or UDP redirection",
.cmd = hmp_hostfwd_remove,
},
diff --git a/net/hub.c b/net/hub.c
index 5795a678ed..88cfb876f3 100644
--- a/net/hub.c
+++ b/net/hub.c
@@ -193,29 +193,6 @@ NetClientState *net_hub_add_port(int hub_id, const char *name,
return &port->nc;
}
-/**
- * Find a specific client on a hub
- */
-NetClientState *net_hub_find_client_by_name(int hub_id, const char *name)
-{
- NetHub *hub;
- NetHubPort *port;
- NetClientState *peer;
-
- QLIST_FOREACH(hub, &hubs, next) {
- if (hub->id == hub_id) {
- QLIST_FOREACH(port, &hub->ports, next) {
- peer = port->nc.peer;
-
- if (peer && strcmp(peer->name, name) == 0) {
- return peer;
- }
- }
- }
- }
- return NULL;
-}
-
/**
* Find a available port on a hub; otherwise create one new port
*/
diff --git a/net/hub.h b/net/hub.h
index 66d3322fac..ce45f7b399 100644
--- a/net/hub.h
+++ b/net/hub.h
@@ -15,10 +15,8 @@
#ifndef NET_HUB_H
#define NET_HUB_H
-
NetClientState *net_hub_add_port(int hub_id, const char *name,
NetClientState *hubpeer);
-NetClientState *net_hub_find_client_by_name(int hub_id, const char *name);
void net_hub_info(Monitor *mon);
void net_hub_check_clients(void);
bool net_hub_flush(NetClientState *nc);
diff --git a/net/slirp.c b/net/slirp.c
index c4334ee876..77042e6df7 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -610,25 +610,13 @@ error:
return -1;
}
-static SlirpState *slirp_lookup(Monitor *mon, const char *hub_id,
- const char *name)
+static SlirpState *slirp_lookup(Monitor *mon, const char *id)
{
- if (name) {
- NetClientState *nc;
- if (hub_id) {
- nc = net_hub_find_client_by_name(strtol(hub_id, NULL, 0), name);
- if (!nc) {
- monitor_printf(mon, "unrecognized (hub-id, stackname) pair\n");
- return NULL;
- }
- warn_report("Using 'hub-id' is deprecated, specify the netdev id "
- "directly instead");
- } else {
- nc = qemu_find_netdev(name);
- if (!nc) {
- monitor_printf(mon, "unrecognized netdev id '%s'\n", name);
- return NULL;
- }
+ if (id) {
+ NetClientState *nc = qemu_find_netdev(id);
+ if (!nc) {
+ monitor_printf(mon, "unrecognized netdev id '%s'\n", id);
+ return NULL;
}
if (strcmp(nc->model, "user")) {
monitor_printf(mon, "invalid device specified\n");
@@ -655,16 +643,12 @@ void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict)
int err;
const char *arg1 = qdict_get_str(qdict, "arg1");
const char *arg2 = qdict_get_try_str(qdict, "arg2");
- const char *arg3 = qdict_get_try_str(qdict, "arg3");
- if (arg3) {
- s = slirp_lookup(mon, arg1, arg2);
- src_str = arg3;
- } else if (arg2) {
- s = slirp_lookup(mon, NULL, arg1);
+ if (arg2) {
+ s = slirp_lookup(mon, arg1);
src_str = arg2;
} else {
- s = slirp_lookup(mon, NULL, NULL);
+ s = slirp_lookup(mon, NULL);
src_str = arg1;
}
if (!s) {
@@ -784,16 +768,12 @@ void hmp_hostfwd_add(Monitor *mon, const QDict *qdict)
SlirpState *s;
const char *arg1 = qdict_get_str(qdict, "arg1");
const char *arg2 = qdict_get_try_str(qdict, "arg2");
- const char *arg3 = qdict_get_try_str(qdict, "arg3");
- if (arg3) {
- s = slirp_lookup(mon, arg1, arg2);
- redir_str = arg3;
- } else if (arg2) {
- s = slirp_lookup(mon, NULL, arg1);
+ if (arg2) {
+ s = slirp_lookup(mon, arg1);
redir_str = arg2;
} else {
- s = slirp_lookup(mon, NULL, NULL);
+ s = slirp_lookup(mon, NULL);
redir_str = arg1;
}
if (s) {
diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
index 66d2b22a94..e407cc085e 100644
--- a/qemu-deprecated.texi
+++ b/qemu-deprecated.texi
@@ -206,11 +206,6 @@ the 'wait' field, which is only applicable to sockets in server mode
@section Human Monitor Protocol (HMP) commands
-@subsection The hub_id parameter of 'hostfwd_add' / 'hostfwd_remove' (since 3.1)
-
-The @option{[hub_id name]} parameter tuple of the 'hostfwd_add' and
-'hostfwd_remove' HMP commands has been replaced by @option{netdev_id}.
-
@subsection cpu-add (since 4.0)
Use ``device_add'' for hotplugging vCPUs instead of ``cpu-add''. See
@@ -376,6 +371,14 @@ What follows is a record of recently removed, formerly deprecated
features that serves as a record for users who have encountered
trouble after a recent upgrade.
+@section Human Monitor Protocol (HMP) commands
+
+@subsection The hub_id parameter of 'hostfwd_add' / 'hostfwd_remove' (removed in 5.0)
+
+The @option{[hub_id name]} parameter tuple of the 'hostfwd_add' and
+'hostfwd_remove' HMP commands has been replaced by the single option
+@option{netdev_id}.
+
@section QEMU Machine Protocol (QMP) commands
@subsection block-dirty-bitmap-add "autoload" parameter (since 4.2.0)
--
2.18.1
4 years, 8 months
[PATCH 0/8] qemu: Show willingness to use blockdev-reopen
by Peter Krempa
To break the chicken and egg problem loop between qemu and libvirt in
using new features introduce experimental support for blockdev-reopen
(or actually x-blockdev-reopen for the time being).
This patchset adds QEMU_CAPS_BLOCKDEV_REOPEN capability which is
currently not asserted until qemu stabilizes the blockdev-reopen
interface but implements all the handlers to use it.
This is a similar approach we used to add all of the bits required to
use -blockdev with qemu.
To show it's usefullnes two real problems are addressed using reopening:
- Checkpoint deletion in backing chain, where we need to reopen
the read-only backing images to allow modification of bitmaps.
Using this approach will prevent qemu from having to introduce yet
another ad-hoc interface to deal with the bitmaps.
(note that checkpoints are also experimental themselves since they
are part of the not-yet-finished incremental backup feature)
- Late open of backing files for virDomainBlockCopy
oVirt abuses a quirk in the old handling of block-copy when
drive-mirror is used as qemu opens the backing images of the
destination of the copy only once block-job-complete is called.
Without blockdev-reopen it's impossible to replicate the old semantics
as we need to install a backing file for the mirror copy and that
is possible only using blockdev-reopen.
(this change will stay disabled until blockdev-reopen is stabilized)
There are a few other problems which this will deal with mostly related
to bitmap handling which would also require ad-hoc qemu functionality
otherwise.
Since we have an existing interface we can show we are willing to use it
to prevent wasting more engieering on qemu's side on partial solutions.
This patchset applies on top of:
https://www.redhat.com/archives/libvir-list/2020-February/msg01062.html
It can be fetched from my repo:
git fetch https://gitlab.com/pipo.sk/libvirt.git reopen-impl
https://gitlab.com/pipo.sk/libvirt/-/commits/reopen-impl
Note the above branch contains also patches which enable the feature
and also enable incremental backup to facilitate simple testing
without the need to use the qemu namespace.
Successful use requires the following qemu patches:
https://lists.gnu.org/archive/html/qemu-block/2020-02/msg01423.html
https://lists.gnu.org/archive/html/qemu-block/2020-02/msg01467.html
A qemu repo containing the above patches and patch to enable the
detection done in my private brnch mentioned above can be fetched at:
git fetch https://gitlab.com/pipo.sk/qemu.git bitmap-reopen
https://gitlab.com/pipo.sk/qemu/-/commits/bitmap-reopen
Peter Krempa (8):
qemu: capabilities: Add QEMU_CAPS_BLOCKDEV_REOPEN
qemu: monitor: Add handler for blockdev-reopen
qemu: block: implement helpers for blockdev-reopen
qemuCheckpointDiscardBitmaps: Reopen images for bitmap modifications
qemuCheckpointDiscardBitmaps: Use correct field for checkpoint bitmap
name
qemuDomainBlockPivot: Move check prior to executing the pivot steps
qemuDomainBlockCopyCommon: Record updated flags to block job
qemu: blockcopy: Allow late opening of the backing chain of a shallow
copy
src/qemu/qemu_block.c | 121 +++++++++++++++++++++++++++++++++++
src/qemu/qemu_block.h | 14 ++++
src/qemu/qemu_capabilities.c | 1 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_checkpoint.c | 6 +-
src/qemu/qemu_driver.c | 67 ++++++++++++++++---
src/qemu/qemu_monitor.c | 13 ++++
src/qemu/qemu_monitor.h | 3 +
src/qemu/qemu_monitor_json.c | 21 ++++++
src/qemu/qemu_monitor_json.h | 4 ++
10 files changed, 241 insertions(+), 10 deletions(-)
--
2.24.1
4 years, 8 months
[libvirt PATCH 0/7] valgrind-inspired fixes
by Ján Tomko
First, clean up some valgrind noise.
Then, fix some reported leaks in the test suite.
Last, refactor some touched tests.
Ján Tomko (7):
tests: valgrind.supp: suppress g_type_register_static leaks
tests: valgrind: do not trace system binaries
qemumonitorjsontest: do not leak qapiData.schema
qemumonitorjsontest: use virCPUDefNew()
virsystemdtest: do not leak socket path
qemumonitorjsontest: GetCPUModelComparison: use g_auto
qemumonitorjsontest: GetCPUModelBaseline: use g_auto
tests/.valgrind.supp | 13 +++++++++++++
tests/Makefile.am | 2 +-
tests/qemumonitorjsontest.c | 29 ++++++++---------------------
tests/virsystemdtest.c | 5 ++++-
4 files changed, 26 insertions(+), 23 deletions(-)
--
2.24.1
4 years, 8 months