From: Michal Rakowski Date: Thu, 15 Oct 2020 05:45:58 +0000 (+0200) Subject: bscan: Add Plugin Object handling X-Git-Tag: Release-11.3.2~996 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13efd0cd31c96033fd0703c17465295a71589bc5;p=thirdparty%2Fbacula.git bscan: Add Plugin Object handling --- diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 62de35836..d61d58e3d 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -824,6 +824,42 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec) break; } + case STREAM_PLUGIN_OBJECT: + { + OBJECT_DBR obj_r; + char *buf = rec->data; + num_plugin_objects++; + + obj_r.parse_plugin_object_string(&buf); + + // Need to get new jobId if possible + mjcr = get_jcr_by_session(rec->VolSessionId, rec->VolSessionTime); + if (!mjcr) { + Pmsg2(000, _("Could not find SessId=%d SessTime=%d for PluginObject record.\n"), + rec->VolSessionId, rec->VolSessionTime); + break; + } + + obj_r.JobId = mjcr->JobId; + + /* Look if we have already the same object */ + if (db_get_plugin_object_record(mjcr, db, &obj_r)) { + if (verbose) { + Pmsg1(0, _("RESTORE_OBJECT: Found Plugin Object \"%s\" in the catalog\n"), obj_r.ObjectName); + } + } else if (update_db) { + /* Send it */ + Pmsg1(0, _("PLUGIN_OBJECT: Inserting Plugin Object \"%s\" into the catalog\n"), obj_r.ObjectName); + if (!db_create_object_record(mjcr, db, &obj_r)) { + Jmsg1(mjcr, M_FATAL, 0, _("Plugin object create error. %s"), db_strerror(db)); + } + } else { + Pmsg1(0, _("PLUGIN_OBJECT: Found Plugin Object \"%s\" on the volume\n"), obj_r.ObjectName); + } + + break; + } + /* Data stream */ case STREAM_WIN32_DATA: case STREAM_FILE_DATA: