Re: [PATCH v1 15/20] node_device_udev: Pass the driver state as parameter in preparation for the next commit

2024-04-23 Thread Marc Hartmayer
On Fri, Apr 19, 2024 at 02:23 PM -0500, Jonathon Jongsma wrote: > On 4/19/24 9:49 AM, Marc Hartmayer wrote: >> It's better practice for all functions called by the threads to pass the >> driver >> via parameter and not global variables. Easier to test and cleaner. >> […snip…] >> >> >>

Re: [PATCH v1 15/20] node_device_udev: Pass the driver state as parameter in preparation for the next commit

2024-04-23 Thread Daniel P . Berrangé
On Tue, Apr 23, 2024 at 10:03:35AM +0200, Marc Hartmayer wrote: > On Fri, Apr 19, 2024 at 02:23 PM -0500, Jonathon Jongsma > wrote: > > On 4/19/24 9:49 AM, Marc Hartmayer wrote: > >> It's better practice for all functions called by the threads to pass the > >> driver > >> via parameter and not g

Re: [PATCH v1 17/20] node_device_udev: Call `nodeDeviceUpdateMediatedDevices` directly

2024-04-23 Thread Marc Hartmayer
On Mon, Apr 22, 2024 at 05:43 PM +0200, Boris Fiuczynski wrote: > This could be quashed with patch 3 but I am also fine with this if you > do not want to spend the effort. > > Reviewed-by: Boris Fiuczynski Will squash it. […snip] -- Kind regards / Beste Grüße Marc Hartmayer IBM Deutschl

Re: [PATCH v1 15/20] node_device_udev: Pass the driver state as parameter in preparation for the next commit

2024-04-23 Thread Marc Hartmayer
On Tue, Apr 23, 2024 at 09:10 AM +0100, Daniel P. Berrangé wrote: > On Tue, Apr 23, 2024 at 10:03:35AM +0200, Marc Hartmayer wrote: >> On Fri, Apr 19, 2024 at 02:23 PM -0500, Jonathon Jongsma >> wrote: >> > On 4/19/24 9:49 AM, Marc Hartmayer wrote: >> >> It's better practice for all functions c

Re: [PATCH v1 15/20] node_device_udev: Pass the driver state as parameter in preparation for the next commit

2024-04-23 Thread Daniel P . Berrangé
On Tue, Apr 23, 2024 at 10:46:14AM +0200, Marc Hartmayer wrote: > On Tue, Apr 23, 2024 at 09:10 AM +0100, Daniel P. Berrangé > wrote: > > On Tue, Apr 23, 2024 at 10:03:35AM +0200, Marc Hartmayer wrote: > >> On Fri, Apr 19, 2024 at 02:23 PM -0500, Jonathon Jongsma > >> wrote: > >> > On 4/19/24 9

Re: [PATCH v1 15/20] node_device_udev: Pass the driver state as parameter in preparation for the next commit

2024-04-23 Thread Marc Hartmayer
On Tue, Apr 23, 2024 at 10:06 AM +0100, Daniel P. Berrangé wrote: > On Tue, Apr 23, 2024 at 10:46:14AM +0200, Marc Hartmayer wrote: >> On Tue, Apr 23, 2024 at 09:10 AM +0100, Daniel P. Berrangé >> wrote: >> > On Tue, Apr 23, 2024 at 10:03:35AM +0200, Marc Hartmayer wrote: >> >> On Fri, Apr 19,

Re: [PATCH v2 01/27] util/network: move viriptables.[ch] from util to network directory

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:09PM -0400, Laine Stump wrote: > These functions are only ever used by the network driver, and are so > specific to the network driver's usage of iptables that they likely > won't ever be used elsewhere. The files are renamed to > network_iptables.[ch] to be more in li

Re: [PATCH v2 03/27] network: make all iptables functions used only in network_iptables.c static

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:11PM -0400, Laine Stump wrote: > Now that the toplevel iptables functions have been moved out of the > linux bridge driver into network_iptables.c, all of the utility > functions are used only within that same file, so simplify it. > > Signed-off-by: Laine Stump > --

Re: [PATCH v2 02/27] network: move all functions manipulating iptables rules into network_iptables.c

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:10PM -0400, Laine Stump wrote: > Although initially we will add exactly the same rules for the nftables > backend, the two may (hopefully) soon diverge as we take advantage of > nftables features that weren't available in iptables. When we do that, > there will need to

