mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
perf(instances): the VM page lists ISO images without reading every pool
The VM page refreshed every active storage pool to list the ISO images for its CD-ROM drives. A pool holding large disk images took up to seconds to refresh, most of the page's time, on every page load. The page now lists the ISO images libvirt already knows. Images uploaded through the panel are known at once. For an image copied to a pool by hand, the Removable media section has a Refresh ISO list button that refreshes the active pools and returns to the page.
This commit is contained in:
parent
37905a0b75
commit
d5d054de71
6 changed files with 52 additions and 19 deletions
|
|
@ -23,6 +23,7 @@ DISK_ENDPOINTS = [
|
|||
("detach_cdrom", ["hda"]),
|
||||
("mount_iso", []),
|
||||
("unmount_iso", []),
|
||||
("refresh_iso", []),
|
||||
]
|
||||
|
||||
VM_DISK = {
|
||||
|
|
@ -86,6 +87,13 @@ class DiskViewsTenantIsolationTestCase(TestCase):
|
|||
mock_storage.assert_not_called()
|
||||
mock_create.assert_not_called()
|
||||
|
||||
def test_refresh_iso_reads_the_pools_again_and_returns_to_the_disks_tab(self):
|
||||
self.client.force_login(self.superuser)
|
||||
with patch("instances.models.wvmInstance") as mock_wvm:
|
||||
res = self._post("refresh_iso", {})
|
||||
self.assertRedirects(res, self.referer + "#disks", fetch_redirect_response=False)
|
||||
mock_wvm.return_value.refresh_iso_pools.assert_called_once_with()
|
||||
|
||||
def test_delete_vol_deletes_the_volume_attached_to_dev_not_the_posted_one(self):
|
||||
self.client.force_login(self.superuser)
|
||||
with patch("instances.models.wvmInstance") as mock_wvm, patch(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue