From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 854681FF0AA for ; Tue, 06 Oct 2026 12:46:05 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 700272139F; Tue, 06 Oct 2026 12:46:02 +0200 (CEST) Content-Type: text/plain; charset=UTF-8 Date: Tue, 06 Oct 2026 12:45:59 +0200 Message-Id: Subject: Re: [PATCH test-tools 1/6] runner: add vmid-range option for test guest VMIDs From: "Lukas Wagner" To: =?utf-8?q?Michael_K=C3=B6ppl?= , Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: aerc 0.21.0-0-g5549850facc2-dirty References: <20260917162324.1926056-1-m.koeppl@proxmox.com> <20260917162324.1926056-2-m.koeppl@proxmox.com> In-Reply-To: <20260917162324.1926056-2-m.koeppl@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1791283559300 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.356 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: FS2P7ABQJJA267XGWVVZ637V6KG6RRTY X-Message-ID-Hash: FS2P7ABQJJA267XGWVVZ637V6KG6RRTY X-MailFrom: l.wagner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu Sep 17, 2026 at 6:23 PM CEST, Michael K=C3=B6ppl wrote: > +impl FromStr for VmIdRange { > + type Err =3D Error; > + > + fn from_str(s: &str) -> Result { > + let (start, end) =3D s > + .split_once(':') > + .ok_or_else(|| format_err!("expected ':', got '{= s}'"))?; > + > + let start: u32 =3D start > + .parse() > + .with_context(|| format!("invalid range start '{start}'"))?; > + > + let end: u32 =3D end > + .parse() > + .with_context(|| format!("invalid range end '{end}'"))?; > + > + if start >=3D end { > + bail!("range start {start} must be lower than its end {end}"= ); > + } > + > + if start < VMID_MIN || end > VMID_MAX { > + bail!("range must be within {VMID_MIN}..=3D{VMID_MAX}"); > + } > + > + Ok(Self { start, end }) > + } > +} > + > +impl std::fmt::Display for VmIdRange { > + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { > + write!(f, "{}:{}", self.start, self.end) > + } > +} > + > +impl Serialize for VmIdRange { > + fn serialize(&self, serializer: S) -> Result > + where > + S: serde::Serializer, > + { > + serializer.collect_str(self) > + } > +} > + > +impl<'d> Deserialize<'d> for VmIdRange { > + fn deserialize(deserializer: D) -> Result > + where > + D: serde::Deserializer<'d>, > + { > + let s =3D String::deserialize(deserializer)?; > + s.parse().map_err(serde::de::Error::custom) > + } > +} Btw, you could use: proxmox_serde::forward_deserialize_to_from_str!(VmIdRange); proxmox_serde::forward_serialize_to_display!(VmIdRange); we use these helpers quite often in our code bases already.