From 7132acd8c1e9b05c8c7ff1fbd1cfc592f698385a Mon Sep 17 00:00:00 2001 From: Mat Kowalski Date: Wed, 26 May 2021 14:32:58 +0200 Subject: [PATCH] Use /dev/sdx instead of /dev/sdc when mounting boot images Currently when mounting cdrom device we are hardcoding use of /dev/sdc. Given that in some scenarios users may want to attach additional disks to their VMs, it means they need to be aware that using /dev/sdc is not permitted if e.g. there is an inspector image mounted as Virtual Media. In order to simplify the usage we are instead mounting boot devices as /dev/sdx so that users have a freedom of creating block devices without discontinuous names. Change-Id: Ifd072ca6e0a88da138d9ef7140499faca1705c46 --- .../emulator/resources/systems/libvirtdriver.py | 2 +- .../unit/emulator/resources/systems/test_libvirt.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sushy_tools/emulator/resources/systems/libvirtdriver.py b/sushy_tools/emulator/resources/systems/libvirtdriver.py index 8a0369b1..0d800098 100644 --- a/sushy_tools/emulator/resources/systems/libvirtdriver.py +++ b/sushy_tools/emulator/resources/systems/libvirtdriver.py @@ -951,7 +951,7 @@ class LibvirtDriver(AbstractSystemsDriver): elif lv_device == 'floppy': tgt_dev, tgt_bus = ('fda', 'fdc') else: - tgt_dev, tgt_bus = ('sdc', controller_type) + tgt_dev, tgt_bus = ('sdx', controller_type) # Enumerate existing disks to find a free unit on the bus diff --git a/sushy_tools/tests/unit/emulator/resources/systems/test_libvirt.py b/sushy_tools/tests/unit/emulator/resources/systems/test_libvirt.py index 95d44cd8..e89386a2 100644 --- a/sushy_tools/tests/unit/emulator/resources/systems/test_libvirt.py +++ b/sushy_tools/tests/unit/emulator/resources/systems/test_libvirt.py @@ -602,7 +602,7 @@ class LibvirtDriverTestCase(base.BaseTestCase): volume_mock.upload.assert_called_once_with(mock.ANY, 0, mock.ANY) expected_disk = ('' - '' + '' '
') @@ -610,7 +610,7 @@ class LibvirtDriverTestCase(base.BaseTestCase): # preserves the attribute order specified by the user. if sys.version_info[1] >= 8: expected_disk = ('' - '' + '' '
') self.assertEqual(1, conn_mock.defineXML.call_count) @@ -655,7 +655,7 @@ class LibvirtDriverTestCase(base.BaseTestCase): volume_mock.upload.assert_called_once_with(mock.ANY, 0, mock.ANY) expected_disk = ('' - '' + '' '
') @@ -663,7 +663,7 @@ class LibvirtDriverTestCase(base.BaseTestCase): # preserves the attribute order specified by the user. if sys.version_info[1] >= 8: expected_disk = ('' - '' + '' '
') self.assertEqual(1, conn_mock.defineXML.call_count) @@ -708,7 +708,7 @@ class LibvirtDriverTestCase(base.BaseTestCase): volume_mock.upload.assert_called_once_with(mock.ANY, 0, mock.ANY) expected_disk = ('' - '' + '' '
') @@ -716,7 +716,7 @@ class LibvirtDriverTestCase(base.BaseTestCase): # preserves the attribute order specified by the user. if sys.version_info[1] >= 8: expected_disk = ('' - '' + '' '
')