From: Daniel Herzig <d.herzig@proxmox.com>
To: Stefan Hanreich <s.hanreich@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH guest-common 1/4] fix #5900: add helper function
Date: Mon, 16 Dec 2024 09:38:58 +0100 [thread overview]
Message-ID: <87v7vkf2e5.fsf@proxmox.com> (raw)
In-Reply-To: <c781bff4-9ff0-4d28-8ff8-abd363594fa8@proxmox.com> (Stefan Hanreich's message of "Thu, 12 Dec 2024 18:12:23 +0100")
Hi Stefan,
thanks for the feedback.
Thanks for hinting at ~PVE::LXC::Config::parse_lxc_network~. I oversaw
that and did not want to pull ~PVE::QemuServer::parse_net~ into LXC's
deps.
Stefan Hanreich <s.hanreich@proxmox.com> writes:
> On 12/5/24 17:33, Daniel Herzig wrote:
>> This patch adds a small helper function to retrieve the bridge name
>> from the netN parameter string of a container or VM configuration.
>>
>> Signed-off-by: Daniel Herzig <d.herzig@proxmox.com>
>> ---
>> src/PVE/GuestHelpers.pm | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/src/PVE/GuestHelpers.pm b/src/PVE/GuestHelpers.pm
>> index 592b4a8..c6006ba 100644
>> --- a/src/PVE/GuestHelpers.pm
>> +++ b/src/PVE/GuestHelpers.pm
>> @@ -450,4 +450,15 @@ sub abort_guest_tasks {
>> return $aborted_tasks;
>> }
>>
>> +sub get_bridge {
>> + my $net_params = shift;
>> + my $param_array = [ split(/,/, $net_params) ];
>> + my $bridge;
>> + for my $net_param (@$param_array) {
>> + $bridge = $net_param if ($net_param =~ /bridge\=/);
>> + $bridge =~ s|bridge\=|| if (defined($bridge));
>> + }
>> + return $bridge;
>> +}
>> +
>> 1;
>
> net is a property string, if you want to parse it there are helpers for
> that in PVE::JSONSchema.
>
> For VMs as well as CTs we already have helpers for parsing the network
> property string defined:
>
> PVE::QemuServer::parse_net
> PVE::LXC::Config::parse_lxc_network
_______________________________________________
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:[~2024-12-16 8:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 16:33 [pve-devel] [PATCH guest-common, network, container, qemu-server 0/4] fix #5900: enhance SDN auto-dhcp behaviour Daniel Herzig
2024-12-05 16:33 ` [pve-devel] [PATCH guest-common 1/4] fix #5900: add helper function Daniel Herzig
2024-12-12 17:12 ` Stefan Hanreich
2024-12-16 8:38 ` Daniel Herzig [this message]
2024-12-05 16:33 ` [pve-devel] [PATCH network 2/4] fix #5900: add helper functions Daniel Herzig
2024-12-12 17:06 ` Stefan Hanreich
2024-12-16 8:35 ` Daniel Herzig
2024-12-05 16:33 ` [pve-devel] [PATCH container 3/4] fix #5900: do not create container if dhcp range is exhausted Daniel Herzig
2024-12-05 16:33 ` [pve-devel] [PATCH qemu-server 4/4] fix #5900: do not create vm " Daniel Herzig
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=87v7vkf2e5.fsf@proxmox.com \
--to=d.herzig@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox