You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by an...@apache.org on 2014/05/01 20:45:56 UTC
git commit: updated refs/heads/master to b3491bc
Repository: cloudstack
Updated Branches:
refs/heads/master 537536835 -> b3491bcba
removed unused command ClusterSyncCommand
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b3491bcb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b3491bcb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b3491bcb
Branch: refs/heads/master
Commit: b3491bcbac9bbd0e20999a0983bca69dab5daf0b
Parents: 5375368
Author: Anthony Xu <an...@citrix.com>
Authored: Thu May 1 11:45:19 2014 -0700
Committer: Anthony Xu <an...@citrix.com>
Committed: Thu May 1 11:45:19 2014 -0700
----------------------------------------------------------------------
.../com/cloud/agent/api/ClusterSyncAnswer.java | 54 -------------------
.../com/cloud/agent/api/ClusterSyncCommand.java | 46 ----------------
.../com/cloud/agent/manager/AgentAttache.java | 3 +-
.../com/cloud/vm/VirtualMachineManagerImpl.java | 55 +-------------------
.../agent/manager/SimulatorManagerImpl.java | 3 --
.../xen/resource/CitrixResourceBase.java | 25 ---------
.../xenserver/XenServerResourceNewBase.java | 13 -----
7 files changed, 2 insertions(+), 197 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3491bcb/core/src/com/cloud/agent/api/ClusterSyncAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ClusterSyncAnswer.java b/core/src/com/cloud/agent/api/ClusterSyncAnswer.java
deleted file mode 100644
index 7b8a525..0000000
--- a/core/src/com/cloud/agent/api/ClusterSyncAnswer.java
+++ /dev/null
@@ -1,54 +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;
-
-import java.util.HashMap;
-
-import com.cloud.utils.Pair;
-import com.cloud.vm.VirtualMachine.State;
-
-public class ClusterSyncAnswer extends Answer {
- private long _clusterId;
- private HashMap<String, Pair<String, State>> _newStates;
- private boolean _isExecuted = false;
-
- // this is here because a cron command answer is being sent twice
- // AgentAttache.processAnswers
- // AgentManagerImpl.notifyAnswersToMonitors
- public boolean isExecuted() {
- return _isExecuted;
- }
-
- public void setExecuted() {
- _isExecuted = true;
- }
-
- public ClusterSyncAnswer(long clusterId, HashMap<String, Pair<String, State>> newStates) {
- _clusterId = clusterId;
- _newStates = newStates;
- result = true;
- }
-
- public long getClusterId() {
- return _clusterId;
- }
-
- public HashMap<String, Pair<String, State>> getNewStates() {
- return _newStates;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3491bcb/core/src/com/cloud/agent/api/ClusterSyncCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ClusterSyncCommand.java b/core/src/com/cloud/agent/api/ClusterSyncCommand.java
deleted file mode 100644
index 6a27491..0000000
--- a/core/src/com/cloud/agent/api/ClusterSyncCommand.java
+++ /dev/null
@@ -1,46 +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 ClusterSyncCommand extends Command implements CronCommand {
- int _interval;
-
- long _clusterId;
-
- public ClusterSyncCommand() {
- }
-
- public ClusterSyncCommand(int interval, long clusterId) {
- _interval = interval;
- _clusterId = clusterId;
- }
-
- @Override
- public int getInterval() {
- return _interval;
- }
-
- public long getClusterId() {
- return _clusterId;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3491bcb/engine/orchestration/src/com/cloud/agent/manager/AgentAttache.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/agent/manager/AgentAttache.java b/engine/orchestration/src/com/cloud/agent/manager/AgentAttache.java
index fd1531e..ebf9366 100755
--- a/engine/orchestration/src/com/cloud/agent/manager/AgentAttache.java
+++ b/engine/orchestration/src/com/cloud/agent/manager/AgentAttache.java
@@ -41,7 +41,6 @@ import com.cloud.agent.api.CheckHealthCommand;
import com.cloud.agent.api.CheckNetworkCommand;
import com.cloud.agent.api.CheckVirtualMachineCommand;
import com.cloud.agent.api.CleanupNetworkRulesCmd;
-import com.cloud.agent.api.ClusterSyncCommand;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.MaintainCommand;
import com.cloud.agent.api.MigrateCommand;
@@ -113,7 +112,7 @@ public abstract class AgentAttache {
public final static String[] s_commandsAllowedInMaintenanceMode = new String[] {MaintainCommand.class.toString(), MigrateCommand.class.toString(),
StopCommand.class.toString(), CheckVirtualMachineCommand.class.toString(), PingTestCommand.class.toString(), CheckHealthCommand.class.toString(),
- ReadyCommand.class.toString(), ShutdownCommand.class.toString(), SetupCommand.class.toString(), ClusterSyncCommand.class.toString(),
+ ReadyCommand.class.toString(), ShutdownCommand.class.toString(), SetupCommand.class.toString(),
CleanupNetworkRulesCmd.class.toString(), CheckNetworkCommand.class.toString(), PvlanSetupCommand.class.toString()};
protected final static String[] s_commandsNotAllowedInConnectingMode = new String[] {StartCommand.class.toString(), CreateCommand.class.toString()};
static {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3491bcb/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index b797875..e15d287 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -77,8 +77,6 @@ import com.cloud.agent.api.AgentControlCommand;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.CheckVirtualMachineAnswer;
import com.cloud.agent.api.CheckVirtualMachineCommand;
-import com.cloud.agent.api.ClusterSyncAnswer;
-import com.cloud.agent.api.ClusterSyncCommand;
import com.cloud.agent.api.ClusterVMMetaDataSyncAnswer;
import com.cloud.agent.api.ClusterVMMetaDataSyncCommand;
import com.cloud.agent.api.Command;
@@ -2602,41 +2600,6 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
}
}
- public void deltaSync(Map<String, Pair<String, State>> newStates) {
- Map<Long, AgentVmInfo> states = convertToInfos(newStates);
-
- for (Map.Entry<Long, AgentVmInfo> entry : states.entrySet()) {
- AgentVmInfo info = entry.getValue();
- VMInstanceVO vm = info.vm;
- Command command = null;
- if (vm != null) {
- Host host = _resourceMgr.findHostByGuid(info.getHostUuid());
- long hId = host.getId();
-
- HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vm.getHypervisorType());
- command = compareState(hId, vm, info, false, hvGuru.trackVmHostChange());
- } else {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Cleaning up a VM that is no longer found <deltaSync>: " + info.name);
- }
- command = cleanup(info.name);
- }
- if (command != null) {
- try {
- Host host = _resourceMgr.findHostByGuid(info.getHostUuid());
- if (host != null) {
- Answer answer = _agentMgr.send(host.getId(), cleanup(info.name));
- if (!answer.getResult()) {
- s_logger.warn("Unable to stop a VM due to " + answer.getDetails());
- }
- }
- } catch (Exception e) {
- s_logger.warn("Unable to stop a VM due to " + e.getMessage());
- }
- }
- }
- }
-
public void fullSync(final long clusterId, Map<String, Pair<String, State>> newStates) {
if (newStates == null)
return;
@@ -3077,15 +3040,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
@Override
public boolean processAnswers(long agentId, long seq, Answer[] answers) {
for (final Answer answer : answers) {
- if (answer instanceof ClusterSyncAnswer) {
- if (!VmJobEnabled.value()) {
- ClusterSyncAnswer hs = (ClusterSyncAnswer)answer;
- if (!hs.isExecuted()) {
- deltaSync(hs.getNewStates());
- hs.setExecuted();
- }
- }
- } else if ( answer instanceof ClusterVMMetaDataSyncAnswer) {
+ if ( answer instanceof ClusterVMMetaDataSyncAnswer) {
ClusterVMMetaDataSyncAnswer cvms = (ClusterVMMetaDataSyncAnswer)answer;
if (!cvms.isExecuted()) {
syncVMMetaData(cvms.getVMMetaDatum());
@@ -3182,14 +3137,6 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
if (allStates != null) {
fullSync(clusterId, allStates);
}
- // initiate the cron job
- ClusterSyncCommand syncCmd = new ClusterSyncCommand(ClusterDeltaSyncInterval.value(), clusterId);
- try {
- long seq_no = _agentMgr.send(agentId, new Commands(syncCmd), this);
- s_logger.debug("Cluster VM sync started with jobid " + seq_no);
- } catch (AgentUnavailableException e) {
- s_logger.fatal("The Cluster VM sync process failed for cluster id " + clusterId + " with ", e);
- }
}
// initiate the cron job
ClusterVMMetaDataSyncCommand syncVMMetaDataCmd = new ClusterVMMetaDataSyncCommand(ClusterVMMetaDataSyncInterval.value(), clusterId);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3491bcb/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
index 3bc689e..321f06f 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
@@ -46,7 +46,6 @@ import com.cloud.agent.api.CheckRouterCommand;
import com.cloud.agent.api.CheckS2SVpnConnectionsCommand;
import com.cloud.agent.api.CheckVirtualMachineCommand;
import com.cloud.agent.api.CleanupNetworkRulesCmd;
-import com.cloud.agent.api.ClusterSyncCommand;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.ComputeChecksumCommand;
import com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand;
@@ -373,8 +372,6 @@ public class SimulatorManagerImpl extends ManagerBase implements SimulatorManage
answer = _mockVmMgr.bumpPriority((BumpUpPriorityCommand)cmd);
} else if (cmd instanceof GetDomRVersionCmd) {
answer = _mockVmMgr.getDomRVersion((GetDomRVersionCmd)cmd);
- } else if (cmd instanceof ClusterSyncCommand) {
- answer = new Answer(cmd);
} else if (cmd instanceof CopyVolumeCommand) {
answer = _mockStorageMgr.CopyVolume((CopyVolumeCommand)cmd);
} else if (cmd instanceof PlugNicCommand) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3491bcb/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 6ba7fae..e3fbe2e 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -30,8 +30,6 @@ import com.cloud.agent.api.CheckOnHostCommand;
import com.cloud.agent.api.CheckVirtualMachineAnswer;
import com.cloud.agent.api.CheckVirtualMachineCommand;
import com.cloud.agent.api.CleanupNetworkRulesCmd;
-import com.cloud.agent.api.ClusterSyncAnswer;
-import com.cloud.agent.api.ClusterSyncCommand;
import com.cloud.agent.api.ClusterVMMetaDataSyncAnswer;
import com.cloud.agent.api.ClusterVMMetaDataSyncCommand;
import com.cloud.agent.api.Command;
@@ -528,8 +526,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
return execute((OvsDestroyTunnelCommand)cmd);
} else if (clazz == UpdateHostPasswordCommand.class) {
return execute((UpdateHostPasswordCommand)cmd);
- } else if (cmd instanceof ClusterSyncCommand) {
- return execute((ClusterSyncCommand)cmd);
} else if (cmd instanceof ClusterVMMetaDataSyncCommand) {
return execute((ClusterVMMetaDataSyncCommand)cmd);
} else if (clazz == CheckNetworkCommand.class) {
@@ -7173,27 +7169,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
return new Answer(cmd, success, "");
}
- protected Answer execute(final ClusterSyncCommand cmd) {
- Connection conn = getConnection();
- //check if this is master
- Pool pool;
- try {
- pool = Pool.getByUuid(conn, _host.pool);
- Pool.Record poolr = pool.getRecord(conn);
-
- Host.Record hostr = poolr.master.getRecord(conn);
- if (!_host.uuid.equals(hostr.uuid)) {
- return new Answer(cmd);
- }
- } catch (Throwable e) {
- s_logger.warn("Check for master failed, failing the Cluster sync command");
- return new Answer(cmd);
- }
- HashMap<String, Pair<String, State>> newStates = deltaClusterSync(conn);
- return new ClusterSyncAnswer(cmd.getClusterId(), newStates);
- }
-
-
protected ClusterVMMetaDataSyncAnswer execute(final ClusterVMMetaDataSyncCommand cmd) {
Connection conn = getConnection();
//check if this is master
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3491bcb/plugins/hypervisors/xen/src/org/apache/cloudstack/hypervisor/xenserver/XenServerResourceNewBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/org/apache/cloudstack/hypervisor/xenserver/XenServerResourceNewBase.java b/plugins/hypervisors/xen/src/org/apache/cloudstack/hypervisor/xenserver/XenServerResourceNewBase.java
index 4a039c6..0b3bca8 100644
--- a/plugins/hypervisors/xen/src/org/apache/cloudstack/hypervisor/xenserver/XenServerResourceNewBase.java
+++ b/plugins/hypervisors/xen/src/org/apache/cloudstack/hypervisor/xenserver/XenServerResourceNewBase.java
@@ -35,9 +35,6 @@ import com.xensource.xenapi.Types;
import com.xensource.xenapi.Types.XenAPIException;
import com.xensource.xenapi.VM;
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.ClusterSyncAnswer;
-import com.cloud.agent.api.ClusterSyncCommand;
import com.cloud.agent.api.StartupCommand;
import com.cloud.hypervisor.xen.resource.XenServer620SP1Resource;
import com.cloud.utils.Pair;
@@ -152,16 +149,6 @@ public class XenServerResourceNewBase extends XenServer620SP1Resource {
}
- @Override
- protected Answer execute(final ClusterSyncCommand cmd) {
- if (!_listener.isListening()) {
- return new Answer(cmd);
- }
-
- HashMap<String, Pair<String, VirtualMachine.State>> newStates = _listener.getChanges();
- return new ClusterSyncAnswer(cmd.getClusterId(), newStates);
- }
-
protected class VmEventListener extends Thread {
boolean _stop = false;
HashMap<String, Pair<String, VirtualMachine.State>> _changes = new HashMap<String, Pair<String, VirtualMachine.State>>();