bseltz-cohesity / scripts

Cohesity REST API examples in PowerShell and Python
Apache License 2.0
100 stars 40 forks source link

recoverVMs.py not working #179

Open ltfrebac opened 22 hours ago

ltfrebac commented 22 hours ago

Trying to recover VMs both with ps1 and .py script. A simple restore works ok, however, when trying to select datastore, networkname, folder it kinds of ignores those. Runs 7.1.2 version of cohesity

Example

PS /home/frudd> ./recoverVMs.ps1 -vip 172.24.50.12 -username restore-test -datastoreName 'Powerstore-04' -foldername 'Sandbox' -networkName 'Backup-SANDBOXVLAN' -detachNetwork -prefix RESTORETEST2- -vmName MGMT02 Connected! Ready to restore: RESTORETEST2-MGMT02 Are you sure? Yes(No): Yes restoring RESTORETEST2-MGMT02

bseltz-cohesity commented 21 hours ago

To restore to an alternate location, just like in the UI, you must specify the vCenter name (-vc, --vcentername) that tells the script to use the other location/configuration parameters.

ltfrebac commented 21 hours ago

I tried that one also, however, when being more specific this pops out frudd@mgmt03:~$ python3 recoverVMs.py -v 172.24.50.12 -u restore-test -vc vc01.acme.se -vh ACME-Cluster01 -dc ACME-Datacenter -s Powerstore-04 -n Backup-SANDBOXVLAN -x -pre rst-test -vm MGMT02 Connected! folder vm not found

ltfrebac commented 21 hours ago

I see when doing this in GUI the parameter "Resources" is required. No such parameter in python script to use though

bseltz-cohesity commented 21 hours ago

The README provides an example: https://github.com/cohesity/community-automation-samples/tree/main/python/recoverVMs

./recoverVMs.py -v mycluster \
                -u myusername \
                -d mydomain.net \
                -vm myvm1 \
                -vc myVcenter.mydomain.net \
                -dc mydatacenter \
                -vh myHAcluster \
                -f someFolder \
                -n 'vm network' \
                -p
bseltz-cohesity commented 21 hours ago

The README also contains notes about specifying a folder: https://github.com/cohesity/community-automation-samples/tree/main/python/recoverVMs#specifying-a-folder

ltfrebac commented 20 hours ago

Read that back and forth. Tried what i think is every way of presenting the path to my sandbox folder and it always comes up with not found.

ltfrebac commented 20 hours ago

Sorry, it has come to my attention that the user given to me has limited access to certain objects in Cohesity cluster. Will investigate further