mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 11:16:47 +00:00
fix(instances): a running VM's QoS edit keeps the pending QoS changes
The QoS table showed the running VM's bandwidth while an edit changes the definition for the next start. Each row posts average, peak and burst, so an edit wrote the running values back over a pending change, and a direction added while the VM ran had no row. The table shows the persistent definition now. An edit also kept only the posted values and dropped an inbound floor; it now updates them and keeps the rest.
This commit is contained in:
parent
8d2c9b1217
commit
ea9424ee1f
8 changed files with 62 additions and 22 deletions
|
|
@ -1979,9 +1979,9 @@ class wvmInstance(wvmConnect):
|
|||
def set_memory(self, size, flags=0):
|
||||
self.instance.setMemoryFlags(size, flags)
|
||||
|
||||
def get_all_qos(self):
|
||||
def get_all_qos(self, config=False):
|
||||
qos_values = dict()
|
||||
tree = etree.fromstring(self._XMLDesc(0))
|
||||
tree = etree.fromstring(self._XMLDesc(PERSISTENT_XML if config else 0))
|
||||
qos = tree.xpath("/domain/devices/interface")
|
||||
|
||||
for q in qos:
|
||||
|
|
@ -2029,10 +2029,7 @@ class wvmInstance(wvmConnect):
|
|||
peak = int(peak)
|
||||
burst = int(burst)
|
||||
|
||||
if direction == "inbound":
|
||||
xml = f"<inbound average='{average}' peak='{peak}' burst='{burst}'/>"
|
||||
else:
|
||||
xml = f"<outbound average='{average}' peak='{peak}' burst='{burst}'/>"
|
||||
xml = f"<{direction} average='{average}' peak='{peak}' burst='{burst}'/>"
|
||||
|
||||
tree = etree.fromstring(self._XMLDesc(PERSISTENT_XML))
|
||||
|
||||
|
|
@ -2048,9 +2045,8 @@ class wvmInstance(wvmConnect):
|
|||
else:
|
||||
direct = band.find(direction)
|
||||
if direct is not None:
|
||||
parent = direct.getparent()
|
||||
parent.remove(direct)
|
||||
parent.append(etree.fromstring(xml))
|
||||
# keep what the form does not post (an inbound floor)
|
||||
direct.attrib.update(etree.fromstring(xml).attrib)
|
||||
else:
|
||||
band.append(etree.fromstring(xml))
|
||||
new_xml = etree.tostring(tree).decode()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue