]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/dircmd.c
First go at supporting a mount and unmount wrapper for tape devices. Initial cleanup...
[bacula/bacula] / bacula / src / stored / dircmd.c
index c7d564c6ecc8ca1879a4b1168f8f383e80fe21f8..c658f5d36d4d1b4bc38f507ccc4cee1c0ec626b5 100644 (file)
@@ -884,16 +884,18 @@ static bool action_on_purge_cmd(JCR *jcr)
    BSOCK *dir = jcr->dir_bsock;
    DEVICE *dev;
    DCR *dcr;
-   int drive;
    int action;
 
-   if (sscanf(dir->msg, "action_on_purge_cmd %127s vol=%s action=%d",
+   if (sscanf(dir->msg, "action_on_purge %127s vol=%s action=%d",
               devname.c_str(), volumename.c_str(), &action) != 3) {
-      dir->fsend(_("3916 Error scanning action_on_purge_cmd command\n"));
+      dir->fsend(_("3916 Error scanning action_on_purge command\n"));
       goto done;
    }
+   unbash_spaces(volumename.c_str());
 
-   /* FIXME: autochanger, drive = 0? how can we avoid that? we only work on files */
+   /* FIXME: autochanger, drive = 0? how can we avoid that? we only work on
+    * files 
+    */
    if ((dcr = find_device(jcr, devname, 0)) == NULL) {
       dir->fsend(_("3999 Device \"%s\" not found or could not be opened.\n"), devname.c_str());
       goto done;
@@ -906,9 +908,11 @@ static bool action_on_purge_cmd(JCR *jcr)
    bstrncpy(dev->VolHdr.VolumeName, volumename.c_str(), sizeof(dev->VolHdr.VolumeName));
 
    /* Re-write the label with the recycle flag */
-   if (rewrite_volume_label(dcr, true))
+   if (rewrite_volume_label(dcr, true)) {
       dir->fsend(_("3917 Volume recycled\n"));
-   else dir->fsend(_("3918 Recycle failed\n"));
+   } else {
+      dir->fsend(_("3918 Recycle failed\n"));
+   }
 
 done:
    dir->signal(BNET_EOD);
@@ -1065,7 +1069,10 @@ static bool changer_cmd(JCR *jcr)
     */
    bool safe_cmd = false;
 
-   if (sscanf(dir->msg, "autochanger list %127s", devname.c_str()) == 1) {
+   if (sscanf(dir->msg, "autochanger listall %127s", devname.c_str()) == 1) {
+      cmd = "listall";
+      safe_cmd = ok = true;
+   } else if (sscanf(dir->msg, "autochanger list %127s", devname.c_str()) == 1) {
       cmd = "list";
       safe_cmd = ok = true;
    } else if (sscanf(dir->msg, "autochanger slots %127s", devname.c_str()) == 1) {