1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +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:
catborise 2026-10-30 07:59:11 +03:00
parent 2f17bf8cb9
commit 87cb728fcb
11 changed files with 184 additions and 311 deletions

View file

@ -1012,7 +1012,7 @@ class InstancesTestCase(TestCase):
self.assertEqual(self.instance.networks[0]["state"], "down")
def test_set_unset_qos(self):
self.assertEqual(len(self.instance.config_qos.keys()), 0)
self.assertFalse(self.instance.config_networks[0]["inbound"])
net_mac = self.instance.networks[0]["mac"]
response = self.client.post(
reverse("instances:set_qos", args=[self.instance.id]),
@ -1027,8 +1027,8 @@ class InstancesTestCase(TestCase):
)
self.assertEqual(response.status_code, 302)
del self.instance.config_qos
self.assertEqual(len(self.instance.config_qos.keys()), 1)
del self.instance.config_networks
self.assertEqual(self.instance.config_networks[0]["inbound"]["average"], "1")
response = self.client.post(
reverse("instances:unset_qos", args=[self.instance.id]),
@ -1039,8 +1039,8 @@ class InstancesTestCase(TestCase):
HTTP_REFERER=reverse("index"),
)
self.assertEqual(response.status_code, 302)
del self.instance.config_qos
self.assertEqual(len(self.instance.config_qos.keys()), 0)
del self.instance.config_networks
self.assertFalse(self.instance.config_networks[0]["inbound"])
# test on running instance
# self.instance.proxy.start()