For the sake of seeing it trigger at least once I redeployed a mchine with Xenial to create LVMs there on a free /dev/sdb disk as your example needs it.
# create guest
$ uvt-simplestreams-libvirt --verbose sync --source http://cloud-images.ubuntu.com/daily arch=amd64 label=daily release=xenial
$ uvt-kvm create xsnaptest arch=amd64 release=xenial label=daily
# Check snapshot being backed by lvmdisk
$ sudo qemu-img info /var/lib/libvirt/images/xsnaptest-snapshot.qcow2
image: /var/lib/libvirt/images/xsnaptest-snapshot.qcow2
file format: qcow2
virtual size: 15G (16106127360 bytes)
disk size: 196K
cluster_size: 65536
backing file: /dev/LVMpool_vg/lvvol1
backing file format: raw
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
# dump I/O onto that device from inside the guest
$ while /bin/true; do uvt-kvm ssh --insecure xsnaptest "sudo dd if=/dev/urandom of=/dev/vdc count=8192 bs=1M"; done
# Iterate on it while the disk/snapshot keeps getting dirty
$ while virsh blockcommit xsnaptest vdc --active --verbose --pivot --wait; do sudo rm /var/lib/libvirt/images/xsnaptest-snapshot.qcow2; sleep 2s; virsh snapshot-create-as --domain xsnaptest --diskspec vdc,file=/var/lib/libvirt/images/xsnaptest-snapshot.qcow2,snapshot=external --disk-only --atomic; sleep $(( RANDOM % 30 + 20 ))s; sudo ls -laFh /var/lib/libvirt/images/xsnaptest-snapshot.qcow2; done
Finally I saw it in action
Block commit: [100 %]error: failed to pivot job for disk vdc
error: block copy still active: disk 'vdc' not ready for pivot yet
I retried and this was reproducible.
I upgraded to the PPA (more about that later) and ran my loop.
It reached 100% and then got slow (I/O while doing the pivot).
I needed to either wait quite a while or slow down the ongoing I/O a bit.
I had the loop running a 10 times and with the fix it never failed again (sized between 519M and 7.1G).
For the sake of seeing it trigger at least once I redeployed a mchine with Xenial to create LVMs there on a free /dev/sdb disk as your example needs it. ms-libvirt --verbose sync --source http:// cloud-images. ubuntu. com/daily arch=amd64 label=daily release=xenial
# create guest
$ uvt-simplestrea
$ uvt-kvm create xsnaptest arch=amd64 release=xenial label=daily
# create Volume vg</name> dev/LVMpool_ vg</path>
$ sudo pvcreate /dev/sdb
$ sudo vgcreate LVMpool_vg /dev/sdb
$ cat > lvmpool.xml <<EOF
<pool type="logical">
<name>LVMpool_
<source>
<device path="/dev/sdb"/>
</source>
<target>
<path>/
</target>
</pool>
EOF
$ virsh pool-define lvmpool.xml
$ sudo vgcreate LVMpool_vg /dev/sdb
$ virsh pool-start LVMpool_vg
$ virsh vol-create-as LVMpool_vg lvvol1 15G
# Use volume in the guest LVMpool_ vg/lvvol1' />
$ cat > lvmdisk.xml <<EOF
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/dev/
<target dev='vdc' bus='virtio'/>
</disk>
EOF
$ virsh attach-device xsnaptest lvmdisk.xml
# Prep initial snapshot /var/lib/ libvirt/ images/ xsnaptest- snapshot. qcow2,snapshot= external --disk-only --atomic
virsh snapshot-create-as --domain xsnaptest --diskspec vdc,file=
# Check snapshot being backed by lvmdisk libvirt/ images/ xsnaptest- snapshot. qcow2 libvirt/ images/ xsnaptest- snapshot. qcow2 vg/lvvol1
$ sudo qemu-img info /var/lib/
image: /var/lib/
file format: qcow2
virtual size: 15G (16106127360 bytes)
disk size: 196K
cluster_size: 65536
backing file: /dev/LVMpool_
backing file format: raw
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
# dump I/O onto that device from inside the guest
$ while /bin/true; do uvt-kvm ssh --insecure xsnaptest "sudo dd if=/dev/urandom of=/dev/vdc count=8192 bs=1M"; done
# Iterate on it while the disk/snapshot keeps getting dirty libvirt/ images/ xsnaptest- snapshot. qcow2; sleep 2s; virsh snapshot-create-as --domain xsnaptest --diskspec vdc,file= /var/lib/ libvirt/ images/ xsnaptest- snapshot. qcow2,snapshot= external --disk-only --atomic; sleep $(( RANDOM % 30 + 20 ))s; sudo ls -laFh /var/lib/ libvirt/ images/ xsnaptest- snapshot. qcow2; done
$ while virsh blockcommit xsnaptest vdc --active --verbose --pivot --wait; do sudo rm /var/lib/
Finally I saw it in action
Block commit: [100 %]error: failed to pivot job for disk vdc
error: block copy still active: disk 'vdc' not ready for pivot yet
I retried and this was reproducible.
I upgraded to the PPA (more about that later) and ran my loop.
It reached 100% and then got slow (I/O while doing the pivot).
I needed to either wait quite a while or slow down the ongoing I/O a bit.
I had the loop running a 10 times and with the fix it never failed again (sized between 519M and 7.1G).