Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DetachVolume failure: Disk is not getting unplugged from Domain #114

Open
kasabe28 opened this issue Jan 16, 2024 · 2 comments
Open

DetachVolume failure: Disk is not getting unplugged from Domain #114

kasabe28 opened this issue Jan 16, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@kasabe28
Copy link
Contributor

kasabe28 commented Jan 16, 2024

Describe the bug
Disk is not getting unplugged from domain when DetachVolume() IRI call is triggered. Volume gets removed from store but not from DomainXML.

To Reproduce

  1. Create a machine with 2 empty disks
  2. Detach one emty disk from machine
  3. Verify domain XML for machine - empty disk will not get removed

Expected behavior
Empty disk should be removed from Domain XML also.

@kasabe28 kasabe28 added the bug Something isn't working label Jan 16, 2024
@lukas016 lukas016 self-assigned this Jan 16, 2024
@lukas016 lukas016 added this to Compute Jan 17, 2024
@lukas016 lukas016 moved this to In Progress in Compute Jan 17, 2024
@lukas016
Copy link
Contributor

Detach logic for libvirtd works properly. Detach is asynchronous call too, so it cannot detach disk immediately

    <disk type='network' device='disk'>
     <driver name='qemu' type='raw' cache='none' io='threads'/>
     <source protocol='rbd' name='ceph/img_05979169209155bdb34087ec06ddc31bfb6eeadf5c47b3f9f4389304e678fc4' index='3'>
       <host name='2a00...' port='6789'/>
       <auth username='volume-rook-ceph--ceph'>
         <secret type='ceph' uuid='4013d936-3459-5fb5-815e-79a85f3f2c1a'/>
       </auth>
     </source>
     <target dev='vda' bus='virtio'/>
     <serial>oda-4127059624245cdc</serial>
     <alias name='ua-volume-b3MtZGlzaw'/>
     <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
   </disk>
   <disk type='file' device='disk'>
     <driver name='qemu' type='raw'/>
     <source file='/home/.../.libvirt-provider/machines/cf5caf4b-9af8-4402-856f-2aae5b9281d3/volumes/libvirt-provider.ironcore.dev~empty-disk/ephe-disk/disk.raw' index='2'/>
     <backingStore/>
     <target dev='vdb' bus='virtio'/>
     <serial>odb-8d534764e409d8df</serial>
     <alias name='ua-volume-ZXBoZS1kaXNr'/>
     <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
   </disk>
   <disk type='file' device='disk'>
     <driver name='qemu' type='raw'/>
     <source file='/home/../.libvirt-provider/machines/cf5caf4b-9af8-4402-856f-2aae5b9281d3/volumes/libvirt-provider.ironcore.dev~empty-disk/ephe-disk2/disk.raw' index='1'/>
     <backingStore/>
     <target dev='vdc' bus='virtio'/>
     <serial>odc-d3c005e425b513c9</serial>
     <alias name='ua-volume-ZXBoZS1kaXNrMg'/>
     <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
   </disk>

after detach:

    <disk type='network' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='threads'/>
      <source protocol='rbd' name='ceph/img_05979169209155bdb34087ec06ddc31bfb6eeadf5c47b3f9f4389304e678fc4' index='3'>
        <host name='2a00... port='6789'/>
        <auth username='volume-rook-ceph--ceph'>
          <secret type='ceph' uuid='4013d936-3459-5fb5-815e-79a85f3f2c1a'/>
        </auth>
      </source>
      <target dev='vda' bus='virtio'/>
      <serial>oda-4127059624245cdc</serial>
      <alias name='ua-volume-b3MtZGlzaw'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/home/.../cf5caf4b-9af8-4402-856f-2aae5b9281d3/volumes/libvirt-provider.ironcore.dev~empty-disk/ephe-disk2/disk.raw' index='1'/>
      <backingStore/>
      <target dev='vdc' bus='virtio'/>
      <serial>odc-d3c005e425b513c9</serial>
      <alias name='ua-volume-ZXBoZS1kaXNrMg'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </disk>

Root cause for wrong behavior in this case is using wrong os image. Image isn't booted properly and vm is stuck in efi shell. Problem is efi shell doesn't process ACPI signal. These signals are required for detach volume (https://wiki.ubuntu.com/QemuDiskHotplug#Removing_disks_from_Guests). I didn't go extremely depth into problematic because detach of volume for wrong booted os is edge case.

@lukas016
Copy link
Contributor

Minimally, we have wrong logic for update status of api.Machine in store. Main problem is deleting volume from status, which is still part of domain xml.

  "status": {
    "volumeStatus": [
      {
        "name": "ephe-disk2",
        "handle": "libvirt-provider.ironcore.dev/empty-disk/ephe-disk2",
        "state": "Attached",
        "size": 524288000
      }
    ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants