On Thu, 11 Jun 2026 at 09:04, <rsmigiel@redhat.com> wrote:
LXC domains did not assign device aliases to filesystem devices, unlike other device types (consoles, network interfaces, etc.).
This change assigns aliases in the format 'fs0', 'fs1', etc. to all filesystem devices during domain startup, following the same pattern used for console devices.
Related: https://gitlab.com/libvirt/libvirt/-/work_items/63 Signed-off-by: Radoslaw Smigielski <rsmigiel@redhat.com> --- src/lxc/lxc_process.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 2c0bcb9dd3aa..aae9fcc9dfd1 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -1350,6 +1350,12 @@ int virLXCProcessStart(virLXCDriver * driver, vm->def->consoles[i]->info.alias = g_strdup_printf("console%zu", i); }
+ VIR_DEBUG("Setting up filesystem aliases"); + for (i = 0; i < vm->def->nfss; i++) { + g_free(vm->def->fss[i]->info.alias); + vm->def->fss[i]->info.alias = g_strdup_printf("fs%zu", i); + } + VIR_DEBUG("Setting up Interfaces"); if (virLXCProcessSetupInterfaces(driver, vm->def, &veths) < 0) goto cleanup; -- 2.54.0
And just to better explain the problem which this patch fixes. It fixes the missing device alias assignment for filesystem devices in LXC domains. Currently, only console devices receive aliases during domain startup, but filesystem devices are left without them, even if the aliases are requested in the XML domain definition. This is a prerequisite for fixing bug #63 (loop device path length limitation), where we need file filesystem, blockdevices aliases to compose lo_file_name in following format "libvirt-$UUID-$DEVALIAS". Before this patch, virsh dumpxml showed filesystem devices without aliases: <filesystem type='mount' accessmode='passthrough'> <source dir='/var/lib/libvirt/lxc/demo-root'/> <target dir='/'/> </filesystem> <console type='pty' tty='/dev/pts/8'> <source path='/dev/pts/8'/> <target type='lxc' port='0'/> <alias name='console0'/> <!-- Only console has alias --> </console> After this patch, filesystem devices now have auto-generated aliases: <filesystem type='mount' accessmode='passthrough'> <source dir='/var/lib/libvirt/lxc/demo-root'/> <target dir='/'/> <alias name='fs0'/> <!-- Now assigned --> </filesystem> <filesystem type='file' accessmode='passthrough'> <driver type='loop' format='raw'/> <source file='/var/tmp/short6.raw'/> <target dir='/short6'/> <alias name='fs1'/> <!-- Now assigned --> </filesystem> <console type='pty' tty='/dev/pts/8'> <source path='/dev/pts/8'/> <target type='lxc' port='0'/> <alias name='console0'/> </console> The implementation follows the same pattern as console device alias assignment in virLXCProcessStart(). ---------------------- < Tℏanks | Radek >