]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/dircmd.c
Disabled ActionOnPurge waiting for a fix
[bacula/bacula] / bacula / src / stored / dircmd.c
index c658f5d36d4d1b4bc38f507ccc4cee1c0ec626b5..c9b74b000f875c6395e7039af29430aa7510b098 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2001-2008 Free Software Foundation Europe e.V.
+   Copyright (C) 2001-2009 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -119,7 +119,7 @@ static struct s_cmds cmds[] = {
    {"status",      status_cmd,      1},
    {".status",     qstatus_cmd,     1},
    {"unmount",     unmount_cmd,     0},
-   {"action_on_purge", action_on_purge_cmd,    0},
+   {"action_on_purge",  action_on_purge_cmd,    0},
    {"use storage=", use_cmd,        0},
    {"run",         run_cmd,         0},
 // {"query",       query_cmd,       0},
@@ -327,7 +327,8 @@ static bool cancel_cmd(JCR *cjcr)
             Dmsg1(100, "JobId=%u broadcast wait_device_release\n", (uint32_t)jcr->JobId);
             pthread_cond_broadcast(&wait_device_release);
          }
-         Jmsg(jcr, M_INFO, 0, _("Job %s marked to be canceled.\n"), jcr->Job);
+         Jmsg(jcr, M_INFO, 0, _("JobId=%d Job=\"%s\" marked to be canceled.\n"), 
+            (int)jcr->JobId, jcr->Job);
          dir->fsend(_("3000 Job %s marked to be canceled.\n"), jcr->Job);
          free_jcr(jcr);
       }
@@ -758,6 +759,9 @@ static bool mount_cmd(JCR *jcr)
             } else { /* must be file */
                dir->fsend(_("3906 File device %s is always mounted.\n"),
                   dev->print_name());
+               pthread_cond_broadcast(&dev->wait_next_vol);
+               Dmsg1(100, "JobId=%u broadcast wait_device_release\n", (uint32_t)dcr->jcr->JobId);
+               pthread_cond_broadcast(&wait_device_release);
             }
             break;
 
@@ -879,19 +883,41 @@ static bool unmount_cmd(JCR *jcr)
  */
 static bool action_on_purge_cmd(JCR *jcr)
 {
-   POOL_MEM devname;
-   POOL_MEM volumename;
+   char devname[MAX_NAME_LENGTH];
+   char volumename[MAX_NAME_LENGTH];
    BSOCK *dir = jcr->dir_bsock;
    DEVICE *dev;
    DCR *dcr;
    int action;
 
-   if (sscanf(dir->msg, "action_on_purge %127s vol=%s action=%d",
-              devname.c_str(), volumename.c_str(), &action) != 3) {
+   /* Currently disabled */
+   dir->fsend(_("3916 Feature action_on_purge currently disabled\n"));
+
+#if 0
+   /* TODO: Need to find a free device and ask for slot to the director */
+   if (sscanf(dir->msg, 
+              "action_on_purge %127s vol=%127s action=%d",
+              devname.c_str(), volumename.c_str(), &action)!= 5) 
+   {
       dir->fsend(_("3916 Error scanning action_on_purge command\n"));
       goto done;
    }
-   unbash_spaces(volumename.c_str());
+   unbash_spaces(volumename);
+   unbash_spaces(devname);
+
+   /* Check if action is correct */
+   switch (action) {
+   case AOP_TRUNCTATE:
+      break;
+   default:
+      dir->fsend(_("3919 Bad ActionOnPurge\n"));
+      goto done;
+   }
+
+   /* TODO: Ask for Volume information
+    *  - check recycle
+    *  - find slot
+    */
 
    /* FIXME: autochanger, drive = 0? how can we avoid that? we only work on
     * files 
@@ -913,6 +939,7 @@ static bool action_on_purge_cmd(JCR *jcr)
    } else {
       dir->fsend(_("3918 Recycle failed\n"));
    }
+#endif
 
 done:
    dir->signal(BNET_EOD);