]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
add: vm device type
authorBastian Dehn <hhaalo@arcor.de>
Wed, 14 Feb 2018 16:54:26 +0000 (17:54 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Wed, 14 Feb 2018 16:54:26 +0000 (17:54 +0100)
backup

diff --git a/backup b/backup
index 3fd18981195a00f32b64ac73ae570832d7dee1e4..8264e4c8a148e0c66ccce0882da6ceb6626c0bf2 100755 (executable)
--- a/backup
+++ b/backup
@@ -62,18 +62,25 @@ BackupVMDiscs() {
                | grep disk \
                | awk '{print $4}')
        local logFile=""
+       local DiskType=""
 
        for Disk in $Disks; do
                printf "Disk %s von %s wird gesichert\n\n" "$Disk" "$VM"
 
+               DiskType=$(ssh $remoteLogin virsh vol-info $Disk \
+                       | grep Type | awk '{print $2}')
                logFile="$backRemotePCPath/backup-$(echo $Disk \
                        | sed 's/\//-/g').log"
 
-               rsync --archive --verbose --sparse --acls --hard-links \
-                       --relative --progress --human-readable \
-                       --log-file=$logFile \
-                       $hardlinkopt \
-                       $remoteLogin:$Disk $backRemotePCPath
+               if [ "$DiskType" == "file" ]; then
+                       rsync --archive --verbose --sparse --acls --hard-links \
+                               --relative --progress --human-readable \
+                               --log-file=$logFile \
+                               $hardlinkopt \
+                               $remoteLogin:$Disk $backRemotePCPath
+               elif [ "$DiskType" == "block" ]; then
+                       # TODO implement lvm backup
+               fi
        done
 }