return false;
}
- /* Send the command to truncate the volume after purge. If this feature
- * is disabled for the specific device, this will be a no-op. */
- BSOCK *sd;
- if ((sd=open_sd_bsock(ua)) != NULL) {
- sd->fsend("truncate_on_purge %s vol=%s", ua->jcr->wstore->dev_name(), mr->VolumeName);
-
- while (sd->recv() >= 0)
- ua->send_msg("%s", sd->msg);
-
- sd->signal(BNET_TERMINATE);
- sd->close();
- ua->jcr->store_bsock = NULL;
+ if (mr->ActionOnPurge > 0) {
+ /* Send the command to truncate the volume after purge. If this feature
+ * is disabled for the specific device, this will be a no-op. */
+ BSOCK *sd;
+ if ((sd=open_sd_bsock(ua)) != NULL) {
+ sd->fsend("action_on_purge %s vol=%s action=%d",
+ ua->jcr->wstore->dev_name(),
+ mr->VolumeName,
+ mr->ActionOnPurge);
+
+ while (sd->recv() >= 0)
+ ua->send_msg("%s", sd->msg);
+
+ sd->signal(BNET_TERMINATE);
+ sd->close();
+ ua->jcr->store_bsock = NULL;
+ }
}
pm_strcpy(jcr->VolumeName, mr->VolumeName);
static bool cancel_cmd(JCR *cjcr);
static bool mount_cmd(JCR *jcr);
static bool unmount_cmd(JCR *jcr);
-static bool truncate_on_purge_cmd(JCR *jcr);
+static bool action_on_purge_cmd(JCR *jcr);
static bool bootstrap_cmd(JCR *jcr);
static bool changer_cmd(JCR *sjcr);
static bool do_label(JCR *jcr, int relabel);
{"status", status_cmd, 1},
{".status", qstatus_cmd, 1},
{"unmount", unmount_cmd, 0},
- {"truncate_on_purge", truncate_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},
* for File Storage, of course.
*
*/
-static bool truncate_on_purge_cmd(JCR *jcr)
+static bool action_on_purge_cmd(JCR *jcr)
{
POOL_MEM devname;
POOL_MEM volumename;
DEVICE *dev;
DCR *dcr;
int drive;
+ int action;
- if (sscanf(dir->msg, "truncate_on_purge %127s vol=%s", devname.c_str(), volumename.c_str()) != 2) {
- dir->fsend(_("3916 Error scanning truncate_on_purge command\n"));
+ if (sscanf(dir->msg, "action_on_purge_cmd %127s vol=%s action=%d",
+ devname.c_str(), volumename.c_str(), &action) != 3) {
+ dir->fsend(_("3916 Error scanning action_on_purge_cmd command\n"));
goto done;
}
dev = dcr->dev;
- if (!dev->truncate_on_purge) {
- dir->fsend(_("3919 Truncate on purge not enabled, skipping\n"));
- goto done;
- }
-
/* Store the VolumeName for opening and re-labeling the volume */
bstrncpy(dcr->VolumeName, volumename.c_str(), sizeof(dcr->VolumeName));
bstrncpy(dev->VolHdr.VolumeName, volumename.c_str(), sizeof(dev->VolHdr.VolumeName));