[pve-devel] [PATCH qemu-server 4/4] fix #5900: do not create vm if dhcp range is exhausted
Daniel Herzig
d.herzig at proxmox.com
Thu Dec 5 17:33:32 CET 2024
This patch prevents VMs to be created if their bridge is
associated with a SDN zone with dnsmasq automatic dhcp enabled, and if
the dhcp-range is exhausted or unset.
Signed-off-by: Daniel Herzig <d.herzig at proxmox.com>
---
PVE/API2/Qemu.pm | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index ec45d5ff..73580c64 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -1065,6 +1065,18 @@ __PACKAGE__->register_method({
raise_perm_exc();
}
+ for my $opt (keys %$param) {
+ if ($opt =~ /net/) {
+ my $bridge_err;
+ my $bridge = PVE::GuestHelpers::get_bridge(${param}->{$opt});
+ if (defined($bridge)) {
+ eval { PVE::Network::SDN::Dhcp::test_bridge_for_sdn_dnsmasq($bridge) };
+ ${bridge_err}->{$opt} = $@ if $@;
+ raise_param_exc($bridge_err) if $bridge_err;
+ }
+ }
+ }
+
if ($archive) {
for my $opt (sort keys $param->%*) {
if (PVE::QemuServer::Drive::is_valid_drivename($opt)) {
--
2.39.5
More information about the pve-devel
mailing list