Skip to content
Snippets Groups Projects
Commit 69e1d584 authored by David Vasek's avatar David Vasek
Browse files

backup: display zone count in the label file

It's enough to count planned backup events. Counting finished zones isn't necessary.
parent ab5574bb
No related branches found
No related tags found
1 merge request!1325backup improvements -- modified backup format (BACKUP_FORMAT_2), label file, improved backup locking, etc.
......@@ -522,6 +522,7 @@ static int zone_backup_cmd(zone_t *zone, ctl_args_t *args)
pthread_mutex_lock(&ctx->readers_mutex);
ctx->readers++;
pthread_mutex_unlock(&ctx->readers_mutex);
ctx->zone_count++;
int ret = schedule_trigger(zone, args, ZONE_EVENT_BACKUP, true);
......
......@@ -99,14 +99,16 @@ static int make_label_file(zone_backup_ctx_t *ctx, char *full_path)
"Knot DNS version: %s\n"
LABEL_FILE_FORMAT
"Parameters used: +backupdir %s\n"
" +%szonefile +%sjournal +%stimers +%skaspdb +%scatalog\n",
" +%szonefile +%sjournal +%stimers +%skaspdb +%scatalog\n"
"Zone count: %d\n",
label_file_head, hostname, date, PACKAGE_VERSION, BACKUP_VERSION,
ctx->backup_dir,
ctx->backup_zonefile ? "" : "no",
ctx->backup_journal ? "" : "no",
ctx->backup_timers ? "" : "no",
ctx->backup_kaspdb ? "" : "no",
ctx->backup_catalog ? "" : "no");
ctx->backup_catalog ? "" : "no",
ctx->zone_count);
ret = (ret < 0) ? knot_map_errno() : KNOT_EOK;
......@@ -191,6 +193,7 @@ int zone_backup_init(bool restore_mode, bool forced, const char *backup_dir,
ctx->backup_global = false;
ctx->readers = 1;
ctx->failed = false;
ctx->zone_count = 0;
ctx->backup_dir = (char *)(ctx + 1);
memcpy(ctx->backup_dir, backup_dir, backup_dir_len);
......@@ -603,6 +606,7 @@ done_zfile:
}
if (ret != KNOT_EOK) {
LOG_MARK_FAIL("timers");
goto done;
}
}
......
......@@ -48,6 +48,7 @@ typedef struct zone_backup_ctx {
int lock_file; // lock file preventing simultaneous backups to same directory
bool failed; // true if an error occurred in processing of any zone
knot_backup_format_t backup_format; // the backup format version used
int zone_count; // count of backed up zones
} zone_backup_ctx_t;
typedef struct {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment