]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_cmds.c
kes Update copyright date in program files, and for the most part
[bacula/bacula] / bacula / src / dird / ua_cmds.c
index 29feea937e5124b6f240893bb1b96f8f0855a52c..9869bb281e92c78df6555c2f20cf81dd84f6258b 100644 (file)
@@ -30,7 +30,6 @@
 extern int r_first;
 extern int r_last;
 extern struct s_res resources[];
-extern char my_name[];
 extern jobq_t job_queue;              /* job queue */
 
 
@@ -147,8 +146,8 @@ int do_a_command(UAContext *ua, const char *cmd)
       return 1;
    }
 
-   while (ua->jcr->storage->size()) {
-      ua->jcr->storage->remove(0);
+   while (ua->jcr->wstorage->size()) {
+      ua->jcr->wstorage->remove(0);
    }
 
    len = strlen(ua->argk[0]);
@@ -186,6 +185,7 @@ void set_pool_dbr_defaults_in_media_dbr(MEDIA_DBR *mr, POOL_DBR *pr)
    mr->MaxVolFiles = pr->MaxVolFiles;
    mr->MaxVolBytes = pr->MaxVolBytes;
    mr->LabelType = pr->LabelType;
+   mr->Enabled = 1;
 }
 
 
@@ -316,6 +316,7 @@ getVolName:
       mr.Slot = Slot++;
       mr.InChanger = InChanger;
       mr.StorageId = store->StorageId;
+      mr.Enabled = 1;
       Dmsg1(200, "Create Volume %s\n", mr.VolumeName);
       if (!db_create_media_record(ua->jcr, ua->db, &mr)) {
          bsendmsg(ua, "%s", db_strerror(ua->db));
@@ -483,7 +484,6 @@ void set_pooldbr_from_poolres(POOL_DBR *pr, POOL *pool, e_pool_op op)
    pr->LabelType = pool->LabelType;
    pr->UseOnce = pool->use_volume_once;
    pr->UseCatalog = pool->use_catalog;
-   pr->AcceptAnyVolume = pool->accept_any_volume;
    pr->Recycle = pool->Recycle;
    pr->VolRetention = pool->VolRetention;
    pr->VolUseDuration = pool->VolUseDuration;
@@ -672,10 +672,10 @@ static void do_storage_setdebug(UAContext *ua, STORE *store, int level, int trac
    BSOCK *sd;
    JCR *jcr = ua->jcr;
 
-   set_storage(jcr, store);
+   set_wstorage(jcr, store);
    /* Try connecting for up to 15 seconds */
    bsendmsg(ua, _("Connecting to Storage daemon %s at %s:%d\n"),
-      store->hdr.name, store->address, store->SDport);
+      store->name(), store->address, store->SDport);
    if (!connect_to_storage_daemon(jcr, 1, 15, 0)) {
       bsendmsg(ua, _("Failed to connect to Storage daemon.\n"));
       return;
@@ -1083,7 +1083,7 @@ static int time_cmd(UAContext *ua, const char *cmd)
    char sdt[50];
    time_t ttime = time(NULL);
    struct tm tm;
-   localtime_r(&ttime, &tm);
+   (void)localtime_r(&ttime, &tm);
    strftime(sdt, sizeof(sdt), "%d-%b-%Y %H:%M:%S", &tm);
    bsendmsg(ua, "%s\n", sdt);
    return 1;
@@ -1237,23 +1237,15 @@ static void delete_job_id_range(UAContext *ua, char *tok)
 
 /*
  * do_job_delete now performs the actual delete operation atomically
- * we always return 1 because C++ is pissy about void functions
  */
 
 static void do_job_delete(UAContext *ua, JobId_t JobId)
 {
-   POOLMEM *query = get_pool_memory(PM_MESSAGE);
+   POOL_MEM query(PM_MESSAGE);
    char ed1[50];
 
-   Mmsg(query, "DELETE FROM Job WHERE JobId=%s", edit_int64(JobId, ed1));
-   db_sql_query(ua->db, query, NULL, (void *)NULL);
-   Mmsg(query, "DELETE FROM MAC WHERE JobId=%s", ed1);
-   db_sql_query(ua->db, query, NULL, (void *)NULL);
-   Mmsg(query, "DELETE FROM File WHERE JobId=%s", ed1);
-   db_sql_query(ua->db, query, NULL, (void *)NULL);
-   Mmsg(query, "DELETE FROM JobMedia WHERE JobId=%s", ed1);
-   db_sql_query(ua->db, query, NULL, (void *)NULL);
-   free_pool_memory(query);
+   purge_files_from_job(ua, JobId);
+   purge_job_from_catalog(ua, JobId);
    bsendmsg(ua, _("Job %s and associated records deleted from the catalog.\n"), edit_int64(JobId, ed1));
 }
 
@@ -1319,7 +1311,7 @@ static void do_mount_cmd(UAContext *ua, const char *command)
    if (!store) {
       return;
    }
-   set_storage(jcr, store);
+   set_wstorage(jcr, store);
    drive = get_storage_drive(ua, store);
 
    Dmsg3(120, "Found storage, MediaType=%s DevName=%s drive=%d\n",