bug 4898: removing the upgrade.url param

status 4898: resolved fixed
This commit is contained in:
abhishek 2010-08-30 14:49:22 -07:00
parent 992458e9d0
commit 1c87879e21
4 changed files with 46 additions and 46 deletions

View File

@ -1785,28 +1785,28 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
}
}
protected void upgradeAgent(final Link link, final byte[] request, final String reason) {
if (reason == UnsupportedVersionException.IncompatibleVersion) {
final UpgradeResponse response = new UpgradeResponse(request, _upgradeMgr.getAgentUrl());
try {
s_logger.info("Asking for the agent to update due to incompatible version: " + response.toString());
link.send(response.toBytes());
} catch (final ClosedChannelException e) {
s_logger.warn("Unable to send response due to connection closed: " + response.toString());
}
return;
}
assert (reason == UnsupportedVersionException.UnknownVersion) : "Unknown reason: " + reason;
final UpgradeResponse response = new UpgradeResponse(request, _upgradeMgr.getAgentUrl());
try {
s_logger.info("Asking for the agent to update due to unknown version: " + response.toString());
link.send(response.toBytes());
} catch (final ClosedChannelException e) {
s_logger.warn("Unable to send response due to connection closed: " + response.toString());
}
}
// protected void upgradeAgent(final Link link, final byte[] request, final String reason) {
//
// if (reason == UnsupportedVersionException.IncompatibleVersion) {
// final UpgradeResponse response = new UpgradeResponse(request, _upgradeMgr.getAgentUrl());
// try {
// s_logger.info("Asking for the agent to update due to incompatible version: " + response.toString());
// link.send(response.toBytes());
// } catch (final ClosedChannelException e) {
// s_logger.warn("Unable to send response due to connection closed: " + response.toString());
// }
// return;
// }
//
// assert (reason == UnsupportedVersionException.UnknownVersion) : "Unknown reason: " + reason;
// final UpgradeResponse response = new UpgradeResponse(request, _upgradeMgr.getAgentUrl());
// try {
// s_logger.info("Asking for the agent to update due to unknown version: " + response.toString());
// link.send(response.toBytes());
// } catch (final ClosedChannelException e) {
// s_logger.warn("Unable to send response due to connection closed: " + response.toString());
// }
// }
protected class SimulateStartTask implements Runnable {
ServerResource resource;
@ -1857,17 +1857,17 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
return;
}
StartupCommand startup = (StartupCommand) cmd;
if ((_upgradeMgr.registerForUpgrade(-1, startup.getVersion()) == UpgradeManager.State.RequiresUpdate) && (_upgradeMgr.getAgentUrl() != null)) {
final UpgradeCommand upgrade = new UpgradeCommand(_upgradeMgr.getAgentUrl());
final Request req = new Request(1, -1, -1, new Command[] { upgrade }, true, true);
s_logger.info("Agent requires upgrade: " + req.toString());
try {
link.send(req.toBytes());
} catch (ClosedChannelException e) {
s_logger.warn("Unable to tell agent it should update.");
}
return;
}
// if ((_upgradeMgr.registerForUpgrade(-1, startup.getVersion()) == UpgradeManager.State.RequiresUpdate) && (_upgradeMgr.getAgentUrl() != null)) {
// final UpgradeCommand upgrade = new UpgradeCommand(_upgradeMgr.getAgentUrl());
// final Request req = new Request(1, -1, -1, new Command[] { upgrade }, true, true);
// s_logger.info("Agent requires upgrade: " + req.toString());
// try {
// link.send(req.toBytes());
// } catch (ClosedChannelException e) {
// s_logger.warn("Unable to tell agent it should update.");
// }
// return;
// }
try {
StartupCommand[] startups = new StartupCommand[cmds.length];
for (int i = 0; i < cmds.length; i++)
@ -2036,7 +2036,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
}
} catch (final UnsupportedVersionException e) {
s_logger.warn(e.getMessage());
upgradeAgent(task.getLink(), data, e.getReason());
//upgradeAgent(task.getLink(), data, e.getReason());
}
} else if (type == Task.Type.CONNECT) {
} else if (type == Task.Type.DISCONNECT) {

View File

@ -126,7 +126,7 @@ public enum Config {
Wait("Advanced", AgentManager.class, Integer.class, "wait", "1800", "Time to wait for control commands to return", null),
Workers("Advanced", AgentManager.class, Integer.class, "workers", "5", "Number of worker threads.", null),
MountParent("Advanced", ManagementServer.class, String.class, "mount.parent", "/var/lib/cloud/mnt", "The mount point on the Management Server for Secondary Storage.", null),
UpgradeURL("Advanced", ManagementServer.class, String.class, "upgrade.url", "http://example.com:8080/client/agent/update.zip", "The upgrade URL is the URL of the management server that agents will connect to in order to automatically upgrade.", null),
// UpgradeURL("Advanced", ManagementServer.class, String.class, "upgrade.url", "http://example.com:8080/client/agent/update.zip", "The upgrade URL is the URL of the management server that agents will connect to in order to automatically upgrade.", null),
SystemVMUseLocalStorage("Advanced", ManagementServer.class, Boolean.class, "system.vm.use.local.storage", "false", "Indicates whether to use local storage pools or shared storage pools for system VMs.", null),
CPUOverprovisioningFactor("Advanced", ManagementServer.class, String.class, "cpu.overprovisioning.factor", "1", "Used for CPU overprovisioning calculation; available CPU will be (actualCpuCapacity * cpu.overprovisioning.factor)", null),
NetworkType("Advanced", ManagementServer.class, String.class, "network.type", "vlan", "The type of network that this deployment will use.", "vlan,direct"),

View File

@ -43,7 +43,7 @@ public interface UpgradeManager extends Manager {
/**
* @return the URL to download the new agent.
*/
String getAgentUrl();
// String getAgentUrl();
}

View File

@ -59,7 +59,7 @@ public class UpgradeManagerImpl implements UpgradeManager {
String _name;
String _minimalVersion;
String _recommendedVersion;
String _upgradeUrl;
// String _upgradeUrl;
String _agentPath;
long _checkInterval;
@ -137,10 +137,10 @@ public class UpgradeManagerImpl implements UpgradeManager {
return "File will be deployed.";
}
@Override
public String getAgentUrl() {
return _upgradeUrl;
}
// @Override
// public String getAgentUrl() {
// return _upgradeUrl;
// }
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
@ -177,12 +177,12 @@ public class UpgradeManagerImpl implements UpgradeManager {
_recommendedVersion = _minimalVersion;
}
_upgradeUrl = configs.get("upgrade.url");
//_upgradeUrl = configs.get("upgrade.url");
if (_upgradeUrl == null) {
s_logger.debug("There is no upgrade url found in configuration table");
// _upgradeUrl = "http://updates.vmops.com/releases/rss.xml";
}
// if (_upgradeUrl == null) {
// s_logger.debug("There is no upgrade url found in configuration table");
// // _upgradeUrl = "http://updates.vmops.com/releases/rss.xml";
// }
return true;
} catch (IOException ex) {