This patch addresses the missing device alias assignment for filesystem
and network interface devices in LXC domains.

Before this patch, virsh dumpxml showed filesystem and network 
devices without aliases:

    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/shared6'/>   
      <target dir='/shared6'/>     
    </filesystem>
    <interface type='bridge'>
      <mac address='b8:3f:d2:c9:e8:bd'/>
      <source bridge='br0'/>
      <target dev='vnet8'/>
      <model type='virtio'/>
    </interface>

After this patch, filesystem devices have auto-generated aliases:

    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/shared6'/>   
      <target dir='/shared6'/>     
      <alias name='fs1'/>          <!-- Now assigned -->     
    </filesystem>
    <interface type='bridge'>
      <mac address='b8:3f:d2:c9:e8:bd'/>
      <source bridge='br0'/>
      <target dev='vnet8'/>
      <model type='virtio'/>
      <alias name='net4'/>          <!-- Now assigned -->
    </interface>


Changes in v3:
  - Implemented new index allocation algorithm,
    scans existing aliases before new index allocation
  - Added hotplug support in lxcDomainAttachDeviceNetLive()
  - Handles gaps in numbering after device detach/attach
  - Follows QEMU's qemuAssignDeviceNetAlias() pattern
  - Tested hotplug scenario

The implementation follows the same pattern used by QEMU's
qemuAssignDeviceNetAlias() and qemuAssignDeviceFSAlias().

This is needed as a prerequisite for fixing bug #63
(loop device path length limitation), where device aliases
will be used to compose synthetic lo_file_name references
in the format "libvirt-$UUID-$DEVALIAS".

Reply via email to