Please enter search query.
Search <book_title>...
Veritas NetBackup™ DataStore SDK Programmer's Guide for XBSA 1.1.0
Last Published:
2021-01-01
Product(s):
NetBackup (9.0.0.1, 9.0)
- Introduction to NetBackup XBSA
- How to set up the SDK
- Using the NetBackup XBSA interface
- NetBackup XBSA data structures
- NetBackup XBSA environment
- XBSA sessions and transactions
- Creating a NetBackup XBSA application
- How to build an XBSA application
- How to run a NetBackup XBSA application
- API reference
- Function calls
- Function specifications
- Type definitions
- Process flow and troubleshooting
- How to use the sample files
- Support and updates
- Appendix A. Register authorized locations
Delete example
This delete example is very simple. It assumes that the copyId has been populated from a previous query or from information stored by the XBSA application. It then deletes one object and commits the transaction that does the delete of the object. In another transaction, an entire image is deleted.
BSA_Handle BsaHandle; BSA_ObjectOwner BsaObjectOwner; BSA_SecurityToken *security_tokenPtr; BSA_ObjectDescriptor *object_desc; BSA_ObjectDescriptor *object_desc2; BSA_QueryDescriptor *query_desc; BSA_UInt32 Size; char *envx[3]; char ErrorString[512]; char msg[1024]; int status; . . BSAInit(&BsaHandle, security_tokenPtr, &BsaObjectOwner, envx); . . BSABeginTxn(BsaHandle); / * Delete the object from NetBackup. */ status = BSADeleteObject(BsaHandle, object_desc->copyId); if (status != BSA_RC_SUCCESS) { Size = 512; NBBSAGetErrorString(status, &Size, ErrorString); sprintf(msg, "ERROR: BSADeleteObject() failed with error: %s", ErrorString); NBBSALogMsg(BsaHandle, MSERROR, msg, "Delete"); BSAEndTxn(BsaHandle, BSA_Vote_ABORT); BSATerminate(BsaHandle); exit(status); } / * End the delete transaction, commit will delete the object */ status = BSAEndTxn(BsaHandle, BSA_Vote_COMMIT); if (status != BSA_RC_SUCCESS) { Size = 512; NBBSAGetErrorString(status, &Size, ErrorString); sprintf(msg, "ERROR: BSAEndTxn() failed with error: %s", ErrorString); NBBSALogMsg(BsaHandle, MSERROR, msg, "Delete"); BSATerminate(BsaHandle); exit(status); } BSABeginTxn(BsaHandle); /* Delete an image from NetBackup. It may contain multiple objects. */ status = NBBSADeleteImage(BsaHandle, object_desc2->copyId); if (status != BSA_RC_SUCCESS) { Size = 512; NBBSAGetErrorString(statuGetSs, &Size, ErrorString); sprintf(msg, "ERROR: NBBSADeleteImage() failed with error: %s", ErrorString); NBBSALogMsg(BsaHandle, MSERROR, msg, "Delete Image"); BSAEndTxn(BsaHandle, BSA_Vote_ABORT); BSATerminate(BsaHandle); exit(status); } /* The deletion of the image has occurred during the NBBSADeleteImage() call */ status = BSAEndTxn(BsaHandle, BSA_Vote_COMMIT); if (status != BSA_RC_SUCCESS) { Size = 512; NBBSAGetErrorString(status, &Size, ErrorString); sprintf(msg, "ERROR: BSAEndTxn() failed with error: %s", ErrorString); NBBSALogMsg(BsaHandle, MSERROR, msg, "Delete Image"); BSATerminate(BsaHandle); exit(status); }