I am using the Morpheus API, using the pyMorpheus Python API wrapper. I am trying to convert a bunch of VMs to managed en masse, so that I don’t have to manually add 60+ VMs that are being provisioned into vCenter by an external vendor’s provisioning system.
The code to make the VM managed is working, but I need to be able to set the Instance Type, the Layout, Plan, etc. which is not working. So the VMs are coming in as vCenter VMs, when I want/need them to be Perimeta Metaswitch VMs (I have already added that Instance Type, Layout, etc).
The inability I am having to pull this off, I am unsure if this is an API limitation or defect or if there is something I am not doing correctly in the API.
Here is an example of what I am doing in the API:
options = [('name', 'Morpheus-Migrate-Test-VM9')]
results = morpheus.call("get", "instances", options=options)
pprint.pprint("GET INSTANCE RESULTS")
pprint.pprint(results)
pprint.pprint("Updating Instance")
for instance in results['instances']:
instnc = {
"instance": {
"id": instance["id"],
"group": {
"id": 1,
},
"instanceType": {
"id": 114,
"code": "FORTIMANAGER",
"category": "network",
"name": "Fortinet FortiManager"
},
"layout": {
"id": 1402,
"name": "Fortinet FortiManager Std Layout",
"provisionTypeId": 6,
"provisionTypeCode": "vmware"
}
}
}
jinst = json.dumps(instnc)
append = "instances" + "/" + str(instance["id"])
options = []
results = morpheus.call("put", append, options=options, jsonpayload=jinst)
pprint.pprint("PUT INSTANCES RESULTS")
pprint.pprint(results)