Search in sources :

Example 6 with CleanupNetworkRulesCmd

use of com.cloud.agent.api.CleanupNetworkRulesCmd in project cloudstack by apache.

the class NotAValidCommand method testCleanupNetworkRulesCmdNullDetails.

@Test
public void testCleanupNetworkRulesCmdNullDetails() {
    final CleanupNetworkRulesCmd cleanupNets = new CleanupNetworkRulesCmd(20);
    final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
    assertNotNull(wrapper);
    when(citrixResourceBase.canBridgeFirewall()).thenReturn(false);
    final Answer answer = wrapper.execute(cleanupNets, citrixResourceBase);
    assertTrue(answer.getResult());
    assertNull(answer.getDetails());
}
Also used : RebootAnswer(com.cloud.agent.api.RebootAnswer) CreateAnswer(com.cloud.agent.api.storage.CreateAnswer) AttachAnswer(org.apache.cloudstack.storage.command.AttachAnswer) Answer(com.cloud.agent.api.Answer) CleanupNetworkRulesCmd(com.cloud.agent.api.CleanupNetworkRulesCmd) Test(org.junit.Test)

Example 7 with CleanupNetworkRulesCmd

use of com.cloud.agent.api.CleanupNetworkRulesCmd in project cloudstack by apache.

the class SecurityGroupListener method processConnect.

@Override
public void processConnect(Host host, StartupCommand cmd, boolean forRebalance) {
    if (s_logger.isInfoEnabled())
        s_logger.info("Received a host startup notification");
    if (cmd instanceof StartupRoutingCommand) {
        //if (Boolean.toString(true).equals(host.getDetail("can_bridge_firewall"))) {
        try {
            int interval = MIN_TIME_BETWEEN_CLEANUPS + _cleanupRandom.nextInt(MIN_TIME_BETWEEN_CLEANUPS / 2);
            CleanupNetworkRulesCmd cleanupCmd = new CleanupNetworkRulesCmd(interval);
            Commands c = new Commands(cleanupCmd);
            _agentMgr.send(host.getId(), c, this);
            if (s_logger.isInfoEnabled())
                s_logger.info("Scheduled network rules cleanup, interval=" + cleanupCmd.getInterval());
        } catch (AgentUnavailableException e) {
            //usually hypervisors that do not understand sec group rules.
            s_logger.debug("Unable to schedule network rules cleanup for host " + host.getId(), e);
        }
        if (_workTracker != null) {
            _workTracker.processConnect(host.getId());
        }
    }
}
Also used : AgentUnavailableException(com.cloud.exception.AgentUnavailableException) Commands(com.cloud.agent.manager.Commands) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand) CleanupNetworkRulesCmd(com.cloud.agent.api.CleanupNetworkRulesCmd)

Aggregations

CleanupNetworkRulesCmd (com.cloud.agent.api.CleanupNetworkRulesCmd)7 Answer (com.cloud.agent.api.Answer)6 RebootAnswer (com.cloud.agent.api.RebootAnswer)3 AttachAnswer (org.apache.cloudstack.storage.command.AttachAnswer)3 Test (org.junit.Test)3 AttachIsoCommand (com.cloud.agent.api.AttachIsoCommand)2 BackupSnapshotCommand (com.cloud.agent.api.BackupSnapshotCommand)2 CheckHealthCommand (com.cloud.agent.api.CheckHealthCommand)2 CheckNetworkCommand (com.cloud.agent.api.CheckNetworkCommand)2 ComputeChecksumCommand (com.cloud.agent.api.ComputeChecksumCommand)2 CreatePrivateTemplateFromSnapshotCommand (com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand)2 CreatePrivateTemplateFromVolumeCommand (com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand)2 CreateStoragePoolCommand (com.cloud.agent.api.CreateStoragePoolCommand)2 CreateVolumeFromSnapshotCommand (com.cloud.agent.api.CreateVolumeFromSnapshotCommand)2 DeleteStoragePoolCommand (com.cloud.agent.api.DeleteStoragePoolCommand)2 GetDomRVersionCmd (com.cloud.agent.api.GetDomRVersionCmd)2 GetHostStatsCommand (com.cloud.agent.api.GetHostStatsCommand)2 GetStorageStatsCommand (com.cloud.agent.api.GetStorageStatsCommand)2 GetVmStatsCommand (com.cloud.agent.api.GetVmStatsCommand)2 GetVncPortCommand (com.cloud.agent.api.GetVncPortCommand)2