[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
[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
[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
[libvirt] [PATCH 0/8] 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
Marc-André Lureau (8):
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
m4/virt-driver-qemu.m4 | 6 +
src/qemu/Makefile.inc.am | 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 | 65 +++----
src/qemu/qemu_command.h | 6 +-
src/qemu/qemu_conf.c | 9 +
src/qemu/qemu_conf.h | 2 +
src/qemu/qemu_dbus.c | 283 +++++++++++++++++++++++++----
src/qemu/qemu_dbus.h | 30 +--
src/qemu/qemu_domain.c | 30 +--
src/qemu/qemu_domain.h | 9 +-
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 | 126 ++-----------
src/qemu/qemu_slirp.h | 4 +-
src/qemu/test_libvirtd_qemu.aug.in | 1 +
tests/Makefile.am | 1 +
27 files changed, 564 insertions(+), 331 deletions(-)
--
2.25.0.rc2.1.g09a9a1a997
4 years, 8 months
Re: [PATCH v2 0/2] finish qemu-nbd --partition deprecation
by Eric Blake
ping
On 1/23/20 10:46 AM, Eric Blake wrote:
> Based-on: <20200116141511.16849-1-peter.maydell(a)linaro.org>
> (0/3 convert qemu-nbd, qemu-block-drivers to rST)
>
> In v2:
> - rebased on top of rST doc changes
> - patch 1 added
>
> Eric Blake (2):
> docs: Fix typo in qemu-nbd -P replacement
> qemu-nbd: Removed deprecated --partition option
>
> docs/interop/qemu-nbd.rst | 15 ++---
> qemu-deprecated.texi | 49 ++++++--------
> qemu-nbd.c | 133 +-------------------------------------
> 3 files changed, 24 insertions(+), 173 deletions(-)
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
4 years, 9 months
[PATCH v2 0/7] Couple of apparmor fixes
by Michal Privoznik
v2 of:
https://www.redhat.com/archives/libvir-list/2020-January/msg01068.html
diff to v1:
- Keep old paths to virt-aa-helper in profiles as SUSE still uses it.
- patch 7/7 is new
Michal Prívozník (7):
apparmor: Fix parthelper, iohelper and virt-aa-helper paths in
profiles
apparmor: Allow libvirt to spawn virt-aa-helper and libvirt_lxc
docs: Fix virt-aa-helper location
apparmor: Rename virt-aa-helper profile
apparmor: Sort paths in blocks in libvirt-qemu profile
apparmor: Allow some more BIOS/UEFI paths
apparmor: Drop 'Last modified' comment from profiles
docs/drvqemu.html.in | 2 +-
src/security/Makefile.inc.am | 10 +--
src/security/apparmor/libvirt-lxc | 2 -
src/security/apparmor/libvirt-qemu | 80 +++++++++----------
...t-aa-helper => usr.libexec.virt-aa-helper} | 7 +-
src/security/apparmor/usr.sbin.libvirtd | 7 +-
6 files changed, 53 insertions(+), 55 deletions(-)
rename src/security/apparmor/{usr.lib.libvirt.virt-aa-helper => usr.libexec.virt-aa-helper} (88%)
--
2.24.1
4 years, 9 months
[libvirt] [patch v2 1/1] virt-aa-helper: Add support for smartcard host-certificates
by Arnaud Patard
When emulating smartcard with host certificates, qemu needs to
be able to read the certificates files. Add necessary code to
add the smartcard certificates file path to the apparmor profile.
Passthrough support has been tested with spicevmc and remote-viewer.
v2:
- Fix CodingStyle
- Add support for 'host' case.
- Add a comment to mention that the passthrough case doesn't need
some configuration
- Use one rule with '{,*}' instead of two rules.
Signed-off-by: Arnaud Patard <apatard(a)hupstream.com>
Index: libvirt/src/security/virt-aa-helper.c
===================================================================
--- libvirt.orig/src/security/virt-aa-helper.c
+++ libvirt/src/security/virt-aa-helper.c
@@ -1271,6 +1271,39 @@ get_files(vahControl * ctl)
}
}
+ for (i = 0; i < ctl->def->nsmartcards; i++) {
+ virDomainSmartcardDefPtr sc = ctl->def->smartcards[i];
+ virDomainSmartcardType sc_type = sc->type;
+ char *sc_db = (char *)VIR_DOMAIN_SMARTCARD_DEFAULT_DATABASE;
+ if (sc->data.cert.database)
+ sc_db = sc->data.cert.database;
+ switch (sc_type) {
+ /*
+ * Note: At time of writing, to get this working, qemu seccomp sandbox has
+ * to be disabled or the host must be running QEMU with commit
+ * 9a1565a03b79d80b236bc7cc2dbce52a2ef3a1b8.
+ * It's possibly due to libcacard:vcard_emul_new_event_thread(), which calls
+ * PR_CreateThread(), which calls {g,s}etpriority(). And resourcecontrol seccomp
+ * filter forbids it (cf src/qemu/qemu_command.c which seems to always use
+ * resourcecontrol=deny).
+ */
+ case VIR_DOMAIN_SMARTCARD_TYPE_HOST:
+ virBufferAddLit(&buf, " \"/etc/pki/nssdb/{,*}\" rk,\n");
+ break;
+ case VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES:
+ virBufferAsprintf(&buf, " \"%s/{,*}\" rk,\n", sc_db);
+ break;
+ /*
+ * Nothing to do for passthrough, as the smartcard
+ * access is done through TCP or Spice
+ */
+ case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH:
+ break;
+ case VIR_DOMAIN_SMARTCARD_TYPE_LAST:
+ break;
+ }
+ }
+
if (ctl->def->virtType == VIR_DOMAIN_VIRT_KVM) {
for (i = 0; i < ctl->def->nnets; i++) {
virDomainNetDefPtr net = ctl->def->nets[i];
4 years, 9 months
[libvirt PATCHv3 00/12] add virtiofs support (virtio-fs epopee)
by Ján Tomko
https://bugzilla.redhat.com/show_bug.cgi?id=1694166
v1: https://www.redhat.com/archives/libvir-list/2019-November/msg00005.html
v2: https://www.redhat.com/archives/libvir-list/2020-January/msg00980.html
new in v3:
* renamed qemu.conf option
* removed cache-size since it was not yet merged in upstream QEMU
* use XPath for XML parsing
* separated virtiofsd options under the <binary> element [0]
* the binary path is now autodetected from vhost-user schemas
* log virtiofsd output into a file instead of syslog
[0] naming is hard
Ján Tomko (12):
qemuExtDevicesStart: pass logManager
schema: wrap fsDriver in a choice group
qemu: add QEMU_CAPS_VHOST_USER_FS
docs: add virtiofs kbase
conf: qemu: add virtiofs fsdriver type
conf: add virtiofs-related elements and attributes
qemu: add virtiofsd_debug to qemu.conf
qemu: validate virtiofs filesystems
qemu: forbid migration with vhost-user-fs device
qemu: add code for handling virtiofsd
qemu: use the vhost-user schemas to find binary
qemu: build vhost-user-fs device command line
docs/formatdomain.html.in | 35 +-
docs/kbase.html.in | 3 +
docs/kbase/virtiofs.rst | 152 +++++++++
docs/schemas/domaincommon.rng | 88 ++++-
po/POTFILES.in | 1 +
src/conf/domain_conf.c | 108 ++++++-
src/conf/domain_conf.h | 16 +
src/libvirt_private.syms | 1 +
src/qemu/Makefile.inc.am | 2 +
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 7 +
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 47 ++-
src/qemu/qemu_conf.c | 2 +
src/qemu/qemu_conf.h | 1 +
src/qemu/qemu_domain.c | 33 +-
src/qemu/qemu_domain.h | 2 +-
src/qemu/qemu_domain_address.c | 4 +
src/qemu/qemu_extdevice.c | 28 ++
src/qemu/qemu_extdevice.h | 1 +
src/qemu/qemu_migration.c | 10 +
src/qemu/qemu_process.c | 4 +-
src/qemu/qemu_vhost_user.c | 40 +++
src/qemu/qemu_vhost_user.h | 4 +
src/qemu/qemu_virtiofs.c | 302 ++++++++++++++++++
src/qemu/qemu_virtiofs.h | 42 +++
src/qemu/test_libvirtd_qemu.aug.in | 1 +
.../caps_4.2.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 +
.../caps_4.2.0.x86_64.xml | 1 +
.../caps_5.0.0.x86_64.xml | 1 +
...vhost-user-fs-fd-memory.x86_64-latest.args | 39 +++
.../vhost-user-fs-fd-memory.xml | 43 +++
...vhost-user-fs-hugepages.x86_64-latest.args | 47 +++
.../vhost-user-fs-hugepages.xml | 75 +++++
tests/qemuxml2argvtest.c | 14 +
.../vhost-user-fs-fd-memory.x86_64-latest.xml | 1 +
.../vhost-user-fs-hugepages.x86_64-latest.xml | 1 +
tests/qemuxml2xmltest.c | 3 +
40 files changed, 1144 insertions(+), 21 deletions(-)
create mode 100644 docs/kbase/virtiofs.rst
create mode 100644 src/qemu/qemu_virtiofs.c
create mode 100644 src/qemu/qemu_virtiofs.h
create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-fd-memory.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-hugepages.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/vhost-user-fs-hugepages.xml
create mode 120000 tests/qemuxml2xmloutdata/vhost-user-fs-fd-memory.x86_64-latest.xml
create mode 120000 tests/qemuxml2xmloutdata/vhost-user-fs-hugepages.x86_64-latest.xml
--
2.21.0
4 years, 9 months
[libvirt] [PATCH for-5.0 0/4] Remove the deprecated bluetooth subsystem
by Thomas Huth
This patch series removes the bitrotten bluetooth subsystem. See
the patch description of the third patch for the rationale.
Thomas Huth (4):
hw/arm/nseries: Replace the bluetooth chardev with a "null" chardev
hw/usb: Remove the USB bluetooth dongle device
Remove the core bluetooth code
Remove libbluetooth / bluez from the CI tests
.gitlab-ci.yml | 2 +-
Makefile.objs | 2 -
bt-host.c | 198 --
bt-vhci.c | 167 --
configure | 31 -
hw/Kconfig | 1 -
hw/Makefile.objs | 1 -
hw/arm/nseries.c | 16 +-
hw/bt/Kconfig | 2 -
hw/bt/Makefile.objs | 3 -
hw/bt/core.c | 143 --
hw/bt/hci-csr.c | 512 -----
hw/bt/hci.c | 2263 --------------------
hw/bt/hid.c | 553 -----
hw/bt/l2cap.c | 1367 ------------
hw/bt/sdp.c | 989 ---------
hw/usb/Kconfig | 5 -
hw/usb/Makefile.objs | 1 -
hw/usb/dev-bluetooth.c | 581 -----
include/hw/bt.h | 2177 -------------------
include/sysemu/bt.h | 20 -
qemu-deprecated.texi | 7 -
qemu-doc.texi | 17 -
qemu-options.hx | 79 -
tests/docker/dockerfiles/fedora.docker | 1 -
tests/docker/dockerfiles/ubuntu.docker | 1 -
tests/docker/dockerfiles/ubuntu1804.docker | 1 -
vl.c | 136 --
28 files changed, 8 insertions(+), 9268 deletions(-)
delete mode 100644 bt-host.c
delete mode 100644 bt-vhci.c
delete mode 100644 hw/bt/Kconfig
delete mode 100644 hw/bt/Makefile.objs
delete mode 100644 hw/bt/core.c
delete mode 100644 hw/bt/hci-csr.c
delete mode 100644 hw/bt/hci.c
delete mode 100644 hw/bt/hid.c
delete mode 100644 hw/bt/l2cap.c
delete mode 100644 hw/bt/sdp.c
delete mode 100644 hw/usb/dev-bluetooth.c
delete mode 100644 include/hw/bt.h
delete mode 100644 include/sysemu/bt.h
--
2.23.0
4 years, 9 months
[PATCH v2 2/2] qemu-nbd: Removed deprecated --partition option
by Eric Blake
The option was deprecated in 4.0.0 (commit 0ae2d546); it's now been
long enough with no complaints to follow through with that process.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
docs/interop/qemu-nbd.rst | 15 ++---
qemu-deprecated.texi | 49 ++++++--------
qemu-nbd.c | 133 +-------------------------------------
3 files changed, 24 insertions(+), 173 deletions(-)
diff --git a/docs/interop/qemu-nbd.rst b/docs/interop/qemu-nbd.rst
index 873bb9e17d56..2e20f84cf025 100644
--- a/docs/interop/qemu-nbd.rst
+++ b/docs/interop/qemu-nbd.rst
@@ -72,13 +72,6 @@ driver options if ``--image-opts`` is specified.
Export the disk as read-only.
-.. option:: -P, --partition=NUM
-
- Deprecated: Only expose MBR partition *NUM*. Understands physical
- partitions 1-4 and logical partition 5. New code should instead use
- :option:`--image-opts` with the raw driver wrapping a subset of the
- original image.
-
.. option:: -B, --bitmap=NAME
If *filename* has a qcow2 persistent bitmap *NAME*, expose
@@ -224,14 +217,14 @@ a 1 megabyte subset of a raw file, using the export name 'subset':
-t -x subset -p 10810 \
--image-opts driver=raw,offset=1M,size=1M,file.driver=file,file.filename=file.raw
-Serve a read-only copy of just the first MBR partition of a guest
-image over a Unix socket with as many as 5 simultaneous readers, with
-a persistent process forked as a daemon:
+Serve a read-only copy of a guest image over a Unix socket with as
+many as 5 simultaneous readers, with a persistent process forked as a
+daemon:
::
qemu-nbd --fork --persistent --shared=5 --socket=/path/to/sock \
- --partition=1 --read-only --format=qcow2 file.qcow2
+ --read-only --format=qcow2 file.qcow2
Expose the guest-visible contents of a qcow2 file via a block device
/dev/nbd0 (and possibly creating /dev/nbd0p1 and friends for
diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
index 358eb6deebdc..f152e8816164 100644
--- a/qemu-deprecated.texi
+++ b/qemu-deprecated.texi
@@ -319,37 +319,6 @@ The above, converted to the current supported format:
@section Related binaries
-@subsection qemu-nbd --partition (since 4.0.0)
-
-The ``qemu-nbd --partition $digit'' code (also spelled @option{-P})
-can only handle MBR partitions, and has never correctly handled
-logical partitions beyond partition 5. If you know the offset and
-length of the partition (perhaps by using @code{sfdisk} within the
-guest), you can achieve the effect of exporting just that subset of
-the disk by use of the @option{--image-opts} option with a raw
-blockdev using the @code{offset} and @code{size} parameters layered on
-top of any other existing blockdev. For example, if partition 1 is
-100MiB long starting at 1MiB, the old command:
-
-@code{qemu-nbd -t -P 1 -f qcow2 file.qcow2}
-
-can be rewritten as:
-
-@code{qemu-nbd -t --image-opts driver=raw,offset=1M,size=100M,file.driver=qcow2,file.file.driver=file,file.file.filename=file.qcow2}
-
-Alternatively, the @code{nbdkit} project provides a more powerful
-partition filter on top of its nbd plugin, which can be used to select
-an arbitrary MBR or GPT partition on top of any other full-image NBD
-export. Using this to rewrite the above example results in:
-
-@code{qemu-nbd -t -k /tmp/sock -f qcow2 file.qcow2 &}
-@code{nbdkit -f --filter=partition nbd socket=/tmp/sock partition=1}
-
-Note that if you are exposing the export via /dev/nbd0, it is easier
-to just export the entire image and then mount only /dev/nbd0p1 than
-it is to reinvoke @command{qemu-nbd -c /dev/nbd0} limited to just a
-subset of the image.
-
@subsection qemu-img convert -n -o (since 4.2.0)
All options specified in @option{-o} are image creation options, so
@@ -406,3 +375,21 @@ trouble after a recent upgrade.
The "autoload" parameter has been ignored since 2.12.0. All bitmaps
are automatically loaded from qcow2 images.
+
+@section Related binaries
+
+@subsection qemu-nbd --partition (removed in 5.0.0)
+
+The ``qemu-nbd --partition $digit'' code (also spelled @option{-P})
+could only handle MBR partitions, and never correctly handled logical
+partitions beyond partition 5. Exporting a partition can still be
+done by utilizing the @option{--image-opts} option with a raw blockdev
+using the @code{offset} and @code{size} parameters layered on top of
+any other existing blockdev. For example, if partition 1 is 100MiB
+long starting at 1MiB, the old command:
+
+@code{qemu-nbd -t -P 1 -f qcow2 file.qcow2}
+
+can be rewritten as:
+
+@code{qemu-nbd -t --image-opts driver=raw,offset=1M,size=100M,file.driver=qcow2,file.file.driver=file,file.file.filename=file.qcow2}
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 108a51f7eb01..a04930770ff7 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -100,7 +100,6 @@ static void usage(const char *name)
"\n"
"Exposing part of the image:\n"
" -o, --offset=OFFSET offset into the image\n"
-" -P, --partition=NUM only expose partition NUM\n"
" -B, --bitmap=NAME expose a persistent dirty bitmap\n"
"\n"
"General purpose options:\n"
@@ -156,96 +155,6 @@ QEMU_COPYRIGHT "\n"
, name);
}
-struct partition_record
-{
- uint8_t bootable;
- uint8_t start_head;
- uint32_t start_cylinder;
- uint8_t start_sector;
- uint8_t system;
- uint8_t end_head;
- uint8_t end_cylinder;
- uint8_t end_sector;
- uint32_t start_sector_abs;
- uint32_t nb_sectors_abs;
-};
-
-static void read_partition(uint8_t *p, struct partition_record *r)
-{
- r->bootable = p[0];
- r->start_head = p[1];
- r->start_cylinder = p[3] | ((p[2] << 2) & 0x0300);
- r->start_sector = p[2] & 0x3f;
- r->system = p[4];
- r->end_head = p[5];
- r->end_cylinder = p[7] | ((p[6] << 2) & 0x300);
- r->end_sector = p[6] & 0x3f;
-
- r->start_sector_abs = ldl_le_p(p + 8);
- r->nb_sectors_abs = ldl_le_p(p + 12);
-}
-
-static int find_partition(BlockBackend *blk, int partition,
- uint64_t *offset, uint64_t *size)
-{
- struct partition_record mbr[4];
- uint8_t data[MBR_SIZE];
- int i;
- int ext_partnum = 4;
- int ret;
-
- ret = blk_pread(blk, 0, data, sizeof(data));
- if (ret < 0) {
- error_report("error while reading: %s", strerror(-ret));
- exit(EXIT_FAILURE);
- }
-
- if (data[510] != 0x55 || data[511] != 0xaa) {
- return -EINVAL;
- }
-
- for (i = 0; i < 4; i++) {
- read_partition(&data[446 + 16 * i], &mbr[i]);
-
- if (!mbr[i].system || !mbr[i].nb_sectors_abs) {
- continue;
- }
-
- if (mbr[i].system == 0xF || mbr[i].system == 0x5) {
- struct partition_record ext[4];
- uint8_t data1[MBR_SIZE];
- int j;
-
- ret = blk_pread(blk, mbr[i].start_sector_abs * MBR_SIZE,
- data1, sizeof(data1));
- if (ret < 0) {
- error_report("error while reading: %s", strerror(-ret));
- exit(EXIT_FAILURE);
- }
-
- for (j = 0; j < 4; j++) {
- read_partition(&data1[446 + 16 * j], &ext[j]);
- if (!ext[j].system || !ext[j].nb_sectors_abs) {
- continue;
- }
-
- if ((ext_partnum + j + 1) == partition) {
- *offset = (uint64_t)ext[j].start_sector_abs << 9;
- *size = (uint64_t)ext[j].nb_sectors_abs << 9;
- return 0;
- }
- }
- ext_partnum += 4;
- } else if ((i + 1) == partition) {
- *offset = (uint64_t)mbr[i].start_sector_abs << 9;
- *size = (uint64_t)mbr[i].nb_sectors_abs << 9;
- return 0;
- }
- }
-
- return -ENOENT;
-}
-
static void termsig_handler(int signum)
{
atomic_cmpxchg(&state, RUNNING, TERMINATE);
@@ -617,7 +526,7 @@ int main(int argc, char **argv)
int64_t fd_size;
QemuOpts *sn_opts = NULL;
const char *sn_id_or_name = NULL;
- const char *sopt = "hVb:o:p:rsnP:c:dvk:e:f:tl:x:T:D:B:L";
+ const char *sopt = "hVb:o:p:rsnc:dvk:e:f:tl:x:T:D:B:L";
struct option lopt[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
@@ -626,7 +535,6 @@ int main(int argc, char **argv)
{ "socket", required_argument, NULL, 'k' },
{ "offset", required_argument, NULL, 'o' },
{ "read-only", no_argument, NULL, 'r' },
- { "partition", required_argument, NULL, 'P' },
{ "bitmap", required_argument, NULL, 'B' },
{ "connect", required_argument, NULL, 'c' },
{ "disconnect", no_argument, NULL, 'd' },
@@ -657,7 +565,6 @@ int main(int argc, char **argv)
int ch;
int opt_ind = 0;
int flags = BDRV_O_RDWR;
- int partition = 0;
int ret = 0;
bool seen_cache = false;
bool seen_discard = false;
@@ -793,15 +700,6 @@ int main(int argc, char **argv)
readonly = true;
flags &= ~BDRV_O_RDWR;
break;
- case 'P':
- warn_report("The '-P' option is deprecated; use --image-opts with "
- "a raw device wrapper for subset exports instead");
- if (qemu_strtoi(optarg, NULL, 0, &partition) < 0 ||
- partition < 1 || partition > 8) {
- error_report("Invalid partition '%s'", optarg);
- exit(EXIT_FAILURE);
- }
- break;
case 'B':
bitmap = optarg;
break;
@@ -898,7 +796,7 @@ int main(int argc, char **argv)
error_report("List mode is incompatible with a file name");
exit(EXIT_FAILURE);
}
- if (export_name || export_description || dev_offset || partition ||
+ if (export_name || export_description || dev_offset ||
device || disconnect || fmt || sn_id_or_name || bitmap ||
seen_aio || seen_discard || seen_cache) {
error_report("List mode is incompatible with per-device settings");
@@ -1162,33 +1060,6 @@ int main(int argc, char **argv)
}
fd_size -= dev_offset;
- if (partition) {
- uint64_t limit;
-
- if (dev_offset) {
- error_report("Cannot request partition and offset together");
- exit(EXIT_FAILURE);
- }
- ret = find_partition(blk, partition, &dev_offset, &limit);
- if (ret < 0) {
- error_report("Could not find partition %d: %s", partition,
- strerror(-ret));
- exit(EXIT_FAILURE);
- }
- /*
- * MBR partition limits are (32-bit << 9); this assert lets
- * the compiler know that we can't overflow 64 bits.
- */
- assert(dev_offset + limit >= dev_offset);
- if (dev_offset + limit > fd_size) {
- error_report("Discovered partition %d at offset %" PRIu64
- " size %" PRIu64 ", but size exceeds file length %"
- PRId64, partition, dev_offset, limit, fd_size);
- exit(EXIT_FAILURE);
- }
- fd_size = limit;
- }
-
export = nbd_export_new(bs, dev_offset, fd_size, export_name,
export_description, bitmap, readonly, shared > 1,
nbd_export_closed, writethrough, NULL,
--
2.24.1
4 years, 9 months