Need a reliable way to consult Morpheus and figure out of the instance is still a legit instance that has an id tying it to vCenter. Or more simply, we need a reliable way to determine if a VM has been removed in vCenter (making it an orphan in Morpheus).
I have used the pyMorpheus API, to develop some administration tools. One tool called orphans.py, is supposed to loop through instances in Morpheus, and check the state/status fields of the instance (it also checks the fields in the server objects tied to the instance). If the instance is believed to be gone, the user gets to manually decide whether to delete that instance. What is happening right now, is that even if the VM is deleted in vCenter, the status and state fields do not seem to be setting correctly in the json of the instance/server objects such that I can reliably tell if it is gone from vCenter. I would rather not have to make API calls to both Morpheus and vCenter and do a reconciliation. So I am proposing that we set a state or status field to “missing” in the instance (or server if that is a better way to go), so that we can have something more reliable. Maybe we can even color code something on the Instances page accordingly. Really, I think this might be a defect, but was told to introduce this into Ideas by the Support Team. I looked into VRA (we have another side of the house who uses VRA), and asked them if and how they knew whether a VM has had its rug pulled out in vCenter, and they told me that VRA uses a field and populates the value as “missing”. For what that’s worth. Maybe we can do something consistent to that.
Launch a VM with Morpheus. Go into vCenter and clone the VM. The VM will show as Discovered in Infrastructure->VMs. Convert it to Managed. Then, delete the instance in vCenter. Morpheus will continue to show the instance as though it is still alive. If, on the next sync, we did not find the instance - meaning no VM with that ID found - we set a field to “missing”, we could reliably use API tools to go in and remove those instances on some kind of a basis. I know that removing instances sounds dangerous, but, we have a process where people are provisioning using external provisioners, and then we convert them to managed. And when they pull the VMs down and redeploy, we are stuck with 120+ orphan instances sitting in Morpheus that we need to use the GUI to remove. Hence the need for this field and related API automation.