From 1c87879e218bbd38ccf3d537f269a7f74c3dcbe5 Mon Sep 17 00:00:00 2001 From: abhishek Date: Mon, 30 Aug 2010 14:49:22 -0700 Subject: [PATCH] bug 4898: removing the upgrade.url param status 4898: resolved fixed --- .../cloud/agent/manager/AgentManagerImpl.java | 68 +++++++++---------- .../src/com/cloud/configuration/Config.java | 2 +- .../src/com/cloud/maint/UpgradeManager.java | 2 +- .../com/cloud/maint/UpgradeManagerImpl.java | 20 +++--- 4 files changed, 46 insertions(+), 46 deletions(-) diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java index 7bdd846d2c0..a91dfba0741 100755 --- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java +++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java @@ -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) { diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index c97749a6bc8..ae4dd16ca23 100644 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -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"), diff --git a/server/src/com/cloud/maint/UpgradeManager.java b/server/src/com/cloud/maint/UpgradeManager.java index 490a325bb5b..10fce57bd18 100644 --- a/server/src/com/cloud/maint/UpgradeManager.java +++ b/server/src/com/cloud/maint/UpgradeManager.java @@ -43,7 +43,7 @@ public interface UpgradeManager extends Manager { /** * @return the URL to download the new agent. */ - String getAgentUrl(); +// String getAgentUrl(); } diff --git a/server/src/com/cloud/maint/UpgradeManagerImpl.java b/server/src/com/cloud/maint/UpgradeManagerImpl.java index de3b2f0a5d7..06b4ddd84d2 100644 --- a/server/src/com/cloud/maint/UpgradeManagerImpl.java +++ b/server/src/com/cloud/maint/UpgradeManagerImpl.java @@ -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 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) {