From: Hannes Laimer <h.laimer@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Stefan Hanreich <s.hanreich@proxmox.com>
Subject: Re: [pve-devel] [PATCH proxmox-ve-rs v2 1/1] config: guest: store network devices in BTreeMap
Date: Wed, 1 Oct 2025 09:23:13 +0200 [thread overview]
Message-ID: <b145eb95-c071-4ce3-a7c0-5f94b2e58ce3@proxmox.com> (raw)
In-Reply-To: <20250925122142.228719-2-s.hanreich@proxmox.com>
On 9/25/25 14:22, Stefan Hanreich wrote:
> Enables iterating over the network devices in order, without
> performing any additional sorting at the call sites. This makes the
> output in proxmox-firewall stable, which is useful for test cases as
> well as for comparing the output of different proxmox-firewall runs.
>
Are we actually explicitly sorting anywhere? I didn't really find any
places. If there should be, we can drop those. Nonetheless this makes a
lot if sense.
> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
> ---
> proxmox-ve-config/src/guest/vm.rs | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/proxmox-ve-config/src/guest/vm.rs b/proxmox-ve-config/src/guest/vm.rs
> index cc97781..baff1b8 100644
> --- a/proxmox-ve-config/src/guest/vm.rs
> +++ b/proxmox-ve-config/src/guest/vm.rs
> @@ -1,4 +1,4 @@
> -use std::collections::HashMap;
> +use std::collections::BTreeMap;
> use std::io;
> use std::str::FromStr;
>
> @@ -278,7 +278,7 @@ impl FromStr for NetworkDevice {
> #[derive(Debug, Default)]
> #[cfg_attr(test, derive(Eq, PartialEq))]
> pub struct NetworkConfig {
> - network_devices: HashMap<i64, NetworkDevice>,
> + network_devices: BTreeMap<i64, NetworkDevice>,
> }
>
> impl NetworkConfig {
> @@ -300,12 +300,12 @@ impl NetworkConfig {
> bail!("No index found in net key string: {key}")
> }
>
> - pub fn network_devices(&self) -> &HashMap<i64, NetworkDevice> {
> + pub fn network_devices(&self) -> &BTreeMap<i64, NetworkDevice> {
> &self.network_devices
> }
>
> pub fn parse<R: io::BufRead>(input: R) -> Result<Self, Error> {
> - let mut network_devices = HashMap::new();
> + let mut network_devices = BTreeMap::new();
>
> for line in input.lines() {
> let line = line?;
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-10-01 7:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-25 12:21 [pve-devel] [PATCH proxmox{-ve-rs, -firewall} v2 0/4] Fix ipfilters in proxmox-firewall Stefan Hanreich
2025-09-25 12:21 ` [pve-devel] [PATCH proxmox-ve-rs v2 1/1] config: guest: store network devices in BTreeMap Stefan Hanreich
2025-10-01 7:23 ` Hannes Laimer [this message]
2025-10-01 8:17 ` Stefan Hanreich
2025-09-25 12:21 ` [pve-devel] [PATCH proxmox-firewall v2 1/3] run rustfmt Stefan Hanreich
2025-09-25 12:21 ` [pve-devel] [PATCH proxmox-firewall v2 2/3] ipfilter: fix wrong entries for containers Stefan Hanreich
2025-09-25 12:21 ` [pve-devel] [PATCH proxmox-firewall v2 3/3] fix #6336: fix ipfilter matching logic Stefan Hanreich
2025-10-01 7:31 ` Hannes Laimer
2025-10-01 8:11 ` Stefan Hanreich
2025-10-01 16:30 ` [pve-devel] superseded: [PATCH proxmox{-ve-rs, -firewall} v2 0/4] Fix ipfilters in proxmox-firewall Stefan Hanreich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b145eb95-c071-4ce3-a7c0-5f94b2e58ce3@proxmox.com \
--to=h.laimer@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=s.hanreich@proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.