diff --git a/agent/src/com/cloud/agent/Agent.java b/agent/src/com/cloud/agent/Agent.java index 84b0db62684..28d04709d34 100755 --- a/agent/src/com/cloud/agent/Agent.java +++ b/agent/src/com/cloud/agent/Agent.java @@ -51,8 +51,6 @@ import com.cloud.agent.api.ReadyCommand; import com.cloud.agent.api.ShutdownCommand; import com.cloud.agent.api.StartupAnswer; import com.cloud.agent.api.StartupCommand; -import com.cloud.agent.api.UpgradeAnswer; -import com.cloud.agent.api.UpgradeCommand; import com.cloud.agent.transport.Request; import com.cloud.agent.transport.Response; import com.cloud.exception.AgentControlChannelException; @@ -482,9 +480,6 @@ public class Agent implements HandlerFactory, IAgentControl { final CronCommand watch = (CronCommand) cmd; scheduleWatch(link, request, watch.getInterval() * 1000, watch.getInterval() * 1000); answer = new Answer(cmd, true, null); - } else if (cmd instanceof UpgradeCommand) { - final UpgradeCommand upgrade = (UpgradeCommand) cmd; - answer = upgradeAgent(upgrade.getUpgradeUrl(), upgrade); } else if (cmd instanceof ShutdownCommand) { ShutdownCommand shutdown = (ShutdownCommand) cmd; s_logger.debug("Received shutdownCommand, due to: " + shutdown.getReason()); @@ -649,25 +644,6 @@ public class Agent implements HandlerFactory, IAgentControl { } } - protected UpgradeAnswer upgradeAgent(final String url, final UpgradeCommand cmd) { - try { - upgradeAgent(url, cmd == null); - return null; - } catch (final Exception e) { - s_logger.error("Unable to run this agent because we couldn't complete the upgrade process.", e); - if (cmd != null) { - final StringWriter writer = new StringWriter(); - writer.append(e.getMessage()); - writer.append("===>Stack<==="); - e.printStackTrace(new PrintWriter(writer)); - return new UpgradeAnswer(cmd, writer.toString()); - } - - System.exit(3); - return null; - } - } - public synchronized void setLastPingResponseTime() { _lastPingResponseTime = System.currentTimeMillis(); } diff --git a/core/src/com/cloud/agent/api/UpgradeAnswer.java b/core/src/com/cloud/agent/api/UpgradeAnswer.java deleted file mode 100644 index 00b0f25b050..00000000000 --- a/core/src/com/cloud/agent/api/UpgradeAnswer.java +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.agent.api; - -public class UpgradeAnswer extends Answer { - protected UpgradeAnswer() { - } - - public UpgradeAnswer(UpgradeCommand cmd, String failure) { - super(cmd, false, failure); - } -} diff --git a/core/src/com/cloud/agent/api/UpgradeCommand.java b/core/src/com/cloud/agent/api/UpgradeCommand.java deleted file mode 100644 index 0e1b6d2e7c4..00000000000 --- a/core/src/com/cloud/agent/api/UpgradeCommand.java +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.agent.api; - -/** - * UpgradeCommand is sent when the agent should update. - */ -public class UpgradeCommand extends Command { - - String url; - - protected UpgradeCommand() { - } - - public UpgradeCommand(String url) { - this.url = url; - } - - public String getUpgradeUrl() { - return url; - } - - @Override - public boolean executeInSequence() { - return true; - } - -}