live migration check source failed caused bdm.device_path lost

Live migration vm, the process raised exception in the function
"check_can_live_migrate_source". Then, the vm looks like running
and active. But, the bdm.connection_info lost 'device_path' key.

The reason is:the function check_can_live_migrate_source call
the function _get_instance_block_device_info to check
cinderclient, but this function will call cinder
initialize_connection api interface and update
BDM.connection_info, but cinder return connection_info has no
'device_path' key. So after that, 'device_path' key lost.

modification scheme:as for vm has been connected the volume,
check in source host that is of small significance.
Unfortunately, this interface will trigger the volume add SAN
mapping group again.This interface call is very time consuming.
In addition, For some SAN, this behavior may trigger errors. So
this patch set the parameter 'refresh_conn_info' to false in
order to remove the interface initialize_connection call.

Change-Id: Ice8882b0c0e838072526ed285648bb8840968072
Closes-Bug: #1582482
This commit is contained in:
zhengyao1
2016-06-17 17:42:00 +08:00
parent fab0cba7cd
commit c2f57a126f
2 changed files with 3 additions and 33 deletions
+2 -7
View File
@@ -5021,13 +5021,8 @@ class ComputeManager(manager.Manager):
migrate_data_obj.LiveMigrateData.detect_implementation(
dest_check_data)
dest_check_data.is_volume_backed = is_volume_backed
try:
block_device_info = self._get_instance_block_device_info(
ctxt, instance, refresh_conn_info=True)
except cinder_exception.ClientException as exc:
raise exception.MigrationPreCheckClientException(
reason=six.text_type(exc))
block_device_info = self._get_instance_block_device_info(
ctxt, instance, refresh_conn_info=False)
result = self.driver.check_can_live_migrate_source(ctxt, instance,
dest_check_data,
block_device_info)
+1 -26
View File
@@ -1845,35 +1845,10 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
{'block_device_mapping': 'fake'})
mock_volume.assert_called_once_with(self.context, instance)
mock_get_inst.assert_called_once_with(self.context, instance,
refresh_conn_info=True)
refresh_conn_info=False)
self.assertTrue(dest_check_data.is_volume_backed)
def test_can_live_migrate_source_for_cinder_client_exception(self):
is_volume_backed = 'volume_backed'
dest_check_data = migrate_data_obj.LiveMigrateData()
db_instance = fake_instance.fake_db_instance()
instance = objects.Instance._from_db_object(
self.context, objects.Instance(), db_instance)
@mock.patch.object(compute_utils, 'EventReporter')
@mock.patch.object(compute_utils, 'add_instance_fault_from_exc')
@mock.patch.object(compute_utils, 'is_volume_backed_instance')
@mock.patch.object(self.compute,
'_get_instance_block_device_info')
def do_test(mock_block_info, mock_volume_backed,
mock_inst_fault, mock_event):
mock_volume_backed.return_value = is_volume_backed
mock_block_info.side_effect = cinder_exception.ClientException(
'test', 'test')
self.assertRaises(exception.MigrationPreCheckClientException,
self.compute.check_can_live_migrate_source,
self.context, instance,
dest_check_data)
do_test()
def _test_check_can_live_migrate_destination(self, do_raise=False):
db_instance = fake_instance.fake_db_instance(host='fake-host')
instance = objects.Instance._from_db_object(