Question

SDK Pyhton : Backup Vm(indexV2) using VMGuid

  • 24 January 2023
  • 3 replies
  • 33 views

Badge +1

Hi,

I'm trying to save a Vm in V2 indexing by the VmGuid. I can't find a samples.The only article is the one :

Samples for the Developer SDK for Python (commvault.com)

Can you Help me please ?

Thanks

 


3 replies

Userlevel 7
Badge +18

I’m not sure about python but here is the RESTAPI to do so:

https://api.commvault.com/#d91d27ea-81af-43c9-969b-a035a0f840f8

On the outset it does not appear that the python SDK has a documented equivalent. Let me check internally and see if I can find out.

Userlevel 7
Badge +18

Unfortunately it seems the pythonSDK does not have an option to specify by vmGuid that I can find. If you are OK with VM name you can use this code - but the VM would have had to had a previous back to exist in the database. This targets the VM as a client (possibly only with V2):

from cvpysdk.commcell import Commcell

commcell = Commcell('CSHostname', 'admin', '********')
client = commcell.clients.get('Ubuntu14')
agent = client.agents.get('Virtual Server')
backupset = agent.backupsets.get('defaultBackupSet')
subclient = backupset.subclients.get('default')

subclient.backup(backup_level='Incremental')

commcell.logout()

)

 

Badge +1

Hi,

Thanks for your reply :)

if I want to save only one Vm that is included in a subclient of multiple Vms.Will it work ? 

 

Reply