backup that will be overwritten.
The backup procedure will begin soon and will happen zone-by-zone
(partially in parallel if more :ref:`server_background-workers` are configured).
-The user shall check the logs for the outcome of each zone's backup attempt.
+**The user shall check the logs for the outcome of each zone's backup attempt.**
The knotc's ``-b`` parameter might be used if the user desires to wait until
the backup work is done.
return policy;
}
+#define LOG_FAIL(action) log_zone_warning(zone->name, "%s, %s failed (%s)\n", ctx->restore_mode ? "restore" : "backup", (action), knot_strerror(ret))
+
static int backup_keystore(conf_t *conf, zone_t *zone, zone_backup_ctx_t *ctx)
{
dnssec_keystore_t *from = NULL, *to = NULL;
unsigned backend_type = 0;
int ret = zone_init_keystore(conf, &policy_id, &from, &backend_type);
if (ret != KNOT_EOK) {
+ LOG_FAIL("keystore init");
return ret;
}
if (backend_type == KEYSTORE_BACKEND_PKCS11) {
(void)snprintf(kasp_dir, sizeof(kasp_dir), "%s/keys", ctx->backup_dir);
ret = keystore_load("keys", KEYSTORE_BACKEND_PEM, kasp_dir, &to);
if (ret != KNOT_EOK) {
+ LOG_FAIL("keystore load");
goto done;
}
ret = kasp_db_list_keys(zone->kaspdb, zone->name, &key_params);
ret = (ret == KNOT_ENOENT ? KNOT_EOK : ret);
if (ret != KNOT_EOK) {
+ LOG_FAIL("keystore list");
goto done;
}
ptrnode_t *n;
free_key_params(n->d);
}
}
+ if (ret != KNOT_EOK) {
+ LOG_FAIL("key copy");
+ }
ptrlist_deep_free(&key_params, NULL);
done:
free(backup_zf);
free(local_zf);
if (ret != KNOT_EOK) {
+ LOG_FAIL("zone file");
goto done;
}
}
if (knot_lmdb_exists(kasp_from)) {
ret = kasp_db_backup(zone->name, kasp_from, kasp_to);
if (ret != KNOT_EOK) {
+ LOG_FAIL("KASP database");
goto done;
}
ret = journal_scrape_with_md(zone_journal(zone), true);
}
if (ret != KNOT_EOK) {
+ LOG_FAIL("journal");
goto done;
}
ret = knot_lmdb_open(&ctx->bck_timer_db);
if (ret != KNOT_EOK) {
+ LOG_FAIL("timers open");
goto done;
}
if (ctx->restore_mode) {
} else {
ret = zone_timers_write(&ctx->bck_timer_db, zone->name, &zone->timers);
}
+ if (ret != KNOT_EOK) {
+ LOG_FAIL("timers");
+ }
done:
zone_backup_deinit(ctx);