From aa720e09e86bd2b6ef6f88a8dd6378229d7bdc0d Mon Sep 17 00:00:00 2001 From: catborise Date: Wed, 21 Oct 2026 08:31:10 +0300 Subject: [PATCH] refactor(computes): drop the unused domain capabilities endpoint No page or script called it, and it answered with the disk device types for both videos and buses. The create view keeps reading the domain capabilities through wvmConnect. Co-Authored-By: Claude Opus 5.5 (1M context) --- computes/tests/test_views.py | 9 --------- computes/urls.py | 5 ----- computes/views.py | 22 ---------------------- instances/tests/test_xss.py | 3 +-- 4 files changed, 1 insertion(+), 38 deletions(-) diff --git a/computes/tests/test_views.py b/computes/tests/test_views.py index c46b2d6d..009dbd19 100644 --- a/computes/tests/test_views.py +++ b/computes/tests/test_views.py @@ -186,15 +186,6 @@ class ComputesTestCase(TestCase): response = self.client.get(reverse("buses", args=[self.compute.id, "x86_64", "q35", "disk"])) self.assertEqual(json.loads(response.content), {"bus": ["sata", "scsi", "virtio"]}) - def test_dom_capabilities(self): - self._require_live_compute() - response = self.client.get( - reverse( - "domcaps", kwargs={"compute_id": self.compute.id, "arch": "x86_64", "machine": "pc"} - ) - ) - self.assertEqual(response.status_code, 200) - class ComputeConcurrencyTestCase(TransactionTestCase): def test_concurrent_refresh_instance_database(self): diff --git a/computes/urls.py b/computes/urls.py index 80732d50..806e5907 100644 --- a/computes/urls.py +++ b/computes/urls.py @@ -85,11 +85,6 @@ urlpatterns = [ views.get_compute_disk_buses, name="buses", ), - path( - "archs//machines//capabilities", - views.get_dom_capabilities, - name="domcaps", - ), ] ), ), diff --git a/computes/views.py b/computes/views.py index 1e894194..d614eefb 100644 --- a/computes/views.py +++ b/computes/views.py @@ -167,18 +167,6 @@ def get_compute_machine_types(request, compute_id, arch): return HttpResponse(comp_mgr.get_machine_types(arch), content_type="application/json") -def get_dom_capabilities(request, compute_id, arch, machine): - """ - :param request: - :param compute_id: - :param arch: - :param machine: - :return: - """ - comp_mgr = ComputeManager(compute_id) - return HttpResponse(comp_mgr.get_dom_capabilities(arch, machine), content_type="application/json") - - class ComputeManager: def __init__(self, compute_id): self.compute = get_object_or_404(Compute, pk=compute_id) @@ -189,16 +177,6 @@ class ComputeManager: self.compute.type, ) - def get_dom_capabilities(self, arch, machine): - data = dict() - try: - data["videos"] = self.conn.get_disk_device_types(arch, machine) - data["bus"] = self.conn.get_disk_device_types(arch, machine) - except libvirtError: - pass - - return json.dumps(data) - def get_machine_types(self, arch): data = dict() try: diff --git a/instances/tests/test_xss.py b/instances/tests/test_xss.py index 132b3afc..6be3e1aa 100644 --- a/instances/tests/test_xss.py +++ b/instances/tests/test_xss.py @@ -87,10 +87,9 @@ class JsonEndpointContentTypeTestCase(TestCase): reverse("compute_graph", args=[self.compute.id]), reverse("machines", args=[self.compute.id, "x86_64"]), reverse("buses", args=[self.compute.id, "x86_64", "q35", "disk"]), - reverse("domcaps", args=[self.compute.id, "x86_64", "q35"]), ] with patch("computes.views.ComputeManager") as mock_mgr: - for method in ("compute_graph", "get_machine_types", "get_disk_buses", "get_dom_capabilities"): + for method in ("compute_graph", "get_machine_types", "get_disk_buses"): getattr(mock_mgr.return_value, method).return_value = "{}" for url in urls: with self.subTest(url=url):