if (type == VERT_LIST) {
Mmsg(&mdb->cmd, "SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,"
"AcceptAnyVolume,VolRetention,VolUseDuration,MaxVolJobs,MaxVolBytes,"
- "AutoPrune,Recycle,PoolType,LabelFormat "
+ "AutoPrune,Recycle,PoolType,LabelFormat,Enabled,ScratchPoolId,"
+ "RecyclePoolId "
"FROM Pool ORDER BY PoolId");
} else {
Mmsg(&mdb->cmd, "SELECT PoolId,Name,NumVols,MaxVols,PoolType,LabelFormat "
bsendmsg(ua, _("Illegal command from this console.\n"));
return 1;
}
+ LockRes();
client = (CLIENT *)GetResWithName(R_CLIENT, ua->cons->hdr.name);
if (!client) {
bsendmsg(ua, _("Client \"%s\" not found.\n"), ua->cons->hdr.name);
- return 1;
+ goto get_out;
}
- LockRes();
if (client->address) {
free(client->address);
}
client->address = bstrdup(inet_ntoa(ua->UA_sock->client_addr.sin_addr));
bsendmsg(ua, _("Client \"%s\" address set to %s\n"),
client->hdr.name, client->address);
+get_out:
UnlockRes();
return 1;
}
* updates pool from Pool resource
* update media pool=<pool-name> volume=<volume-name>
* changes pool info for volume
+ * update slots [scan=...]
+ * updates autochanger slots
*/
static int update_cmd(UAContext *ua, char *cmd)
{
POOL_DBR *pr, int relabel, bool media_record_exits);
static vol_list_t *get_vol_list_from_SD(UAContext *ua, bool scan);
static void free_vol_list(vol_list_t *vol_list);
-static int is_cleaning_tape(UAContext *ua, MEDIA_DBR *mr, POOL_DBR *pr);
+static bool is_cleaning_tape(UAContext *ua, MEDIA_DBR *mr, POOL_DBR *pr);
static BSOCK *open_sd_bsock(UAContext *ua);
static void close_sd_bsock(UAContext *ua);
static char *get_volume_name_from_SD(UAContext *ua, int Slot);
return do_label(ua, cmd, 1); /* relabel tape */
}
-#define MAX_SLOTS 5000
+static int const max_slots = 5000;
static bool get_user_slot_list(UAContext *ua, char *slot_list, int num_slots)
{
scan = find_arg(ua, _("scan")) >= 0;
- slot_list = (char *)malloc(MAX_SLOTS);
- if (!get_user_slot_list(ua, slot_list, MAX_SLOTS)) {
+ slot_list = (char *)malloc(max_slots);
+ if (!get_user_slot_list(ua, slot_list, max_slots)) {
free(slot_list);
return 1;
}
for (vl=vol_list; vl; vl=vl->next) {
/* Check if user wants us to look at this slot */
if (!slot_list[vl->Slot]) {
+ Dmsg1(100, "Skipping slot=%d\n", vl->Slot);
continue;
}
/* If scanning, we read the label rather than the barcode */
vl->VolName = NULL;
}
vl->VolName = get_volume_name_from_SD(ua, vl->Slot);
+ Dmsg2(100, "Got Vol=%s from SD for Slot=%d\n", vl->VolName, vl->Slot);
}
if (!vl->VolName) {
+ Dmsg1(100, "No VolName for Slot=%d skipping.\n", vl->Slot);
continue;
}
memset(&mr, 0, sizeof(mr));
bool media_record_exists;
char *slot_list;
- slot_list = (char *)malloc(MAX_SLOTS);
- if (!get_user_slot_list(ua, slot_list, MAX_SLOTS)) {
+ slot_list = (char *)malloc(max_slots);
+ if (!get_user_slot_list(ua, slot_list, max_slots)) {
free(slot_list);
return;
}
* Check if the Volume name has legal characters
* If ua is non-NULL send the message
*/
-int is_volume_name_legal(UAContext *ua, char *name)
+bool is_volume_name_legal(UAContext *ua, char *name)
{
int len;
char *p;
vl = (vol_list_t *)malloc(sizeof(vol_list_t));
vl->Slot = Slot;
if (p) {
+ if (*p == ':') {
+ p++; /* skip separator */
+ }
vl->VolName = bstrdup(p);
} else {
vl->VolName = NULL;
}
+ Dmsg2(100, "Add slot=%d Vol=%s to list.\n", vl->Slot, NPRT(vl->VolName));
if (!vol_list) {
vl->next = vol_list;
vol_list = vl;
* with the Cleaning Prefix. If they match, this is a cleaning
* tape.
*/
-static int is_cleaning_tape(UAContext *ua, MEDIA_DBR *mr, POOL_DBR *pr)
+static bool is_cleaning_tape(UAContext *ua, MEDIA_DBR *mr, POOL_DBR *pr)
{
+ /* Find Pool resource */
+ ua->jcr->pool = (POOL *)GetResWithName(R_POOL, pr->Name);
if (!ua->jcr->pool) {
- /* Find Pool resource */
- ua->jcr->pool = (POOL *)GetResWithName(R_POOL, pr->Name);
- if (!ua->jcr->pool) {
- bsendmsg(ua, _("Pool %s resource not found!\n"), pr->Name);
- return 1;
- }
+ bsendmsg(ua, _("Pool \"%s\" resource not found!\n"), pr->Name);
+ return true;
}
if (ua->jcr->pool->cleaning_prefix == NULL) {
- return 0;
+ return false;
}
- Dmsg4(200, "CLNprefix=%s: Vol=%s: len=%d strncmp=%d\n",
+ Dmsg4(100, "CLNprefix=%s: Vol=%s: len=%d strncmp=%d\n",
ua->jcr->pool->cleaning_prefix, mr->VolumeName,
strlen(ua->jcr->pool->cleaning_prefix),
strncmp(mr->VolumeName, ua->jcr->pool->cleaning_prefix,