[PATCH 0/2] qemu_process: Two trivial fixes aroung VIR_QEMU_PROCESS_START_RESET_NVRAM
by Michal Privoznik
I've pushed both patches, because they are trivial.
Michal Prívozník (2):
qemu_process.c: Fix VIR_QEMU_PROCESS_START_RESET_NVRAM value
qemu_process: Fix theoretical overflow in uint to bool typecast
src/qemu/qemu_process.c | 2 +-
src/qemu/qemu_process.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--
2.34.1
2 years, 9 months
[PATCH] libxl: Release auto-allocated spice ports
by Jim Fehlig
While VNC ports auto-allocated by the libxl driver are released in
libxlDomainCleanup, spice ports are overlooked. Rework the existing
logic to release any auto-allocated graphics ports, not just the VNC
port of the first graphics device.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_domain.c | 34 ++++++++++++++++++++++++++--------
1 file changed, 26 insertions(+), 8 deletions(-)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 577985b5ea..b995f20a64 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -906,10 +906,10 @@ libxlDomainCleanup(libxlDriverPrivate *driver,
{
libxlDomainObjPrivate *priv = vm->privateData;
g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
- int vnc_port;
char *file;
virHostdevManager *hostdev_mgr = driver->hostdevMgr;
unsigned int hostdev_flags = VIR_HOSTDEV_SP_PCI;
+ size_t i;
VIR_DEBUG("Cleaning up domain with id '%d' and name '%s'",
vm->def->id, vm->def->name);
@@ -944,13 +944,31 @@ libxlDomainCleanup(libxlDriverPrivate *driver,
if (!!g_atomic_int_dec_and_test(&driver->nactive) && driver->inhibitCallback)
driver->inhibitCallback(false, driver->inhibitOpaque);
- if ((vm->def->ngraphics == 1) &&
- vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
- vm->def->graphics[0]->data.vnc.autoport) {
- vnc_port = vm->def->graphics[0]->data.vnc.port;
- if (vnc_port >= LIBXL_VNC_PORT_MIN) {
- if (virPortAllocatorRelease(vnc_port) < 0)
- VIR_DEBUG("Could not mark port %d as unused", vnc_port);
+ /* Release auto-allocated graphics ports */
+ for (i = 0; i < vm->def->ngraphics; i++) {
+ virDomainGraphicsDef *graphics = vm->def->graphics[i];
+ int gport = -1;
+
+ switch (graphics->type) {
+ case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
+ if (graphics->data.vnc.autoport &&
+ graphics->data.vnc.port >= LIBXL_VNC_PORT_MIN)
+ gport = graphics->data.vnc.port;
+ break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
+ if (graphics->data.spice.autoport)
+ gport = graphics->data.spice.port;
+ break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
+ case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
+ case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
+ break;
+ }
+ if (gport != -1) {
+ if (virPortAllocatorRelease(gport) < 0)
+ VIR_DEBUG("Could not mark port %d as unused", gport);
}
}
--
2.34.1
2 years, 9 months
[libvirt][PATCH v10 0/5] Support query and use SGX
by Haibin Huang
This patch series provides support for enabling Intel's Software
Guard Extensions (SGX) feature in guest VM.
Giving the SGX support in QEMU had been merged. Intel SGX is a
set of instructions that increases the security of application code
and data, giving them more protection from disclosure or modification.
Developers can partition sensitive information into enclaves, which
are areas of execution in memory with more security protection.
It depends on QEMU fixing[1], which will move cpu QOM object from
/machine/unattached/device[nn] to /machine/cpu[nn]. It requires libvirt
to change the default cpu QOM object location once QEMU patch gets
accepted, but it is out of this SGX patch scope.
The typical flow looks below at very high level:
1. Calls virConnectGetDomainCapabilities API to domain capabilities
that includes the following SGX information.
<feature>
...
<sgx supported='yes'>
<epc_size unit='KiB'>N</epc_size>
</sgx>
...
</feature>
2. User requests to start a guest calling virCreateXML() with SGX
requirement. It does not support NUMA yet, since latest QEMU 6.2
release does not support NUMA.
It should contain
<devices>
...
<memory model='sgx-epc'>
<target>
<size unit='KiB'>N</size>
</target>
</memory>
...
</devices>
[1] https://lists.nongnu.org/archive/html/qemu-devel/2022-01/msg03534.html
Haibin Huang (3):
qemu: provide support to query the SGX capability
conf: expose SGX feature in domain capabilities
Add unit test for domaincapsdata sgx
Lin Yang (2):
conf: Introduce SGX EPC element into device memory xml
Update default CPU location in qemu QOM tree
docs/formatdomain.rst | 9 +-
docs/formatdomaincaps.html.in | 26 ++++
docs/schemas/domaincaps.rng | 22 ++-
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_capabilities.c | 29 ++++
src/conf/domain_capabilities.h | 13 ++
src/conf/domain_conf.c | 6 +
src/conf/domain_conf.h | 1 +
src/conf/domain_validate.c | 16 ++
src/libvirt_private.syms | 1 +
src/qemu/qemu_alias.c | 3 +
src/qemu/qemu_capabilities.c | 137 ++++++++++++++++++
src/qemu/qemu_capabilities.h | 4 +
src/qemu/qemu_capspriv.h | 4 +
src/qemu/qemu_command.c | 1 +
src/qemu/qemu_domain.c | 38 +++--
src/qemu/qemu_domain_address.c | 6 +
src/qemu/qemu_driver.c | 1 +
src/qemu/qemu_monitor.c | 10 ++
src/qemu/qemu_monitor.h | 3 +
src/qemu/qemu_monitor_json.c | 84 ++++++++++-
src/qemu/qemu_monitor_json.h | 9 ++
src/qemu/qemu_process.c | 2 +
src/qemu/qemu_validate.c | 8 +
src/security/security_apparmor.c | 1 +
src/security/security_dac.c | 2 +
src/security/security_selinux.c | 2 +
tests/domaincapsdata/bhyve_basic.x86_64.xml | 1 +
tests/domaincapsdata/bhyve_fbuf.x86_64.xml | 1 +
tests/domaincapsdata/bhyve_uefi.x86_64.xml | 1 +
tests/domaincapsdata/empty.xml | 1 +
tests/domaincapsdata/libxl-xenfv.xml | 1 +
tests/domaincapsdata/libxl-xenpv.xml | 1 +
.../domaincapsdata/qemu_2.11.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.11.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_2.11.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_2.11.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.12.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.12.0-tcg.x86_64.xml | 1 +
.../qemu_2.12.0-virt.aarch64.xml | 1 +
tests/domaincapsdata/qemu_2.12.0.aarch64.xml | 1 +
tests/domaincapsdata/qemu_2.12.0.ppc64.xml | 1 +
tests/domaincapsdata/qemu_2.12.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_2.12.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.4.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.4.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_2.4.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.5.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.5.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_2.5.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.6.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.6.0-tcg.x86_64.xml | 1 +
.../qemu_2.6.0-virt.aarch64.xml | 1 +
tests/domaincapsdata/qemu_2.6.0.aarch64.xml | 1 +
tests/domaincapsdata/qemu_2.6.0.ppc64.xml | 1 +
tests/domaincapsdata/qemu_2.6.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.7.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.7.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_2.7.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_2.7.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.8.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.8.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_2.8.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_2.8.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.9.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_2.9.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_2.9.0.ppc64.xml | 1 +
tests/domaincapsdata/qemu_2.9.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_2.9.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_3.0.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_3.0.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_3.0.0.ppc64.xml | 1 +
tests/domaincapsdata/qemu_3.0.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_3.0.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_3.1.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_3.1.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_3.1.0.ppc64.xml | 1 +
tests/domaincapsdata/qemu_3.1.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_4.0.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_4.0.0-tcg.x86_64.xml | 1 +
.../qemu_4.0.0-virt.aarch64.xml | 1 +
tests/domaincapsdata/qemu_4.0.0.aarch64.xml | 1 +
tests/domaincapsdata/qemu_4.0.0.ppc64.xml | 1 +
tests/domaincapsdata/qemu_4.0.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_4.0.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_4.1.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_4.1.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_4.1.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 1 +
.../qemu_4.2.0-virt.aarch64.xml | 1 +
tests/domaincapsdata/qemu_4.2.0.aarch64.xml | 1 +
tests/domaincapsdata/qemu_4.2.0.ppc64.xml | 1 +
tests/domaincapsdata/qemu_4.2.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 1 +
.../qemu_5.0.0-virt.aarch64.xml | 1 +
tests/domaincapsdata/qemu_5.0.0.aarch64.xml | 1 +
tests/domaincapsdata/qemu_5.0.0.ppc64.xml | 1 +
tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.1.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.1.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_5.1.0.sparc.xml | 1 +
tests/domaincapsdata/qemu_5.1.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.2.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml | 1 +
.../qemu_5.2.0-virt.aarch64.xml | 1 +
tests/domaincapsdata/qemu_5.2.0.aarch64.xml | 1 +
tests/domaincapsdata/qemu_5.2.0.ppc64.xml | 1 +
tests/domaincapsdata/qemu_5.2.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_5.2.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_6.0.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_6.0.0-tcg.x86_64.xml | 1 +
.../qemu_6.0.0-virt.aarch64.xml | 1 +
tests/domaincapsdata/qemu_6.0.0.aarch64.xml | 1 +
tests/domaincapsdata/qemu_6.0.0.s390x.xml | 1 +
tests/domaincapsdata/qemu_6.0.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_6.1.0-q35.x86_64.xml | 1 +
.../domaincapsdata/qemu_6.1.0-tcg.x86_64.xml | 1 +
tests/domaincapsdata/qemu_6.1.0.x86_64.xml | 1 +
.../domaincapsdata/qemu_6.2.0-q35.x86_64.xml | 4 +
.../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml | 4 +
.../qemu_6.2.0-virt.aarch64.xml | 1 +
tests/domaincapsdata/qemu_6.2.0.aarch64.xml | 1 +
tests/domaincapsdata/qemu_6.2.0.ppc64.xml | 1 +
tests/domaincapsdata/qemu_6.2.0.x86_64.xml | 4 +
.../domaincapsdata/qemu_7.0.0-q35.x86_64.xml | 4 +
.../domaincapsdata/qemu_7.0.0-tcg.x86_64.xml | 4 +
tests/domaincapsdata/qemu_7.0.0.ppc64.xml | 1 +
tests/domaincapsdata/qemu_7.0.0.x86_64.xml | 4 +
.../caps_6.2.0.x86_64.replies | 22 ++-
.../caps_6.2.0.x86_64.xml | 5 +
.../caps_7.0.0.x86_64.replies | 22 ++-
.../caps_7.0.0.x86_64.xml | 5 +
tests/qemuxml2argvdata/sgx-epc.xml | 36 +++++
.../sgx-epc.x86_64-latest.xml | 52 +++++++
tests/qemuxml2xmltest.c | 2 +
138 files changed, 675 insertions(+), 30 deletions(-)
create mode 100644 tests/qemuxml2argvdata/sgx-epc.xml
create mode 100644 tests/qemuxml2xmloutdata/sgx-epc.x86_64-latest.xml
--
2.17.1
2 years, 9 months
[PATCH] libxl: Set auto-allocated graphics ports to used on reconnect
by Jim Fehlig
The libxl driver reconnects to all running VMs when libvirtd is restarted,
but it failed to mark auto-allocated graphics ports as set in the port
allocator. If many VMs are running that use port auto-allocation and
libvirtd is restarted, the port allocator is likely to hand out a port
already in use when a new VM is created that uses auto-allocation. VM
creation will fail due to the port clash.
When reconnecting to running VMs after a libvirtd restart, let the port
allocator know about previously allocated ports.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
Like 31e937fb3b, another item unaccounted for when reconnecting to VMs
after a daemon restart.
src/libxl/libxl_driver.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 2d9385654c..97965aaf1d 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -393,6 +393,7 @@ libxlReconnectDomain(virDomainObj *vm,
virHostdevManager *hostdev_mgr = driver->hostdevMgr;
unsigned int hostdev_flags = VIR_HOSTDEV_SP_PCI;
int ret = -1;
+ size_t i;
hostdev_flags |= VIR_HOSTDEV_SP_USB;
@@ -447,6 +448,28 @@ libxlReconnectDomain(virDomainObj *vm,
libxlReconnectNotifyNets(vm->def);
+ /* Set any auto-allocated graphics ports to used */
+ for (i = 0; i < vm->def->ngraphics; i++) {
+ virDomainGraphicsDef *graphics = vm->def->graphics[i];
+
+ switch (graphics->type) {
+ case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
+ if (graphics->data.vnc.autoport)
+ virPortAllocatorSetUsed(graphics->data.vnc.port);
+ break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
+ if (graphics->data.spice.autoport)
+ virPortAllocatorSetUsed(graphics->data.spice.port);
+ break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
+ case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
+ case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
+ break;
+ }
+ }
+
if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
VIR_WARN("Cannot update XML for running Xen guest %s", vm->def->name);
--
2.34.1
2 years, 9 months
[PATCH 0/2] lib: Use g_clear_pointer() more
by Michal Privoznik
*** BLURB HERE ***
Michal Prívozník (2):
vbox_common: Drop needless set to NULL
lib: Use g_clear_pointer() more
src/ch/ch_driver.c | 6 +-
src/ch/ch_process.c | 3 +-
src/conf/capabilities.c | 9 +--
src/conf/domain_conf.c | 49 ++++++----------
src/conf/network_conf.c | 3 +-
src/conf/numa_conf.c | 3 +-
src/conf/nwfilter_conf.c | 3 +-
src/conf/snapshot_conf.c | 3 +-
src/conf/storage_source_conf.c | 3 +-
src/conf/virinterfaceobj.c | 3 +-
src/conf/virnetworkobj.c | 6 +-
src/conf/virnodedeviceobj.c | 3 +-
src/conf/virnwfilterbindingobj.c | 3 +-
src/conf/virsecretobj.c | 6 +-
src/conf/virstorageobj.c | 6 +-
src/datatypes.c | 6 +-
src/hyperv/hyperv_wmi.c | 6 +-
src/interface/interface_backend_netcf.c | 12 ++--
src/libvirt-domain.c | 3 +-
src/libxl/libxl_capabilities.c | 3 +-
src/libxl/libxl_migration.c | 6 +-
src/locking/lock_daemon.c | 6 +-
src/locking/lock_driver_lockd.c | 3 +-
src/logging/log_daemon.c | 6 +-
src/lxc/lxc_controller.c | 12 ++--
src/lxc/lxc_domain.c | 6 +-
src/lxc/lxc_driver.c | 6 +-
src/lxc/lxc_fuse.c | 3 +-
src/lxc/lxc_native.c | 24 +++-----
src/lxc/lxc_process.c | 21 +++----
src/network/bridge_driver_linux.c | 6 +-
src/nwfilter/nwfilter_dhcpsnoop.c | 6 +-
src/nwfilter/nwfilter_driver.c | 3 +-
src/qemu/qemu_agent.c | 6 +-
src/qemu/qemu_backup.c | 3 +-
src/qemu/qemu_blockjob.c | 30 ++++------
src/qemu/qemu_domain.c | 68 +++++++---------------
src/qemu/qemu_domain_address.c | 3 +-
src/qemu/qemu_driver.c | 9 +--
src/qemu/qemu_hotplug.c | 12 ++--
src/qemu/qemu_migration.c | 9 +--
src/qemu/qemu_monitor.c | 9 +--
src/qemu/qemu_namespace.c | 3 +-
src/qemu/qemu_process.c | 18 ++----
src/remote/remote_daemon_dispatch.c | 15 ++---
src/remote/remote_driver.c | 21 +++----
src/remote/remote_ssh_helper.c | 3 +-
src/rpc/virnetclient.c | 15 ++---
src/rpc/virnetserverclient.c | 15 ++---
src/rpc/virnettlscontext.c | 3 +-
src/secret/secret_driver.c | 6 +-
src/security/security_manager.c | 3 +-
src/security/security_selinux.c | 6 +-
src/storage/storage_backend_iscsi_direct.c | 3 +-
src/storage/storage_backend_rbd.c | 6 +-
src/storage/storage_util.c | 3 +-
src/storage_file/storage_file_probe.c | 3 +-
src/storage_file/storage_source.c | 3 +-
src/test/test_driver.c | 6 +-
src/util/viralloc.c | 3 +-
src/util/virconf.c | 3 +-
src/util/virerror.c | 3 +-
src/util/vireventglib.c | 12 ++--
src/util/virfile.c | 3 +-
src/util/virfilecache.c | 6 +-
src/util/virgdbus.c | 3 +-
src/util/virmdev.c | 3 +-
src/util/virnetdev.c | 3 +-
src/util/virnetlink.c | 3 +-
src/util/virpci.c | 3 +-
src/util/virresctrl.c | 3 +-
src/util/virstring.c | 3 +-
src/util/virsysinfo.c | 18 ++----
src/util/virtpm.c | 3 +-
src/vbox/vbox_XPCOMCGlue.c | 3 +-
src/vbox/vbox_common.c | 5 +-
src/vbox/vbox_snapshot_conf.c | 12 ++--
src/vmx/vmx.c | 27 +++------
src/vz/vz_driver.c | 3 +-
src/vz/vz_sdk.c | 3 +-
tests/commandtest.c | 6 +-
tests/cputest.c | 3 +-
tests/qemumonitortestutils.c | 3 +-
tests/virnetdaemontest.c | 3 +-
tests/virnetsockettest.c | 3 +-
tests/virnettlshelpers.c | 3 +-
tests/virpcivpdtest.c | 2 +-
tests/virusbtest.c | 6 +-
tools/virsh-domain-monitor.c | 6 +-
tools/virsh-domain.c | 3 +-
tools/virsh-interface.c | 3 +-
tools/virsh-network.c | 6 +-
tools/virsh-nodedev.c | 3 +-
tools/virsh-nwfilter.c | 6 +-
tools/virsh-pool.c | 3 +-
tools/virsh-secret.c | 3 +-
tools/virsh-snapshot.c | 16 ++---
tools/virsh-volume.c | 3 +-
tools/virsh.c | 3 +-
tools/vsh.c | 18 ++----
100 files changed, 252 insertions(+), 503 deletions(-)
--
2.34.1
2 years, 9 months
[PATCH 0/7] qemu: Don't use hardcoded QOM path for vcpu
by Peter Krempa
Peter Krempa (7):
qemuMonitorJSONGetCPUx86Data: Unexport
qemuProcessUpdateAndVerifyCPU: Refactor cleanup
qemu: monitor: Don't hardcode QOM path of first CPU
qemu: domain: Store 'qomPath' in qemuDomainVcpuPrivate
qemu: process: Move cpu flag querying after code probing cpus
qemu: process: Move call to qemuProcessRefreshCPU after cpu probe
qemu: process: Don't use hardcoded QOM path for cpu for probing flags
src/qemu/qemu_domain.c | 3 ++
src/qemu/qemu_domain.h | 2 ++
src/qemu/qemu_monitor.c | 17 +++++++----
src/qemu/qemu_monitor.h | 3 ++
src/qemu/qemu_monitor_json.c | 40 +++++++++++++++-----------
src/qemu/qemu_monitor_json.h | 8 ++----
src/qemu/qemu_process.c | 55 ++++++++++++++++++++++--------------
tests/qemumonitorjsontest.c | 2 ++
8 files changed, 82 insertions(+), 48 deletions(-)
--
2.34.1
2 years, 9 months
[PATCH] qemu: fix formatting of pflash readonly attribute
by Daniel P. Berrangé
When the <loader> had an explicit readonly='no' attribute we
accidentally still marked the plfash as readonly due to the
bad conversion from virTristateBool to bool.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/qemu/qemu_domain.c | 3 +-
.../bios-nvram-implicit-rw.x86_64-latest.args | 39 +++++++++++++++++++
.../bios-nvram-implicit-rw.xml | 35 +++++++++++++++++
.../bios-nvram-rw.x86_64-latest.args | 39 +++++++++++++++++++
tests/qemuxml2argvdata/bios-nvram-rw.xml | 35 +++++++++++++++++
tests/qemuxml2argvtest.c | 2 +
6 files changed, 152 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/bios-nvram-implicit-rw.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/bios-nvram-implicit-rw.xml
create mode 100644 tests/qemuxml2argvdata/bios-nvram-rw.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/bios-nvram-rw.xml
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 9f9e969872..ec71144808 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11120,7 +11120,8 @@ qemuDomainInitializePflashStorageSource(virDomainObj *vm)
pflash0->type = VIR_STORAGE_TYPE_FILE;
pflash0->format = VIR_STORAGE_FILE_RAW;
pflash0->path = g_strdup(def->os.loader->path);
- pflash0->readonly = def->os.loader->readonly;
+ pflash0->readonly = false;
+ virTristateBoolToBool(def->os.loader->readonly, &pflash0->readonly);
pflash0->nodeformat = g_strdup("libvirt-pflash0-format");
pflash0->nodestorage = g_strdup("libvirt-pflash0-storage");
diff --git a/tests/qemuxml2argvdata/bios-nvram-implicit-rw.x86_64-latest.args b/tests/qemuxml2argvdata/bios-nvram-implicit-rw.x86_64-latest.args
new file mode 100644
index 0000000000..fde4c3f57f
--- /dev/null
+++ b/tests/qemuxml2argvdata/bios-nvram-implicit-rw.x86_64-latest.args
@@ -0,0 +1,39 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-test-bios \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-test-bios/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-test-bios/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-test-bios/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=test-bios,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-test-bios/master-key.aes"}' \
+-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/test-bios.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-pflash0-format","read-only":false,"driver":"raw","file":"libvirt-pflash0-storage"}' \
+-machine pc,usb=off,dump-guest-core=off,pflash0=libvirt-pflash0-format,memory-backend=pc.ram \
+-accel tcg \
+-cpu qemu64 \
+-m 1024 \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 362d1fc1-df7d-193e-5c18-49a71bd1da66 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot menu=on,strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
+-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}' \
+-device '{"driver":"usb-tablet","id":"input0","bus":"usb.0","port":"1"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/bios-nvram-implicit-rw.xml b/tests/qemuxml2argvdata/bios-nvram-implicit-rw.xml
new file mode 100644
index 0000000000..ebcd3e5300
--- /dev/null
+++ b/tests/qemuxml2argvdata/bios-nvram-implicit-rw.xml
@@ -0,0 +1,35 @@
+<domain type='qemu'>
+ <name>test-bios</name>
+ <uuid>362d1fc1-df7d-193e-5c18-49a71bd1da66</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <loader type='pflash'>/var/lib/libvirt/qemu/nvram/test-bios.fd</loader>
+ <boot dev='hd'/>
+ <bootmenu enable='yes'/>
+ </os>
+ <features>
+ <acpi/>
+ </features>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='tablet' bus='usb'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/bios-nvram-rw.x86_64-latest.args b/tests/qemuxml2argvdata/bios-nvram-rw.x86_64-latest.args
new file mode 100644
index 0000000000..fde4c3f57f
--- /dev/null
+++ b/tests/qemuxml2argvdata/bios-nvram-rw.x86_64-latest.args
@@ -0,0 +1,39 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-test-bios \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-test-bios/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-test-bios/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-test-bios/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=test-bios,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-test-bios/master-key.aes"}' \
+-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/test-bios.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-pflash0-format","read-only":false,"driver":"raw","file":"libvirt-pflash0-storage"}' \
+-machine pc,usb=off,dump-guest-core=off,pflash0=libvirt-pflash0-format,memory-backend=pc.ram \
+-accel tcg \
+-cpu qemu64 \
+-m 1024 \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 362d1fc1-df7d-193e-5c18-49a71bd1da66 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot menu=on,strict=on \
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
+-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
+-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}' \
+-device '{"driver":"usb-tablet","id":"input0","bus":"usb.0","port":"1"}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/bios-nvram-rw.xml b/tests/qemuxml2argvdata/bios-nvram-rw.xml
new file mode 100644
index 0000000000..b03b4b5ecb
--- /dev/null
+++ b/tests/qemuxml2argvdata/bios-nvram-rw.xml
@@ -0,0 +1,35 @@
+<domain type='qemu'>
+ <name>test-bios</name>
+ <uuid>362d1fc1-df7d-193e-5c18-49a71bd1da66</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <loader readonly='no' type='pflash'>/var/lib/libvirt/qemu/nvram/test-bios.fd</loader>
+ <boot dev='hd'/>
+ <bootmenu enable='yes'/>
+ </os>
+ <features>
+ <acpi/>
+ </features>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='tablet' bus='usb'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index b9d8885912..b1592f3214 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1273,6 +1273,8 @@ mymain(void)
QEMU_CAPS_DEVICE_IOH3420,
QEMU_CAPS_ICH9_AHCI,
QEMU_CAPS_VIRTIO_SCSI);
+ DO_TEST_CAPS_LATEST("bios-nvram-rw");
+ DO_TEST_CAPS_LATEST("bios-nvram-implicit-rw");
/* Make sure all combinations of ACPI and UEFI behave as expected */
DO_TEST_NOCAPS("q35-acpi-uefi");
--
2.34.1
2 years, 9 months
[PATCH 0/3] Mdev test cleanup, completion and parent addr exposure
by Boris Fiuczynski
Clean up the testing json. Add a test for vfio-ccw mdev.
Expose the parent address in the XML when dumping a mdev nodedev as the
address is now part of the mdev nodedev name and users should not parse
and manipulate the mdev nodedev name to retrieve it.
Boris Fiuczynski (3):
tests: correct formating in mdevctl test
tests: adding vfio-ccw to nodedev tests
nodedev: add parent_addr to mdev nodedev dumpxml
docs/schemas/nodedev.rng | 5 ++
src/conf/node_device_conf.c | 2 +
...52_9b13_9b13_9b13_cc23009b1326-create.argv | 5 ++
...52_9b13_9b13_9b13_cc23009b1326-create.json | 1 +
...52_9b13_9b13_9b13_cc23009b1326-define.argv | 5 ++
...52_9b13_9b13_9b13_cc23009b1326-define.json | 1 +
.../mdevctl-list-multiple.json | 56 +++++++++++--------
.../mdevctl-list-multiple.out.xml | 14 +++++
tests/nodedevmdevctltest.c | 31 +++++++++-
...v_cc000052_9b13_9b13_9b13_cc23009b1326.xml | 8 +++
10 files changed, 104 insertions(+), 24 deletions(-)
create mode 100644 tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-create.argv
create mode 100644 tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-create.json
create mode 100644 tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-define.argv
create mode 100644 tests/nodedevmdevctldata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326-define.json
create mode 100644 tests/nodedevschemadata/mdev_cc000052_9b13_9b13_9b13_cc23009b1326.xml
--
2.33.1
2 years, 9 months
[libvirt PATCH 0/4] qemu: make nvram creation more robust and enable recovery
by Daniel P. Berrangé
Daniel P. Berrangé (4):
qemu: do crash safe creation of NVRAM file
include: define constants for resetting NVRAM state
qemu: wire up support for resetting NVRAM
tools: add --reset-nvram arg to several virsh commands
docs/manpages/virsh.rst | 21 ++++++++++++---
include/libvirt/libvirt-domain-snapshot.h | 1 +
include/libvirt/libvirt-domain.h | 2 ++
src/libvirt-domain.c | 16 ++++++++++++
src/qemu/qemu_driver.c | 24 ++++++++++++-----
src/qemu/qemu_process.c | 32 ++++++++++++++++++-----
src/qemu/qemu_process.h | 1 +
src/qemu/qemu_saveimage.c | 9 +++++--
src/qemu/qemu_saveimage.h | 1 +
src/qemu/qemu_snapshot.c | 6 ++++-
tools/virsh-domain.c | 18 +++++++++++++
tools/virsh-snapshot.c | 6 +++++
12 files changed, 117 insertions(+), 20 deletions(-)
--
2.34.1
2 years, 9 months
[PATCH v4 2/4] hw/i386: Attach CPUs to machine
by Philippe Mathieu-Daudé
Previously CPUs were exposed in the QOM tree at a path
/machine/unattached/device[nn]
where the 'nn' of the first CPU is usually zero, but can
vary depending on what devices were already created.
With this change the CPUs are now at
/machine/cpu[nn]
where the 'nn' of the first CPU is always zero.
Note: This (intentionally) breaks compatibility with current
libvirt code that looks for "/machine/unattached/device[0]"
in the assumption it is the first CPU.
Cc: libvir-list(a)redhat.com
Suggested-by: Daniel P. Berrangé <berrange(a)redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange(a)redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug(a)amsat.org>
---
hw/i386/x86.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index b84840a1bb9..50bf249c700 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -108,6 +108,7 @@ void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp)
{
Object *cpu = object_new(MACHINE(x86ms)->cpu_type);
+ object_property_add_child(OBJECT(x86ms), "cpu[*]", OBJECT(cpu));
if (!object_property_set_uint(cpu, "apic-id", apic_id, errp)) {
goto out;
}
--
2.34.1
2 years, 9 months