Re: [PATCH v2 04/27] util: #define the names used for private packet filter chains

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:12PM -0400, Laine Stump wrote: > Signed-off-by: Laine Stump > --- > src/network/network_iptables.c | 51 +++--- > 1 file changed, 29 insertions(+), 22 deletions(-) Reviewed-by: Daniel P. Berrangé With regards, Daniel -- |: https://ber

Re: [PATCH v2 06/27] util: rename virNetFilterAction to iptablesAction, and add VIR_ENUM_DECL/IMPL

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:14PM -0400, Laine Stump wrote: > I had originally named these as VIR_NETFILTER_* because I assumed the > same enum would eventually be used by our nftables backend as well as > iptables. But it turns out that in most cases it's not possible to > delete an nftables rule

Re: [PATCH v2 07/27] util: check for 0 args when applying iptables rule

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:15PM -0400, Laine Stump wrote: > In normal practice a virFirewallCmd should never have 0 args by the > time it gets to the Apply stage, but at some time while debugging one > of the other patches in this series, exactly that happened (due to a > bug that was since squa

Re: [PATCH v2 09/27] util: determine ignoreErrors value when creating virFirewallCmd, not when applying

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:17PM -0400, Laine Stump wrote: > We know at the time a virFirewallCmd is created (with > virFirewallAddCmd*()) whether or not we will later want to ignore > errors encountered when attempting to apply that command - if > ignoreErrors is set in the AddCmd or if the grou

Re: [PATCH v2 10/27] util/network: new virFirewallBackend enum

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:18PM -0400, Laine Stump wrote: > (This paragraph is for historical reference only, described only to > avoid confusion of past use of the name with its new use) In a past > life, virFirewallBackend had been a private static in virfirewall.c > that was set at daemon ini

Re: [PATCH v2 11/27] network: add (empty) network.conf file to distribution files

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:19PM -0400, Laine Stump wrote: > Signed-off-by: Laine Stump > --- > libvirt.spec.in | 3 ++ > src/network/libvirtd_network.aug | 36 > src/network/meson.build | 11 > src/network/net

Re: [PATCH v2 12/27] network: support setting firewallBackend from network.conf

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:20PM -0400, Laine Stump wrote: > It still can have only one useful value ("iptables"), but once a 2nd > value is supported, it will be selectable by setting > "firewall_backend=nftables" in /etc/libvirt/network.conf. > > If firewall_backend isn't set in network.conf,

Re: [PATCH v2 13/27] network: framework to call backend-specific function to init private filter chains

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:21PM -0400, Laine Stump wrote: > Modify networkSetupPrivateChains() in the network driver to accept a > firewallBackend argument so it will know which backend to call. (right > now it always calls the iptables version of the lower level function, > but in the future it

Re: [PATCH v2 22/27] meson: stop looking for iptables/ip6tables/ebtables at build time

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:30PM -0400, Laine Stump wrote: > This was the only reason we required the iptables and ebtables > packages at build time, and many other external commands already have > their binaries found at runtime by looking through $PATH (virCommand > automatically does this), so

Re: [PATCH v2 23/27] rpm: drop BuildRequires for iptables and ebtables

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:31PM -0400, Laine Stump wrote: > The only reason for requiring these was so that meson could search for > the binary location, and the previous patch eliminated that, so we no > longer need them at build time. > > Signed-off-by: Laine Stump > --- > libvirt.spec.in |

Re: [PATCH v2 26/27] network: prefer the nftables backend over iptables

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:34PM -0400, Laine Stump wrote: > The initial patches to support nftables for virtual networks left > iptables as the default backend. > > The only functional difference between the two backends is that the > nftables backend doesn't add any rules to fix up the checksu

Re: [PATCH v2 27/27] RFC: spec: change iptables/ebtables from Requires to Recommends, add nftables

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:35PM -0400, Laine Stump wrote: > We really shouldn't be requiring ebtables and iptables any more, since > they don't always need to be used. Likewise, we probably should at > least Recommend nftables, even though it's pretty much always > installed already anyway. > >

Re: [PATCH v2 05/27] util: change name of virFirewallRule to virFirewallCmd

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:13PM -0400, Laine Stump wrote: > These objects aren't rules, they are commands that are executed that > may create a firewall rule, delete a firewall rule, or simply list the > existing firewall rules. It's confusing for the objects to be called > "Rule" (especially in

Re: [PATCH v2 08/27] util: add -w/--concurrent when applying a FirewallCmd rather than when building it

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:16PM -0400, Laine Stump wrote: > We will already need a separate function for virFirewallApplyCmd for > iptables vs. nftables, but the only reason for needing a separate > function for virFirewallAddCmd* is that iptables/ebtables need to have > an extra arg added for l

Re: [PATCH v2 15/27] util: implement rollback rule autocreation for iptables commands

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:23PM -0400, Laine Stump wrote: > If the VIR_FIREWALL_TRANSACTION_AUTO_ROLLBACK flag is set, each time > an iptables command is executed that is adding a rule or chain, a > corresponding command that will *delete* the same rule/chain is > constructed and added to the li

Re: [PATCH v2 16/27] network: turn on auto-rollback for the rules added for virtual networks

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:24PM -0400, Laine Stump wrote: > So far this will only affect what happens if there is some failure > while applying the firewall rules; the rollback rules aren't yet > persistent beyond that time. More work is needed to remember the > rollback rules while the network

Re: [PATCH v2 18/27] util: new functions virFirewallParseXML() and virFirewallFormat()

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:26PM -0400, Laine Stump wrote: > These functions convert a virFirewall object to/from XML so that it > can be serialized to disk (in a virNetworkObj's status file) and > restored later (e.g. after libvirtd/virtnetworkd is restarted). > > Signed-off-by: Laine Stump >

Re: [PATCH v2 19/27] conf: add a virFirewall object to virNetworkObj

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:27PM -0400, Laine Stump wrote: > This virFirewall object will store the list of actions required to > remove the firewall that was added for the currently active instance > of the network, so it has been named "fwRemoval". > > There are no uses of the fwRemoval object

Re: [PATCH v2 20/27] network: use previously saved list of firewall removal commands

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:28PM -0400, Laine Stump wrote: > When destroying a network, the network driver has always assumed that > it knew what firewall rules had been added as the network was > started. This was usually correct - I only recall one time in the past > that the firewall rules add

Re: [PATCH v2 24/27] network: add an nftables backend for network driver's firewall construction

2024-04-23 Thread Daniel P . Berrangé
On Sun, Apr 21, 2024 at 10:53:32PM -0400, Laine Stump wrote: > Support using nftables to setup the firewall for each virtual network, > rather than iptables. The initial implementation of the nftables > backend creates (almost) exactly the same ruleset as the iptables > backend, determined by runni

Re: [PATCH v4 3/3] conf: nodedev: Fill active_config at XML parse time

2024-04-23 Thread Cole Robinson
On 4/19/24 8:38 AM, Boris Fiuczynski wrote: > On 4/17/24 17:17, Cole Robinson wrote: >> Commit v10.0.0-265-ge67bca23e4 added a `active_config` and >> `defined_config` to nodedev mdev internal XML handling. >> `defined_config` can be filled at XML parse time, but `active_config` >> must be filled in

[PATCH v5 1/3] test: make parsed nodedevs active and persistent

2024-04-23 Thread Cole Robinson
This was the implied default before nodedevs gained a notion of being inactive and transient. It also matches the implied default when parsing other object types Signed-off-by: Cole Robinson --- src/test/test_driver.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/test_driver.c b

[PATCH v5 2/3] test: Sync GetXML INACTIVE behavior with live driver

2024-04-23 Thread Cole Robinson
- Error if INACTIVE requested for transient object - Force dumping INACTIVE XML when object is inactive Signed-off-by: Cole Robinson --- src/test/test_driver.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c in

[PATCH v5 0/3] test: fix nodedev mdev XML regression

2024-04-23 Thread Cole Robinson
See last patch for explanation. First two patches are related bugfixes/improvements v5: - Changed impl to match Boris' suggestion Cole Robinson (3): test: make parsed nodedevs active and persistent test: Sync GetXML INACTIVE behavior with live driver test: nodedev: fill active_config at d

[PATCH v5 3/3] test: nodedev: fill active_config at driver startup time

2024-04-23 Thread Cole Robinson
Commit v10.0.0-265-ge67bca23e4 added a `active_config` and `defined_config` to nodedev mdev internal XML handling. `defined_config` can be filled at XML parse time, but `active_config` must be filled in by nodedev driver. This wasn't implemented for the test driver however, which caused virt-manage

[PATCH v2 2/4] virfile: Introduce virFileReadValueBitmapAllowEmpty()

2024-04-23 Thread Michal Privoznik
Some sysfs files contain either string representation of a bitmap or just a newline character. An example of such file is: /sys/devices/system/cpu/isolated. Our current implementation of virFileReadValueBitmap() fails in the latter case, unfortunately. Introduce a slightly modified version that acc

[PATCH v2 1/4] virbitmap: Introduce virBitmapParseUnlimitedAllowEmpty()

2024-04-23 Thread Michal Privoznik
Some sysfs files contain either string representation of a bitmap or just a newline character. An example of such file is: /sys/devices/system/cpu/isolated. Our current implementation of virBitmapParseUnlimited() fails in the latter case, unfortunately. Introduce a slightly modified version that ac

[PATCH v2 3/4] virhostcpu: Introduce virHostCPUGetIsolated()

2024-04-23 Thread Michal Privoznik
This is a helper that parses /sys/devices/system/cpu/isolated into a virBitmap. It's going to be needed soon. Signed-off-by: Michal Privoznik --- src/libvirt_private.syms | 1 + src/util/virhostcpu.c| 31 +++ src/util/virhostcpu.h| 1 + 3 files changed, 33 i

[PATCH v2 0/4] qemu: Substract isolcpus from all online affinity

2024-04-23 Thread Michal Privoznik
v2 of: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/4V7OI5AEGYRN4GFQMQPIN4MYPJNK3NYJ/ diff to v1: - Don't error out on systems where /sys/devices/system/cpu/isolated is unavailable. - Don't error out on systems where /sys/devices/system/cpu/isolated is empty. Both o

[PATCH v2 4/4] qemu: Substract isolcpus from all online affinity

2024-04-23 Thread Michal Privoznik
When starting a domain and there's no vCPU/emulator pinning set, we query the list of all online physical CPUs and set affinity of the child process (which eventually becomes QEMU) to that list. We can't assume libvirtd itself had affinity to all online CPUs and since affinity of the child process

Re: [PATCH v2 10/27] util/network: new virFirewallBackend enum

2024-04-23 Thread Laine Stump
On 4/23/24 6:10 AM, Daniel P. Berrangé wrote: On Sun, Apr 21, 2024 at 10:53:18PM -0400, Laine Stump wrote: (This paragraph is for historical reference only, described only to avoid confusion of past use of the name with its new use) In a past life, virFirewallBackend had been a private static in

Re: [PATCH v2 12/27] network: support setting firewallBackend from network.conf

2024-04-23 Thread Laine Stump
On 4/23/24 6:17 AM, Daniel P. Berrangé wrote: On Sun, Apr 21, 2024 at 10:53:20PM -0400, Laine Stump wrote: It still can have only one useful value ("iptables"), but once a 2nd value is supported, it will be selectable by setting "firewall_backend=nftables" in /etc/libvirt/network.conf. If firew

Re: [PATCH v2 13/27] network: framework to call backend-specific function to init private filter chains

2024-04-23 Thread Laine Stump
On 4/23/24 6:21 AM, Daniel P. Berrangé wrote: On Sun, Apr 21, 2024 at 10:53:21PM -0400, Laine Stump wrote: >> [...] +static int +networkFirewallSetupPrivateChains(virFirewallBackend backend, + virFirewallLayer layer) +{ +switch (backend) { +case VIR_FIRE

Re: [PATCH v2 26/27] network: prefer the nftables backend over iptables

2024-04-23 Thread Laine Stump
On 4/23/24 6:40 AM, Daniel P. Berrangé wrote: I wonder if we shouldn't make the default firewall backend be a meson_options.txt parameter. Good idea! If a distro rebases libvirt in their existing release, they probably don't want the firewall backend silently changing as a side effect. A me

Re: [PATCH v2 12/27] network: support setting firewallBackend from network.conf

2024-04-23 Thread Daniel P . Berrangé
On Tue, Apr 23, 2024 at 11:48:24AM -0400, Laine Stump wrote: > On 4/23/24 6:17 AM, Daniel P. Berrangé wrote: > > On Sun, Apr 21, 2024 at 10:53:20PM -0400, Laine Stump wrote: > > > It still can have only one useful value ("iptables"), but once a 2nd > > > value is supported, it will be selectable by

Re: [PATCH v2 27/27] RFC: spec: change iptables/ebtables from Requires to Recommends, add nftables

2024-04-23 Thread Laine Stump
On 4/23/24 6:46 AM, Daniel P. Berrangé wrote: On Sun, Apr 21, 2024 at 10:53:35PM -0400, Laine Stump wrote: We really shouldn't be requiring ebtables and iptables any more, since they don't always need to be used. Likewise, we probably should at least Recommend nftables, even though it's pretty m

Re: [PATCH v2 01/27] util/network: move viriptables.[ch] from util to network directory

2024-04-23 Thread Laine Stump
On 4/23/24 5:52 AM, Daniel P. Berrangé wrote: On Sun, Apr 21, 2024 at 10:53:09PM -0400, Laine Stump wrote: These functions are only ever used by the network driver, and are so specific to the network driver's usage of iptables that they likely won't ever be used elsewhere. The files are renamed

Re: [PATCH v2 16/27] network: turn on auto-rollback for the rules added for virtual networks

2024-04-23 Thread Laine Stump
On 4/23/24 6:53 AM, Daniel P. Berrangé wrote: On Sun, Apr 21, 2024 at 10:53:24PM -0400, Laine Stump wrote: diff --git a/tests/networkxml2firewalltest.c b/tests/networkxml2firewalltest.c index 3a9f409e2a..e61787daec 100644 --- a/tests/networkxml2firewalltest.c +++ b/tests/networkxml2firewalltest

Re: [PATCH v2 18/27] util: new functions virFirewallParseXML() and virFirewallFormat()

2024-04-23 Thread Laine Stump
On 4/23/24 6:59 AM, Daniel P. Berrangé wrote: On Sun, Apr 21, 2024 at 10:53:26PM -0400, Laine Stump wrote: + */ +int +virFirewallParseXML(virFirewall **firewall, +xmlNodePtr node, +xmlXPathContextPtr ctxt) +{ [...] +nargs = virXPathNodeSet("

Re: [PATCH v2 24/27] network: add an nftables backend for network driver's firewall construction

2024-04-23 Thread Laine Stump
On 4/23/24 7:15 AM, Daniel P. Berrangé wrote: On Sun, Apr 21, 2024 at 10:53:32PM -0400, Laine Stump wrote: Support using nftables to setup the firewall for each virtual network, rather than iptables. The initial implementation of the nftables backend creates (almost) exactly the same ruleset as

Re: [PATCH v2 24/27] network: add an nftables backend for network driver's firewall construction

2024-04-23 Thread Daniel P . Berrangé
On Tue, Apr 23, 2024 at 01:27:05PM -0400, Laine Stump wrote: > On 4/23/24 7:15 AM, Daniel P. Berrangé wrote: > > On Sun, Apr 21, 2024 at 10:53:32PM -0400, Laine Stump wrote: > > > Support using nftables to setup the firewall for each virtual network, > > > rather than iptables. The initial implemen

[PATCH v2 01/20] nodedev: fix mdev add udev event data handling

2024-04-23 Thread Marc Hartmayer
From: Boris Fiuczynski Two situations will trigger an udev add event: 1) the mdev is created when started (transient) or 2) the mdev was defined and is started In case 1 there is no node object existing and no config data is copied. In case 2 copying the active config data of an existing node o

[PATCH v2 00/20] node_dev_udev: use workerpool and improve nodedev events

2024-04-23 Thread Marc Hartmayer
When an udev event occurs for a mediated device (mdev) the mdev config data requires an update via mdevctl as the udev event does not contain all config data. This update needs to occur immediately and to be finished before the libvirt nodedev event is issued to keep the API usage reliable. Change

[PATCH v2 05/20] node_device_udev: Remove the timeout if the data is disposed

2024-04-23 Thread Marc Hartmayer
Remove the timeout when the udevEventData is disposed, analogous to priv->watch. Reviewed-by: Boris Fiuczynski Reviewed-by: Jonathon Jongsma Signed-off-by: Marc Hartmayer --- src/node_device/node_device_udev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/node_device/node_device_u

[PATCH v2 07/20] node_device_udev: Don't take `mdevctlLock` for `mdevctl list` and add comments about locking

2024-04-23 Thread Marc Hartmayer
Commit a99d876a0f58 ("node_device: Use automatic mutex management") replaced the locking mechanism and accidentally removed the comment with the reason why the lock is taken. The reason was to "ensure only a single thread can query mdevctl at a time", but this reason is no longer valid or maybe it

[PATCH v2 02/20] node_device_udev: Set @def to NULL

2024-04-23 Thread Marc Hartmayer
@def is owned by @obj after adding it the node device object list. As soon as the @obj lock has been released, another thread could free @obj and therefore @def. If now someone accesses @def this would lead to a heap-use-after-free and therefore most likely to a segmentation fault, therefore set @d

[PATCH v2 06/20] node_device_udev: Test for mdevctlTimeout != -1

2024-04-23 Thread Marc Hartmayer
It is done a little differently everywhere in libvirt, but most common is to test for != -1. Reviewed-by: Boris Fiuczynski Reviewed-by: Jonathon Jongsma Signed-off-by: Marc Hartmayer --- src/node_device/node_device_udev.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git

[PATCH v2 04/20] nodedev: reset active config data on udev remove event

2024-04-23 Thread Marc Hartmayer
From: Boris Fiuczynski When a mdev device is destroyed or stopped the udev remove event handling needs to reset the active config data of the node object representing a persisted mdev. Reviewed-by: Marc Hartmayer Reviewed-by: Jonathon Jongsma Signed-off-by: Boris Fiuczynski --- src/node_devi

[PATCH v2 08/20] node_device_udev: Take lock if `driver->privateData` is modified

2024-04-23 Thread Marc Hartmayer
Since @driver->privateData is modified take the lock. Reviewed-by: Boris Fiuczynski Reviewed-by: Jonathon Jongsma Signed-off-by: Marc Hartmayer --- src/node_device/node_device_udev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/node_device/node_device_udev.c b/sr

[PATCH v2 03/20] nodedev: immediate update of active config on udev events

2024-04-23 Thread Marc Hartmayer
From: Boris Fiuczynski When an udev add, change or remove event occurs the mdev active config data requires an update via mdevctl as the udev does not contain all config data. This update needs to occur immediately and to be finished before the libvirt nodedev event is issued to keep the API usag

[PATCH v2 11/20] node_device_udev: Move responsibility to release `(init|udev)Thread` to `udevEventDataDispose`

2024-04-23 Thread Marc Hartmayer
Everything is released in `udevEventDataDispose` except for the threads, change this as this makes the code easier to read as it can be simplified a little. Reviewed-by: Jonathon Jongsma Reviewed-by: Boris Fiuczynski Signed-off-by: Marc Hartmayer --- src/node_device/node_device_udev.c | 14 +++

[PATCH v2 10/20] node_device_udev: Inline `udevRemoveOneDevice`

2024-04-23 Thread Marc Hartmayer
Inline `udevRemoveOneDevice` as it's used only once. Reviewed-by: Boris Fiuczynski Reviewed-by: Jonathon Jongsma Signed-off-by: Marc Hartmayer --- src/node_device/node_device_udev.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/node_device/node_devi

[PATCH v2 14/20] node_device_udev: nodeStateShutdownPrepare: Disconnect the signals explicitly

2024-04-23 Thread Marc Hartmayer
The documentation of gobject signals reads: "If you are connecting handlers to signals and using a GObject instance as your signal handler user data, you should remember to pair calls to g_signal_connect() with calls to g_signal_handler_disconnect() or g_signal_handlers_disconnect_by_func(). While

[PATCH v2 13/20] node_device_udev: Introduce and use `stateShutdownPrepare` and `stateShutdownWait`

2024-04-23 Thread Marc Hartmayer
Introduce and use the driver functions for the node state shutdown preparation and wait. As they're also called in the error/cleanup path of `nodeStateInitialize`, they must be written in a way, that they can safely be executed even if not everything is initialized. In the next commit, these funct

[PATCH v2 12/20] node_device_udev: Fix leak of mdevctlLock, udevThreadCond, and mdevCtlMonitors

2024-04-23 Thread Marc Hartmayer
Even if `priv->udev_monitor` was never initialized, the mdevctlLock, udevThread were. Therefore let's match the order of releasing the resources the order of allocating the resources in `nodeStateInitialize`. In addition, use `g_steal_pointer` in `g_list_free_full`. Reviewed-by: Jonathon Jongsma

[PATCH v2 09/20] node_device_udev: Add prefix `udev` for udev related data

2024-04-23 Thread Marc Hartmayer
The new names make it easier to understand the purpose of the data. Reviewed-by: Boris Fiuczynski Reviewed-by: Jonathon Jongsma Signed-off-by: Marc Hartmayer --- src/node_device/node_device_udev.c | 48 +++--- 1 file changed, 24 insertions(+), 24 deletions(-) diff --gi

[PATCH v2 20/20] node_device_udev: remove incorrect G_GNUC_UNUSED

2024-04-23 Thread Marc Hartmayer
Signed-off-by: Marc Hartmayer --- src/node_device/node_device_udev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 14d44d5bcd0e..cc725997a39e 100644 --- a/src/node_device/node_device_udev.c +++ b/

[PATCH v2 15/20] node_device_udev: Pass the driver state as parameter in preparation for the next commit

2024-04-23 Thread Marc Hartmayer
It's better practice for all functions called by the threads to pass the driver via parameter and not global variables. Easier to test and cleaner. Reviewed-by: Jonathon Jongsma Reviewed-by: Boris Fiuczynski Signed-off-by: Marc Hartmayer --- src/node_device/node_device_driver.h | 2 +- src/no

[PATCH v2 18/20] node_device_udev: Add support for `g_autoptr` to `udevEventData`

2024-04-23 Thread Marc Hartmayer
Use this feature in `udevEventDataNew`. Reviewed-by: Jonathon Jongsma Reviewed-by: Boris Fiuczynski Signed-off-by: Marc Hartmayer --- src/node_device/node_device_udev.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/n

[PATCH v2 17/20] node_device_udev: Make the code easier to read

2024-04-23 Thread Marc Hartmayer
There is only one case where force is true, therefore let's inline that case. Reviewed-by: Jonathon Jongsma Reviewed-by: Boris Fiuczynski Signed-off-by: Marc Hartmayer --- src/node_device/node_device_udev.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff

[PATCH v2 16/20] node_device_udev: Use a worker pool for processing events and emitting nodedev event

2024-04-23 Thread Marc Hartmayer
Use a worker pool for processing the events (e.g. udev, mdevctl config changes) and the initialization instead of a separate initThread and a mdevctl-thread. This has the large advantage that we can leverage the job API and now this thread pool is responsible to do all the "costly-work" and emittin

[PATCH v2 19/20] node_device_udev: Pass the `udevEventData` via parameter and use refcounting

2024-04-23 Thread Marc Hartmayer
Instead of accessing the global `driver` object pass the `udevEventData` as parameter to the thread handler and watch callback. This has the advantage that: 1. proper refcounting 2. easier to read and test Reviewed-by: Jonathon Jongsma Reviewed-by: Boris Fiuczynski Signed-off-by: Marc Hartmayer

Re: [PATCH v2 24/27] network: add an nftables backend for network driver's firewall construction

2024-04-23 Thread Laine Stump
On 4/23/24 1:42 PM, Daniel P. Berrangé wrote: On Tue, Apr 23, 2024 at 01:27:05PM -0400, Laine Stump wrote: [...] On 4/23/24 7:15 AM, Daniel P. Berrangé wrote: What are the uniqueness guarantees of handle numbers. Each table has a monotonically increasing counter (I'd assume at least 32 bi

RFC: Drop micro part of our release versioning scheme

2024-04-23 Thread Jiri Denemark
Hi, Does anyone feel strongly against dropping the "micro" part from libvirt(-python) versions? I think the original idea was to use this number for maintenance releases in -maint branches, but we stopped doing those a long time ago (v3.2.1 was the last and most likely even the only release with m

Re: RFC: Drop micro part of our release versioning scheme

2024-04-23 Thread Peter Krempa
On Wed, Apr 24, 2024 at 08:43:00 +0200, Jiri Denemark wrote: > Hi, > > Does anyone feel strongly against dropping the "micro" part from > libvirt(-python) versions? I think the original idea was to use this > number for maintenance releases in -maint branches, but we stopped doing > those a long t