mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 03:36:48 +00:00
feat(instances): a VM's network devices as cards, each with its QoS limits
Settings > Network was a table whose fields were read-only inputs cut off at phone width, an unlabelled "+", three icon buttons per NIC and a separate QoS table keyed by MAC. The owner chose card layout from three rendered options, with the QoS limits folding out like the device details: - A card per NIC: a VM's only NIC spans the row, two or more sit side by side from md. Each has its name and target, the link state as a switch, its source and IPv4 addresses, and "Device details" (type, MAC, model, NWFilter, IPv6) in a <details>. - "QoS limits" in a second <details>, its summary naming the limited directions: a form per inbound or outbound limit, with Save and Delete limit, and the units. - Labelled Edit, Add QoS and Delete in the card footer; "Add network device" by the heading. The edit and add-QoS dialogs are titled and labelled, and the edit dialog's fields have labels. The limits come from each NIC of the persistent definition, so the QoS table, Instance.config_qos and wvmInstance.get_all_qos are removed.
This commit is contained in:
parent
0f778fe9f0
commit
a8f445d580
11 changed files with 184 additions and 311 deletions
|
|
@ -2883,48 +2883,6 @@ class wvmInstance(wvmConnect):
|
|||
def set_memory(self, size, flags=0):
|
||||
self.instance.setMemoryFlags(size, flags)
|
||||
|
||||
def get_all_qos(self, config=False):
|
||||
qos_values = dict()
|
||||
tree = etree.fromstring(self._XMLDesc(PERSISTENT_XML if config else 0))
|
||||
qos = tree.xpath("/domain/devices/interface")
|
||||
|
||||
for q in qos:
|
||||
bound_list = list()
|
||||
mac = q.xpath("mac/@address")
|
||||
band = q.find("bandwidth")
|
||||
if band is not None:
|
||||
in_qos = band.find("inbound")
|
||||
if in_qos is not None:
|
||||
in_av = in_qos.get("average")
|
||||
in_peak = in_qos.get("peak")
|
||||
in_burst = in_qos.get("burst")
|
||||
in_floor = in_qos.get("floor")
|
||||
bound_list.append(
|
||||
{
|
||||
"direction": "inbound",
|
||||
"average": in_av,
|
||||
"peak": in_peak,
|
||||
"floor": in_floor,
|
||||
"burst": in_burst,
|
||||
}
|
||||
)
|
||||
|
||||
out_qos = band.find("outbound")
|
||||
if out_qos is not None:
|
||||
out_av = out_qos.get("average")
|
||||
out_peak = out_qos.get("peak")
|
||||
out_burst = out_qos.get("burst")
|
||||
bound_list.append(
|
||||
{
|
||||
"direction": "outbound",
|
||||
"average": out_av,
|
||||
"peak": out_peak,
|
||||
"burst": out_burst,
|
||||
}
|
||||
)
|
||||
qos_values[mac[0]] = bound_list
|
||||
return qos_values
|
||||
|
||||
def set_qos(self, mac, direction, average, peak, burst):
|
||||
if direction not in ("inbound", "outbound"):
|
||||
raise ValueError("Direction must be inbound or outbound")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue