Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion nova/tests/unit/virt/libvirt/test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14944,8 +14944,11 @@ def test_create_images_and_backing_ephemeral_gets_created(
'ephemeral_foo')
]

# This also asserts that the filesystem label name is generated
# correctly as 'ephemeral0' to help prevent regression of the
# related bug fix from https://launchpad.net/bugs/2061701
create_ephemeral_mock.assert_called_once_with(
ephemeral_size=1, fs_label='ephemeral_foo',
ephemeral_size=1, fs_label='ephemeral0',
os_type='linux', target=ephemeral_backing)

fetch_image_mock.assert_called_once_with(
Expand Down
13 changes: 10 additions & 3 deletions nova/virt/libvirt/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -4948,6 +4948,13 @@ def _inject_data(self, disk, instance, injection_info):
{'img_id': img_id, 'e': e},
instance=instance)

@staticmethod
def _get_fs_label_ephemeral(index: int) -> str:
# Use a consistent naming convention for FS labels. We need to be
# mindful of various filesystems label name length limitations.
# See for example: https://bugs.launchpad.net/nova/+bug/2061701
return f'ephemeral{index}'

# NOTE(sileht): many callers of this method assume that this
# method doesn't fail if an image already exists but instead
# think that it will be reused (ie: (live)-migration/resize)
Expand Down Expand Up @@ -5063,7 +5070,7 @@ def raw(fname, disk_info_mapping=None):
created_disks = created_disks or not disk_image.exists()

fn = functools.partial(self._create_ephemeral,
fs_label='ephemeral0',
fs_label=self._get_fs_label_ephemeral(0),
os_type=instance.os_type,
is_block_dev=disk_image.is_block_dev,
vm_mode=vm_mode)
Expand All @@ -5089,7 +5096,7 @@ def raw(fname, disk_info_mapping=None):
raise exception.InvalidBDMFormat(details=msg)

fn = functools.partial(self._create_ephemeral,
fs_label='ephemeral%d' % idx,
fs_label=self._get_fs_label_ephemeral(idx),
os_type=instance.os_type,
is_block_dev=disk_image.is_block_dev,
vm_mode=vm_mode)
Expand Down Expand Up @@ -11511,7 +11518,7 @@ def _create_images_and_backing(self, context, instance, instance_dir,
# cached.
disk.cache(
fetch_func=self._create_ephemeral,
fs_label=cache_name,
fs_label=self._get_fs_label_ephemeral(0),
os_type=instance.os_type,
filename=cache_name,
size=info['virt_disk_size'],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fixes:
- |
Fixed an issue where certain server actions could fail for servers with
ephemeral disks due to filesystem label name length limitations
(VFAT, XFS, ...). Filesystem label name generation has been fixed for these
cases. See https://launchpad.net/bugs/2061701 for more details.
Loading