[PATCH] ci: regenerate with 'lcitool manifest'

2025-09-22 Thread Michal Privoznik via Devel
From: Michal Privoznik This pulls in the fix for generating ENV vars in Dockerfile according to latest standard. Signed-off-by: Michal Privoznik --- ci/containers/almalinux-9.Dockerfile | 10 +- ci/containers/alpine-322.Dockerfile| 10 +- ci/contai

[PATCH 2/4] ch: Make sure the cloud-hypervisor process is killed in virCHProcessStop()

2025-09-20 Thread Michal Privoznik via Devel
From: Michal Privoznik Currently, virCHProcessStop() is called either when the cloud-hypervisor process dies gracefully (e.g. on shutdown initiated from within the guest) or when virDomainDestroy() is called (or on failed start attempt, but that's not important right now). At any rate, if the cl

[PATCH 3/4] ch: Introduce flags to virCHProcessStop()

2025-09-20 Thread Michal Privoznik via Devel
From: Michal Privoznik A caller (e.g. chDomainDestroyFlags()) might want to chose whether to kill emulator process forcefully or gracefully (the @force argument of virProcessKillPainfully()). Invent a flag to virCHProcessStop() for this. And to keep consistent behaviour, pass the flag everywhere

[PATCH 1/2] ch: Avoid memory leak in virCHProcessEvents()

2025-09-20 Thread Michal Privoznik via Devel
From: Michal Privoznik The aim of virCHProcessEvents() is to read data (in JSON format) from CH monitor and then process them. To parse incoming data virJSONValueFromString() is used. But the corresponding virJSONValue is freed only when processing of an even succeeds. If processing an event fail

[PATCH 2/4] ch: Drop deadcode from chDomainDetachDeviceLive()

2025-09-18 Thread Michal Privoznik via Devel
From: Michal Privoznik At the end of chDomainDetachDeviceLive() there's a code that tries to remove the disk that's being detached from the domain definition. Well, it's a leftover from the original patch which I forgot to remove when rewriting it to use chDomainRemoveDevice(). The disk is remove

[PATCH 1/4] virprocess: Report errno if virProcessAbort() fails

2025-09-15 Thread Michal Privoznik via Devel
From: Michal Privoznik The aim of virProcessAbort() is to reap a child process. It does so by waitpid()-ing and possibly sending SIGTERM/SIGKILL to the child process (and waitpid()-ing again). Nevertheless, if everything fails a debug message is printed. But the message mentions only the PID and

[PATCH 3/5] ch: Propagate lifecycle events

2025-09-12 Thread Michal Privoznik via Devel
From: Michal Privoznik We already have a thread that listens on cloud-hypervisor's monitor for incoming events and processes them. What is missing though, is emitting of corresponding lifecycle events. Signed-off-by: Michal Privoznik --- src/ch/ch_events.c | 55

[PATCH 1/5] ch: Emit event on device attach

2025-09-12 Thread Michal Privoznik via Devel
From: Michal Privoznik When a device is attached to a running guest we ought to emit the VIR_DOMAIN_EVENT_ID_DEVICE_ADDED event. Signed-off-by: Michal Privoznik --- src/ch/ch_hotplug.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/ch/ch_hotplug.c b

[PATCH 2/5] ch: Emit event on device attach

2025-09-12 Thread Michal Privoznik via Devel
From: Michal Privoznik When a device is detached from a running guest we ought to emit the VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED event. Signed-off-by: Michal Privoznik --- src/ch/ch_hotplug.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ch/ch_hotplug.c

[PATCH 5/5] ch: Implement virConnectDomainEventDeregister()

2025-09-12 Thread Michal Privoznik via Devel
From: Michal Privoznik Signed-off-by: Michal Privoznik --- src/ch/ch_driver.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index d16e2ed3aa..ad13306c4c 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -2455,6 +2455,2

[PATCH 4/5] ch: Implement virConnectDomainEventRegister()

2025-09-12 Thread Michal Privoznik via Devel
From: Michal Privoznik Signed-off-by: Michal Privoznik --- src/ch/ch_driver.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index 0a516f3384..d16e2ed3aa 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -2434,6 +243

[PATCH 0/5] ch: Emit more events

2025-09-12 Thread Michal Privoznik via Devel
*** BLURB HERE *** Michal Prívozník (5): ch: Emit event on device attach ch: Emit event on device attach ch: Propagate lifecycle events ch: Implement virConnectDomainEventRegister() ch: Implement virConnectDomainEventDeregister() src/ch/ch_driver.c | 41 +++

[PATCH 4/4] ch: Implement VIR_DOMAIN_DESTROY_GRACEFUL flag support

2025-09-11 Thread Michal Privoznik via Devel
From: Michal Privoznik The virDomainDestroyFlags() API has several flags, including VIR_DOMAIN_DESTROY_GRACEFUL which is documented to send only SIGTERM to the emulator process. Implement its support into CH driver. Signed-off-by: Michal Privoznik --- src/ch/ch_driver.c | 9 ++--- 1 file c

[PATCH 0/2] ch: Two simple fixes

2025-09-11 Thread Michal Privoznik via Devel
While working on emitting more events from the CH driver and playing with cloud-hypervisor itself, I've noticed one memleak and one forgotten call to unlock. Michal Prívozník (2): ch: Avoid memory leak in virCHProcessEvents() ch: Unlock domain in virCHEventStopProcess() on all exit paths src

[PATCH 2/2] ch: Unlock domain in virCHEventStopProcess() on all exit paths

2025-09-11 Thread Michal Privoznik via Devel
From: Michal Privoznik The aim of virCHEventStopProcess() is to clean up after stopped domain by calling virCHProcessStop(). But in order to do that it needs to acquire a job and in order to do that it needs to lock the domain object. Well, the object is not unlocked in all exit paths, i.e. when

[PATCH 0/4] ch: Disk attach/detach fixes

2025-09-10 Thread Michal Privoznik via Devel
While reviewing Stefan patches [1] I've changed some of them before merging and oopsie, I've introduced a bug (patch 1/4) but fortunately forgot to remove the code I intended to move so it actually works :-D. 1: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/HAZRW5NYFJFBG

[PATCH 4/4] ch: Avoid memleak on disk detach in chDomainRemoveDevice()

2025-09-10 Thread Michal Privoznik via Devel
From: Michal Privoznik The aim of chDomainRemoveDevice() is to remove device from virDomainDef. Well, in case of disks this is done by calling virDomainDiskRemove() which merely just removes it from the array of virDomainDiskDef-s but leaves it up to the caller to actually free the disk def. 1,2

[PATCH 3/4] ch: Drop useless variable in chDomainFindDisk()

2025-09-10 Thread Michal Privoznik via Devel
From: Michal Privoznik The 'disk' variable inside of chDomainFindDisk() is not used really. Drop it. Signed-off-by: Michal Privoznik --- src/ch/ch_hotplug.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ch/ch_hotplug.c b/src/ch/ch_hotplug.c index aa723dd123..cfa11cc

[PATCH 1/4] ch: Actually remove device in chDomainDetachDeviceLive()

2025-09-10 Thread Michal Privoznik via Devel
From: Michal Privoznik Inside of chDomainDetachDeviceLive() there are two variables that are important in this case: 'match' and 'detach'. The first one contains device definition as parsed from user provided XML, the other contains pointer to the device definition inside virDomainDef (as returne

[PATCH] ch: Avoid memleak in virCHDriverConfigDispose()

2025-09-10 Thread Michal Privoznik via Devel
From: Michal Privoznik When virCHDriverConfig struct is initialized in virCHDriverConfigNew() the 'configDir' member is allocated but corresponding free is missing in virCHDriverConfigDispose(). While at it, reorder the free calls to match the order in which they are declared in the struct so it'

[PATCH 0/4] ch: Improve domain destroy

2025-09-09 Thread Michal Privoznik via Devel
*** BLURB HERE *** Michal Prívozník (4): virprocess: Report errno if virProcessAbort() fails ch: Make sure the cloud-hypervisor process is killed in virCHProcessStop() ch: Introduce flags to virCHProcessStop() ch: Implement VIR_DOMAIN_DESTROY_GRACEFUL flag support src/ch/ch_driver.c

[PATCH] esx: Satisfy curl type checks

2025-09-08 Thread Michal Privoznik via Devel
From: Michal Privoznik Since its commit [1] curl now performs type checks on curl_easy_setopt(). Some options expect long but we're passing an int. The fix consists mostly of specifying type of numbers passed to the function. Except for two cases: proxy_type and proxy_port which are stored in a s

[PATCH] spec: Package newly introduced CH conf files

2025-08-19 Thread Michal Privoznik via Devel
From: Michal Privoznik In a recent commit of v11.6.0-25-g5dca0567f6 new config files for the CH driver were introduced. But corresponding change to the specfile was missing resulting in a broken rpmbuild. Just put those files into daemon-driver-ch rpm. Fixes: 5dca0567f694a7405ca3e796149aed857b1f

[PATCH] qemuxmlconftest: Paper over test failure at MacOS

2025-08-13 Thread Michal Privoznik via Devel
From: Michal Privoznik MacOS has its own dynamic linker (dyld) which is different to Linux/BSD one. But with a little help (by setting "DYLD_FORCE_FLAT_NAMESPACE" env var) it would behave similarly to Linux/BSD ones. In particular, if a library is preloaded via "DYLD_INSERT_LIBRARIES" on MacOS or

[PATCH 2/2] qemu: Match firmware with fully resolved and canonicalized paths

2025-08-01 Thread Michal Privoznik via Devel
From: James Le Cuirot Distros may provide compatibility symlinks after moving firmware files around, but they won't work for existing VMs when doing a straight string comparison. I tried to compare inodes instead, but even glib doesn't provide a straightforward cross-platform method to do this.

[PATCH 1/2] qemuxml2argvmock: Pretend FW blobs are always present

2025-08-01 Thread Michal Privoznik via Devel
From: Michal Privoznik Soon, the QEMU driver, specifically the part that picks firmware based on firmware descriptor files (qemu_firmware.c) is going to check for the presence of those firmware blobs (well, for their realpath()). Just collect the list of all blobs we use in our tests and mock vir

[PATCH 0/2] qemu: Match firmware with fully resolved and canonicalized paths

2025-08-01 Thread Michal Privoznik via Devel
As promised, this is a resend of previous patches: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/XVHIWFXSF5NOPUL4LTU7IGXZWTH43BBC/ Diff to v1: - new patch 1/2 which fixes the mocking. James Le Cuirot (1): qemu: Match firmware with fully resolved and canonicalized paths

[PATCH] NEWS: Document features/improvements/bug fixes I've participated in

2025-07-30 Thread Michal Privoznik via Devel
From: Michal Privoznik There are some features/improvements/bug fixes I've either contributed or reviewed/merged. Document them for upcoming release. Signed-off-by: Michal Privoznik --- NEWS.rst | 6 ++ 1 file changed, 6 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 7f08e45537..d69

[PATCH 1/2] virnetdevvportprofile: Drop explicit enum virNetDevVPortProfile declaration

2025-07-23 Thread Michal Privoznik via Devel
From: Michal Privoznik The virNetDevVPortProfile enum is both explicitly declared and also typedef-ed. This repetition is redundant. Just use typedef. To make matters worse, there's another type with the same name, but because in the code, those few places used 'enum virNetDevVPortProfile var;' t

[PATCH 2/2] virnetdevvportprofile: Turn 'virtPortType' of virNetDevVPortProfile into proper enum type

2025-07-23 Thread Michal Privoznik via Devel
From: Michal Privoznik Convert the member to the appropriate type, fix few missing cases in switch() and switch to virXMLPropEnum() in parsing. Signed-off-by: Michal Privoznik --- src/conf/netdev_vport_profile_conf.c | 9 - src/hypervisor/virhostdev.c | 1 + src/qemu/qemu_mi

[PATCH 0/2] virnetdevvportprofile: Misc cleanups

2025-07-23 Thread Michal Privoznik via Devel
*** BLURB HERE *** Michal Prívozník (2): virnetdevvportprofile: Drop explicit enum virNetDevVPortProfile declaration virnetdevvportprofile: Turn 'virtPortType' of virNetDevVPortProfile into proper enum type src/conf/netdev_vport_profile_conf.c | 11 +-- src/hypervisor/virhost

[PATCH 4/5] security_apparmor: Drop needless checks for seclabel->model == "apparmor"

2025-07-23 Thread Michal Privoznik via Devel
From: Michal Privoznik In few instances, after virDomainDefGetSecurityLabelDef(SECURITY_APPARMOR_NAME) was called, we take the returned secdef and compare secdef->model against SECURITY_APPARMOR_NAME. This makes no sense because virDomainDefGetSecurityLabelDef() has already done this comparison.

[PATCH 5/5] security_dac: Drop needles typecast in virSecurityDACGenLabel()

2025-07-23 Thread Michal Privoznik via Devel
From: Michal Privoznik Inside of virSecurityDACGenLabel() there's a switch() statement and the variable it uses is typecasted to virDomainSeclabelType. Well, as of v7.10.0-rc1~26 the variable is already of that type rendering the typecast needless. Drop it. Signed-off-by: Michal Privoznik ---

[PATCH 2/5] security_selinux: Drop needless checks for seclabel->model == "selinux"

2025-07-23 Thread Michal Privoznik via Devel
From: Michal Privoznik In few instances, after virDomainDefGetSecurityLabelDef(SECURITY_SELINUX_NAME) was called, we take the returned secdef and compare secdef->model against SECURITY_SELINUX_NAME. This makes no sense because virDomainDefGetSecurityLabelDef() has already done this comparison. S

[PATCH 1/5] security: Drop some G_GNUC_UNUSED attributes

2025-07-23 Thread Michal Privoznik via Devel
From: Michal Privoznik Some variables are annotated with G_GNUC_UNUSED attribute so that compiles knows to not complain about unused variable. Well, some variables are annotated and then used. Drop the G_GNUC_UNUSED attribute in such cases. Signed-off-by: Michal Privoznik --- src/security/secu

[PATCH 3/5] security_dac: Drop needless checks for seclabel->model == "dac"

2025-07-23 Thread Michal Privoznik via Devel
From: Michal Privoznik In one instance, after virDomainDefGetSecurityLabelDef(SECURITY_DAC_NAME) was called, we take the returned secdef and compare secdef->model against SECURITY_DAC_NAME. This makes no sense because virDomainDefGetSecurityLabelDef() has already done this comparison. Signed-off

[PATCH 0/5] secdriver: Misc cleanups

2025-07-23 Thread Michal Privoznik via Devel
*** BLURB HERE *** Michal Prívozník (5): security: Drop some G_GNUC_UNUSED attributes security_selinux: Drop needless checks for seclabel->model == "selinux" security_dac: Drop needless checks for seclabel->model == "dac" security_apparmor: Drop needless checks for seclabel->model ==

[PATCH 2/2] meson: Report library versions in the summary

2025-07-18 Thread Michal Privoznik via Devel
From: Michal Privoznik The summary() directive accepts dependency() too [1] in which case it also prints version of the dependency found. This may come handy when reading build process transcripts. 1: https://mesonbuild.com/Reference-manual_functions.html#summary Signed-off-by: Michal Privoznik

[PATCH 1/2] meson: Convert attr_dep to dependency()

2025-07-18 Thread Michal Privoznik via Devel
From: Michal Privoznik Currently, libattr is detected using cc.find_library() because at historically, the library was lacking pkg-config file. But that changed with libattr-2.4.48 (released 7+ years ago) and even prehistoric distros have it now. Switch to dependency(). Signed-off-by: Michal Pri

[PATCH 0/2] meson: Report library versions in the summary

2025-07-18 Thread Michal Privoznik via Devel
Green pipeline: https://gitlab.com/MichalPrivoznik/libvirt/-/pipelines/1934463449 and if you shod individual builds you can see these in action. Michal Prívozník (2): meson: Convert attr_dep to dependency() meson: Report library versions in the summary meson.build | 77

[PATCH 2/2] qemu_tpm: Don't report uninitialized variable in error message

2025-07-17 Thread Michal Privoznik via Devel
From: Michal Privoznik Inside to qemu_tpm.c there are three functions that use the same pattern (qemuTPMEmulatorRunSetup(), qemuTPMEmulatorReconfigure() and qemuTPMEmulatorUpdateProfileName()): int exitstatus; ... if (virCommandRun(cmd, &exitstatus) < 0 || exitstatus != 0) { virRepor

[PATCH 1/2] qemu: Report system error on failed open()

2025-07-17 Thread Michal Privoznik via Devel
From: Michal Privoznik With a help from coccinelle three places were identified that call virReportError() after failed open() (in qemuDomainWriteMasterKeyFile(), qemuDomainMasterKeyReadFile() and qemuProcessOpenVhostVsock()). The open() syscall does set errno on failure so switch them to virRepo

[PATCH 0/2] qemu: Random fixes

2025-07-17 Thread Michal Privoznik via Devel
I've been migrating some machines recently and on dst didn't have VSOCK enabled in the kernel which led to 1/2. Then I've also noticed weird looking error messaged around TPM which led to 2/2. Michal Prívozník (2): qemu: Report system error on failed open() qemu_tpm: Don't report uninitialized

[PATCH 6/6] nss: Debug print JSON files as they are parsed

2025-07-04 Thread Michal Privoznik via Devel
From: Michal Privoznik It may help in case the NSS plugin ever faces a corrupted JSON Signed-off-by: Michal Privoznik --- tools/nss/libvirt_nss_leases.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/nss/libvirt_nss_leases.c b/tools/nss/libvirt_nss_lease

[PATCH 5/6] nss: Print module name

2025-07-04 Thread Michal Privoznik via Devel
From: Michal Privoznik Signed-off-by: Michal Privoznik --- tools/nss/libvirt_nss.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c index 52b769d760..fe9a6bdb37 100644 --- a/tools/nss/libvirt_nss.c +++ b/tools/nss/libvirt_nss.c @@ -121,

[PATCH 4/6] nss: Include filename in debug printings

2025-07-04 Thread Michal Privoznik via Devel
From: Michal Privoznik Signed-off-by: Michal Privoznik --- tools/nss/libvirt_nss_log.c | 7 ++- tools/nss/libvirt_nss_log.h | 7 --- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/nss/libvirt_nss_log.c b/tools/nss/libvirt_nss_log.c index 9a28a91800..04fc049376 100

[PATCH 3/6] nss: Make logging conditional on an envvar

2025-07-04 Thread Michal Privoznik via Devel
From: Michal Privoznik As promised in previous commit, make NSS modules silent by default and enable debug printings if LIBVIRT_NSS_DEBUG envvar is set. Signed-off-by: Michal Privoznik --- docs/nss.rst| 13 + tools/nss/libvirt_nss_log.c | 4 tools/nss/libvirt_

[PATCH 2/6] nss: Move logging into a separate file and turn it temporarily on

2025-07-04 Thread Michal Privoznik via Devel
From: Michal Privoznik Currently, when somebody wants to debug the NSS plugin, they have to change a line in libvirt_nss.h (to enable debug printings) and recompile the module. This may work for us, developers, but we can not expect this from users. For now, this turns debug printings unconditio

[PATCH 1/6] nss: Promote debug message to proper error when time() fails

2025-07-04 Thread Michal Privoznik via Devel
From: Michal Privoznik The difference between DEBUG() and ERROR() macros is that the latter also prints (stringified) errno. Inside of findLease() there's one line where time() is called which is documented as: On error, ((time_t) -1) is returned, and errno is set to indicate the error. The

[PATCH 0/6] nss: Rework debugging

2025-07-04 Thread Michal Privoznik via Devel
I've been debugging a problem with NSS plugin recently [1] and the fact that I had to recompile libvirt just to enable debugging printings for the NSS plugin turned out very inconvenient. Make the debug printings env var dependant and add a few more printings. 1: https://bugzilla.redhat.com/show_b

[PATCH] build: prohibit realpath() by syntax-check

2025-07-04 Thread Michal Privoznik via Devel
From: Michal Privoznik We have virFileCanonicalizePath() which calls realpath() but also is present in our mocks (in contrast to realpath()). Introduce a syntax-check rule to enforce use of our wrapper. Signed-off-by: Michal Privoznik --- build-aux/syntax-check.mk | 9 + 1 file changed

[PATCH] NEWS: Document features/improvements/bug fixes I've participated in

2025-06-30 Thread Michal Privoznik via Devel
From: Michal Privoznik There are some features/improvements/bug fixes I've either contributed or reviewed/merged. Document them for upcoming release. Signed-off-by: Michal Privoznik --- NEWS.rst | 6 ++ 1 file changed, 6 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 184df16547..ee4

[PATCH] qemu_monitor_json: Use proper initializer in qemuMonitorJSONGetBlockInfo()

2025-06-24 Thread Michal Privoznik via Devel
From: Michal Privoznik Inside of qemuMonitorJSONGetBlockInfo() there's a for loop in which a variable of struct qemuDomainDiskInfo type is declared and initialized as { false }. This works only because stdbool.h declares 'false' as a macro, so preprocessor expands initializer to proper form of {

[PATCH] security_manager: Don't leak seclabel in virSecurityManagerGenLabel()

2025-06-16 Thread Michal Privoznik via Devel
From: Michal Privoznik When a domain is being started, seclabels are generated for it. This is handled in virSecurityManagerGenLabel() which can either find pre-existing seclabel in domain def or generate a new one. At any rate, domainGenSecurityLabel() callback is called and if it fails then the

[PATCH] qemu: Be more forgiving when acquiring QUERY job when formatting domain XML

2025-06-16 Thread Michal Privoznik via Devel
From: Michal Privoznik In my previous commit of v11.0.0-rc1~115 I've made QEMU driver implementation for virDomainGetXMLDesc() (qemuDomainGetXMLDesc()) acquire QERY job. See its commit message for more info. But this unfortunately broke apps witch fetch domain XML for incoming migration (like vir

[PATCH 05/15] tests: Fix mocking of open()

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik In some cases (well, majority), open() is either rewritten to open64(), either by plain '#define open open64') or at assembly level (using __REDIRECT macro). See for more info. This didn't really matter to us, because we do not chain load two mocks that would need to reim

[PATCH 14/15] virt-aa-helper: Drop cleanup label from get_files()

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik After previous cleanup the cleanup label is no longer necessary. Drop it. Signed-off-by: Michal Privoznik --- src/security/virt-aa-helper.c | 120 ++ 1 file changed, 62 insertions(+), 58 deletions(-) diff --git a/src/security/virt-aa-help

[PATCH 15/15] virt-aa-helper-test: Switch to getopts

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik Instead of treating -d and -v arguments as positional, use getopts to parse cmd line arguments passed to virt-aa-helper-test script. While at it, introduce -h for printing basic help describing each argument. Signed-off-by: Michal Privoznik --- tests/virt-aa-helper-test

[PATCH 13/15] virt-aa-helper: Check retval of vah_add_file()

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik Inside of get_files() there are two cases where vah_add_file() is not checked for its retval. This is possibly dangerous, because vah_add_file() might fail. Fix those places by introducing checks for the retval. Signed-off-by: Michal Privoznik --- src/security/virt-aa-he

[PATCH 10/15] virt-aa-helper: Simplify paths collection

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik The way virt-aa-helper works is the following: the apparmor secdriver formats domain XML, spawns virt-aa-helper process and feeds it with domain XML (through stdin). The helper process then parses the XML and iterates over devices, appending paths in each loop. These loops

[PATCH 12/15] virt-aa-helper: Use automatic memory freeing

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik Signed-off-by: Michal Privoznik --- src/security/virt-aa-helper.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 64cada3b3b..2ea4b47fa5 100644 --- a/src/security/virt-

[PATCH 11/15] virt-aa-helper: Decrease scope of @mem_path in get_files()

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik The @mem_path variable inside of get_files() is used only within a single block. Move its declaration inside it. And also utilize automatic memory freeing. Signed-off-by: Michal Privoznik --- src/security/virt-aa-helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 dele

[PATCH 09/15] virt-aa-helper: Rework USB hostdev handling

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik For an USB device, the virt-aa-helper must put that /dev/bus/usb/... path associated with given device. The way the code is currently written not only leads to a memleak (the @usb variable is allocated only to be overwritten right away), but is needlessly cumbersome. We ca

[PATCH 08/15] virt-aa-helper-test: Test hostdevs unconditionally

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik Our test suite is very feature rich. In particular, it has two mocks that implement sysfs close enough to create host-independent environment to work with PCI and USB devices. These mocks are called virpcimock and virusbmock, respectively. Inside of virt-aa-helper-test the

[PATCH 07/15] virt-aa-helper-test: Silence ls

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik virt-aa-helper checks presence of files before it adds them into a profile. Because of that, test cases inside of virt-aa-helper-test that require presence of /boot/initrd* are guarded by a check. The check uses ls to find at least one initrd file. If there's none, then ls

[PATCH 06/15] virt-aa-helper-test: Print errors to stderr

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik When a test case fails, there are two echo-s executed: the first one either prints the error message into /dev/null (default) or onto stdout (when the test script is executed with -d). Then, the second one prints the error message onto stdout. While this technically works,

[PATCH 04/15] virpcimock: Strip fakerootdir prefix in virFileCanonicalizePath()

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik The mocked implementation of virFileCanonicalizePath() redirects accesses to few dirs into a temporary directory, where PCI related files live. See getrealpath() for more info on this. Anyway, in the end - real implementation of virFileCanonicalizePath() is called which th

[PATCH 03/15] virpcimock: Automatically invent fakerootdir, if not provided

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik Currently, all users of virpcimock do set LIBVIRT_FAKE_ROOT_DIR envvar. But soon, virt-aa-helper will be run with it and basically right at the beginning of its main() it clears whole environment. So even if the envvar is provided the mock won't see that. Anyway, the solut

[PATCH 01/15] log_cleaner: Use virFileCanonicalizePath()

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik While use of realpath() is not forbidden, our some of our mocks already have a test friendly reimplementation of virFileCanonicalizePath(). Use the latter. Signed-off-by: Michal Privoznik --- src/logging/log_cleaner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[PATCH 02/15] virt-aa-helper: Use virFileCanonicalizePath()

2025-06-12 Thread Michal Privoznik via Devel
From: Michal Privoznik While use of realpath() is not forbidden, our some of our mocks already have a test friendly reimplementation of virFileCanonicalizePath(). Use the latter. Signed-off-by: Michal Privoznik --- src/security/virt-aa-helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletio

[PATCH 00/15] virt-aa-helper: Misc improvements

2025-06-12 Thread Michal Privoznik via Devel
Inspired by a patchset against virt-aa-helper that I reviewed recently: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/QQXMAK56H2CXCIZPALG5BHDNTKT3OQKZ/ Green pipeline: https://gitlab.com/MichalPrivoznik/libvirt/-/pipelines/1866451277 Michal Prívozník (15): log_cleaner

[PATCH] ci: refresh with 'lcitool manifest'

2025-06-09 Thread Michal Privoznik via Devel
From: Michal Privoznik - Replace Alpine 3.21 with 3.22 Signed-off-by: Michal Privoznik --- Green pipeline: https://gitlab.com/MichalPrivoznik/libvirt/-/pipelines/1860029940 ci/buildenv/{alpine-321.sh => alpine-322.sh} | 0 .../{alpine-321.Dockerfile => alpine-322.Dockerfile}

[PATCH 03/10] src: Unify argument name of virDomainMigratePrepare2()

2025-06-05 Thread Michal Privoznik via Devel
From: Michal Privoznik The virDomainMigratePrepare2() API declares one of its argument as 'bandwidth', though throughout various typedefs, RPC and callback implementations the name is changed to 'resource'. This creates a confusing. Unify the name. Signed-off-by: Michal Privoznik --- src/drive

[PATCH 10/10] gendispatch: Finish rename of the migration argument

2025-06-05 Thread Michal Privoznik via Devel
From: Michal Privoznik This patch is useless. Either APIs it don't have 'resource' nor 'bandwidth' argument to begin with, or they serve as a wrapper over different API (changed in previous commits). Nonetheless, in the name of consistency, let's just change those variable names. Signed-off-by:

[PATCH 09/10] qemu: Finish argument rename

2025-06-05 Thread Michal Privoznik via Devel
From: Michal Privoznik There are still some functions around migration code that use 'resource' instead 'bandwidth'. Rename the variable/argument inside them. Signed-off-by: Michal Privoznik --- src/qemu/qemu_migration.c | 60 +++ 1 file changed, 30 insertio

[PATCH 08/10] src: Unify argument name of virDomainMigratePerform3()

2025-06-05 Thread Michal Privoznik via Devel
From: Michal Privoznik The virDomainMigratePerform3() API declares its last argument as 'bandwidth', though throughout various typedefs, RPC and callback implementations the name is changed to 'resource'. This creates a confusing. Unify the name. Signed-off-by: Michal Privoznik --- src/driver-

[PATCH 07/10] src: Unify argument name of virDomainMigrateBegin3()

2025-06-05 Thread Michal Privoznik via Devel
From: Michal Privoznik The virDomainMigrateBegin3() API declares its last argument as 'bandwidth', though throughout various typedefs, RPC and callback implementations the name is changed to 'resource'. This creates a confusing. Unify the name. Signed-off-by: Michal Privoznik --- src/driver-hy

[PATCH 06/10] src: Unify argument name of virDomainMigratePrepareTunnel3()

2025-06-05 Thread Michal Privoznik via Devel
From: Michal Privoznik The virDomainMigratePrepareTunnel3() API declares one of its argument as 'bandwidth', though throughout various typedefs, RPC and callback implementations the name is changed to 'resource'. This creates a confusing. Unify the name. Signed-off-by: Michal Privoznik --- src

[PATCH 05/10] src: Unify argument name of virDomainMigratePrepare3()

2025-06-05 Thread Michal Privoznik via Devel
From: Michal Privoznik The virDomainMigratePrepare3() API declares one of its argument as 'bandwidth', though throughout various typedefs, RPC and callback implementations the name is changed to 'resource'. This creates a confusing. Unify the name. Signed-off-by: Michal Privoznik --- src/drive

[PATCH 04/10] src: Unify argument name of virDomainMigratePrepareTunnel()

2025-06-05 Thread Michal Privoznik via Devel
From: Michal Privoznik The virDomainMigratePrepareTunnel() API declares one of its argument as 'bandwidth', though throughout various typedefs, RPC and callback implementations the name is changed to 'resource'. This creates a confusing. Unify the name. Signed-off-by: Michal Privoznik --- src/

[PATCH 02/10] src: Unify argument name of virDomainMigratePerform()

2025-06-05 Thread Michal Privoznik via Devel
From: Michal Privoznik The virDomainMigratePerform() API declares its last argument as 'bandwidth', though throughout various typedefs, RPC and callback implementations the name is changed to 'resource'. This creates a confusing. Unify the name. Signed-off-by: Michal Privoznik --- src/driver-h

[PATCH 01/10] src: Unify argument name of virDomainMigratePrepare()

2025-06-05 Thread Michal Privoznik via Devel
From: Michal Privoznik The virDomainMigratePrepare() API declares its last argument as 'bandwidth', though throughout various typedefs, RPC and callback implementations the name is changed to 'resource'. This creates a confusing. Unify the name. Signed-off-by: Michal Privoznik --- src/driver-h

[PATCH 00/10] Unify argument name of migration APIs

2025-06-05 Thread Michal Privoznik via Devel
Some of our APIs have 'bandwidth' argument but then, at internal impl level it's renamed to 'resource', inconsistently. Since it's really describing bandwidth that the migration can use, let's rename it. Michal Prívozník (10): src: Unify argument name of virDomainMigratePrepare() src: Unify ar

[PATCH] libxl_capabilities: Make some functions return void

2025-06-05 Thread Michal Privoznik via Devel
From: Michal Privoznik Inside of libxlMakeDomainCapabilities() there are some functions called and basically all of them never return anything but zero (indicating success). Yet, they are called in a fashion that suggests otherwise. Turn those functions into void and drop checks for their retvals

[PATCH v2 2/2] NEWS: Document removal of support of VIR_DUMP_LIVE flag from QEMU driver

2025-06-03 Thread Michal Privoznik via Devel
From: Michal Privoznik Signed-off-by: Michal Privoznik --- NEWS.rst | 7 +++ 1 file changed, 7 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 160aac0b31..b97f86ffb6 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -15,6 +15,13 @@ v11.5.0 (unreleased) * **Removed features** + * qemu: Don

[PATCH v2 1/2] qemu: Don't accept VIR_DUMP_LIVE flag in qemuDomainCoreDumpWithFormat()

2025-06-03 Thread Michal Privoznik via Devel
From: Michal Privoznik QEMU can't really do live dumps of guest memory. It's because inside of dump_init() the vm_stop() is called basically unconditionally (the only condition is whether vCPUs are running). Hence, there is no way for us to do live dumps and thus honor VIR_DUMP_LIVE flag. Instead

[PATCH v2 0/2] qemu: Don't accept VIR_DUMP_LIVE flag in qemuDomainCoreDumpWithFormat()

2025-06-03 Thread Michal Privoznik via Devel
This is a v2 of: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/PP7KRRWN3PPIDDYW5ZC3NFH7C5UI2TBA/ Instead of documenting the flag quirks, let's just error out if specified. Michal Prívozník (2): qemu: Don't accept VIR_DUMP_LIVE flag in qemuDomainCoreDumpWithFormat()

[PATCH] lib: Document VIR_DUMP_LIVE flag quirk

2025-06-02 Thread Michal Privoznik via Devel
From: Michal Privoznik The virDomainCoreDump() API has VIR_DUMP_LIVE flag which is documented to leave vCPUs running throughout making of the dump of guest memory. Well, this is not the case for QEMU which pauses vCPUs unconditionally (it calls vm_stop() in dump_init()). Document this quirk. And

[PATCH 6/7] libvirt_nss: Allocate buffer in ERROR() dynamically

2025-05-22 Thread Michal Privoznik via Devel
From: Michal Privoznik So far, inside of the ERROR() macro there's pretty large buffer allocated on the stack (for use by strerror_r()). Problem is, with our current stack size limit of 2048 bytes we may come pretty close to the limit or even overshoot it, e.g. in aiforaf() where the function its

[PATCH 7/7] libvirt_nss: Allocate buffer in aiforaf() dynamically

2025-05-22 Thread Michal Privoznik via Devel
From: Michal Privoznik While we were trying to decrease stack usage of some functions, in v9.8.0-rc1~217 we introduced a couple of internal blocks to the aiforaf() and declared some variables inside those blocks hoping the compiler will reuse the stack for each block. While in general this might

[PATCH 5/7] libvirt_nss: Drop needless cleanup labels

2025-05-22 Thread Michal Privoznik via Devel
From: Michal Privoznik After previous cleanup, some labels were rendered pointless. Drop them. Signed-off-by: Michal Privoznik --- tools/nss/libvirt_nss.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c ind

[PATCH 4/7] libvirt_nss: Use automatic memory freeing

2025-05-22 Thread Michal Privoznik via Devel
From: Michal Privoznik Signed-off-by: Michal Privoznik --- tools/nss/libvirt_nss.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c index 25e2ec0642..8460b63228 100644 --- a/tools/nss/libvirt_nss.c +++ b/tools

[PATCH 1/7] libvirt_nss_macs: Fix type of @len in findMACsFromJSON()

2025-05-22 Thread Michal Privoznik via Devel
From: Michal Privoznik Inside of findMACsFromJSON(), the retval of json_object_array_length() is stored in a variable that's type of int. But the function is declared to return size_t: /usr/include/json-c/json_object.h:JSON_EXPORT size_t json_object_array_length(const struct json_object *obj)

[PATCH 3/7] nss: Declare g_autofree and g_steal_pointer() macros

2025-05-22 Thread Michal Privoznik via Devel
From: Michal Privoznik While we do not want the nss plugin to link with anything but necessary libs (libc and libjson-c) it can benefit from automatic memory freeing. Instead of inventing macros with new name for them, lets stick with g_autofree and g_steal_pointer() which we are used to from the

[PATCH 2/7] nss: Add missing includes for gai_strerror()

2025-05-22 Thread Michal Privoznik via Devel
From: Michal Privoznik There are two places where gai_strerror() is called but neither of them includes all necessary header files as documented in its manpage. Fortunately, both calls occur in ERROR() macro which by default does nothing - hence we don't see any compilation errors. Signed-off-by

[PATCH 0/7] nss: Couple of fixes and small improvements

2025-05-22 Thread Michal Privoznik via Devel
I've noticed most of these after I've turned on debugging for the NSS plugin: diff --git i/tools/nss/libvirt_nss.h w/tools/nss/libvirt_nss.h index 54a0216013..f9c3136985 100644 --- i/tools/nss/libvirt_nss.h +++ w/tools/nss/libvirt_nss.h @@ -35 +35 @@ -#if 0 +#if 1 Michal Prívozník (7): libvirt_

[PATCH 2/2] spec: Bump min_fedora

2025-05-16 Thread Michal Privoznik via Devel
From: Michal Privoznik Fedora 40 is now officially at end of life [1]. The minimal version we aim to support upstream is thus Fedora 41. Reflect this in the spec file. 1: https://lists.fedoraproject.org/archives/list/devel-annou...@lists.fedoraproject.org/thread/XCUBN7NR7LXFFSA3IJDRTGHC7K4CXARV

[PATCH 1/2] spec: Bump min_rhel

2025-05-16 Thread Michal Privoznik via Devel
From: Michal Privoznik RHEL-8 is out of our support scope. The minimal version we aim to support upstream is RHEL-9. Reflect this in the spec file. Signed-off-by: Michal Privoznik --- libvirt.spec.in | 32 +--- 1 file changed, 9 insertions(+), 23 deletions(-) diff

[PATCH 0/2] spec: Bump min_rhel and min_fedora

2025-05-16 Thread Michal Privoznik via Devel
Per our support policy [1], the minimal version we aim to support is RHEL-9 and Fedora 41. Reflect this in the spec file. 1: https://libvirt.org/platforms.html Michal Prívozník (2): spec: Bump min_rhel spec: Bump min_fedora libvirt.spec.in | 38 -- 1 file

[PATCH] ci: refresh with 'lcitool manifest'

2025-05-16 Thread Michal Privoznik via Devel
From: Michal Privoznik - Add Fedora 42 - Remove EOL Fedora 40 - Switch mingw from Fedora 41 to Fedora 42 Signed-off-by: Michal Privoznik --- Green pipeline: https://gitlab.com/MichalPrivoznik/libvirt/-/pipelines/1819375318 It also contains spec file changes that I'll be sending shortly. I ha

  1   2   >