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
■
|
Download the vSphere ESX Agent Manager SDK.
|
■
|
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
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.
The EAM Sample
Solution calls the
Agency.disable() method
in the
AgentHandler.java
class.
public void disable() throws RuntimeFaultFaultMsg {
waitForSetup();
_eamConnection.getStub().disable(_agency);
}
|
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.
The EAM Sample
Solution calls the
Agency.uninstall()
method in the
AgentHandler.java
class.
public void uninstall() throws RuntimeFaultFaultMsg {
waitForSetup();
_eamConnection.getStub().uninstall(_agency);
}
|
3 | Delete the ESX agency
and ESX agents.
|
|
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.
|
The EAM Sample
Solution deletes the ESX agency by calling the
ExtensionManager.unregisterExtension()
method in the
Manager.java class.
public void cleanup() throws NotFoundFaultMsg, RuntimeFaultFaultMsg {
if (_eamConnection != null) {
_eamConnection.disconnect();
}
_vimConnection.getStub().unregisterExtension(_vimConnection.getExtensionManager(),
EXTENSION_KEY);
}
|
You defined a function to
delete an ESX agency from a solution.