A solution can delete an ESX agency by calling the Agency.destroyAgency() method on the Agency object.
Typically, before deleting an ESX agency, a solution firsts call the EsxAgentManager.uninstall() method to put the agency in the uninstalled state. The solution tracks the progress of EsxAgentManager.uninstall() and only calls destroyAgency() to remove the ESX agency when the status of the ESX agency is green.
If your solution does not need to track the removal of the ESX agency and its ESX agents, you can call destroyAgency() without first calling uninstall(). ESX Agent Manager removes the ESX agency and all of the ESX agents without tracking the status of the uninstallation process.
Alternatively, disconnecting the solution from vCenter Server by calling the ExtensionManager.unregisterExtension() method removes all ESX agencies and ESX agents.
The EAM Sample Solution does not call the Agency.destroyAgency() method directly. The EAM Sample Solution calls the Agency.disable() and Agency.uninstall() methods to set the ESX agents in the uninstalled state, then calls ExtensionManager.unregisterExtension() to unregister the solution from vCenter Server, which removes the ESX agency and the ESX agents.
Prerequisites
-
Verify that you have set up and started the EAM Sample Solution in an application server.
-
Verify that you have opened eam_work_folder\src\com\vmware\eam\sample\solution\AgentHandler.java in an editor.
-
Verify that you have opened eam_work_folder\src\com\vmware\eam\sample\solution\Manager.java in an editor.
Procedure
Results
You defined a function to delete an ESX agency from a solution.