1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 19:26:48 +00:00

fix(computes): a disk is offered the host's disk buses

The bus list of a disk on the VM create page came from the host's disk
device types: choosing "disk" for an added image offered cdrom, disk and
lun as its buses. The disk branch of get_disk_buses now returns the
host's disk bus types, the list the page starts each disk with.
This commit is contained in:
catborise 2026-10-20 20:33:14 +03:00
parent dba41f97f3
commit 0d5014d9ef
2 changed files with 10 additions and 1 deletions

View file

@ -1,4 +1,6 @@
import json
import os
from unittest.mock import patch
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import reverse
from django.test import RequestFactory, TestCase, TransactionTestCase
@ -177,6 +179,13 @@ class ComputesTestCase(TestCase):
)
self.assertEqual(response.status_code, 200)
def test_a_disk_is_offered_the_hosts_disk_buses(self):
with patch("computes.views.wvmConnect") as conn:
conn.return_value.get_disk_device_types.return_value = ["disk", "cdrom", "lun"]
conn.return_value.get_disk_bus_types.return_value = ["virtio", "sata", "scsi"]
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(

View file

@ -215,7 +215,7 @@ class ComputeManager:
if disk in disk_device_types:
if disk == "disk":
data["bus"] = sorted(disk_device_types)
data["bus"] = sorted(self.conn.get_disk_bus_types(arch, machine))
elif disk == "cdrom":
data["bus"] = ["ide", "sata", "scsi"]
elif disk == "floppy":