Merge "Hyper-V: Fix volume attach issue caused by wrong constant name"
This commit is contained in:
commit
1b2fb031f3
@ -714,3 +714,25 @@ class VMUtilsTestCase(test.NoDBTestCase):
|
||||
self.assertEqual(mock.sentinel.fake_value,
|
||||
compare.Properties_.Item().Value)
|
||||
self.assertEqual(compare, response)
|
||||
|
||||
def test_get_attached_disks(self):
|
||||
mock_scsi_ctrl_path = mock.MagicMock()
|
||||
expected_query = ("SELECT * FROM %(class_name)s "
|
||||
"WHERE (ResourceSubType = "
|
||||
"'%(res_sub_type)s' OR "
|
||||
"ResourceSubType='%(res_sub_type_virt)s')"
|
||||
" AND Parent = '%(parent)s'" %
|
||||
{"class_name":
|
||||
self._vmutils._RESOURCE_ALLOC_SETTING_DATA_CLASS,
|
||||
"res_sub_type":
|
||||
self._vmutils._PHYS_DISK_RES_SUB_TYPE,
|
||||
"res_sub_type_virt":
|
||||
self._vmutils._DISK_DRIVE_RES_SUB_TYPE,
|
||||
"parent":
|
||||
mock_scsi_ctrl_path.replace("'", "''")})
|
||||
expected_disks = self._vmutils._conn.query.return_value
|
||||
|
||||
ret_disks = self._vmutils.get_attached_disks(mock_scsi_ctrl_path)
|
||||
|
||||
self._vmutils._conn.query.assert_called_once_with(expected_query)
|
||||
self.assertEqual(expected_disks, ret_disks)
|
||||
|
@ -325,7 +325,7 @@ class VMUtils(object):
|
||||
'res_sub_type':
|
||||
self._PHYS_DISK_RES_SUB_TYPE,
|
||||
'res_sub_type_virt':
|
||||
self._DISK_RES_SUB_TYPE,
|
||||
self._DISK_DRIVE_RES_SUB_TYPE,
|
||||
'parent':
|
||||
scsi_controller_path.replace("'", "''")})
|
||||
return volumes
|
||||
|
Loading…
Reference in New Issue
Block a user