<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">I have a very strange issue that has plagued our KVM-based hypervisor infrastructure. <br><br><div>Environment:<br>- All EL7-based libvirt releases since EL7.0<br>- Fully patched EL7-based KVM guest on a fully patched EL7-based KVM host.</div><div>- Secondary disk attached via 'virsh attach-device guest /vm/guest-with-secondary-disk-01/disk2.xml --persistent' (note --persistent flag here)<br><br>Problem Description:</div><div>- Guest becomes unresponsive/hangs due to issue on guest. Typically the scenario is that PID1 hangs or goes into a bad state due to a misbehaving application.<br>- Before virsh destroy, 'virsh dumpxml guest | grep vd[ab]' returns the expected filesystems.</div><div>- Guest is destroyed from the hypervisor via 'virsh destroy guest'. <br>- With guest still powered off, 'virsh dumpxml guest | grep vd[ab]' only shows 'vda'. 'vdb' now unattached.<br>- To fix, requires re-run of 'virsh attach-device guest guest-with-secondary-disk-01/disk2.xml --persistent'<br><br>Expected Behavior:<br>- 'virsh destroy guest' does not drop the secondary disk attached to the guest if the node is in a hung state.<br><br>Other notes:<br>- If guest is not in a hung state, 'virsh destroy' does not drop the secondary disk.<br>- 'virsh reset guest' does not exhibit the same behavior when guest is hung - vdb remains attached.<br>- No logs produced in /var/log/libvirt indicating an issue, even with debug logging enabled.<br><br></div><div>Is there any obvious I'm missing? Is this expected behavior?</div><div><br></div><div>Guest XML via 'virsh dumpxml guest':<br><div><domain type='kvm' id='17'></div><div>  <name>guest-with-secondary-disk-01</name></div><div>  <uuid>ab578b51-3afd-4d01-86ab-a16b1b953919</uuid></div><div>  <memory unit='KiB'>4194304</memory></div><div>  <currentMemory unit='KiB'>4194304</currentMemory></div><div>  <vcpu placement='static'>1</vcpu></div><div>  <resource></div><div>    <partition>/machine</partition></div><div>  </resource></div><div>  <os></div><div>    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type></div><div>    <boot dev='hd'/></div><div>    <bootmenu enable='yes'/></div><div>  </os></div><div>  <features></div><div>    <acpi/></div><div>    <apic/></div><div>    <pae/></div><div>  </features></div><div>  <clock offset='utc'/></div><div>  <on_poweroff>destroy</on_poweroff></div><div>  <on_reboot>restart</on_reboot></div><div>  <on_crash>restart</on_crash></div><div>  <devices></div><div>    <emulator>/usr/libexec/qemu-kvm</emulator></div><div>    <disk type='file' device='disk'></div><div>      <driver name='qemu' type='qcow2' cache='none'/></div><div>      <source file='/vm/guest-with-secondary-disk-01/guest-with-secondary-disk-01.img'/></div><div>      <backingStore/></div><div>      <target dev='vda' bus='virtio'/></div><div>      <alias name='virtio-disk0'/></div><div>      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/></div><div>    </disk></div><div>    <disk type='file' device='disk'></div><div>      <driver name='qemu' type='qcow2' cache='none'/></div><div>      <source file='/vm/guest-with-secondary-disk-01/guest-with-secondary-disk-01_2.img'/></div><div>      <backingStore/></div><div>      <target dev='vdb' bus='virtio'/></div><div>      <alias name='virtio-disk1'/></div><div>      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/></div><div>    </disk></div><div>    <controller type='usb' index='0' model='piix3-uhci'></div><div>      <alias name='usb'/></div><div>      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/></div><div>    </controller></div><div>    <controller type='pci' index='0' model='pci-root'></div><div>      <alias name='pci.0'/></div><div>    </controller></div><div>    <controller type='virtio-serial' index='0'></div><div>      <alias name='virtio-serial0'/></div><div>      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/></div><div>    </controller></div><div>    <interface type='bridge'></div><div>      <mac address='01:02:03:99:99:99'/></div><div>      <source bridge='bridge_99'/></div><div>      <target dev='vnet0'/></div><div>      <model type='virtio'/></div><div>      <alias name='eth0'/></div><div>      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/></div><div>    </interface></div><div>    <channel type='unix'></div><div>      <source mode='bind' path='/var/lib/libvirt/qemu/guest-with-secondary-disk-01.agent'/></div><div>      <target type='virtio' name='org.qemu.guest_agent.0' state='connected'/></div><div>      <alias name='channel0'/></div><div>      <address type='virtio-serial' controller='0' bus='0' port='1'/></div><div>    </channel></div><div>    <input type='mouse' bus='ps2'></div><div>      <alias name='input0'/></div><div>    </input></div><div>    <input type='keyboard' bus='ps2'></div><div>      <alias name='input1'/></div><div>    </input></div><div>    <graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1' keymap='en-us'></div><div>      <listen type='address' address='127.0.0.1'/></div><div>    </graphics></div><div>    <video></div><div>      <model type='cirrus' vram='16384' heads='1' primary='yes'/></div><div>      <alias name='video0'/></div><div>      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/></div><div>    </video></div><div>    <memballoon model='virtio'></div><div>      <alias name='balloon0'/></div><div>      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/></div><div>    </memballoon></div><div>    <rng model='virtio'></div><div>      <backend model='random'>/dev/random</backend></div><div>      <alias name='rng0'/></div><div>      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/></div><div>    </rng></div><div>  </devices></div><div>  <seclabel type='dynamic' model='selinux' relabel='yes'></div><div>    <label>system_u:system_r:svirt_t:s0:c259,c495</label></div><div>    <imagelabel>system_u:object_r:svirt_image_t:s0:c259,c495</imagelabel></div><div>  </seclabel></div><div>  <seclabel type='dynamic' model='dac' relabel='yes'></div><div>    <label>+107:+107</label></div><div>    <imagelabel>+107:+107</imagelabel></div><div>  </seclabel></div><div></domain></div><br>Secondary disk XML: <br><div><disk type='file' device='disk'></div><div>  <driver name='qemu' type='qcow2' cache='none'/></div><div>  <source file='/vm/guest-with-secondary-disk-01/guest-with-secondary-disk-01_2.img'/></div><div>  <target dev='vdb'/></div><div></disk></div><br></div></div></div></div></div>