public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH common] inotify: avoid cyclic use statement
@ 2024-08-02 11:53 Fiona Ebner
  2024-11-11 11:49 ` Stefan Hanreich
  2024-11-11 12:37 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 5+ messages in thread
From: Fiona Ebner @ 2024-08-02 11:53 UTC (permalink / raw)
  To: pve-devel

Commit e68ebda ("fix #545: interfaces: allow arbitrary bridge names in
network config") introduced a cyclic usage between
PVE::RESTEnvironment and PVE::INotify, making code like the following
fail:

> perl -e "use PVE::RESTEnvironment qw(log_warn);"

Note, including the PVE::INotify module first would still work, i.e.:

> perl -e "use PVE::INotify; use PVE::RESTEnvironment qw(log_warn);"

The rest of the PVE::INotify module alredy uses syslog(), which could
be used here as well to get rid of the cyclic usage. Wolfgang argued
that the whole point of commit e68ebda was to remove coupling between
the name and the type of the interface. If there still is some code
about a name starting with 'vmbr' being classified wrong, that should
rather be fixed. Because of the very commit, the frontend already
doesn't show e.g. a non-bridge with name 'vmbr7' in bridge selectors.

Suggested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Fixes: e68ebda ("fix #545: interfaces: allow arbitrary bridge names in network config")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

@Stefan: Do you have any good rationale to rather keep the check?

 src/PVE/INotify.pm | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index 8a4a810..e7c55f6 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -22,7 +22,6 @@ use PVE::Network;
 use PVE::ProcFSTools;
 use PVE::SafeSyslog;
 use PVE::Tools;
-use PVE::RESTEnvironment qw(log_warn);
 
 use base 'Exporter';
 
@@ -1145,9 +1144,6 @@ sub __read_etc_network_interfaces {
 	    }
 	}
 
-	log_warn("detected a interface $iface that is not a bridge!")
-	    if !($d->{type} eq 'OVSBridge' || $d->{type} eq 'bridge') && $iface =~ m/^vmbr\d+$/;
-
 	# map address and netmask to cidr
 	if (my $addr = $d->{address}) {
 	    if (_address_is_cidr($addr)) {
-- 
2.39.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [pve-devel] [PATCH common] inotify: avoid cyclic use statement
  2024-08-02 11:53 [pve-devel] [PATCH common] inotify: avoid cyclic use statement Fiona Ebner
@ 2024-11-11 11:49 ` Stefan Hanreich
  2024-11-11 12:10   ` Fiona Ebner
  2024-11-11 12:37 ` [pve-devel] applied: " Thomas Lamprecht
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Hanreich @ 2024-11-11 11:49 UTC (permalink / raw)
  To: Fiona Ebner, pve-devel

On 8/2/24 13:53, Fiona Ebner wrote:
> @Stefan: Do you have any good rationale to rather keep the check?

maybe change it from log_warn to warn? I can send a patch if you like.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [pve-devel] [PATCH common] inotify: avoid cyclic use statement
  2024-11-11 11:49 ` Stefan Hanreich
@ 2024-11-11 12:10   ` Fiona Ebner
  2024-11-11 12:33     ` Stefan Hanreich
  0 siblings, 1 reply; 5+ messages in thread
From: Fiona Ebner @ 2024-11-11 12:10 UTC (permalink / raw)
  To: Stefan Hanreich, pve-devel

Am 11.11.24 um 12:49 schrieb Stefan Hanreich:
> On 8/2/24 13:53, Fiona Ebner wrote:
>> @Stefan: Do you have any good rationale to rather keep the check?
> 
> maybe change it from log_warn to warn? I can send a patch if you like.

See the commit message:

>> The rest of the PVE::INotify module alredy uses syslog(), which could
>> be used here as well to get rid of the cyclic usage. Wolfgang argued
>> that the whole point of commit e68ebda was to remove coupling between
>> the name and the type of the interface. If there still is some code
>> about a name starting with 'vmbr' being classified wrong, that should
>> rather be fixed. Because of the very commit, the frontend already
>> doesn't show e.g. a non-bridge with name 'vmbr7' in bridge selectors.

If we keep it, syslog() is better than warn here. But why is it better
for the check to be there than not (like Wolfgang suggested)?


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [pve-devel] [PATCH common] inotify: avoid cyclic use statement
  2024-11-11 12:10   ` Fiona Ebner
@ 2024-11-11 12:33     ` Stefan Hanreich
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Hanreich @ 2024-11-11 12:33 UTC (permalink / raw)
  To: Fiona Ebner, pve-devel

On 11/11/24 13:10, Fiona Ebner wrote:
>>> The rest of the PVE::INotify module alredy uses syslog(), which could
>>> be used here as well to get rid of the cyclic usage. Wolfgang argued
>>> that the whole point of commit e68ebda was to remove coupling between
>>> the name and the type of the interface. If there still is some code
>>> about a name starting with 'vmbr' being classified wrong, that should
>>> rather be fixed. Because of the very commit, the frontend already
>>> doesn't show e.g. a non-bridge with name 'vmbr7' in bridge selectors.
> 
> If we keep it, syslog() is better than warn here. But why is it better
> for the check to be there than not (like Wolfgang suggested)?

It was intended as a safety net, so we can catch potentially odd setups.
Iirc no one ever reported seeing that warning, so I guess it passed the
scream test.

So, removing this check is fine by me.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] applied: [PATCH common] inotify: avoid cyclic use statement
  2024-08-02 11:53 [pve-devel] [PATCH common] inotify: avoid cyclic use statement Fiona Ebner
  2024-11-11 11:49 ` Stefan Hanreich
@ 2024-11-11 12:37 ` Thomas Lamprecht
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2024-11-11 12:37 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fiona Ebner

Am 02.08.24 um 13:53 schrieb Fiona Ebner:
> Commit e68ebda ("fix #545: interfaces: allow arbitrary bridge names in
> network config") introduced a cyclic usage between
> PVE::RESTEnvironment and PVE::INotify, making code like the following
> fail:
> 
>> perl -e "use PVE::RESTEnvironment qw(log_warn);"
> 
> Note, including the PVE::INotify module first would still work, i.e.:
> 
>> perl -e "use PVE::INotify; use PVE::RESTEnvironment qw(log_warn);"
> 
> The rest of the PVE::INotify module alredy uses syslog(), which could
> be used here as well to get rid of the cyclic usage. Wolfgang argued
> that the whole point of commit e68ebda was to remove coupling between
> the name and the type of the interface. If there still is some code
> about a name starting with 'vmbr' being classified wrong, that should
> rather be fixed. Because of the very commit, the frontend already
> doesn't show e.g. a non-bridge with name 'vmbr7' in bridge selectors.
> 
> Suggested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> Fixes: e68ebda ("fix #545: interfaces: allow arbitrary bridge names in network config")
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> 
> @Stefan: Do you have any good rationale to rather keep the check?
> 
>  src/PVE/INotify.pm | 4 ----
>  1 file changed, 4 deletions(-)
> 
>

applied, thanks!


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-11 12:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-02 11:53 [pve-devel] [PATCH common] inotify: avoid cyclic use statement Fiona Ebner
2024-11-11 11:49 ` Stefan Hanreich
2024-11-11 12:10   ` Fiona Ebner
2024-11-11 12:33     ` Stefan Hanreich
2024-11-11 12:37 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal