[PATCH] documentation: untrue statement in GetVersion() method description
by Stepan Zobal
In the end of virConnectGetVersion() description there is written: "not with a Read-Only connection"
which isn't true after I tried virConnectOpenReadOnly() with virConnectGetVersion() and it clearly shows the version correctly.
Signed-off-by: Stepan Zobal <szobal(a)redhat.com>
---
src/libvirt-host.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/libvirt-host.c b/src/libvirt-host.c
index e67b36812e..5030707bbf 100644
--- a/src/libvirt-host.c
+++ b/src/libvirt-host.c
@@ -180,8 +180,7 @@ virConnectGetType(virConnectPtr conn)
* @hvVer: return value for the version of the running hypervisor (OUT)
*
* Get the version level of the Hypervisor running. This may work only with
- * hypervisor call, i.e. with privileged access to the hypervisor, not
- * with a Read-Only connection.
+ * hypervisor call, i.e. with privileged access to the hypervisor.
*
* Returns -1 in case of error, 0 otherwise. if the version can't be
* extracted by lack of capacities returns 0 and @hvVer is 0, otherwise
--
2.46.0
7 months, 4 weeks
[PATCH v2 0/2] Adapt to latest libxml2
by Jakub Palacky
I noticed a couple deprecation errors when trying to build libvirt
with the latest libxml2 version from the master branch. These patches
fix the deprecated fields.
Both functions used are available in the oldest libxml2 version
required by libvirt, so there is no need to bump it.
Changes in v2:
- Save return value of xmlCtxtGetLastError for later use
- Check that xmlCtxtGetLastError doesn't return NULL
Jakub Palacky (2):
util/virxml: use xmlCtxtGetLastError when applicable
vmx: use xmlBufferDetach() when applicable
src/util/virxml.c | 19 ++++++++++---------
src/vmx/vmx.c | 2 +-
2 files changed, 11 insertions(+), 10 deletions(-)
--
2.46.0
7 months, 4 weeks
[PATCH v2] util/virutil: Use readpassphrase when libbsd is available
by Jakub Palacky
When libbsd is available, use the preferred readpassphrase() function isntead of getpass()
as the getpass() function has been marked as obsolete and shouldnt be used
Signed-off-by: Jakub Palacky <jpalacky(a)redhat.com>
---
Changes in v2:
- Fix possible memory leak of g_new0
- Use PASS_MAX for max password length
- Set PASS_MAX to 1024 if not defined
meson.build | 6 ++++++
src/meson.build | 1 +
src/util/virutil.c | 17 +++++++++++++++++
3 files changed, 24 insertions(+)
diff --git a/meson.build b/meson.build
index 297fbfae48..699a65c7e8 100644
--- a/meson.build
+++ b/meson.build
@@ -954,6 +954,11 @@ if blkid_dep.found()
conf.set('WITH_BLKID', 1)
endif
+bsd_dep = dependency('libbsd', required: false)
+if bsd_dep.found()
+ conf.set('WITH_LIBBSD', 1)
+endif
+
capng_dep = dependency('libcap-ng', required: get_option('capng'))
if capng_dep.found()
conf.set('WITH_CAPNG', 1)
@@ -2335,6 +2340,7 @@ libs_summary = {
'dlopen': dlopen_dep.found(),
'fuse': fuse_dep.found(),
'glusterfs': glusterfs_dep.found(),
+ 'libbsd': bsd_dep.found(),
'libiscsi': libiscsi_dep.found(),
'libkvm': libkvm_dep.found(),
'libnbd': libnbd_dep.found(),
diff --git a/src/meson.build b/src/meson.build
index 8cce42c7ad..30ae34646e 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -9,6 +9,7 @@ src_dep = declare_dependency(
dependencies: [
glib_dep,
libxml_dep,
+ bsd_dep,
],
include_directories: [
libvirt_inc,
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 6c89a48e51..bf6008fdfb 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -31,6 +31,10 @@
# include <conio.h>
#endif /* WIN32 */
+#ifdef WITH_LIBBSD
+# include <bsd/readpassphrase.h>
+#endif
+
#ifdef __linux__
# include <sys/sysmacros.h>
#endif
@@ -1773,6 +1777,19 @@ char *virGetPassword(void)
}
return g_string_free(pw, FALSE);
+#elif WITH_LIBBSD /* !WIN32 */
+# ifndef PASS_MAX
+# define PASS_MAX 1024
+# endif
+ char *pass = NULL;
+ g_autofree char *buffer = g_new0(char, PASS_MAX);
+
+ pass = readpassphrase("", buffer, PASS_MAX, 0);
+ if (pass == NULL) {
+ return NULL;
+ }
+
+ return g_steal_pointer(&buffer);
#else /* !WIN32 */
return g_strdup(getpass(""));
#endif /* ! WIN32 */
--
2.46.0
7 months, 4 weeks
[PATCH 0/2] Adapt to latest libxml2
by Jakub Palacky
I noticed a couple deprecation errors when trying to build libvirt
with the latest libxml2 version from the master branch. These patches
fix the deprecated fields.
Both functions used are available in the oldest libxml2 version
required by libvirt, so there is no need to bump it.
Jakub Palacky (2):
util/virxml: use xmlCtxtGetLastError when applicable
vmx: use xmlBufferDetach() when applicable
src/util/virxml.c | 16 ++++++++--------
src/vmx/vmx.c | 2 +-
2 files changed, 9 insertions(+), 9 deletions(-)
--
2.46.0
7 months, 4 weeks
[PATCH] vmx: Allow '*' to appear in VMX file keys
by Richard W.M. Jones
When connecting to a VMware server (eg using vpx://) we download and
try to parse the VMware metadata '*.vmx' file of a guest. In this
case a VMX file was found which contained this key:
pciPassthru*.present = "False"
The '*' character was not previously allowed in keys so this failed to
parse with the error:
VIR_ERR_CONF_SYNTAX: VIR_FROM_CONF: configuration file syntax error:
memory conf:74: expecting an assignment
Resolves: https://issues.redhat.com/browse/RHEL-58446
Thanks: Daniel Berrange
Signed-off-by: Richard W.M. Jones <rjones(a)redhat.com>
---
src/util/virconf.c | 2 +-
tests/vmx2xmldata/esx-in-the-wild-14.vmx | 109 +++++++++++++++++++++++
tests/vmx2xmldata/esx-in-the-wild-14.xml | 35 ++++++++
tests/vmx2xmltest.c | 1 +
4 files changed, 146 insertions(+), 1 deletion(-)
diff --git a/src/util/virconf.c b/src/util/virconf.c
index 66b3e0482e..c820c94037 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -553,7 +553,7 @@ virConfParseName(virConfParserCtxt *ctxt)
while ((ctxt->cur < ctxt->end) &&
(g_ascii_isalnum(CUR) || (CUR == '_') ||
((ctxt->conf->flags & VIR_CONF_FLAG_VMX_FORMAT) &&
- ((CUR == ':') || (CUR == '.') || (CUR == '-'))) ||
+ ((CUR == ':') || (CUR == '.') || (CUR == '-') || (CUR == '*'))) ||
((ctxt->conf->flags & VIR_CONF_FLAG_LXC_FORMAT) &&
(CUR == '.'))))
NEXT;
diff --git a/tests/vmx2xmldata/esx-in-the-wild-14.vmx b/tests/vmx2xmldata/esx-in-the-wild-14.vmx
new file mode 100644
index 0000000000..1b06352348
--- /dev/null
+++ b/tests/vmx2xmldata/esx-in-the-wild-14.vmx
@@ -0,0 +1,109 @@
+.encoding = "UTF-8"
+displayName = "wild14"
+config.version = "8"
+virtualHW.version = "19"
+nvram = "wild14.nvram"
+pciBridge0.present = "TRUE"
+svga.present = "TRUE"
+pciBridge4.present = "TRUE"
+pciBridge4.virtualDev = "pcieRootPort"
+pciBridge4.functions = "8"
+pciBridge5.present = "TRUE"
+pciBridge5.virtualDev = "pcieRootPort"
+pciBridge5.functions = "8"
+pciBridge6.present = "TRUE"
+pciBridge6.virtualDev = "pcieRootPort"
+pciBridge6.functions = "8"
+pciBridge7.present = "TRUE"
+pciBridge7.virtualDev = "pcieRootPort"
+pciBridge7.functions = "8"
+vmci0.present = "TRUE"
+hpet0.present = "TRUE"
+numvcpus = "12"
+memSize = "32768"
+vm.createDate = "1661219530463754"
+scsi0.virtualDev = "pvscsi"
+scsi0.present = "TRUE"
+annotation = "execution env sandbox automation platform"
+guestOS = "rhel7-64"
+uuid.bios = "42 1b 22 3a f2 c1 c7 c9-a3 99 34 d2 d9 fd e2 6d"
+vc.uuid = "50 1b 83 1e 75 d8 15 f8-36 fa b9 e2 25 f3 95 aa"
+migrate.hostLog = "wild14.hlog"
+disk.EnableUUID = "true"
+guestinfo.Vrm.Server.Host = "wild14.local"
+numa.autosize.cookie = "120012"
+numa.autosize.vcpu.maxPerVirtualNode = "12"
+sched.swap.derivedName = "/vmfs/volumes/64e4b8e0/wild/wild14.vswp"
+pciBridge0.pciSlotNumber = "17"
+pciBridge4.pciSlotNumber = "21"
+pciBridge5.pciSlotNumber = "22"
+pciBridge6.pciSlotNumber = "23"
+pciBridge7.pciSlotNumber = "24"
+scsi0.pciSlotNumber = "160"
+vmci0.pciSlotNumber = "32"
+scsi0.sasWWID = "50 05 05 6a f2 c1 c7 c0"
+vmci0.id = "-637672851"
+svga.vramSize = "8388608"
+monitor.phys_bits_used = "45"
+vmotion.checkpointFBSize = "8388608"
+vmotion.checkpointSVGAPrimarySize = "8388608"
+softPowerOff = "FALSE"
+svga.guestBackedPrimaryAware = "TRUE"
+tools.syncTime = "FALSE"
+guestOS.detailed.data = "architecture='X86' bitness='64' distroName='Red Hat Enterprise Linux' distroVersion='8.8' familyName='Linux' kernelVersion='4.18.0-477.21.1.el8_8.x86_64' prettyName='Red Hat Enterprise Linux 8.8 (Ootpa)'"
+tools.remindInstall = "TRUE"
+config.readOnly = "FALSE"
+guestInfo.detailed.data = "architecture='X86' bitness='64' cpeString='cpe:/o:redhat:enterprise_linux:8::baseos' distroAddlVersion='8.10 (Ootpa)' distroName='Red Hat Enterprise Linux' distroVersion='8.10' familyName='Linux' kernelVersion='4.18.0-553.8.1.el8_10.x86_64' prettyName='Red Hat Enterprise Linux 8.10 (Ootpa)'"
+log.keepOld = "10"
+tools.setInfo.sizeLimit = "1048576"
+RemoteDisplay.maxConnections = "1"
+isolation.tools.diskWiper.disable = "True"
+isolation.tools.vmxDnDVersionGet.disable = "True"
+isolation.tools.copy.disable = "true"
+isolation.device.connectable.disable = "True"
+tools.guestlib.enableHostInfo = "False"
+isolation.device.edit.disable = "True"
+isolation.tools.setGUIOptions.enable = "False"
+pciPassthru*.present = "False"
+isolation.tools.dnd.disable = "true"
+log.rotateSize = "1024000"
+isolation.tools.paste.disable = "True"
+isolation.tools.diskShrink.disable = "True"
+time.synchronize.restore = "False"
+time.synchronize.resume.disk = "False"
+time.synchronize.tools.startup = "False"
+time.synchronize.continue = "False"
+time.synchronize.shrink = "False"
+time.synchronize.tools.enable = "False"
+mks.enable3d = "False"
+time.synchronize.resume.host = "False"
+ethernet0.addressType = "static"
+ethernet0.pciSlotNumber = "192"
+ethernet0.present = "TRUE"
+ethernet0.uptCompatibility = "TRUE"
+ethernet0.virtualDev = "vmxnet3"
+floppy0.present = "FALSE"
+ide0:0.deviceType = "atapi-cdrom"
+ide0:0.present = "TRUE"
+ide0:0.startConnected = "FALSE"
+ethernet0.opaqueNetwork.id = "a2636d32-fc15-469f-b3b4-f8193fefd097"
+ethernet0.opaqueNetwork.type = "nsx.LogicalSwitch"
+ethernet0.address = "00:00:00:00:00:00"
+vmotion.svga.mobMaxSize = "8388608"
+vmotion.svga.graphicsMemoryKB = "8192"
+scsi0:0.deviceType = "scsi-hardDisk"
+scsi0:0.fileName = "wild1.vmdk"
+sched.scsi0:0.shares = "normal"
+sched.scsi0:0.throughputCap = "off"
+scsi0:0.present = "TRUE"
+scsi0:1.deviceType = "scsi-hardDisk"
+scsi0:1.fileName = "wild2.vmdk"
+sched.scsi0:1.shares = "normal"
+sched.scsi0:1.throughputCap = "off"
+scsi0:1.present = "TRUE"
+bios.bootDelay = "10000"
+scsi0:1.redo = ""
+scsi0:0.redo = ""
+ide0:0.fileName = "emptyBackingString"
+ide0:0.clientDevice = "TRUE"
+cleanShutdown = "FALSE"
diff --git a/tests/vmx2xmldata/esx-in-the-wild-14.xml b/tests/vmx2xmldata/esx-in-the-wild-14.xml
new file mode 100644
index 0000000000..dd5c2434ee
--- /dev/null
+++ b/tests/vmx2xmldata/esx-in-the-wild-14.xml
@@ -0,0 +1,35 @@
+<domain type='vmware'>
+ <name>wild14</name>
+ <uuid>421b223a-f2c1-c7c9-a399-34d2d9fde26d</uuid>
+ <description>execution env sandbox automation platform</description>
+ <memory unit='KiB'>33554432</memory>
+ <currentMemory unit='KiB'>33554432</currentMemory>
+ <vcpu placement='static'>12</vcpu>
+ <os>
+ <type arch='x86_64'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <source file='[datastore] directory/wild1.vmdk'/>
+ <target dev='sda' bus='scsi'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <source file='[datastore] directory/wild2.vmdk'/>
+ <target dev='sdb' bus='scsi'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='1'/>
+ </disk>
+ <controller type='scsi' index='0' model='vmpvscsi'/>
+ <interface type='null'>
+ <mac address='00:00:00:00:00:00' type='static'/>
+ <model type='vmxnet3'/>
+ </interface>
+ <video>
+ <model type='vmvga' vram='8192' primary='yes'/>
+ </video>
+ </devices>
+</domain>
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index 0fb5f13f72..3ca9541000 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -264,6 +264,7 @@ mymain(void)
DO_TEST("esx-in-the-wild-11");
DO_TEST("esx-in-the-wild-12");
DO_TEST("esx-in-the-wild-13");
+ DO_TEST("esx-in-the-wild-14");
DO_TEST("gsx-in-the-wild-1");
DO_TEST("gsx-in-the-wild-2");
--
2.46.0
7 months, 4 weeks
[PATCH] Allow apparmor parser to be executed in /usr/bin
by Andrea Bolognani
From: Tom <libvirt-patch(a)douile.com>
This commit modifies the AppArmor profile for virt-aa-helper to
accommodate an observed behavior in certain Linux distributions,
such as ArchLinux.
In these distributions, /usr/sbin symlinks to /usr/bin. To ensure
that virt-aa-helper can execute apparmor_parser when it resides
in /usr/bin, the profile has been updated accordingly.
Signed-off-by: Tom <libvirt-patch(a)douile.com>
Reviewed-by: Andrea Bolognani <abologna(a)redhat.com>
---
https://gitlab.com/libvirt/libvirt/-/merge_requests/373
Pushed.
src/security/apparmor/usr.lib.libvirt.virt-aa-helper.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/security/apparmor/usr.lib.libvirt.virt-aa-helper.in b/src/security/apparmor/usr.lib.libvirt.virt-aa-helper.in
index 26ee20a17d..44645c6989 100644
--- a/src/security/apparmor/usr.lib.libvirt.virt-aa-helper.in
+++ b/src/security/apparmor/usr.lib.libvirt.virt-aa-helper.in
@@ -41,7 +41,7 @@ profile virt-aa-helper @libexecdir@/virt-aa-helper {
deny /dev/mapper/* r,
@libexecdir@/virt-aa-helper mr,
- /{usr/,}sbin/apparmor_parser Ux,
+ /{usr/,}{s,}bin/apparmor_parser Ux,
@sysconfdir(a)/apparmor.d/libvirt/* r,
@sysconfdir@/apparmor.d/libvirt/libvirt-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]* rw,
--
2.46.0
7 months, 4 weeks
[PATCH] util/virutil: Use readpassphrase when libbsd is available
by Jakub Palacky
When libbsd is available, use the preferred readpassphrase() function isntead of getpass()
as the getpass() function has been marked as obsolete and shouldnt be used
Signed-off-by: Jakub Palacky <jpalacky(a)redhat.com>
---
meson.build | 6 ++++++
src/meson.build | 1 +
src/util/virutil.c | 6 ++++++
3 files changed, 13 insertions(+)
diff --git a/meson.build b/meson.build
index 297fbfae48..699a65c7e8 100644
--- a/meson.build
+++ b/meson.build
@@ -954,6 +954,11 @@ if blkid_dep.found()
conf.set('WITH_BLKID', 1)
endif
+bsd_dep = dependency('libbsd', required: false)
+if bsd_dep.found()
+ conf.set('WITH_LIBBSD', 1)
+endif
+
capng_dep = dependency('libcap-ng', required: get_option('capng'))
if capng_dep.found()
conf.set('WITH_CAPNG', 1)
@@ -2335,6 +2340,7 @@ libs_summary = {
'dlopen': dlopen_dep.found(),
'fuse': fuse_dep.found(),
'glusterfs': glusterfs_dep.found(),
+ 'libbsd': bsd_dep.found(),
'libiscsi': libiscsi_dep.found(),
'libkvm': libkvm_dep.found(),
'libnbd': libnbd_dep.found(),
diff --git a/src/meson.build b/src/meson.build
index 8cce42c7ad..30ae34646e 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -9,6 +9,7 @@ src_dep = declare_dependency(
dependencies: [
glib_dep,
libxml_dep,
+ bsd_dep,
],
include_directories: [
libvirt_inc,
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 6c89a48e51..2e07372198 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -31,6 +31,10 @@
# include <conio.h>
#endif /* WIN32 */
+#ifdef WITH_LIBBSD
+# include <bsd/readpassphrase.h>
+#endif
+
#ifdef __linux__
# include <sys/sysmacros.h>
#endif
@@ -1773,6 +1777,8 @@ char *virGetPassword(void)
}
return g_string_free(pw, FALSE);
+#elif WITH_LIBBSD /* !WIN32 */
+ return readpassphrase("", g_new0(char, 1024), 1024, 0);
#else /* !WIN32 */
return g_strdup(getpass(""));
#endif /* ! WIN32 */
--
2.46.0
8 months
[PATCH v2 00/10] Maintainer updates (testing, gdbstub) pre-PR
by Alex Bennée
Hi,
Testing
I've updated a number of the docker containers to deal with breakages
in the crossdev environments as bullseye moves to LTS. I've dropped
the armel environment which doesn't really add much to the armhf cross
build we have that works. i686 and mipsel cross containers are bumped
up to bookworm. Currently mips64el is still broken.
gdbstub
This brings in Gustavo's patches to support MTE for system mode
expanding on the previously implemented user mode support.
plugins
I've dropped the TCG plugins from the series so as not to make the
pull request too large. I'll roll a new series once I've sent the PR
for this.
Changes
- moved mips64le TCG tests to use the debian-all-test-cross
- fixed some --disable-tcg failures for the MTE patches
The following still need review:
tests/docker: use debian-all-test-cross for mips64el tests
Alex Bennée (5):
tests/docker: remove debian-armel-cross
tests/docker: update debian i686 and mipsel images to bookworm
tests/docker: use debian-all-test-cross for mips64el tests
docs/devel: fix duplicate line
scripts/ci: update the gitlab-runner playbook
Gustavo Romero (5):
gdbstub: Use specific MMU index when probing MTE addresses
gdbstub: Add support for MTE in system mode
tests/guest-debug: Support passing arguments to the GDB test script
tests/tcg/aarch64: Improve linker script organization
tests/tcg/aarch64: Extend MTE gdbstub tests to system mode
docs/devel/testing/main.rst | 6 -
configure | 7 +-
target/arm/gdbstub64.c | 23 ++-
.gitlab-ci.d/container-cross.yml | 6 -
.gitlab-ci.d/crossbuilds.yml | 7 -
scripts/ci/setup/gitlab-runner.yml | 39 +++-
.../dockerfiles/debian-armel-cross.docker | 179 ------------------
.../dockerfiles/debian-i686-cross.docker | 10 +-
.../dockerfiles/debian-mipsel-cross.docker | 10 +-
tests/guest-debug/run-test.py | 6 +
tests/guest-debug/test_gdbstub.py | 5 +
tests/lcitool/refresh | 10 +-
tests/tcg/aarch64/Makefile.softmmu-target | 49 ++++-
tests/tcg/aarch64/Makefile.target | 3 +-
tests/tcg/aarch64/gdbstub/test-mte.py | 71 ++++---
tests/tcg/aarch64/system/boot.S | 11 ++
tests/tcg/aarch64/system/kernel.ld | 33 ++--
tests/tcg/aarch64/system/mte.S | 109 +++++++++++
18 files changed, 310 insertions(+), 274 deletions(-)
delete mode 100644 tests/docker/dockerfiles/debian-armel-cross.docker
create mode 100644 tests/tcg/aarch64/system/mte.S
--
2.39.2
8 months
[PATCH] ch: Enable callbacks for ch domain events
by Praveen K Paladugu
From: Praveen K Paladugu <prapal(a)linux.microsoft.com>
Enable callbacks for define, undefine, started, booted, stopped,
destroyed events of ch guests.
Signed-off-by: Praveen K Paladugu <praveenkpaladugu(a)gmail.com>
---
src/ch/ch_conf.h | 4 +++
src/ch/ch_driver.c | 81 ++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 83 insertions(+), 2 deletions(-)
diff --git a/src/ch/ch_conf.h b/src/ch/ch_conf.h
index a77cad7a2a..97c6c24aa5 100644
--- a/src/ch/ch_conf.h
+++ b/src/ch/ch_conf.h
@@ -24,6 +24,7 @@
#include "virthread.h"
#include "ch_capabilities.h"
#include "virebtables.h"
+#include "object_event.h"
#define CH_DRIVER_NAME "CH"
#define CH_CMD "cloud-hypervisor"
@@ -75,6 +76,9 @@ struct _virCHDriver
* then lockless thereafter */
virCHDriverConfig *config;
+ /* Immutable pointer, self-locking APIs */
+ virObjectEventState *domainEventState;
+
/* pid file FD, ensures two copies of the driver can't use the same root */
int lockFD;
diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index dab025edc1..407479b8ab 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -28,6 +28,7 @@
#include "ch_monitor.h"
#include "ch_process.h"
#include "domain_cgroup.h"
+#include "domain_event.h"
#include "datatypes.h"
#include "driver.h"
#include "viraccessapicheck.h"
@@ -263,6 +264,7 @@ chDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
virCHDriver *driver = dom->conn->privateData;
virDomainObj *vm;
virCHDomainObjPrivate *priv;
+ virObjectEvent *event;
g_autofree char *managed_save_path = NULL;
int ret = -1;
@@ -304,6 +306,14 @@ chDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
ret = virCHProcessStart(driver, vm, VIR_DOMAIN_RUNNING_BOOTED);
}
+ if (ret == 0) {
+ event = virDomainEventLifecycleNewFromObj(vm,
+ VIR_DOMAIN_EVENT_STARTED,
+ VIR_DOMAIN_EVENT_STARTED_BOOTED);
+ if (event)
+ virObjectEventStateQueue(driver->domainEventState, event);
+ }
+
endjob:
virDomainObjEndJob(vm);
@@ -323,8 +333,10 @@ chDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
{
virCHDriver *driver = conn->privateData;
g_autoptr(virDomainDef) vmdef = NULL;
+ g_autoptr(virDomainDef) oldDef = NULL;
virDomainObj *vm = NULL;
virDomainPtr dom = NULL;
+ virObjectEvent *event = NULL;
g_autofree char *managed_save_path = NULL;
unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
@@ -345,7 +357,7 @@ chDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
if (!(vm = virDomainObjListAdd(driver->domains, &vmdef,
driver->xmlopt,
- 0, NULL)))
+ 0, &oldDef)))
goto cleanup;
/* cleanup if there's any stale managedsave dir */
@@ -358,11 +370,17 @@ chDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
}
vm->persistent = 1;
-
+ event = virDomainEventLifecycleNewFromObj(vm,
+ VIR_DOMAIN_EVENT_DEFINED,
+ !oldDef ?
+ VIR_DOMAIN_EVENT_DEFINED_ADDED :
+ VIR_DOMAIN_EVENT_DEFINED_UPDATED);
dom = virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id);
cleanup:
virDomainObjEndAPI(&vm);
+ virObjectEventStateQueue(driver->domainEventState, event);
+
return dom;
}
@@ -378,6 +396,7 @@ chDomainUndefineFlags(virDomainPtr dom,
{
virCHDriver *driver = dom->conn->privateData;
virDomainObj *vm;
+ virObjectEvent *event = NULL;
int ret = -1;
virCheckFlags(0, -1);
@@ -393,6 +412,9 @@ chDomainUndefineFlags(virDomainPtr dom,
"%s", _("Cannot undefine transient domain"));
goto cleanup;
}
+ event = virDomainEventLifecycleNewFromObj(vm,
+ VIR_DOMAIN_EVENT_UNDEFINED,
+ VIR_DOMAIN_EVENT_UNDEFINED_REMOVED);
vm->persistent = 0;
if (!virDomainObjIsActive(vm)) {
@@ -403,6 +425,8 @@ chDomainUndefineFlags(virDomainPtr dom,
cleanup:
virDomainObjEndAPI(&vm);
+ virObjectEventStateQueue(driver->domainEventState, event);
+
return ret;
}
@@ -643,6 +667,7 @@ chDomainDestroyFlags(virDomainPtr dom, unsigned int flags)
{
virCHDriver *driver = dom->conn->privateData;
virDomainObj *vm;
+ virObjectEvent *event = NULL;
int ret = -1;
virCheckFlags(0, -1);
@@ -662,6 +687,9 @@ chDomainDestroyFlags(virDomainPtr dom, unsigned int flags)
if (virCHProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED) < 0)
goto endjob;
+ event = virDomainEventLifecycleNewFromObj(vm,
+ VIR_DOMAIN_EVENT_STOPPED,
+ VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
virCHDomainRemoveInactive(driver, vm);
ret = 0;
@@ -670,6 +698,8 @@ chDomainDestroyFlags(virDomainPtr dom, unsigned int flags)
cleanup:
virDomainObjEndAPI(&vm);
+ virObjectEventStateQueue(driver->domainEventState, event);
+
return ret;
}
@@ -1365,6 +1395,7 @@ static int chStateCleanup(void)
virObjectUnref(ch_driver->xmlopt);
virObjectUnref(ch_driver->caps);
virObjectUnref(ch_driver->domains);
+ virObjectUnref(ch_driver->domainEventState);
virMutexDestroy(&ch_driver->lock);
g_clear_pointer(&ch_driver, g_free);
@@ -1414,6 +1445,9 @@ chStateInitialize(bool privileged,
if (!(ch_driver->config = virCHDriverConfigNew(privileged)))
goto cleanup;
+ if (!(ch_driver->domainEventState = virObjectEventStateNew()))
+ goto cleanup;
+
if ((rv = chExtractVersion(ch_driver)) < 0) {
if (rv == -2)
ret = VIR_DRV_STATE_INIT_SKIPPED;
@@ -2205,6 +2239,47 @@ chDomainSetNumaParameters(virDomainPtr dom,
return ret;
}
+static int
+chConnectDomainEventRegisterAny(virConnectPtr conn,
+ virDomainPtr dom,
+ int eventID,
+ virConnectDomainEventGenericCallback callback,
+ void *opaque,
+ virFreeCallback freecb)
+{
+ virCHDriver *driver = conn->privateData;
+
+ if (virConnectDomainEventRegisterAnyEnsureACL(conn) < 0)
+ return -1;
+
+ if (virDomainEventStateRegisterID(conn,
+ driver->domainEventState,
+ dom, eventID,
+ callback, opaque, freecb, &ret) < 0)
+ return -1;
+
+ return 0;
+}
+
+
+static int
+chConnectDomainEventDeregisterAny(virConnectPtr conn,
+ int callbackID)
+{
+ virCHDriver *driver = conn->privateData;
+
+ if (virConnectDomainEventDeregisterAnyEnsureACL(conn) < 0)
+ return -1;
+
+ if (virObjectEventStateDeregisterID(conn,
+ driver->domainEventState,
+ callbackID, true) < 0)
+ return -1;
+
+ return 0;
+}
+
+
/* Function Tables */
static virHypervisorDriver chHypervisorDriver = {
.name = "CH",
@@ -2262,6 +2337,8 @@ static virHypervisorDriver chHypervisorDriver = {
.domainHasManagedSaveImage = chDomainHasManagedSaveImage, /* 10.2.0 */
.domainRestore = chDomainRestore, /* 10.2.0 */
.domainRestoreFlags = chDomainRestoreFlags, /* 10.2.0 */
+ .connectDomainEventRegisterAny = chConnectDomainEventRegisterAny, /* 10.8.0 */
+ .connectDomainEventDeregisterAny = chConnectDomainEventDeregisterAny, /* 10.8.0 */
};
static virConnectDriver chConnectDriver = {
--
2.44.0
8 months
[PATCH 00/26] Maintainer updates (testing, gdbstub, plugins)
by Alex Bennée
Hi,
Here is the current state of my maintainer trees.
Testing
I've updated a number of the docker containers to deal with breakages
in the crossdev environments as bullseye moves to LTS. I've dropped
the armel environment which doesn't really add much to the armhf cross
build we have that works. i686 and mipsel cross containers are bumped
up to bookworm. Currently mips64el is still broken.
gdbstub
This brings in Gustavo's patches to support MTE for system mode
expanding on the previously implemented user mode support.
plugins
I start by deprecating some options that don't make much sense for
instrumentation including 32 bit and TCI support. They will still work
but there are caveats and it doesn't seem worth wasting CI time
keeping track of them.
There are a couple of new plugins including some useful analysis ones.
The bbv plugin can generate files that can be fed into simpoint. The
cflow plugin I've posted before separately but takes advantage of the
new conditional and store helpers to try and be more efficient tracing
control flow.
Finally there is not one but two memory APIs. Pierrick's updates to
the main memory instrumentation now makes values available to the
plugins and should be used if you absolutely want to track what value
was read or stored. I've added a softmmu test case building on
memory.c and I'll merge the updated linux-user test case once its been
re-spun.
Rowan's API provides a more direct access through the existing debug
API but comes with the caveats that it should only used on memory you
don't expect to be changing. The example provided allows for the
contents of syscalls to be probed at the syscall point.
Finally there is a RFC for a gdbstub hook which I mostly wrote while I
was debugging weirdness in the memory stuff. I'll probably drop it
before the PR and let it cook a bit more on plugins/next.
The following still need review:
plugins: add ability to register a GDB triggered callback
util/timer: avoid deadlock when shutting down
tests/tcg: add a system test to check memory instrumentation
tests/tcg: only read/write 64 bit words on 64 bit systems
tests/tcg: clean up output of memory system test
contrib/plugins: control flow plugin
deprecation: don't enable TCG plugins by default with TCI
deprecation: don't enable TCG plugins by default on 32 bit hosts
scripts/ci: update the gitlab-runner playbook
docs/devel: fix duplicate line
tests/docker: update debian i686 and mipsel images to bookworm
tests/docker: remove debian-armel-cross
Akihiko Odaki (1):
contrib/plugins: Add a plugin to generate basic block vectors
Alex Bennée (12):
tests/docker: remove debian-armel-cross
tests/docker: update debian i686 and mipsel images to bookworm
docs/devel: fix duplicate line
scripts/ci: update the gitlab-runner playbook
deprecation: don't enable TCG plugins by default on 32 bit hosts
deprecation: don't enable TCG plugins by default with TCI
contrib/plugins: control flow plugin
tests/tcg: clean up output of memory system test
tests/tcg: only read/write 64 bit words on 64 bit systems
tests/tcg: add a system test to check memory instrumentation
util/timer: avoid deadlock when shutting down
plugins: add ability to register a GDB triggered callback
Gustavo Romero (5):
gdbstub: Use specific MMU index when probing MTE addresses
gdbstub: Add support for MTE in system mode
tests/guest-debug: Support passing arguments to the GDB test script
tests/tcg/aarch64: Improve linker script organization
tests/tcg/aarch64: Extend MTE gdbstub tests to system mode
Pierrick Bouvier (5):
plugins: save value during memory accesses
plugins: extend API to get latest memory value accessed
tests/tcg: add mechanism to run specific tests with plugins
tests/tcg: allow to check output of plugins
tests/plugin/mem: add option to print memory accesses
Rowan Hart (2):
plugins: add plugin API to read guest memory
plugins: add option to dump write argument to syscall plugin
Thomas Huth (1):
contrib/plugins/Makefile: Add a 'distclean' target
docs/about/deprecated.rst | 19 +
docs/about/emulation.rst | 44 +-
docs/devel/testing/main.rst | 6 -
configure | 37 +-
accel/tcg/atomic_template.h | 66 ++-
include/hw/core/cpu.h | 4 +
include/qemu/plugin-event.h | 1 +
include/qemu/plugin.h | 4 +
include/qemu/qemu-plugin.h | 80 +++-
plugins/plugin.h | 9 +
contrib/plugins/bbv.c | 158 +++++++
contrib/plugins/cflow.c | 413 ++++++++++++++++++
plugins/api.c | 71 +++
plugins/core.c | 43 ++
target/arm/gdbstub64.c | 21 +-
tcg/tcg-op-ldst.c | 66 ++-
tests/tcg/multiarch/system/memory.c | 123 ++++--
tests/tcg/plugins/mem.c | 254 ++++++++++-
tests/tcg/plugins/syscall.c | 117 +++++
util/qemu-timer.c | 14 +-
accel/tcg/atomic_common.c.inc | 13 +-
accel/tcg/ldst_common.c.inc | 38 +-
.gitlab-ci.d/buildtest.yml | 2 +
.gitlab-ci.d/container-cross.yml | 6 -
.gitlab-ci.d/crossbuilds.yml | 7 -
contrib/plugins/Makefile | 4 +-
plugins/qemu-plugins.symbols | 3 +
scripts/ci/setup/gitlab-runner.yml | 39 +-
.../dockerfiles/debian-armel-cross.docker | 179 --------
.../dockerfiles/debian-i686-cross.docker | 10 +-
.../dockerfiles/debian-mipsel-cross.docker | 10 +-
tests/guest-debug/run-test.py | 6 +
tests/guest-debug/test_gdbstub.py | 5 +
tests/lcitool/refresh | 10 +-
tests/tcg/Makefile.target | 12 +-
tests/tcg/aarch64/Makefile.softmmu-target | 49 ++-
tests/tcg/aarch64/Makefile.target | 3 +-
tests/tcg/aarch64/gdbstub/test-mte.py | 71 ++-
tests/tcg/aarch64/system/boot.S | 11 +
tests/tcg/aarch64/system/kernel.ld | 33 +-
tests/tcg/aarch64/system/mte.S | 109 +++++
tests/tcg/alpha/Makefile.softmmu-target | 2 +-
.../multiarch/system/Makefile.softmmu-target | 6 +
.../system/validate-memory-counts.py | 115 +++++
44 files changed, 1935 insertions(+), 358 deletions(-)
create mode 100644 contrib/plugins/bbv.c
create mode 100644 contrib/plugins/cflow.c
delete mode 100644 tests/docker/dockerfiles/debian-armel-cross.docker
create mode 100644 tests/tcg/aarch64/system/mte.S
create mode 100755 tests/tcg/multiarch/system/validate-memory-counts.py
--
2.39.2
8 months