@@ -4635,6 +4635,13 @@ def _inject_data(self, disk, instance, injection_info):
46354635 {'img_id': img_id, 'e': e},
46364636 instance=instance)
46374637
4638+ @staticmethod
4639+ def _get_fs_label_ephemeral(index: int) -> str:
4640+ # Use a consistent naming convention for FS labels. We need to be
4641+ # mindful of various filesystems label name length limitations.
4642+ # See for example: https://bugs.launchpad.net/nova/+bug/2061701
4643+ return f'ephemeral{index}'
4644+
46384645 # NOTE(sileht): many callers of this method assume that this
46394646 # method doesn't fail if an image already exists but instead
46404647 # think that it will be reused (ie: (live)-migration/resize)
@@ -4750,7 +4757,7 @@ def raw(fname, disk_info_mapping=None):
47504757 created_disks = created_disks or not disk_image.exists()
47514758
47524759 fn = functools.partial(self._create_ephemeral,
4753- fs_label='ephemeral0' ,
4760+ fs_label=self._get_fs_label_ephemeral(0) ,
47544761 os_type=instance.os_type,
47554762 is_block_dev=disk_image.is_block_dev,
47564763 vm_mode=vm_mode)
@@ -4776,7 +4783,7 @@ def raw(fname, disk_info_mapping=None):
47764783 raise exception.InvalidBDMFormat(details=msg)
47774784
47784785 fn = functools.partial(self._create_ephemeral,
4779- fs_label='ephemeral%d' % idx,
4786+ fs_label=self._get_fs_label_ephemeral( idx) ,
47804787 os_type=instance.os_type,
47814788 is_block_dev=disk_image.is_block_dev,
47824789 vm_mode=vm_mode)
@@ -10980,7 +10987,7 @@ def _create_images_and_backing(self, context, instance, instance_dir,
1098010987 # cached.
1098110988 disk.cache(
1098210989 fetch_func=self._create_ephemeral,
10983- fs_label=cache_name ,
10990+ fs_label=self._get_fs_label_ephemeral(0) ,
1098410991 os_type=instance.os_type,
1098510992 filename=cache_name,
1098610993 size=info['virt_disk_size'],
0 commit comments