Ransomware attackers specifically target and attempt to destroy backup systems to increase the probability of payment. Hardening your system is critical. Please ensure you have reviewed your platform security using the Security Hardening Checklist
Cohesity

COHESITY Documentation

Explore our documentation to get started, discover products & new features, access troubleshooting guides, register sources, platforms support.

Products
Data Security Alliance
Visit Cohesity.com
Demos
Support
Blogs
Developers
Partner Portals
Cohesity Community
© 2026 Cohesity, Inc. All Rights Reserved.
Terms of Use|
Privacy Policy|
Legal|
  1. Home
  2. Veritas NetBackup™ DataStore SDK Programmer's Guide for XBSA 1.1.0
  3. Using the NetBackup XBSA interface
  4. Creating a NetBackup XBSA application
  5. Delete - deleting an object or image
  6. Delete example
Veritas NetBackup™ DataStore SDK Programmer's Guide for XBSA 1.1.0

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);
}

Feedback

Was this page helpful?
Previous

Delete - deleting an object or image

Next

Media IDs - obtaining media IDs

Feedback

Was this page helpful?