This is a contunuation of thread:
"lxc: truncate LOOP_GET_STATUS64.lo_file_name for long loop backing paths"
https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/NSOQDVNLF4XP34KBOGEACJYBVRGDXHQD/
with updated and more relevant subject.
This patch fixes problem reported as https://gitlab.com/libvirt/libvirt/-/work_items/63
but before it could be posted, it required fixing or rather implementing
aliase for block devices and file systems on LXC domains, commit
065337dd2c1b120be92a4960d0566eb745e8e350 and the patch posted here:
https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/RWKBBQHE377G55CKFEX6DNZUXO6OJXAA/
Now, with the working aliases for for block devices and file systems, this change
implement the this naming pattern "libvirt-$UUID-$DEVALIAS" for LOOP_GET_STATUS64.lo_file_name
which is shown in output of the losetup.
Example, for domain with these file systems attached, where the second one
is backed by path with long file name:
<filesystem type='file' accessmode='passthrough'>
<driver type='loop' format='raw'/>
<source file='/var/tmp/short.raw'/>
<target dir='/short'/>
<alias name='fs1'/>
</filesystem>
<filesystem type='file' accessmode='passthrough'>
<driver type='loop' format='raw'/>
<source file='/var/tmp/looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong.raw'/>
<target dir='/long'/>
<alias name='fs2'/>
</filesystem>
The losetup output looks like below:
[root@rvm08m-3 ]# losetup -l -O +REF
NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE DIO LOG-SEC REF
/dev/loop1 0 0 1 0 /var/tmp/looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong.raw 0 512 libvirt-942c6580-8c49-4b8d-8e79-bba79e9709fd-fs2
/dev/loop0 0 0 1 0 /var/tmp/short.raw 0 512 libvirt-942c6580-8c49-4b8d-8e79-bba79e9709fd-fs1
The last column is where the LOOP_GET_STATUS64.lo_file_name can be seen.
This patch does not add support for custom, user specified aliases because:
1. At the start of the domain, user aliases are silently dropped during XML
parsing and are auto-generated as fs0, fs1, ...
VIR_DOMAIN_DEF_FEATURE_USER_ALIAS is not set for LXC domains.
2. Attaching, hot-plug of a file system to live LXC domain is not supported:
"error: unsupported configuration: device type 'filesystem' cannot be attached"
© 2016 - 2026 Red Hat, Inc.