avocado-vt icon indicating copy to clipboard operation
avocado-vt copied to clipboard

[WIP]Fix qemu convert no space

Open dzhengfy opened this issue 4 years ago • 3 comments

Originally qemu-img convert command and umount command are run in one shell, which causes the final ret code is zero even though qemu-img convert has failed with an error, like 'no space left', because the ret code is overlaped by umount command which is often zero. And when that error happens, the gluster volume is not cleaned up which may cause /tmp folder is full on gluster server host/vm and no new volume can be created. So this fix is to throw out the qemu-img convert error and clean up the volume before throwing.

Signed-off-by: Dan Zheng [email protected]

dzhengfy avatar Jan 28 '21 10:01 dzhengfy

Below error is as expected.

# avocado run --vt-type libvirt --vt-machine-type q35 virsh.snapshot_create_as.negative_tests.network_disk.gluster.with_snapshot_attr --vt-connect-uri qemu:///system

TestFail: Fail to execute command qemu-img convert -f qcow2 -O qcow2 /var/lib/avocado/data/avocado-vt/images/jeos-27-x86_64.qcow2 /mnt/gluster.qcow2 with output: 
command: 'mount -t glusterfs gls.libvirt.redhat.com:vol_virsh_snapshot_create_as /mnt; qemu-img convert -f qcow2 -O qcow2 /var/lib/avocado/data/avocado-vt/images/jeos-27-x86_64.qcow2 /mnt/gluster.qcow2'exit_
status: 1
duration: 4.821591377258301
interrupted: Falsepid: 987238
encoding: 'UTF-8'
stdout: b''
stderr: b'qemu-img: error while writing sector 4952064: No space left on device\n'


dzhengfy avatar Jan 29 '21 03:01 dzhengfy

Before the fix,


2021-01-27 06:15:11,856 process          L0604 INFO | Running 'mount -t glusterfs gls.libvirt.redhat.com:vol_virsh_snapshot_disk /mnt; qemu-img convert -f qcow2 -O qcow2 /var/lib/avocado/data/avocado-vt/images/jeos-27-x86_64.qcow2 /mnt/gluster.qcow2; umount /mnt'
2021-01-27 06:15:16,594 process          L0416 DEBUG| [stderr] qemu-img: error while writing sector 4893440: No space left on device
2021-01-27 06:15:16,612 process          L0686 INFO | Command 'mount -t glusterfs gls.libvirt.redhat.com:vol_virsh_snapshot_disk /mnt; qemu-img convert -f qcow2 -O qcow2 /var/lib/avocado/data/avocado-vt/images/jeos-27-x86_64.qcow2 /mnt/gluster.qcow2; umount /mnt' finished with 0 after 4.748637437820435s

dzhengfy avatar Jan 29 '21 03:01 dzhengfy

Currently we do not need this PR any more. So keep it as a draft PR.

dzhengfy avatar Mar 18 '21 02:03 dzhengfy