mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-10 04:06:47 +00:00
fix(networks): a network QoS rate that is not a whole number is refused
A network's QoS form whose rate was not a whole number (abc, 1.5) made wvmNetwork.set_qos raise a ValueError that the view did not catch: the request ended in a server error. The page's pattern stops this in a browser, but the server must refuse it too. set_qos now says "QoS rates must be whole numbers", and the view reports that, as it does a libvirt error, and goes back to the network's page.
This commit is contained in:
parent
0a1219c659
commit
8c1d7d33bb
3 changed files with 32 additions and 5 deletions
|
|
@ -356,9 +356,10 @@ class wvmNetwork(wvmConnect):
|
|||
if direction not in ("inbound", "outbound"):
|
||||
raise ValueError("Direction must be inbound or outbound")
|
||||
|
||||
average = int(average)
|
||||
peak = int(peak)
|
||||
burst = int(burst)
|
||||
try:
|
||||
average, peak, burst = int(average), int(peak), int(burst)
|
||||
except ValueError:
|
||||
raise ValueError("QoS rates must be whole numbers")
|
||||
|
||||
xml = f"<{direction} average='{average}' peak='{peak}' burst='{burst}'/>"
|
||||
tree = etree.fromstring(self._XMLDesc(0))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue