Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to [vmbackup](https://github.com/doutsis/vmbackup) will be d

Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versions follow [Semantic Versioning](https://semver.org/).

## [Unreleased]

### Fixed

- **`VIRTNBD_FALSE_SUCCESS` false-positive on Windows VMs with BitLocker** — The post-backup ERROR-line scan in `perform_backup()` used a case-insensitive substring match (`grep -qi "ERROR"`), which fired on the word "ERROR" appearing inside INFO/WARN payloads. On Windows VMs the QEMU guest agent surfaces BitLocker status text containing the word during normal operation, marking otherwise-successful backups as failed and triggering retries / spurious alert noise. The check is now anchored to the timestamped severity prefix (`^[YYYY-MM-DD HH:MM:SS] ERROR `) so only real `ERROR`-level records trigger the guard, with ANSI colour escapes stripped first so coloured output still matches. Same fix applied to the diagnostic snippet extraction.

## [0.5.6] - 2026-04-26

### Changed
Expand Down
17 changes: 11 additions & 6 deletions vmbackup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3587,13 +3587,18 @@ perform_backup() {
pkill -P $monitor_pid 2>/dev/null || true
kill $monitor_pid 2>/dev/null || true

# virtnbdbackup sometimes exits 0 despite logging ERROR lines (e.g.,
# "target directory already contains full or copy backup", bitmap
# conflicts, extent read failures). Scan the captured log for any
# ERROR line and treat it as a backup failure.
if [[ -f "$backup_log" ]] && grep -qi "ERROR" "$backup_log" 2>/dev/null; then
# virtnbdbackup sometimes exits 0 despite logging ERROR lines. Anchor
# the match to the timestamped severity prefix so the word "ERROR"
# appearing inside INFO/WARN payloads (e.g. Windows guest-agent
# BitLocker status) doesn't produce a false failure. Strip ANSI
# colour escapes first so coloured output still matches.
if [[ -f "$backup_log" ]] && \
sed -E 's/\x1b\[[0-9;]*m//g' "$backup_log" | \
grep -qE '^\[[0-9-]{10} [0-9:]{8}\] ERROR ' 2>/dev/null; then
local error_lines
error_lines=$(grep -i "ERROR" "$backup_log" 2>/dev/null | tail -3 | tr '\n' ' ' | cut -c1-200)
error_lines=$(sed -E 's/\x1b\[[0-9;]*m//g' "$backup_log" | \
grep -E '^\[[0-9-]{10} [0-9:]{8}\] ERROR ' 2>/dev/null | \
tail -3 | tr '\n' ' ' | cut -c1-200)
log_error "vmbackup.sh" "perform_backup" \
"virtnbdbackup exited 0 but logged ERROR(s) for VM $vm_name: $error_lines"
set_backup_error "VIRTNBD_FALSE_SUCCESS" \
Expand Down