Enabled FS update with start/stop times, and updated scripts to default to -L

This commit is contained in:
Deon George 2014-08-26 00:21:53 +10:00
parent 2a9f0c0aac
commit 901d43cc7f
9 changed files with 45 additions and 15 deletions

View File

@ -107,9 +107,9 @@ int tsm_regfs(dsUint32_t dsmHandle, char *fsname) {
/* Send data to TSM for storage */
#ifdef USE_DIGEST
double tsm_sendfile(dsUint32_t dsmHandle, char *fsname, char *filename, long long length, char *description, dsmSendType sendtype, dsBool_t summary, char *digest) {
double tsm_sendfile(dsUint32_t dsmHandle, char *fsname, char *filename, long long length, char *description, dsmSendType sendtype, dsBool_t startstop, dsBool_t summary, char *digest) {
#else
double tsm_sendfile(dsUint32_t dsmHandle, char *fsname, char *filename, long long length, char *description, dsmSendType sendtype, dsBool_t summary) {
double tsm_sendfile(dsUint32_t dsmHandle, char *fsname, char *filename, long long length, char *description, dsmSendType sendtype, dsBool_t startstop, dsBool_t summary) {
#endif
extern int verbose;
char *buffer;
@ -158,6 +158,10 @@ double tsm_sendfile(dsUint32_t dsmHandle, char *fsname, char *filename, long lon
if (verbose && compressEnabled && length <= DSM_MIN_COMPRESS_SIZE)
fprintf(stderr,"tsm_sendfile: WARNING: Size (%i) too small for compression/de-duplication, even though it is enabled",(int)length);
// Log start backup
if (startstop)
tsm_datefs(dsmHandle,fsname,DSM_FSUPD_BACKSTARTDATE);
// Start a Transaction
rc = dsmBeginTxn(dsmHandle);
if (rc != DSM_RC_OK) {
@ -304,6 +308,12 @@ double tsm_sendfile(dsUint32_t dsmHandle, char *fsname, char *filename, long lon
objAttr.sizeEstimate.lo = dsmEndSendObjExOut.totalBytesSent.lo;
rc = dsmUpdateObj(dsmHandle,sendtype,archDataP,&objName,&objAttr,DSM_BACKUPD_OBJINFO | DSM_ARCHUPD_OBJINFO);
// Log start backup
if (startstop) {
tsm_datefs(dsmHandle,fsname,DSM_FSUPD_BACKCOMPLETEDATE);
tsm_updatefs(dsmHandle,fsname,dsmSizeToNum(dsmEndSendObjExOut.totalBytesSent,bFalse));
}
if (summary) {
if (! digest)
fprintf(stdout,"%s",dsmObjnameToStr(objName));
@ -499,7 +509,7 @@ int tsm_deletefile(dsUint32_t dsmHandle, dsmQueryType qType, qryArchiveData qaDa
}
/* Update the FS capacity and utilsation */
int tsm_updatefs(dsUint32_t dsmHandle, char *fsname, long long size ) {
int tsm_updatefs(dsUint32_t dsmHandle, char *fsname, long long size) {
dsInt16_t rc=0;
dsmFSUpd fsUpdateP;
@ -517,3 +527,18 @@ int tsm_updatefs(dsUint32_t dsmHandle, char *fsname, long long size ) {
return 1;
}
int tsm_datefs(dsUint32_t dsmHandle, char *fsname, int startstop) {
dsInt16_t rc=0;
dsmFSUpd fsUpdateP;
memset(&fsUpdateP,0x00,sizeof(dsmFSUpd));
rc = dsmUpdateFS(dsmHandle,fsname,&fsUpdateP,startstop);
if (rc != DSM_RC_OK) {
tsm_printerr(dsmHandle,rc,"tsm_datefs: dsmUpdateFS failed");
return 0;
}
return 1;
}

View File

@ -59,4 +59,4 @@ size=$(getsize);
[ -n "$DEBUG" ] && echo "Processing Kerberous, with size ($size)"
# Backup to TSM
/usr/sbin/kdb5_util dump| tsmpipe -Bcs ${FILESPACE} -f FULL -l ${size} ${TSMPIPE_ARGS}
/usr/sbin/kdb5_util dump| tsmpipe -Bcs ${FILESPACE} -f FULL -L ${size} ${TSMPIPE_ARGS}

View File

@ -68,7 +68,7 @@ for db in $DB; do
[ -n "$DEBUG" ] && echo "Processing DB ($db)"
# Restore from TSM
tsmpipe -Bxs ${FILESPACE} -f ${db}.FULL ${TSMPIPE_ARGS} | mysql ${MYSQL_AUTH} ${db}
tsmpipe -Bxs ${FILESPACE}/{$db} -f FULL ${TSMPIPE_ARGS} | mysql ${MYSQL_AUTH} ${db}
done;
IFS=$OLDIFS

View File

@ -105,5 +105,5 @@ listdb | while read db; do
[ -n "$DEBUG" ] && echo "Processing DB ($db), with size ($size)"
# Backup to TSM
mysqldump ${MYSQL_AUTH} ${MYSQL_ARGS} $db| tsmpipe -Bcs ${FILESPACE} -f ${db}.FULL -l ${size} ${TSMPIPE_ARGS}
mysqldump ${MYSQL_AUTH} ${MYSQL_ARGS} $db| tsmpipe -Bcs ${FILESPACE}/{$db} -f FULL -L ${size} ${TSMPIPE_ARGS}
done;

View File

@ -21,7 +21,7 @@
# Copyright (c) 2012-2013 by Deon George
# Check our arguments
while getopts ":DFh::p:P:r:v:" opt; do
while getopts ":DFh:m:p:P:r:v:" opt; do
case $opt in
D) DEBUG=1 ;;
@ -31,6 +31,9 @@ while getopts ":DFh::p:P:r:v:" opt; do
# Host
h) HOST=$OPTARG ;;
#) Mount Volume
m) MOUNT=$OPTARG ;;
# Volume to restore to
p) PARTITION=$OPTARG ;;
@ -70,4 +73,5 @@ RENAME=${RENAME:-$DB}
[ -n "$DEBUG" ] && echo "Processing DB ($DB) restoring to (${PARTITION}) with name (${RENAME})"
# Restore from TSM
echo "tsmpipe -Bxs ${FILESPACE} -f ${DB}.FULL ${TSMPIPE_ARGS} | vos restore ${HOST} ${PARTITION} ${RENAME} ${VOS_ARGS}"
echo "tsmpipe -Bxs ${FILESPACE}/${DB} -f FULL ${TSMPIPE_ARGS} | vos restore ${HOST} ${PARTITION} ${RENAME} ${VOS_ARGS}"
echo "fs mkm ${RENAME} ${MOUNT}"

View File

@ -110,7 +110,7 @@ list | while read db; do
fi
fi
/usr/sbin/vos dump -localauth $db 2>/dev/null| tsmpipe -Bcs ${FILESPACE} -f ${db}.FULL -l ${size} ${TSMPIPE_ARGS}
/usr/sbin/vos dump -localauth $db 2>/dev/null| tsmpipe -Bcs ${FILESPACE}/${db} -f FULL -L ${size} ${TSMPIPE_ARGS}
[ ! -e $LASTDB ] && touch $LASTDB
if grep -qe "\ ${db}\$" $LASTDB; then

View File

@ -59,4 +59,4 @@ size=$(getsize);
[ -n "$DEBUG" ] && echo "Processing OpenLDAP, with size ($size)"
# Backup to TSM
/usr/sbin/slapcat | tsmpipe -Bcs ${FILESPACE} -f FULL -l ${size} ${TSMPIPE_ARGS}
/usr/sbin/slapcat | tsmpipe -Bcs ${FILESPACE} -f FULL -L ${size} ${TSMPIPE_ARGS}

View File

@ -248,9 +248,9 @@ int main(int argc, char *argv[]) {
debugLog(0,stderr,"tsmpipe: ERROR: Provide positive length, overestimate if guessing",1);
#ifdef USE_DIGEST
stored = tsm_sendfile(dsmHandle,space,filename,length,desc,((qType == qtArchive) ? stArchiveMountWait : stBackupMountWait),summary,digest);
stored = tsm_sendfile(dsmHandle,space,filename,length,desc,((qType == qtArchive) ? stArchiveMountWait : stBackupMountWait),((action == ACTION_CREATE_UPDATE && qType==qtBackup) ? bTrue : bFalse),summary,digest);
#else
stored = tsm_sendfile(dsmHandle,space,filename,length,desc,((qType == qtArchive) ? stArchiveMountWait : stBackupMountWait),summary);
stored = tsm_sendfile(dsmHandle,space,filename,length,desc,((qType == qtArchive) ? stArchiveMountWait : stBackupMountWait),((action == ACTION_CREATE_UPDATE && qType==qtBackup) ? bTrue : bFalse),summary);
#endif
rc = stored ? 1 : 0;

View File

@ -1,4 +1,4 @@
#define _TSMPIPE_VERSION "1.6.0"
#define _TSMPIPE_VERSION "1.6.1"
#define ACTION_INFO 1
#define ACTION_CREATE 2
@ -32,12 +32,13 @@ extern int tsm_deletefile (dsUint32_t dsmHandle, dsmQueryType qType, qryArchiveD
extern int tsm_listfile (dsUint32_t dsmHandle, dsmQueryType qType, qryArchiveData qaData, qryBackupData qbData);
extern int tsm_restorefile(dsUint32_t dsmHandle, dsmQueryType qType, qryArchiveData qaData, qryBackupData qbData);
#ifdef USE_DIGEST
extern double tsm_sendfile (dsUint32_t dsmHandle, char *fsname, char *filename, long long length, char *description, dsmSendType sendtype, dsBool_t summary, char *digest);
extern double tsm_sendfile (dsUint32_t dsmHandle, char *fsname, char *filename, long long length, char *description, dsmSendType sendtype, dsBool_t startstop, dsBool_t summary, char *digest);
#else
extern double tsm_sendfile (dsUint32_t dsmHandle, char *fsname, char *filename, long long length, char *description, dsmSendType sendtype, dsBoot_t summary);
extern double tsm_sendfile (dsUint32_t dsmHandle, char *fsname, char *filename, long long length, char *description, dsmSendType sendtype, dsBool_t startstop, dsBoot_t summary);
#endif
extern int tsm_sessioninfo(dsUint32_t dsmHandle);
extern int tsm_updatefs(dsUint32_t dsmHandle, char *fsname, long long size);
extern int tsm_datefs(dsUint32_t dsmHandle, char *fsname, int startstop);
extern char *dsmDateToStr(dsmDate date);
extern char *dsmObjnameToStr(dsmObjName objName);