Make _get_instance_block_device_info preserve root_device_name
On hard reboots,
nova.compute.manager.ComputeManager._get_instance_block_device_info will
faithfully reconstruct all of the block_device_info attributes that
the instance needs, except for the root_device_name. This causes
the instance to effectively lose its disk configurations on hard
reboots.
This patch set will preserve the root_device_name if it is defined
for the instance.
Conflicts:
nova/tests/unit/compute/test_compute.py
(cherry picked from commit ee435b4267)
Closes-Bug: #1378132
Change-Id: Ia36b1d6170ad120f794aa16d41ed4275b4b11f22
This commit is contained in:
committed by
Claudiu Belu
parent
79b2b9427d
commit
3b62ab5e40
@@ -1975,7 +1975,10 @@ class ComputeManager(manager.Manager):
|
||||
# Get swap out of the list
|
||||
swap = driver_block_device.get_swap(swap)
|
||||
|
||||
root_device_name = instance.get('root_device_name')
|
||||
|
||||
return {'swap': swap,
|
||||
'root_device_name': root_device_name,
|
||||
'ephemerals': ephemerals,
|
||||
'block_device_mapping': block_device_mapping}
|
||||
|
||||
|
||||
@@ -2793,6 +2793,7 @@ class ComputeTestCase(BaseTestCase):
|
||||
expected = {
|
||||
'swap': None,
|
||||
'ephemerals': [],
|
||||
'root_device_name': None,
|
||||
'block_device_mapping': [{
|
||||
'connection_info': {
|
||||
'driver_volume_type': 'rbd'
|
||||
@@ -2824,6 +2825,7 @@ class ComputeTestCase(BaseTestCase):
|
||||
expected = {
|
||||
'swap': None,
|
||||
'ephemerals': [],
|
||||
'root_device_name': None,
|
||||
'block_device_mapping': [{
|
||||
'connection_info': {
|
||||
'driver_volume_type': 'rbd'
|
||||
@@ -2888,7 +2890,8 @@ class ComputeTestCase(BaseTestCase):
|
||||
'virtual_name': 'ephemeral0'},
|
||||
{'device_name': '/dev/vdc', 'num': 1, 'size': 2,
|
||||
'virtual_name': 'ephemeral1'}],
|
||||
'block_device_mapping': []
|
||||
'block_device_mapping': [],
|
||||
'root_device_name': None
|
||||
}
|
||||
|
||||
block_device_info = (
|
||||
@@ -5423,6 +5426,7 @@ class ComputeTestCase(BaseTestCase):
|
||||
self.mox.StubOutWithMock(self.compute.driver, 'pre_live_migration')
|
||||
self.compute.driver.pre_live_migration(mox.IsA(c), mox.IsA(instance),
|
||||
{'swap': None, 'ephemerals': [],
|
||||
'root_device_name': None,
|
||||
'block_device_mapping': []},
|
||||
mox.IgnoreArg(),
|
||||
mox.IgnoreArg(),
|
||||
@@ -5492,7 +5496,8 @@ class ComputeTestCase(BaseTestCase):
|
||||
'rollback_live_migration_at_destination')
|
||||
|
||||
block_device_info = {
|
||||
'swap': None, 'ephemerals': [], 'block_device_mapping': []}
|
||||
'swap': None, 'ephemerals': [], 'block_device_mapping': [],
|
||||
'root_device_name': None}
|
||||
self.compute.driver.get_instance_disk_info(
|
||||
instance.name,
|
||||
block_device_info=block_device_info).AndReturn('fake_disk')
|
||||
@@ -5668,6 +5673,7 @@ class ComputeTestCase(BaseTestCase):
|
||||
|
||||
post_live_migration.assert_has_calls([
|
||||
mock.call(c, instance, {'swap': None, 'ephemerals': [],
|
||||
'root_device_name': None,
|
||||
'block_device_mapping': []}, None)])
|
||||
unfilter_instance.assert_has_calls([mock.call(instance, [])])
|
||||
migration = {'source_compute': srchost,
|
||||
@@ -5826,6 +5832,7 @@ class ComputeTestCase(BaseTestCase):
|
||||
'rollback_live_migration_at_destination')
|
||||
self.compute.driver.rollback_live_migration_at_destination(c,
|
||||
instance, [], {'swap': None, 'ephemerals': [],
|
||||
'root_device_name': None,
|
||||
'block_device_mapping': []},
|
||||
destroy_disks=True, migrate_data=None)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user