Fix up Archive Querys and Retrieval
This commit is contained in:
@@ -34,25 +34,63 @@ int tsm_listfile_cb(dsmQueryType qType, DataBlk *qResp, void *userdata) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (! headerPrinted++)
|
||||
printf("%40s %2s %s %3s %19s %19s %10s %s\n",
|
||||
"NAME",
|
||||
"ST",
|
||||
"L",
|
||||
"CED",
|
||||
"BACKUP",
|
||||
"EXPIRE",
|
||||
"EST SIZE",
|
||||
"ID"
|
||||
);
|
||||
|
||||
if (qType == qtArchive) {
|
||||
if (! headerPrinted++)
|
||||
printf("%40s %2s %s %3s %19s %19s %10s %10s %s\n",
|
||||
"NAME",
|
||||
"ST",
|
||||
"L",
|
||||
"CED",
|
||||
"BACKUP",
|
||||
"EXPIRE",
|
||||
"EST SIZE",
|
||||
"ID",
|
||||
"DESC"
|
||||
);
|
||||
|
||||
memset(&respArchive,0x00,sizeof(qryRespArchiveData));
|
||||
qryRespArchiveData *qr = (void *) qResp->bufferPtr;
|
||||
respArchive = *qr;
|
||||
|
||||
// The Object Status
|
||||
switch (respArchive.objName.objType) {
|
||||
case (DSM_OBJ_FILE) : strcpy(state,"F"); break;
|
||||
case (DSM_OBJ_DIRECTORY) : strcpy(state,"D"); break;
|
||||
default : strcpy(state,"?");
|
||||
}
|
||||
|
||||
// Location
|
||||
switch (respArchive.mediaClass) {
|
||||
case (MEDIA_FIXED) : strcpy(stor,"D"); break;
|
||||
case (MEDIA_LIBRARY) : strcpy(stor,"T"); break;
|
||||
default : strcpy(stor,"?");
|
||||
}
|
||||
|
||||
// Compression, Encryption, De-Duplication
|
||||
strcpy(ced,(respArchive.compressType == DSM_OBJ_COMPRESSED_YES ? "C" :
|
||||
(respArchive.compressType == DSM_OBJ_COMPRESSED_NO ? "-" : "?")));
|
||||
|
||||
strcat(ced,(respArchive.encryptionType & DSM_ENCRYPT_CLIENTENCRKEY ? "C" :
|
||||
(respArchive.encryptionType & DSM_ENCRYPT_USER ? "U" : "-")));
|
||||
|
||||
strcat(ced,respArchive.clientDeduplicated ? "D" : "-");
|
||||
|
||||
// The Object Status
|
||||
printf("%40s|%2s|%s|%3s|%19s|%19s|%7.3f MB|%u-%u|%s\n",dsmObjnameToStr(respArchive.objName),state,stor,ced,dsmDateToStr(respArchive.insDate),respArchive.expDate.year ? dsmDateToStr(respArchive.expDate) : "",dsmSizeToNum(respArchive.sizeEstimate),respArchive.objId.hi,respArchive.objId.lo,respArchive.descr);
|
||||
|
||||
} else if (qType ==qtBackup) {
|
||||
if (! headerPrinted++)
|
||||
printf("%40s %2s %s %3s %19s %19s %10s %s\n",
|
||||
"NAME",
|
||||
"ST",
|
||||
"L",
|
||||
"CED",
|
||||
"BACKUP",
|
||||
"EXPIRE",
|
||||
"EST SIZE",
|
||||
"ID"
|
||||
);
|
||||
|
||||
memset(&respBackup,0x00,sizeof(qryRespBackupData));
|
||||
qryRespBackupData *qr = (void *) qResp->bufferPtr;
|
||||
respBackup = *qr;
|
||||
@@ -86,14 +124,14 @@ int tsm_listfile_cb(dsmQueryType qType, DataBlk *qResp, void *userdata) {
|
||||
|
||||
strcat(ced,respBackup.clientDeduplicated ? "D" : "-");
|
||||
|
||||
printf("%40s|%2s|%s|%3s|%19s|%19s|%7.3f MB|%u-%u\n",dsmObjnameToStr(respBackup.objName),state,stor,ced,dsmDateToStr(respBackup.insDate),respBackup.expDate.year ? dsmDateToStr(respBackup.expDate) : "",dsmSizeToNum(respBackup.sizeEstimate),respBackup.objId.hi,respBackup.objId.lo);
|
||||
|
||||
} else {
|
||||
fprintf(stderr,"tsm_listfile_cb: Internal error: Unknown qType %d\n",qType);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("%40s|%2s|%s|%3s|%19s|%19s|%7.3f MB|%u-%u\n",dsmObjnameToStr(respBackup.objName),state,stor,ced,dsmDateToStr(respBackup.insDate),respBackup.expDate.year ? dsmDateToStr(respBackup.expDate) : "",dsmSizeToNum(respBackup.sizeEstimate),respBackup.objId.hi,respBackup.objId.lo);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@@ -298,7 +298,10 @@ int tsm_restorefile(dsUint32_t dsmHandle, char *fsname, char *filename, char *de
|
||||
cbdata.numfound = 0;
|
||||
|
||||
// Retrieve a list based on the PITDATE or if no PITDATE, the last ACTIVE
|
||||
rc = tsm_queryfile(dsmHandle,&objName,description,sendtype,verbose,tsm_matchone_cb,&cbdata,pitdate,pitdate ? DSM_ANY_MATCH : DSM_ACTIVE);
|
||||
if (sendtype == stBackupMountWait)
|
||||
rc = tsm_queryfile(dsmHandle,&objName,description,sendtype,verbose,tsm_matchone_cb,&cbdata,pitdate,pitdate ? DSM_ANY_MATCH : DSM_ACTIVE);
|
||||
else
|
||||
rc = tsm_queryfile(dsmHandle,&objName,description,sendtype,verbose,tsm_matchone_cb,&cbdata,NULL,0);
|
||||
|
||||
if (rc != DSM_RC_OK)
|
||||
return 0;
|
||||
|
@@ -295,10 +295,15 @@ dsInt16_t tsm_queryfile(dsUint32_t dsmHandle, dsmObjName *objName, char *descrip
|
||||
qaData.stVersion = qryArchiveDataVersion;
|
||||
qaData.objName = objName;
|
||||
qaData.owner = "";
|
||||
qaData.insDateLowerBound.year = DATE_MINUS_INFINITE;
|
||||
qaData.insDateUpperBound.year = DATE_PLUS_INFINITE;
|
||||
qaData.expDateLowerBound.year = DATE_MINUS_INFINITE;
|
||||
qaData.expDateUpperBound.year = DATE_PLUS_INFINITE;
|
||||
if (pitdate) {
|
||||
fprintf(stderr,"tsm_queryfile: Archive Date Range Query not yet setup\n");
|
||||
exit(1);
|
||||
} else {
|
||||
qaData.insDateLowerBound.year = DATE_MINUS_INFINITE;
|
||||
qaData.insDateUpperBound.year = DATE_PLUS_INFINITE;
|
||||
qaData.expDateLowerBound.year = DATE_MINUS_INFINITE;
|
||||
qaData.expDateUpperBound.year = DATE_PLUS_INFINITE;
|
||||
}
|
||||
qaData.descr = description ? description : "*";
|
||||
|
||||
qDataP = &qaData;
|
||||
|
Reference in New Issue
Block a user