allways pull torrent-files from backing-files
This commit is contained in:
		
							parent
							
								
									1a9cb2d68a
								
							
						
					
					
						commit
						9320f6fd67
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		|  | @ -52,11 +52,11 @@ check_images() { | |||
|        echo "Backingfile required: ${backingfile}" | ||||
|        imgfile="${VM_SYSDIR}/${backingfile}" && [[ -f "${VM_DIR}/${backingfile}" ]] && imgfile="${VM_DIR}/${backingfile}" | ||||
|        BACKINGARRAY+=("${imgfile}") | ||||
|        sudo -u lmnsynci /usr/local/bin/vm-sync get_file "${backingfile}.torrent" | ||||
|        [[ -f "${VM_SYSDIR}/${backingfile}" ]] && sudo -u lmnsynci /usr/local/bin/vm-sync delete_outdated_image "${backingfile}" | ||||
|        if [[ ! -f "${imgfile}" ]] || ! qemu-img info -U "${imgfile}" | grep "file format: qcow2"; then | ||||
|            # sync vm-disk image by torrent | ||||
|            echo "Try to sync backingfile ${backingfile} by torrent" | ||||
|            sudo -u lmnsynci /usr/local/bin/vm-sync get_file "${backingfile}.torrent" | ||||
|            [[ -f "${backingfile}" ]] && sudo -u lmnsynci /usr/local/bin/vm-sync delete_outdated_image "${backingfile}" | ||||
|            sudo -u lmnsynci /usr/local/bin/vm-sync get_image "${backingfile%.qcow2}" | ||||
|        fi | ||||
|        backingfile=$(qemu-img info -U "${imgfile}" | grep "^backing file:" | cut -d ' ' -f 3) | ||||
|  | @ -72,6 +72,7 @@ check_images() { | |||
|        if ! qemu-img check -U "${BACKINGARRAY[$i]}" 2>/dev/null; then | ||||
|            echo "check failed!" | ||||
|            echo "sync ${BACKINGARRAY[$i]} again" | ||||
|            sudo -u lmnsynci /usr/local/bin/vm-sync get_file "${BACKINGARRAY[$i]}.torrent" | ||||
|            sudo -u lmnsynci /usr/local/bin/vm-sync get_image "$(basename "${BACKINGARRAY[$i]}" .qcow2)" | ||||
|        fi | ||||
|    done | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Raphael Dannecker
						Raphael Dannecker