Added function for enabling AllowFullSCSICommandSet

By default, Hyper-V filters some of the SCSI commands received from
the VMs. This change allows disabling the filter.

Signed-off-by: Stefan Chivu <schivu@cloudbasesolutions.com>
Change-Id: I1b0fc8e7e75a6c5395aedd5b8e94b3bd000e1843
This commit is contained in:
Stefan Chivu 2022-11-22 15:44:46 +02:00
parent 2a5ee8bdee
commit 1825b6f2ab
2 changed files with 14 additions and 0 deletions

View File

@ -1272,6 +1272,13 @@ class VMUtilsTestCase(test_base.OsWinBaseTestCase):
self._vmutils._jobutils.stop_jobs.assert_called_once_with( self._vmutils._jobutils.stop_jobs.assert_called_once_with(
mock_vm, None) mock_vm, None)
@mock.patch.object(vmutils.VMUtils, '_modify_virtual_system')
def test_set_allow_full_scsi_command_set(self, mock_modify_virtual_system):
mock_vm = self._lookup_vm()
self._vmutils.enable_vm_full_scsi_command_set(mock.sentinel.vm_name)
self.assertTrue(mock_vm.AllowFullSCSICommandSet)
mock_modify_virtual_system.assert_called_once_with(mock_vm)
def test_set_secure_boot(self): def test_set_secure_boot(self):
vs_data = mock.MagicMock() vs_data = mock.MagicMock()
self._vmutils._set_secure_boot(vs_data, msft_ca_required=False) self._vmutils._set_secure_boot(vs_data, msft_ca_required=False)

View File

@ -880,6 +880,13 @@ class VMUtils(baseutils.BaseUtilsVirt):
raise exceptions.HyperVException( raise exceptions.HyperVException(
_("Exceeded the maximum number of slots")) _("Exceeded the maximum number of slots"))
def enable_vm_full_scsi_command_set(self, vm_name):
"Enables the full SCSI command set for the specified VM."
vs_data = self._lookup_vm_check(vm_name)
vs_data.AllowFullSCSICommandSet = True
self._modify_virtual_system(vs_data)
def _get_vm_serial_ports(self, vmsettings): def _get_vm_serial_ports(self, vmsettings):
rasds = _wqlutils.get_element_associated_class( rasds = _wqlutils.get_element_associated_class(
self._compat_conn, self._SERIAL_PORT_SETTING_DATA_CLASS, self._compat_conn, self._SERIAL_PORT_SETTING_DATA_CLASS,