agent: Remove the UpgradeCommand and Answer

This isn't used and handled by the DEB and RPM packaging.
This commit is contained in:
Wido den Hollander 2013-07-12 14:22:07 +02:00
parent aaaf168f5a
commit b9972e587c
3 changed files with 0 additions and 92 deletions

View File

@ -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();
}

View File

@ -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);
}
}

View File

@ -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;
}
}