Merge "Pass None to image if booted from volume in live migration"
This commit is contained in:
commit
fe0f9ca580
@ -258,7 +258,11 @@ class Scheduler(object):
|
||||
# If dest is not specified, have scheduler pick one.
|
||||
if dest is None:
|
||||
instance_type = flavors.extract_instance_type(instance_ref)
|
||||
image = self.image_service.show(context, instance_ref['image_ref'])
|
||||
if not instance_ref['image_ref']:
|
||||
image = None
|
||||
else:
|
||||
image = self.image_service.show(context,
|
||||
instance_ref['image_ref'])
|
||||
request_spec = {'instance_properties': instance_ref,
|
||||
'instance_type': instance_type,
|
||||
'instance_uuids': [instance_ref['uuid']],
|
||||
|
@ -808,6 +808,31 @@ class SchedulerTestCase(test.TestCase):
|
||||
None, ignore_hosts)
|
||||
self.assertEqual('fake_host2', result)
|
||||
|
||||
def test_live_migration_dest_check_no_image(self):
|
||||
instance = self._live_migration_instance()
|
||||
instance['image_ref'] = ''
|
||||
|
||||
# Confirm dest is picked by scheduler if not set.
|
||||
self.mox.StubOutWithMock(self.driver, 'select_hosts')
|
||||
self.mox.StubOutWithMock(flavors, 'extract_instance_type')
|
||||
|
||||
request_spec = {'instance_properties': instance,
|
||||
'instance_type': {},
|
||||
'instance_uuids': [instance['uuid']],
|
||||
'image': None
|
||||
}
|
||||
ignore_hosts = [instance['host']]
|
||||
filter_properties = {'ignore_hosts': ignore_hosts}
|
||||
|
||||
flavors.extract_instance_type(instance).AndReturn({})
|
||||
self.driver.select_hosts(self.context, request_spec,
|
||||
filter_properties).AndReturn(['fake_host2'])
|
||||
|
||||
self.mox.ReplayAll()
|
||||
result = self.driver._live_migration_dest_check(self.context, instance,
|
||||
None, ignore_hosts)
|
||||
self.assertEqual('fake_host2', result)
|
||||
|
||||
def test_live_migration_auto_set_dest(self):
|
||||
instance = self._live_migration_instance()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user