Closed svorobyov closed 9 years ago
confirmed. The problem is in this for:
for block_device in "$block_devices"; do
quotes around $block_devices
creates a single string with all available devices.
Thanks, Davide!
I checked, and it appears that the quotes are already there:
[root@dualix images-backup-gear]# grep -n block_devices fi-backup.sh 128: local block_devices= 153: block_devices=$($VIRSH -q -r domblklist "$domain_name" --details | awk '"disk"==$2 {print $4}') 160: for block_device in "$block_devices"; do 213: local block_devices=$($VIRSH -q -r domblklist "$domain_name" --details | awk '"disk"==$2 {print $4}') 221: print_v d "Block devices to be consolidated:\n $(echo $block_devices | sed 's/ /\n/g')" 223: for block_device in "$block_devices"; do
[root@dualix images-backup-gear]# grep -n block_devices fi-backup.sh | grep for 160: for block_device in "$block_devices"; do 223: for block_device in "$block_devices"; do
However, I now remember (I am using CentOS 7; maybe this is the problem?), I added the following to your code (after # Add this (SV)):
QEMU_IMG="/usr/bin/qemu-img" VIRSH="/usr/bin/virsh" KVM="/usr/bin/kvm" if [ -x "/usr/bin/qemu-kvm" ]; then KVM="/usr/bin/qemu-kvm" fi
if [ -x "/usr/libexec/qemu-kvm" ]; then KVM="/usr/libexec/qemu-kvm" fi
because:
[root@dualix /]# find / -type f -name "kvm" [root@dualix /]# find / -type f -name "qemu-kvm" /usr/libexec/qemu-kvm
[root@dualix /]# grep -i centos /etc/* /etc/redhat-release:CentOS Linux release 7.1.1503 (Core) /etc/system-release:CentOS Linux release 7.1.1503 (Core)
You are welcome. I am working on the first issue. Can you open another ticket for the second, please?
sorry, maybe I just misunderstood; I just wanted to say that the quotes are already in my version of the fi-backup.sh script:
[root@dualix images-backup-gear]# grep -n block_devices fi-backup.sh | grep for 160: for block_device in "$block_devices"; do 223: for block_device in "$block_devices"; do
Yep, they shouldn't :)
Davide,
do you mean that just removing the double quotes in two occurrences above will fix the script?
@svorobyov, before I merge into master, can you please check this PR out?
last night I removed double quotes in the two following lines of the old script
[root@dualix images-backup-gear]# grep -n block_devices fi-backup.sh | grep for 160: for block_device in "$block_devices"; do 223: for block_device in "$block_devices"; do
and everything went well:
===== 2015-05-26 03:27:05, backing up getafix.intertex.se ===== [DEB] libVirt version '1.2.8' is supported [DEB] /usr/bin/qemu-img version '1.5.3' is supported [DEB] KVM version '1.5.3' is supported [DEB] Snapshot for domain 'getafix.intertex.se' requested [DEB] Using timestamp '20150526-032705' [DEB] Snapshotting block devices for 'getafix.intertex.se' using suffix 'bimg-20150526-032705' [VER] Snapshot for block devices of 'getafix.intertex.se' successful [VER] Copy backing file '/var/lib/libvirt/images/getafix-hda.bimg-20150525-032702' to '/var/lib/libvirt/images-backups/getafix-hda.bimg-20150525-032702' [DEB] Parent backing file: '/var/lib/libvirt/images/getafix-hda.bimg-20150524-032708' [VER] Copy backing file '/var/lib/libvirt/images/getafix-hdb.bimg-20150525-032702' to '/var/lib/libvirt/images-backups/getafix-hdb.bimg-20150525-032702' [DEB] Parent backing file: '/var/lib/libvirt/images/getafix-hdb.bimg-20150524-032708'
I will test your new script as soon as possible
Just checked your latest/newest script in the production environment, and everything went well:
===== 2015-05-26 08:59:06, backing up getafix.intertex.se ===== [DEB] libVirt version '1.2.8' is supported [DEB] /usr/bin/qemu-img version '1.5.3' is supported [DEB] KVM version '2.0.0,' is supported [DEB] Snapshot for domain 'getafix.intertex.se' requested [DEB] Using timestamp '20150526-085906' [DEB] Snapshotting block devices for 'getafix.intertex.se' using suffix 'bimg-20150526-085906' [VER] Snapshot for block devices of 'getafix.intertex.se' successful [VER] Copy backing file '/var/lib/libvirt/images/getafix-hda.bimg-20150526-032705' to '/var/lib/libvirt/images-backups/getafix-hda.bimg-20150526-032705' [DEB] Parent backing file: '/var/lib/libvirt/images/getafix-hda.bimg-20150525-032702' [VER] Copy backing file '/var/lib/libvirt/images/getafix-hdb.bimg-20150526-032705' to '/var/lib/libvirt/images-backups/getafix-hdb.bimg-20150526-032705' [DEB] Parent backing file: '/var/lib/libvirt/images/getafix-hdb.bimg-20150525-032702'
I will check consolidation later today.
Many thanks, Davide!
Davide,
about consolidation:
This should be specified in the README.md
Split/Consolidation are designed to be performed on live systems. :) Nevertheless, at this stage of testing, I'd recommend you to take a backup before trying out the script. I will update the README with that. Thanks.
What is the disaster recovery procedure for domain A, with images in directory B, backup directory C?
Is it:
Yes, that is the recovery procedure. I am writing a small guide with these details (and I will use your description)
@svorobyov https://gist.github.com/dguerri/70efcfe0c3ae0fac8bd7 what do you think?
@svorobyov I updated this PR with improved doc and tests. I will merge it into master as soon as you confirm it is working for you. If you have some idea for additional tests, I will be happy to add it.
Two single-disk VMs seem to successfully consolidate (I will now proceed to testing consolidating for a third, two-disk VM). Here's the second, quite long consolidation chain:
[DEB] libVirt version '1.2.8' is supported [DEB] /usr/bin/qemu-img version '1.5.3' is supported [DEB] QEMU/KVM version '2.0.0,' is supported [DEB] Consolidation of block devices for 'washi.ingate.se' requested [DEB] Block devices to be consolidated: /var/lib/libvirt/images/washi.ingate.bimg-20150526-180404 [DEB] Consolidation of block device: '/var/lib/libvirt/images/washi.ingate.bimg-20150526-180404' for 'washi.ingate.se' [DEB] Parent block device: '/var/lib/libvirt/images/washi.ingate.bimg-20150526-085905' [VER] Consolidation of block device '/var/lib/libvirt/images/washi.ingate.bimg-20150526-180404' for 'washi.ingate.se' successful [VER] Deleting old backup files for 'washi.ingate.se' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150526-085905' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150526-032703' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150526-085905' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150526-032703' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150526-032703' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150525-032702' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150526-032703' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150525-032702' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150525-032702' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150524-032704' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150525-032702' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150524-032704' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150524-032704' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150523-032703' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150524-032704' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150523-032703' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150523-032703' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150522-032703' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150523-032703' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150522-032703' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150522-032703' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150521-032704' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150522-032703' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150521-032704' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150521-032704' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150520-032701' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150521-032704' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150520-032701' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150520-032701' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150519-032703' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150520-032701' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150519-032703' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150519-032703' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150518-032702' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150519-032703' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150518-032702' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150518-032702' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150517-032701' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150518-032702' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150517-032701' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150517-032701' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150516-032701' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150517-032701' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150516-032701' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150516-032701' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150515-032702' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150516-032701' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150515-032702' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150515-032702' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150514-032718' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150515-032702' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150514-032718' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150514-032718' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150513-032703' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150514-032718' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150513-032703' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150513-032703' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150512-032702' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150513-032703' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150512-032702' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150512-032702' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150511-032702' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150512-032702' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150511-032702' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150511-032702' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150510-032702' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150511-032702' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150510-032702' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150510-032702' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150509-032702' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150510-032702' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150509-032702' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150509-032702' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150508-033402' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150509-032702' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150508-033402' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150508-033402' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150507-032838' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150508-033402' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150507-032838' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150507-032838' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150506-032742' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150507-032838' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150506-032742' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150506-032742' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150505-032703' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150506-032742' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150505-032703' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150505-032703' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150504-032701' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150505-032703' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150504-032701' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150504-032701' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150503-032701' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150504-032701' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150503-032701' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150503-032701' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150502-032701' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150503-032701' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150502-032701' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150502-032701' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150501-032702' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150502-032701' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150501-032702' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150501-032702' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150430-032703' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150501-032702' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150430-032703' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150430-032703' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150429-032703' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150430-032703' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150429-032703' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150429-032703' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150428-032701' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150429-032703' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150428-032701' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150428-032701' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150427-160802' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150428-032701' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150427-160802' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150427-160802' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.bimg-20150427-153048' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150427-160802' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.bimg-20150427-153048' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150427-153048' for 'washi.ingate.se' [DEB] Parent backing file: '/var/lib/libvirt/images/washi.ingate.se' [VER] Deleting backing file '/var/lib/libvirt/images/washi.ingate.bimg-20150427-153048' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/washi.ingate.se' [DEB] Processing old backing file '/var/lib/libvirt/images/washi.ingate.se' for 'washi.ingate.se' [WAR] '/var/lib/libvirt/images/washi.ingate.se' doesn't seem to be a backup backing file image. [WAR] Stopping backing file chain removal (manual intervetion might be required) [WAR] This is expected if this is the first consolidation
Consolidation for a two-disk VM was also completely successful:
[DEB] libVirt version '1.2.8' is supported [DEB] /usr/bin/qemu-img version '1.5.3' is supported [DEB] QEMU/KVM version '2.0.0,' is supported [DEB] Consolidation of block devices for 'getafix.intertex.se' requested [DEB] Block devices to be consolidated: /var/lib/libvirt/images/getafix-hda.bimg-20150526-180408 /var/lib/libvirt/images/getafix-hdb.bimg-20150526-180408 [DEB] Consolidation of block device: '/var/lib/libvirt/images/getafix-hda.bimg-20150526-180408' for 'getafix.intertex.se' [DEB] Parent block device: '/var/lib/libvirt/images/getafix-hda.bimg-20150526-085906' [VER] Consolidation of block device '/var/lib/libvirt/images/getafix-hda.bimg-20150526-180408' for 'getafix.intertex.se' successful [VER] Deleting old backup files for 'getafix.intertex.se' [DEB] Processing old backing file '/var/lib/libvirt/images/getafix-hda.bimg-20150526-085906' for 'getafix.intertex.se' [DEB] Parent backing file: '/var/lib/libvirt/images/getafix-hda.bimg-20150526-032705' [VER] Deleting backing file '/var/lib/libvirt/images/getafix-hda.bimg-20150526-085906' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/getafix-hda.bimg-20150526-032705' [DEB] Processing old backing file '/var/lib/libvirt/images/getafix-hda.bimg-20150526-032705' for 'getafix.intertex.se' [DEB] Parent backing file: '/var/lib/libvirt/images/getafix-hda.bimg-20150525-032702' [VER] Deleting backing file '/var/lib/libvirt/images/getafix-hda.bimg-20150526-032705' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/getafix-hda.bimg-20150525-032702' [DEB] Processing old backing file '/var/lib/libvirt/images/getafix-hda.bimg-20150525-032702' for 'getafix.intertex.se' [DEB] Parent backing file: '/var/lib/libvirt/images/getafix-hda.bimg-20150524-032708' [VER] Deleting backing file '/var/lib/libvirt/images/getafix-hda.bimg-20150525-032702' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/getafix-hda.bimg-20150524-032708' [DEB] Processing old backing file '/var/lib/libvirt/images/getafix-hda.bimg-20150524-032708' for 'getafix.intertex.se' [DEB] Parent backing file: '/var/lib/libvirt/images/getafix-hda.bimg-20150523-032706' [VER] Deleting backing file '/var/lib/libvirt/images/getafix-hda.bimg-20150524-032708' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/getafix-hda.bimg-20150523-032706' [DEB] Processing old backing file '/var/lib/libvirt/images/getafix-hda.bimg-20150523-032706' for 'getafix.intertex.se' [DEB] Parent backing file: '/var/lib/libvirt/images/getafix-hda.qcow2' [VER] Deleting backing file '/var/lib/libvirt/images/getafix-hda.bimg-20150523-032706' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/getafix-hda.qcow2' [DEB] Processing old backing file '/var/lib/libvirt/images/getafix-hda.qcow2' for 'getafix.intertex.se' [WAR] '/var/lib/libvirt/images/getafix-hda.qcow2' doesn't seem to be a backup backing file image. [WAR] Stopping backing file chain removal (manual intervetion might be required) [WAR] This is expected if this is the first consolidation [DEB] Consolidation of block device: '/var/lib/libvirt/images/getafix-hdb.bimg-20150526-180408' for 'getafix.intertex.se' [DEB] Parent block device: '/var/lib/libvirt/images/getafix-hdb.bimg-20150526-085906' [VER] Consolidation of block device '/var/lib/libvirt/images/getafix-hdb.bimg-20150526-180408' for 'getafix.intertex.se' successful [VER] Deleting old backup files for 'getafix.intertex.se' [DEB] Processing old backing file '/var/lib/libvirt/images/getafix-hdb.bimg-20150526-085906' for 'getafix.intertex.se' [DEB] Parent backing file: '/var/lib/libvirt/images/getafix-hdb.bimg-20150526-032705' [VER] Deleting backing file '/var/lib/libvirt/images/getafix-hdb.bimg-20150526-085906' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/getafix-hdb.bimg-20150526-032705' [DEB] Processing old backing file '/var/lib/libvirt/images/getafix-hdb.bimg-20150526-032705' for 'getafix.intertex.se' [DEB] Parent backing file: '/var/lib/libvirt/images/getafix-hdb.bimg-20150525-032702' [VER] Deleting backing file '/var/lib/libvirt/images/getafix-hdb.bimg-20150526-032705' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/getafix-hdb.bimg-20150525-032702' [DEB] Processing old backing file '/var/lib/libvirt/images/getafix-hdb.bimg-20150525-032702' for 'getafix.intertex.se' [DEB] Parent backing file: '/var/lib/libvirt/images/getafix-hdb.bimg-20150524-032708' [VER] Deleting backing file '/var/lib/libvirt/images/getafix-hdb.bimg-20150525-032702' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/getafix-hdb.bimg-20150524-032708' [DEB] Processing old backing file '/var/lib/libvirt/images/getafix-hdb.bimg-20150524-032708' for 'getafix.intertex.se' [DEB] Parent backing file: '/var/lib/libvirt/images/getafix-hdb.bimg-20150523-032706' [VER] Deleting backing file '/var/lib/libvirt/images/getafix-hdb.bimg-20150524-032708' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/getafix-hdb.bimg-20150523-032706' [DEB] Processing old backing file '/var/lib/libvirt/images/getafix-hdb.bimg-20150523-032706' for 'getafix.intertex.se' [DEB] Parent backing file: '/var/lib/libvirt/images/getafix-hdb.qcow2' [VER] Deleting backing file '/var/lib/libvirt/images/getafix-hdb.bimg-20150523-032706' [DEB] Next file in backing file chain: '/var/lib/libvirt/images/getafix-hdb.qcow2' [DEB] Processing old backing file '/var/lib/libvirt/images/getafix-hdb.qcow2' for 'getafix.intertex.se' [WAR] '/var/lib/libvirt/images/getafix-hdb.qcow2' doesn't seem to be a backup backing file image. [WAR] Stopping backing file chain removal (manual intervetion might be required) [WAR] This is expected if this is the first consolidation
Many thanks, Davide! I think you can now merge the development branch into master.
:+1: Waiting for Travis-CI :)
So, removing quotes will work only if there are no spaces in image file names. I had to refactor that piece of code quite a bit but now it is definitely more robust.
what is Travis-CI? I do not have anything related in my clone of LibVirtKvm-scripts/
https://travis-ci.org/dguerri/LibVirtKvm-scripts/builds
You should have a file named .travis.yml
I will need to study it carefully before adapting to CentOS, since apt-get won't work (it's yum based)
Unfortunately you can't run it locally :( That's why it takes forever to get a working CI test!
Issue fixed. Fix merged in master.
It's a nice script operating flawlessly for other single-disk VMs on the same host. However, something goes wrong for a two-disk VM I just added.
All other disk images are owned by root:root, as the images in question, so it's not a permission issue.
The fi-backup.sh script seems to erroneously report "error getting backing file", although all the files exist and are OK, and the VM continues to operate fine.
There are two .qcow2 disks in the domain: getafix-hda. getafix-hdb. which the script finds and snapshots correctly. But there is a (spurious) error message and the he previous day's backing files are not transferred to the backup directory, as they should and moved for my other single-disk VMs.
The command I use is:
./fi-backup.sh -b /var/lib/libvirt/images-backups -d $name
where $name cycles through all the machines' domain names I want to backup. Again: it works smoothly for all single-disk VMs, but errs on the only two-disk VM.
===== 2015-05-25 03:27:02, backing up getafix.intertex.se ===== [DEB] libVirt version '1.2.8' is supported [DEB] /usr/bin/qemu-img version '1.5.3' is supported [DEB] KVM version '1.5.3' is supported [DEB] Snapshot for domain 'getafix.intertex.se' requested [DEB] Using timestamp '20150525-032702' [DEB] Snapshotting block devices for 'getafix.intertex.se' using suffix 'bimg-20150525-032702' [VER] Snapshot for block devices of 'getafix.intertex.se' successful qemu-img: Could not open '/var/lib/libvirt/images/getafix-hda.bimg-20150525-032702 /var/lib/libvirt/images/getafix-hdb.bimg-20150525-032702': Could not open file: No such file or directory [ERR] Error getting backing file for '/var/lib/libvirt/images/getafix-hda.bimg-20150525-032702 /var/lib/libvirt/images/getafix-hdb.bimg-20150525-032702'.
However:
[root@dualix images]# ll getafix-hda.* -rw-------. 1 root root 4333371392 24 maj 03.27 getafix-hda.bimg-20150523-032706 -rw-------. 1 root root 3972202496 25 maj 03.27 getafix-hda.bimg-20150524-032708 -rw-------. 1 root root 5911937024 25 maj 11.34 getafix-hda.bimg-20150525-032702 -rw-r--r--. 1 root root 427588321280 23 maj 03.27 getafix-hda.qcow2 [root@dualix images]# qemu-img info getafix-hda.qcow2 image: getafix-hda.qcow2 file format: qcow2 virtual size: 767G (823023108096 bytes) disk size: 398G cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: false [root@dualix images]# qemu-img info getafix-hda.bimg-20150523-032706 image: getafix-hda.bimg-20150523-032706 file format: qcow2 virtual size: 767G (823023108096 bytes) disk size: 4.0G cluster_size: 65536 backing file: /var/lib/libvirt/images/getafix-hda.qcow2 backing file format: qcow2 Format specific information: compat: 1.1 lazy refcounts: false [root@dualix images]# qemu-img info getafix-hda.bimg-20150524-032708 image: getafix-hda.bimg-20150524-032708 file format: qcow2 virtual size: 767G (823023108096 bytes) disk size: 3.7G cluster_size: 65536 backing file: /var/lib/libvirt/images/getafix-hda.bimg-20150523-032706 backing file format: qcow2 Format specific information: compat: 1.1 lazy refcounts: false [root@dualix images]# qemu-img info getafix-hda.bimg-20150525-032702 image: getafix-hda.bimg-20150525-032702 file format: qcow2 virtual size: 767G (823023108096 bytes) disk size: 5.5G cluster_size: 65536 backing file: /var/lib/libvirt/images/getafix-hda.bimg-20150524-032708 backing file format: qcow2 Format specific information: compat: 1.1 lazy refcounts: false
[root@dualix images]# ll getafix-hdb* -rw-------. 1 root root 198144 23 maj 03.27 getafix-hdb.bimg-20150523-032706 -rw-------. 1 root root 458752 25 maj 03.27 getafix-hdb.bimg-20150524-032708 -rw-------. 1 root root 198144 25 maj 03.27 getafix-hdb.bimg-20150525-032702 -rw-r--r--. 1 root root 11324817408 22 maj 19.46 getafix-hdb.qcow2 [root@dualix images]# qemu-img info getafix-hdb.qcow2 image: getafix-hdb.qcow2 file format: qcow2 virtual size: 69G (74100654080 bytes) disk size: 11G cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: false [root@dualix images]# qemu-img info getafix-hdb.bimg-20150523-032706 image: getafix-hdb.bimg-20150523-032706 file format: qcow2 virtual size: 69G (74100654080 bytes) disk size: 196K cluster_size: 65536 backing file: /var/lib/libvirt/images/getafix-hdb.qcow2 backing file format: qcow2 Format specific information: compat: 1.1 lazy refcounts: false [root@dualix images]# qemu-img info getafix-hdb.bimg-20150524-032708 image: getafix-hdb.bimg-20150524-032708 file format: qcow2 virtual size: 69G (74100654080 bytes) disk size: 388K cluster_size: 65536 backing file: /var/lib/libvirt/images/getafix-hdb.bimg-20150523-032706 backing file format: qcow2 Format specific information: compat: 1.1 lazy refcounts: false [root@dualix images]# qemu-img info getafix-hdb.bimg-20150525-032702 image: getafix-hdb.bimg-20150525-032702 file format: qcow2 virtual size: 69G (74100654080 bytes) disk size: 196K cluster_size: 65536 backing file: /var/lib/libvirt/images/getafix-hdb.bimg-20150524-032708 backing file format: qcow2 Format specific information: compat: 1.1 lazy refcounts: false
Thanks for any suggestions!