'Verify that all the devices have the device_name set. If not,
provide a default name.
It also ensures that there is a root_device_name and is set to the
first block device in the boot sequence (boot_index=0).'

def _default_block_device_names(self, instance, image_meta, block_devices):

    root_bdm = block_device.get_root_bdm(block_devices)
    if (not root_bdm):
        return
    root_device_name = None
    update_root_bdm = False
    if root_bdm.device_name:
        root_device_name = root_bdm.device_name
        instance.root_device_name = root_device_name
    elif instance.root_device_name:
        root_device_name = instance.root_device_name
        root_bdm.device_name = root_device_name
        update_root_bdm = True
    else:
        root_device_name = self._default_root_device_name(instance, image_meta, root_bdm)
        instance.root_device_name = root_device_name
        root_bdm.device_name = root_device_name
        update_root_bdm = True
    if update_root_bdm:
        root_bdm.save()
    ephemerals = list(filter(block_device.new_format_is_ephemeral, block_devices))
    swap = list(filter(block_device.new_format_is_swap, block_devices))
    block_device_mapping = list(filter(driver_block_device.is_block_device_mapping, block_devices))
    self._default_device_names_for_instance(instance, root_device_name, ephemerals, swap, block_device_mapping)
