From: Stefan Hanreich <s.hanreich@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Maximiliano Sandoval <m.sandoval@proxmox.com>
Subject: Re: [pve-devel] [PATCH proxmox-ve-rs 1/1] partially fix #6176: config: guest: change default for firewall key
Date: Wed, 19 Feb 2025 15:25:33 +0100 [thread overview]
Message-ID: <72f66ab3-857c-466a-b73e-fa881195de7c@proxmox.com> (raw)
In-Reply-To: <s8o34gahz7u.fsf@proxmox.com>
On 2/19/25 13:52, Maximiliano Sandoval wrote:
>> -#[derive(Debug)]
>> +#[derive(Debug, Deserialize)]
>> #[cfg_attr(test, derive(Eq, PartialEq))]
>> -pub struct NetworkDevice {
>> +pub struct QemuNetworkDevice {
>> model: NetworkDeviceModel,
>> + #[serde(rename = "macaddr")]
>> + mac_address: MacAddress,
>> + firewall: Option<bool>,
>
> Why not use `#[serde(default)]` and always get a boolean? The only place
> it is used uses .unwrap_or(false) (unwrap_or_default would be preferable
> imho).
The reasoning for this is that it is modeled 1:1 after what's in the
property string. It works when reading, but when trying to serialize the
struct you then always have to provide the value for firewall and cannot
omit it.
unwrap_or_default() is fine by me, i thought unwrap_or(false) makes it
clearer but I don't mind at all.
_______________________________________________
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-02-19 14:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-19 10:09 Stefan Hanreich
2025-02-19 10:09 ` [pve-devel] [PATCH proxmox-firewall 1/4] ipsets: remove dereference Stefan Hanreich
2025-02-19 10:09 ` [pve-devel] [PATCH proxmox-firewall 2/4] partially fix #6176: ipfilter: honor firewall setting from guest cfg Stefan Hanreich
2025-02-19 10:09 ` [pve-devel] [PATCH proxmox-firewall 3/4] partially fix #6176: do not generate mac filter if firewall disabled Stefan Hanreich
2025-02-19 10:09 ` [pve-devel] [PATCH proxmox-firewall 4/4] tests: add network device without firewall key Stefan Hanreich
2025-02-19 12:52 ` [pve-devel] [PATCH proxmox-ve-rs 1/1] partially fix #6176: config: guest: change default for " Maximiliano Sandoval
2025-02-19 14:25 ` Stefan Hanreich [this message]
2025-02-19 16:12 ` Stefan Hanreich
2025-03-13 13:24 ` [pve-devel] superseded: " 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=72f66ab3-857c-466a-b73e-fa881195de7c@proxmox.com \
--to=s.hanreich@proxmox.com \
--cc=m.sandoval@proxmox.com \
--cc=pve-devel@lists.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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal