Bug 1697115 - LXC driver is not applying <alias/> tag for disks from both XML and virsh command.
Summary: LXC driver is not applying <alias/> tag for disks from both XML and virsh com...
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-04-07 16:12 UTC by Julio Faracco
Modified: 2024-12-17 12:48 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-12-17 12:48:30 UTC
Embargoed:


Attachments (Terms of Use)

Description Julio Faracco 2019-04-07 16:12:15 UTC
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

Comment 1 Julio Faracco 2019-04-08 03:33:26 UTC
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.

Comment 2 Daniel Berrangé 2024-12-17 12:48:30 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.