Solved

API to restart backup just for failed VM's

  • 2 August 2021
  • 6 replies
  • 224 views

Userlevel 1
Badge +1

Hi,

 

maybe someone from the community also needed to automatically restart “Completed with errors” VM job only for failed vm’s? There is an option from GUI, but it would be much easier to restart it using api or wokflow. If someone found an option to do that it would be great if yu could share it!

 

Thank you!

icon

Best answer by Yash 3 August 2021, 15:53

View original

6 replies

Userlevel 7
Badge +21

Hey @ziv !  We just had a similar question posted though that was a search for the graphical option.

I’ll ask internally if anyone has an API based version.  In the meantime, I moved this to our Best Practices section to get our community members to advise!

Userlevel 3
Badge +4

@ziv Where do you see the GUI option to restart for “Completed with Errors”? Are you referring to “Number of resubmits on job failure” under Job Retry of Advanced Backup Options? 

One option is to create a VM Data Protection Job Management alert with desired alert criteria of “Job Succeeded with Errors” and trigger a workflow by sending job id as the input to the workflow and run this below api as part of the workflow.

https://api.commvault.com/#d863efee-8317-4ae5-9372-794ca2eadfba

 

Userlevel 1
Badge +1

Hi,

 

Thanks for replying! 

By “Completed with errors” job state i meant to say that you only have few failed vm’s and you don’t need to resubmit whole subclient. Then the advanced options in the gui can be used to restart it only for failed vm’s. I saw the api to resubmit the job before, but it seem to be for the whole subclient. That’s why i wanted to ask if someone from the community also needed to use it for “advanced options”.

The option in this api i am looking for is to run it only for failed vm’s, same “advanced backup options” as in gui here:

 Do you know if it’s possible and how to use it? Maybe additional xml is needed?

Userlevel 3
Badge +4

Hi @ziv , Yes, It’s possible to trigger this via api.

Here are the options:

XML:

          <vsaBackupOptions>
            <backupFailedVMsOnly>true</backupFailedVMsOnly>
            <backupCWEVMsWithFailedVMs>true</backupCWEVMsWithFailedVMs>
          </vsaBackupOptions>

 

JSON:

                        "vsaBackupOptions": {

                            "backupCWEVMsWithFailedVMs": true,

                            "backupFailedVMsOnly": true

                        }

 

If you’d like to get the complete XML, You could select the options from GUI and save the XML using “Save As Script” option. Then you could call POST CreateTask API to trigger the job. https://documentation.commvault.com/11.24/essential/45783_rest_api_post_create_task_backup_01.html

 

Note: If you’d like to call the above API using JSON payload, you could convert the obtained xml to json using this api: https://api.commvault.com/#fe2fa795-dd7c-4416-857d-75704b52be8c

Badge +2

Hi,

 

Thanks for replying! 

By “Completed with errors” job state i meant to say that you only have few failed vm’s and you don’t need to resubmit whole subclient. Then the advanced options in the gui can be used to restart it only for failed vm’s. I saw the api to resubmit the job before, but it seem to be for the whole subclient. That’s why i wanted to ask if someone from the community also needed to use it for “advanced options”.

The option in this api i am looking for is to run it only for failed vm’s, same “advanced backup options” as in gui here:

 Do you know if it’s possible and how to use it? Maybe additional xml is needed?

 

Hey, @ziv  great you asked exactly the question I had and was looking for an answer ;-) Thanks @Yash for details and XML. Would be nice to have in a future release the possibility in the retry options for VSA Backup to set exactly this for “Completed with errors” would be very helpful.

Userlevel 1
Badge +1

Hi,

 

Thank you @Yash for the suggestion, i’ll definetily try this! and i think this was exactly what i was looking for. I’m glad my question was also usefull for more people in the community :)

Reply