Browse Source

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
changes/58/793158/1
Mat Kowalski 3 weeks ago
parent
commit
7132acd8c1
No known key found for this signature in database GPG Key ID: 66680B80E7DC2703
2 changed files with 7 additions and 7 deletions
  1. +1
    -1
      sushy_tools/emulator/resources/systems/libvirtdriver.py
  2. +6
    -6
      sushy_tools/tests/unit/emulator/resources/systems/test_libvirt.py

+ 1
- 1
sushy_tools/emulator/resources/systems/libvirtdriver.py View File

@ -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


+ 6
- 6
sushy_tools/tests/unit/emulator/resources/systems/test_libvirt.py View File

@ -602,7 +602,7 @@ class LibvirtDriverTestCase(base.BaseTestCase):
volume_mock.upload.assert_called_once_with(mock.ANY, 0, mock.ANY)
expected_disk = ('<disk device="cdrom" type="file">'
'<target bus="sata" dev="sdc" />'
'<target bus="sata" dev="sdx" />'
'<address bus="0" controller="0" '
'target="0" type="drive" unit="0" />')
@ -610,7 +610,7 @@ class LibvirtDriverTestCase(base.BaseTestCase):
# preserves the attribute order specified by the user.
if sys.version_info[1] >= 8:
expected_disk = ('<disk type="file" device="cdrom">'
'<target dev="sdc" bus="sata" />'
'<target dev="sdx" bus="sata" />'
'<address type="drive" controller="0"'
' bus="0" target="0" unit="0" />')
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 = ('<disk device="cdrom" type="file">'
'<target bus="sata" dev="sdc" />'
'<target bus="sata" dev="sdx" />'
'<address bus="0" controller="0" '
'target="0" type="drive" unit="1" />')
@ -663,7 +663,7 @@ class LibvirtDriverTestCase(base.BaseTestCase):
# preserves the attribute order specified by the user.
if sys.version_info[1] >= 8:
expected_disk = ('<disk type="file" device="cdrom">'
'<target dev="sdc" bus="sata" />'
'<target dev="sdx" bus="sata" />'
'<address type="drive" controller="0"'
' bus="0" target="0" unit="1" />')
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 = ('<disk device="cdrom" type="file">'
'<target bus="scsi" dev="sdc" />'
'<target bus="scsi" dev="sdx" />'
'<address bus="0" controller="0" '
'target="0" type="drive" unit="1" />')
@ -716,7 +716,7 @@ class LibvirtDriverTestCase(base.BaseTestCase):
# preserves the attribute order specified by the user.
if sys.version_info[1] >= 8:
expected_disk = ('<disk type="file" device="cdrom">'
'<target dev="sdc" bus="scsi" />'
'<target dev="sdx" bus="scsi" />'
'<address type="drive" controller="0"'
' bus="0" target="0" unit="1" />')


Loading…
Cancel
Save