all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Lendl <s.lendl@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-container 2/3] sdn: pass vmid and hostname to add_dhcp_mapping
Date: Tue, 21 Nov 2023 15:55:55 +0100	[thread overview]
Message-ID: <20231121145556.436743-3-s.lendl@proxmox.com> (raw)
In-Reply-To: <20231121145556.436743-1-s.lendl@proxmox.com>

If no DHCP mapping was found in IPAM it will request a new IP.
In order to register an IPAM mapping it requires these values.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
---
 src/PVE/LXC.pm            | 4 ++--
 src/lxc-pve-prestart-hook | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 9361823..7883cfb 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -993,7 +993,7 @@ sub update_net {
 		warn $@ if $@;
 
 		PVE::Network::SDN::Vnets::add_next_free_cidr($newnet->{bridge}, $conf->{hostname}, $newnet->{hwaddr}, $vmid, undef, 1);
-		PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, $newnet->{hwaddr});
+		PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, $newnet->{hwaddr}, $vmid, $conf->{hostname});
 	    }
 
 	    delete $conf->{$opt};
@@ -1046,7 +1046,7 @@ sub update_net {
     } else {
 	if ($have_sdn) {
 	    PVE::Network::SDN::Vnets::add_next_free_cidr($newnet->{bridge}, $conf->{hostname}, $newnet->{hwaddr}, $vmid, undef, 1);
-	    PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, $newnet->{hwaddr});
+	    PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, $newnet->{hwaddr}, $vmid, $conf->{hostname});
 	}
 
 	hotplug_net($vmid, $conf, $opt, $newnet, $netid);
diff --git a/src/lxc-pve-prestart-hook b/src/lxc-pve-prestart-hook
index ab35774..4f5c7e2 100755
--- a/src/lxc-pve-prestart-hook
+++ b/src/lxc-pve-prestart-hook
@@ -210,7 +210,7 @@ PVE::LXC::Tools::lxc_hook('pre-start', 'lxc', sub {
 	    next if $k !~ /^net(\d+)/;
 	    my $net = PVE::LXC::Config->parse_lxc_network($conf->{$k});
 	    next if $net->{type} ne 'veth';
-	    PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, $net->{hwaddr});
+	    PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, $net->{hwaddr}, $conf->{vmid}, $conf->{hostname});
 	}
     }
 });
-- 
2.42.0





  parent reply	other threads:[~2023-11-21 14:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21 14:55 [pve-devel] [PATCH network/container/qemu-server 0/3] sdn: register a new IP at VM start if missing Stefan Lendl
2023-11-21 14:55 ` [pve-devel] [PATCH pve-network 1/3] sdn: register MAC in IPAM if not found Stefan Lendl
2023-11-21 14:55 ` Stefan Lendl [this message]
2023-11-21 17:49   ` [pve-devel] [PATCH pve-container 2/3] sdn: pass vmid and hostname to add_dhcp_mapping Stefan Hanreich
2023-11-21 14:55 ` [pve-devel] [PATCH qemu-server 3/3] " Stefan Lendl
2023-11-21 19:57 ` [pve-devel] applied-series: [PATCH network/container/qemu-server 0/3] sdn: register a new IP at VM start if missing Thomas Lamprecht

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=20231121145556.436743-3-s.lendl@proxmox.com \
    --to=s.lendl@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