Commvault / cvpysdk

Developer SDK - Python
https://commvault.github.io/cvpysdk/
Apache License 2.0
54 stars 41 forks source link

VMware virtual server restore not working #103

Closed pertoft closed 4 years ago

pertoft commented 4 years ago

Python 3.8.1 cvpysdk-11.20 vsphere 6.7

from cvpysdk.commcell import Commcell
import json
import pprint

commcell = Commcell('commserve', 'apiuser', 'secret')
client = commcell.clients.get('vc01.netic.dk')
agent = client.agents.get('virtual server')
instance = agent.instances.get('vmware')
backupset = instance.backupsets.get('defaultbackupset')
subclient = backupset.subclients.get('netic hosts')
job = subclient.full_vm_restore_out_of_place(
            vm_to_restore='repo01.netic.dk',
            restored_vm_name='repo01-restore-test',
            overwrite=False,
            power_on=False,
            )
print(job)
commcell.logout()

Results in error:

bash-3.2$ python3 restore_test_vm.py 
Traceback (most recent call last):
  File "restore_test_vm.py", line 33, in <module>
    job = subclient.full_vm_restore_out_of_place(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cvpysdk/subclients/virtualserver/vmware.py", line 390, in full_vm_restore_out_of_place
    vm_to_restore=self._set_vm_to_restore(vm_to_restore),
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cvpysdk/subclients/vssubclient.py", line 1784, in _set_vm_to_restore
    self._get_vm_ids_and_names_dict_from_browse()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cvpysdk/subclients/vssubclient.py", line 969, in _get_vm_ids_and_names_dict_from_browse
    self._vm_ids_browse[_vm_id] = _vm_names[_vm_id]
KeyError: 'vcmgmt02.netic.dk5vcmgmt02.netic.dk0vcmgmt02.netic.dk0vcmgmt02.netic.dk7vcmgmt02.netic.dk5vcmgmt02.netic.dk2vcmgmt02.netic.dk5vcmgmt02.netic.dk2vcmgmt02.netic.dk-vcmgmt02.netic.dkfvcmgmt02.netic.dkevcmgmt02.netic.dk9vcmgmt02.netic.dk5vcmgmt02.netic.dk-vcmgmt02.netic.dkbvcmgmt02.netic.dk5vcmgmt02.netic.dk0vcmgmt02.netic.dkevcmgmt02.netic.dk-vcmgmt02.netic.dk1vcmgmt02.netic.dk4vcmgmt02.netic.dk8vcmgmt02.netic.dkdvcmgmt02.netic.dk-vcmgmt02.netic.dkevcmgmt02.netic.dk3vcmgmt02.netic.dk4vcmgmt02.netic.dk2vcmgmt02.netic.dkbvcmgmt02.netic.dk7vcmgmt02.netic.dkavcmgmt02.netic.dk4vcmgmt02.netic.dkbvcmgmt02.netic.dkevcmgmt02.netic.dk7vcmgmt02.netic.dkbvcmgmt02.netic.dk'
bash-3.2$ 
kneerudge commented 4 years ago

We tried to reproduce it in the house but couldn't. we might have to look into commvault logs to analyse this issue. Can you please send an email to support@commvault.com

pertoft commented 4 years ago

I have already submittet a ticket - but its appears to be stuck.

Incident Update: 200806-226 | Need More Information || Commvault API support | CVLT::0229084090

pertoft commented 4 years ago

Resolved with a feature request: 103