From: Eric Bollengier Date: Wed, 18 May 2022 11:53:23 +0000 (+0200) Subject: snapshot: Fix #9143 About snapshot not properly stored in the catalog X-Git-Tag: Release-13.0.0~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec60bfd935fc54f1b61cce30458b750cf87ba3b4;p=thirdparty%2Fbacula.git snapshot: Fix #9143 About snapshot not properly stored in the catalog --- diff --git a/bacula/src/dird/catreq.c b/bacula/src/dird/catreq.c index c5f3f4866..5f753114c 100644 --- a/bacula/src/dird/catreq.c +++ b/bacula/src/dird/catreq.c @@ -121,9 +121,6 @@ static int send_volume_info_to_storage_daemon(JCR *jcr, BSOCK *sd, MEDIA_DBR *mr return stat; } -/* TODO: See if we want to let the FD do all kind - * of catalog request/update - */ void catalog_request(JCR *jcr, BSOCK *bs) { MEDIA_DBR mr, sdmr; diff --git a/bacula/src/dird/getmsg.c b/bacula/src/dird/getmsg.c index b2cf7c7b7..89e6b9778 100644 --- a/bacula/src/dird/getmsg.c +++ b/bacula/src/dird/getmsg.c @@ -268,6 +268,11 @@ int bget_dirmsg(JCR *jcr, BSOCK *bs, BSOCK_CLIENT_TYPE role) catalog_request(jcr, bs); continue; } + /* Only the Snapshot commands are authorized for the FD */ + if (role==BSOCK_TYPE_FD && bs->msg[0] == 'C') { + snapshot_catreq(jcr, bs); + continue; + } if (role==BSOCK_TYPE_SD && bs->msg[0] == 'U') { /* SD sending attributes */ Dmsg2(900, "Catalog upd jcr=%p: %s", jcr, bs->msg); catalog_update(jcr, bs); diff --git a/bacula/src/dird/snapshot.c b/bacula/src/dird/snapshot.c index 14126ff24..39e6f5821 100644 --- a/bacula/src/dird/snapshot.c +++ b/bacula/src/dird/snapshot.c @@ -523,6 +523,11 @@ static int list_client_snapshot(UAContext *ua, bool sync) /* Ask client to create/prune/delete a snapshot via the command line */ int snapshot_cmd(UAContext *ua, const char *cmd) { + if (!open_client_db(ua)) { + Dmsg0(10, "Unable to open database\n"); + return 0; + } + SNAPSHOT_DBR snapdbr; for (int i=0; iargc; i++) { if (strcasecmp(ua->argk[i], NT_("purge")) == 0) {