'Transform block devices to the driver block_device format.'

def _get_instance_block_device_info(self, context, instance, refresh_conn_info=False, bdms=None):

    if (not bdms):
        bdms = objects.BlockDeviceMappingList.get_by_instance_uuid(context, instance.uuid)
    block_device_info = driver.get_block_device_info(instance, bdms)
    if (not refresh_conn_info):
        block_device_info['block_device_mapping'] = [bdm for bdm in driver.block_device_info_get_mapping(block_device_info) if bdm.get('connection_info')]
    else:
        driver_block_device.refresh_conn_infos(driver.block_device_info_get_mapping(block_device_info), context, instance, self.volume_api, self.driver)
    self._block_device_info_to_legacy(block_device_info)
    return block_device_info
