mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
fix(networks): fixed addresses, failed creates and stopped networks behave
- A network created with fixed addresses gets one per address of its DHCP range for any subnet; the old prefix cut assumed a gateway ending in .1 and built addresses such as 10.0.0.1.130. Fixed addresses need a /24 or smaller subnet. - A new network that does not start (its subnet is in use) is undefined again, so the name is free for another try. - Fixed addresses are changed and deleted on a stopped network too: the running network is changed only while it runs. A host with only a name is deleted as defined, not with an empty MAC, shows no "None", and has no edit button it could not use. - The create dialog disables the fields it hides, so an IPv6 subnet typed and then unchecked is not created, and switching from MACVTAP back to BRIDGE restores the bridge label and the Open vSwitch option. - Isolated networks show QoS; QoS save buttons no longer raise a script error; saving an unchanged fixed address says so; two messages lose a stray backslash and spaces.
This commit is contained in:
parent
1262559793
commit
09d7b0c08a
7 changed files with 119 additions and 64 deletions
|
|
@ -61,6 +61,14 @@ class AddNetPool(forms.Form):
|
|||
def clean_subnet(self):
|
||||
return checked_subnet(self.cleaned_data["subnet"], 4)
|
||||
|
||||
def clean(self):
|
||||
cleaned = super().clean()
|
||||
# one fixed address per address of the DHCP range
|
||||
subnet = cleaned.get("subnet")
|
||||
if cleaned.get("fixed") and subnet and ipaddress.ip_network(subnet, strict=False).prefixlen < 24:
|
||||
self.add_error("fixed", _("Fixed addresses need an IPv4 subnet of /24 or smaller"))
|
||||
return cleaned
|
||||
|
||||
def clean_subnet6(self):
|
||||
return checked_subnet(self.cleaned_data["subnet6"], 6)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue