Delete an ESX agency

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.
  1. Call the
    Agency.disable()
    method to disable the ESX agency.
    Calling the
    Agency.disable()
    method powers off the ESX agent virtual machines, but does not undeploy them.
    Your solution can call the
    Agency.disable()
    method in the
    MyAgentHandler.java
    class.
    public void disable() throws RuntimeFaultFaultMsg { waitForSetup(); _myeamConnection.getStub().disable(_myagency); }
  2. Call the
    Agency.uninstall()
    method to put the ESX agency in the uninstalled state.
    Calling the
    Agency.uninstall()
    method uninstalls all the ESX agents in the ESX agency.
    Your solution can call the
    Agency.uninstall()
    method in the
    MyAgentHandler.java
    class.
    public void uninstall() throws RuntimeFaultFaultMsg { waitForSetup(); _myeamConnection.getStub().uninstall(_myagency); }
  3. Delete the ESX agency and ESX agents.
    Option
    Description
    Call the
    Agency.destroyAgency()
    method on the
    Agency
    object.
    Deletes the agency and its ESX agents, but the solution remains registered with
    ExtensionManager
    .
    Call the
    ExtensionManager.unregisterExtension()
    method on the
    Extension
    object.
    Unregisters the solution from
    vCenter Server
    , which uninstalls the solution and deletes the ESX agency and its ESX agents.
    Your solution can delete the ESX agency by calling the
    ExtensionManager.unregisterExtension()
    method in the
    MyManager.java
    class.
    public void cleanup() throws NotFoundFaultMsg, RuntimeFaultFaultMsg { if (_myeamConnection != null) { _myeamConnection.disconnect(); } _myvimConnection.getStub().unregisterExtension(_myvimConnection.getExtensionManager(), EXTENSION_KEY); }
You defined a function to delete an ESX agency from a solution.