I debugged this problem a bit more. It looks like the nova volume manager is using a stale copy of the block_device_mapping. The block_device_mapping needs to be refreshed in order for the updated volume snapshot to be used.
On power on, the nova manager (nova/compute/manager.py ) does:
1. start_instance
2. _power_on
3. _get_instance_volume_block_device_info
The structure for this method is:
def _get_instance_volume_block_device_info(self, context, instance, refresh_conn_info=False, bdms=None):
if not bdms:
bdms = (block_device_obj.BlockDeviceMappingList. get_by_instance_uuid(context, instance['uuid'])) block_device_mapping = ( driver_block_device.convert_volumes(bdms) + driver_block_device.convert_snapshots(bdms) + driver_block_device.convert_images(bdms))
....
block_device_obj.BlockDeviceMappingList.get_by_instance_uuid() goes and queries the database to construct the bdms, which will contain stale data.
In order for this to work properly, refresh_conn_info must be set to True. However, since _get_instance_volume_block_device_info is used by everyone, I am not sure if setting refresh_conn_info = True is such a good solution, since it will affect other cinder drivers also.
I debugged this problem a bit more. It looks like the nova volume manager is using a stale copy of the block_device_ mapping. The block_device_ mapping needs to be refreshed in order for the updated volume snapshot to be used.
On power on, the nova manager (nova/compute/ manager. py ) does: volume_ block_device_ info
1. start_instance
2. _power_on
3. _get_instance_
The structure for this method is: volume_ block_device_ info(self, context, instance, refresh_ conn_info= False, bdms=None): device_ obj.BlockDevice MappingList.
get_ by_instance_ uuid(context, instance['uuid']))
block_ device_ mapping = (
driver_ block_device. convert_ volumes( bdms) +
driver_ block_device. convert_ snapshots( bdms) +
driver_ block_device. convert_ images( bdms)) obj.BlockDevice MappingList. get_by_ instance_ uuid() goes and queries the database to construct the bdms, which will contain stale data.
def _get_instance_
if not bdms:
bdms = (block_
....
block_device_
In order for this to work properly, refresh_conn_info must be set to True. However, since _get_instance_ volume_ block_device_ info is used by everyone, I am not sure if setting refresh_conn_info = True is such a good solution, since it will affect other cinder drivers also.