コード例 #1
0
 def test_get_guest_storage_config_rescue(self):
   qemuwindriver = QemuWinDriver()
   instance = 'fakeinstance'
   image_meta = 'fakeimagemeta'
   disk_info = {'mapping': ['disk.config']}
   rescue = True
   block_device_info = 'fakeblockdeviceinfo'
   inst_type = 'fakeinsttype'
   expected_result = ['fakediskrescueconfig', 'fakediskosconfig', 'fakediskconfigconfig']
   actual_result = qemuwindriver.get_guest_storage_config(instance, image_meta, disk_info, rescue, block_device_info, inst_type)
   assert qemuwindriver.set_cache_mode.called
   self.assertEqual(expected_result, actual_result)
コード例 #2
0
 def test_get_guest_storage_config_not_rescue(self):
   qemuwindriver = QemuWinDriver()
   qemuwindriver.virtapi = mock.Mock()
   qemuwindriver.virtapi.instance_update = mock.Mock()
   instance = {'uuid': 'fakeuuid'}
   image_meta = 'fakeimagemeta'
   disk_info = {'mapping': ['disk', 'disk.local', 'disk.swap']}
   rescue = False
   block_device_info = 'fakeblockdeviceinfo'
   inst_type = 'fakeinsttype'
   expected_result = ['fakediskosconfig', 'fakedisklocalconfig', 'fakediskephconfig', 'fakediskswapconfig', 'fakevolumedriverconfig']
   actual_result = qemuwindriver.get_guest_storage_config(instance, image_meta, disk_info, rescue, block_device_info, inst_type)
   assert qemuwindriver.set_cache_mode.called