All,
Based on results from recent Trillian test runs [1], I've discovered that on
KVM (CentOS7) based detaching a volume fails to update the virt/domain xml and
fails to remove the xml. So, while the agent and cloudstack-mgmt server
succeeds, the entry in the xml is not removed. When the volume is attached
again, we can an error like:
Failed to attach volume xxx to VM VM-yyyy; org.libvirt.LibvirtException: XML
error: target 'vdb' duplicated for disk sources
'/mnt/8a70be4e-4c3c-38e5-aea2-4b38fef83fd5/af85ff7e-a452-43de-8c6b-948dc44aae21'
and
'/mnt/8a70be4e-4c3c-38e5-aea2-4b38fef83fd5/af85ff7e-a452-43de-8c6b-948dc44aae21'This
is seen in agent logs:
Dec 21 10:46:35 pr1837-t692-kvm-centos7-kvm2 sh[27400]: DEBUG
[kvm.storage.KVMStorageProcessor] (agentRequest-Handler-2:) (logid:0648ae70)
Detaching device: <disk device='disk' type='file'>
Dec 21 10:46:35 pr1837-t692-kvm-centos7-kvm2 sh[27400]: <driver name='qemu'
type='qcow2' cache='none' />
Dec 21 10:46:35 pr1837-t692-kvm-centos7-kvm2 sh[27400]: <source
file='/mnt/8a70be4e-4c3c-38e5-aea2-4b38fef83fd5/af85ff7e-a452-43de-8c6b-948dc44aae21'/>
Dec 21 10:46:35 pr1837-t692-kvm-centos7-kvm2 sh[27400]: <target dev='vdb'
bus='virtio'/>
Dec 21 10:46:35 pr1837-t692-kvm-centos7-kvm2 sh[27400]: </disk>
While, after above completes. This is still seen in the VM's dumped xml:
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source
file='/mnt/8a70be4e-4c3c-38e5-aea2-4b38fef83fd5/af85ff7e-a452-43de-8c6b-948dc44aae21'/>
<backingStore/>
<target dev='vdb' bus='virtio'/>
<serial>af85ff7ea45243de8c6b</serial>
<alias name='virtio-disk1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05'
function='0x0'/>
</disk>
Steps to reproduce:
1. Deploy a VM, create a data volume disk and attach to the VM.
2. Detach the volume.
3. Attach the volume to the same VM again, exception is caught.Thoughts,
comments?[1] https://github.com/apache/cloudstack/pull/1837
Regards.
[email protected]
www.shapeblue.com
53 Chandos Place, Covent Garden, London WC2N 4HSUK
@shapeblue