Description of problem: LXC definition is not applying <alias/> tag for extra disks. Consequently, it is not retrieving block stats. Version-Release number of selected component (if applicable): libvirt version: v5.2.0-rc2 (upstream) Host Machine: Ubuntu 18.10 How reproducible: You just need to add a domain definition with an alias tag inside disk section. Example: <domain type='lxc'> <name>ubuntu</name> ... <devices> <emulator>/usr/libexec/libvirt_lxc</emulator> <disk type='block'> <source dev='/dev/loop0'/> <target dev='sda'/> <alias name='scsi-test'/> </disk> <filesystem type='mount' accessmode='passthrough'> <source dir='/var/lib/lxc/ubuntu/rootfs'/> <target dir='/'/> </filesystem> ... </devices> </domain> Start domain and check block list. After that, try to retrieve block stats of 'sda'. Steps to Reproduce: 1. Define a domain like the example above. 2. Start domain with "virsh -c lxc:///system start ubuntu" 3. See domain running: # virsh list Id Name State -------------------------- 6368 ubuntu running 3. Get Block list: # virsh domblklist ubuntu Target Source ---------------------- sda /dev/loop0 4. Get 'sda' block stats: # virsh domblkstat ubuntu sda error: Failed to get block stats for domain 'ubuntu' device 'sda' error: internal error: missing disk device alias name for sda Actual results: Libvirt is removing <alias/> tag from domain definition. This missing tag is causing problems with some block methods. Expected results: See stats from 'sda' block disk of a running domain called 'ubuntu'. Additional info: If you don't define extra disk into 'ubuntu' XML and attach it into a running domain, it does not work too: 1. # virsh attach-disk --domain ubuntu --target sda --source /dev/loop0 --alias scsi-test Disk attached successfully 2. # virsh domblkstat ubuntu sda error: Failed to get block stats for domain 'ubuntu' device 'sda' error: internal error: missing disk device alias name for sda
It partially fixes the problem if we enable USER_ALIAS feature. And now, each alias should have "ua-*" string at the beginning as documentation specifies. diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c index e502997118..cfce7093a8 100644 --- a/src/lxc/lxc_domain.c +++ b/src/lxc/lxc_domain.c @@ -400,6 +400,8 @@ virLXCDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, virDomainDefParserConfig virLXCDriverDomainDefParserConfig = { .domainPostParseCallback = virLXCDomainDefPostParse, .devicesPostParseCallback = virLXCDomainDeviceDefPostParse, + + .features = VIR_DOMAIN_DEF_FEATURE_USER_ALIAS, }; But, if you run 'domblkstat' throws other errors of a valid disk inside container: error: Failed to get block stats for domain 'debian' device 'sda' error: internal error: domain stats query failed I believe the missing feature is not the problem but the query disk using alias information.
Thank you for reporting this issue to the libvirt project. Unfortunately we have been unable to resolve this issue due to insufficient maintainer capacity and it will now be closed. This is not a reflection on the possible validity of the issue, merely the lack of resources to investigate and address it, for which we apologise. If you none the less feel the issue is still important, you may choose to report it again at the new project issue tracker https://gitlab.com/libvirt/libvirt/-/issues The project also welcomes contribution from anyone who believes they can provide a solution.