bash: check periodically until 'virsh blockjob dom vda' shows 100% completion
Hello.
It seems we can make backups of kvm machines now with blockcopy. Does someone has an idea how to make a shellscript which does the following?:
> virsh dumpxml --security-info dom > dom.xml
> virsh undefine dom
> virsh blockcopy dom vda /path/to/backup-vda
> polling loop - check periodically until 'virsh blockjob dom vda'
> shows 100% completion
> virsh suspend dom
> virsh save dom /path/to/memory-backup --running
> virsh blockjob dom vda --abort
> virsh resume dom
> virsh define dom.xml
Everything looks pretty easy except the polling loop is interesting. How do i stop the bashscript until the blockjob command shows 100%?
Thanks and best regards.
|