diff --git a/agent/scripts/_run.sh b/agent/scripts/_run.sh deleted file mode 100644 index 2ba44bf1abf..00000000000 --- a/agent/scripts/_run.sh +++ /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. - -#script to start multiple agents on one host -num=$1 -port=8787 -while [ $num -gt 0 ] -do -let "port=$port + $num" -java -Xrunjdwp:transport=dt_socket,address=$port,server=y,suspend=n -cp ./'*' com.cloud.agent.AgentShell & -let "num=$num - 1" -done diff --git a/agent/scripts/agent.sh b/agent/scripts/agent.sh deleted file mode 100755 index 867571c3d62..00000000000 --- a/agent/scripts/agent.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# 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. - - -#run.sh runs the agent client. - -# set -x - -while true -do - ./run.sh "$@" - ex=$? - if [ $ex -eq 0 ] || [ $ex -eq 1 ] || [ $ex -eq 66 ] || [ $ex -gt 128 ]; then - exit $ex - fi -done diff --git a/agent/scripts/run.sh b/agent/scripts/run.sh deleted file mode 100755 index 1fa427539fd..00000000000 --- a/agent/scripts/run.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# 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. - -#run.sh runs the agent client. -java $1 -Xms128M -Xmx384M -cp cglib-nodep-2.2.jar:trilead-ssh2-build213.jar:cloud-api.jar:cloud-core-extras.jar:cloud-utils.jar:cloud-agent.jar:cloud-console-proxy.jar:cloud-console-common.jar:freemarker.jar:log4j-1.2.15.jar:ws-commons-util-1.0.2.jar:xmlrpc-client-3.1.3.jar:cloud-core.jar:xmlrpc-common-3.1.3.jar:javaee-api-5.0-1.jar:gson-1.3.jar:commons-httpclient-3.1.jar:commons-logging-1.1.1.jar:commons-codec-1.4.jar:commons-collections-3.2.1.jar:commons-pool-1.4.jar:apache-log4j-extras-1.0.jar:libvirt-0.4.5.jar:jna.jar:.:/etc/cloud:./*:/usr/share/java/*:./conf com.cloud.agent.AgentShell diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java index 946eebd180f..6e790e1c170 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java @@ -18,9 +18,6 @@ */ package org.apache.cloudstack.api.command.user.snapshot; -import com.cloud.event.EventTypes; -import com.cloud.storage.Snapshot; -import com.cloud.user.Account; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiConstants; @@ -33,7 +30,11 @@ import org.apache.cloudstack.api.response.SnapshotResponse; import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.context.CallContext; -@APICommand(name = "RevertSnapshot", description = "revert a volume snapshot.", responseObject = SnapshotResponse.class) +import com.cloud.event.EventTypes; +import com.cloud.storage.Snapshot; +import com.cloud.user.Account; + +@APICommand(name = "revertSnapshot", description = "revert a volume snapshot.", responseObject = SnapshotResponse.class) public class RevertSnapshotCmd extends BaseAsyncCmd { private static final String s_name = "revertsnapshotresponse"; @Parameter(name= ApiConstants.ID, type= BaseCmd.CommandType.UUID, entityType = SnapshotResponse.class, @@ -70,10 +71,12 @@ public class RevertSnapshotCmd extends BaseAsyncCmd { return "revert snapshot: " + getId(); } + @Override public ApiCommandJobType getInstanceType() { return ApiCommandJobType.Snapshot; } + @Override public Long getInstanceId() { return getId(); } diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index e4984ee6ef8..161d9484883 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -255,6 +255,8 @@ label.action.stop.systemvm.processing=Stopping System VM.... label.action.stop.systemvm=Stop System VM label.action.take.snapshot.processing=Taking Snapshot.... label.action.take.snapshot=Take Snapshot +label.action.revert.snapshot.processing=Reverting to Snapshot... +label.action.revert.snapshot=Revert to Snapshot label.action.unmanage.cluster.processing=Unmanaging Cluster.... label.action.unmanage.cluster=Unmanage Cluster label.action.update.OS.preference.processing=Updating OS Preference.... @@ -1301,6 +1303,7 @@ message.action.stop.instance=Please confirm that you want to stop this instance. message.action.stop.router=All services provided by this virtual router will be interrupted. Please confirm that you want to stop this router. message.action.stop.systemvm=Please confirm that you want to stop this system VM. message.action.take.snapshot=Please confirm that you want to take a snapshot of this volume. +message.action.revert.snapshot=Please confirm that you want to revert the owning volume to this snapshot. message.action.unmanage.cluster=Please confirm that you want to unmanage the cluster. message.action.vmsnapshot.delete=Please confirm that you want to delete this VM snapshot. message.action.vmsnapshot.revert=Revert VM snapshot diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in index 58c770d95f0..96e841a4c7d 100644 --- a/client/tomcatconf/commands.properties.in +++ b/client/tomcatconf/commands.properties.in @@ -79,7 +79,7 @@ deleteSnapshot=15 createSnapshotPolicy=15 deleteSnapshotPolicies=15 listSnapshotPolicies=15 - +revertSnapshot=15 #### template commands createTemplate=15 diff --git a/core/src/com/cloud/agent/transport/Request.java b/core/src/com/cloud/agent/transport/Request.java index 31076c075e7..cbeb112fea7 100755 --- a/core/src/com/cloud/agent/transport/Request.java +++ b/core/src/com/cloud/agent/transport/Request.java @@ -108,6 +108,7 @@ public class Request { protected long _agentId; protected Command[] _cmds; protected String _content; + protected String _agentName; protected Request() { } @@ -142,6 +143,11 @@ public class Request { setFromServer(fromServer); } + public Request(long agentId, String agentName, long mgmtId, Command[] cmds, boolean stopOnError, boolean fromServer) { + this(agentId, mgmtId, cmds, stopOnError, fromServer); + setAgentName(agentName); + } + public void setSequence(long seq) { _seq = seq; } @@ -174,6 +180,10 @@ public class Request { _flags |= (stopOnError ? FLAG_STOP_ON_ERROR : 0); } + private final void setAgentName(String agentName) { + _agentName = agentName; + } + private final void setInSequence(boolean inSequence) { _flags |= (inSequence ? FLAG_IN_SEQUENCE : 0); } @@ -422,7 +432,11 @@ public class Request { buf.append(msg); buf.append(" { ").append(getType()); - buf.append(", MgmtId: ").append(_mgmtId).append(", via: ").append(_via); + if (_agentName != null) { + buf.append(", MgmtId: ").append(_mgmtId).append(", via: ").append(_via).append("(" + _agentName + ")"); + } else { + buf.append(", MgmtId: ").append(_mgmtId).append(", via: ").append(_via); + } buf.append(", Ver: ").append(_ver.toString()); buf.append(", Flags: ").append(Integer.toBinaryString(getFlags())).append(", "); buf.append(content); diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataMotionStrategy.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataMotionStrategy.java index 6deb6c1afc0..950f9e23758 100644 --- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataMotionStrategy.java +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataMotionStrategy.java @@ -26,9 +26,9 @@ import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.host.Host; public interface DataMotionStrategy { - boolean canHandle(DataObject srcData, DataObject destData); + StrategyPriority.Priority canHandle(DataObject srcData, DataObject destData); - boolean canHandle(Map volumeMap, Host srcHost, Host destHost); + StrategyPriority.Priority canHandle(Map volumeMap, Host srcHost, Host destHost); Void copyAsync(DataObject srcData, DataObject destData, AsyncCompletionCallback callback); diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java index 47e595be6a6..e4cecb6b156 100644 --- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java @@ -27,5 +27,5 @@ public interface SnapshotStrategy { boolean revertSnapshot(Long snapshotId); - boolean canHandle(Snapshot snapshot); + StrategyPriority.Priority canHandle(Snapshot snapshot); } diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StrategyPriority.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StrategyPriority.java new file mode 100644 index 00000000000..81034b1663f --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StrategyPriority.java @@ -0,0 +1,99 @@ +// 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 org.apache.cloudstack.engine.subsystem.api.storage; + +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; + +import com.cloud.host.Host; +import com.cloud.storage.Snapshot; + +public class StrategyPriority { + public enum Priority { + CANT_HANDLE, + DEFAULT, + HYPERVISOR, + PLUGIN, + HIGHEST + } + + public static void sortStrategies(List strategies, Snapshot snapshot) { + Collections.sort(strategies, new SnapshotStrategyComparator(snapshot)); + } + + public static void sortStrategies(List strategies, DataObject srcData, DataObject destData) { + Collections.sort(strategies, new DataMotionStrategyComparator(srcData, destData)); + } + + public static void sortStrategies(List strategies, Map volumeMap, Host srcHost, Host destHost) { + Collections.sort(strategies, new DataMotionStrategyHostComparator(volumeMap, srcHost, destHost)); + } + + static class SnapshotStrategyComparator implements Comparator { + + Snapshot snapshot; + + public SnapshotStrategyComparator(Snapshot snapshot) { + this.snapshot = snapshot; + } + + @Override + public int compare(SnapshotStrategy o1, SnapshotStrategy o2) { + int i1 = o1.canHandle(snapshot).ordinal(); + int i2 = o2.canHandle(snapshot).ordinal(); + return new Integer(i2).compareTo(new Integer(i1)); + } + } + + static class DataMotionStrategyComparator implements Comparator { + + DataObject srcData, destData; + + public DataMotionStrategyComparator(DataObject srcData, DataObject destData) { + this.srcData = srcData; + this.destData = destData; + } + + @Override + public int compare(DataMotionStrategy o1, DataMotionStrategy o2) { + int i1 = o1.canHandle(srcData, destData).ordinal(); + int i2 = o2.canHandle(srcData, destData).ordinal(); + return new Integer(i2).compareTo(new Integer(i1)); + } + } + + static class DataMotionStrategyHostComparator implements Comparator { + + Host srcHost, destHost; + Map volumeMap; + + public DataMotionStrategyHostComparator(Map volumeMap, Host srcHost, Host destHost) { + this.volumeMap = volumeMap; + this.srcHost = srcHost; + this.destHost = destHost; + } + + @Override + public int compare(DataMotionStrategy o1, DataMotionStrategy o2) { + int i1 = o1.canHandle(volumeMap, srcHost, destHost).ordinal(); + int i2 = o2.canHandle(volumeMap, srcHost, destHost).ordinal(); + return new Integer(i2).compareTo(new Integer(i1)); + } + } +} diff --git a/engine/api/test/org/apache/cloudstack/engine/subsystem/api/storage/StrategyPriorityTest.java b/engine/api/test/org/apache/cloudstack/engine/subsystem/api/storage/StrategyPriorityTest.java new file mode 100644 index 00000000000..3d7527903b6 --- /dev/null +++ b/engine/api/test/org/apache/cloudstack/engine/subsystem/api/storage/StrategyPriorityTest.java @@ -0,0 +1,116 @@ +// 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 org.apache.cloudstack.engine.subsystem.api.storage; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority.Priority; +import org.junit.Test; + +import com.cloud.host.Host; +import com.cloud.storage.Snapshot; + +import static org.junit.Assert.assertEquals; + +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; + +public class StrategyPriorityTest { + + @Test + public void testSortSnapshotStrategies() { + SnapshotStrategy cantHandleStrategy = mock(SnapshotStrategy.class); + SnapshotStrategy defaultStrategy = mock(SnapshotStrategy.class); + SnapshotStrategy hyperStrategy = mock(SnapshotStrategy.class); + SnapshotStrategy pluginStrategy = mock(SnapshotStrategy.class); + SnapshotStrategy highestStrategy = mock(SnapshotStrategy.class); + + doReturn(Priority.CANT_HANDLE).when(cantHandleStrategy).canHandle(any(Snapshot.class)); + doReturn(Priority.DEFAULT).when(defaultStrategy).canHandle(any(Snapshot.class)); + doReturn(Priority.HYPERVISOR).when(hyperStrategy).canHandle(any(Snapshot.class)); + doReturn(Priority.PLUGIN).when(pluginStrategy).canHandle(any(Snapshot.class)); + doReturn(Priority.HIGHEST).when(highestStrategy).canHandle(any(Snapshot.class)); + + List strategies = new ArrayList(5); + strategies.addAll(Arrays.asList(defaultStrategy, pluginStrategy, hyperStrategy, cantHandleStrategy, highestStrategy)); + + StrategyPriority.sortStrategies(strategies, mock(Snapshot.class)); + + assertEquals("Highest was not 1st.", highestStrategy, strategies.get(0)); + assertEquals("Plugin was not 2nd.", pluginStrategy, strategies.get(1)); + assertEquals("Hypervisor was not 3rd.", hyperStrategy, strategies.get(2)); + assertEquals("Default was not 4th.", defaultStrategy, strategies.get(3)); + assertEquals("Can't Handle was not 5th.", cantHandleStrategy, strategies.get(4)); + } + + @Test + public void testSortDataMotionStrategies() { + DataMotionStrategy cantHandleStrategy = mock(DataMotionStrategy.class); + DataMotionStrategy defaultStrategy = mock(DataMotionStrategy.class); + DataMotionStrategy hyperStrategy = mock(DataMotionStrategy.class); + DataMotionStrategy pluginStrategy = mock(DataMotionStrategy.class); + DataMotionStrategy highestStrategy = mock(DataMotionStrategy.class); + + doReturn(Priority.CANT_HANDLE).when(cantHandleStrategy).canHandle(any(DataObject.class), any(DataObject.class)); + doReturn(Priority.DEFAULT).when(defaultStrategy).canHandle(any(DataObject.class), any(DataObject.class)); + doReturn(Priority.HYPERVISOR).when(hyperStrategy).canHandle(any(DataObject.class), any(DataObject.class)); + doReturn(Priority.PLUGIN).when(pluginStrategy).canHandle(any(DataObject.class), any(DataObject.class)); + doReturn(Priority.HIGHEST).when(highestStrategy).canHandle(any(DataObject.class), any(DataObject.class)); + + List strategies = new ArrayList(5); + strategies.addAll(Arrays.asList(defaultStrategy, pluginStrategy, hyperStrategy, cantHandleStrategy, highestStrategy)); + + StrategyPriority.sortStrategies(strategies, mock(DataObject.class), mock(DataObject.class)); + + assertEquals("Highest was not 1st.", highestStrategy, strategies.get(0)); + assertEquals("Plugin was not 2nd.", pluginStrategy, strategies.get(1)); + assertEquals("Hypervisor was not 3rd.", hyperStrategy, strategies.get(2)); + assertEquals("Default was not 4th.", defaultStrategy, strategies.get(3)); + assertEquals("Can't Handle was not 5th.", cantHandleStrategy, strategies.get(4)); + } + + @Test + @SuppressWarnings("unchecked") + public void testSortDataMotionStrategies2() { + DataMotionStrategy cantHandleStrategy = mock(DataMotionStrategy.class); + DataMotionStrategy defaultStrategy = mock(DataMotionStrategy.class); + DataMotionStrategy hyperStrategy = mock(DataMotionStrategy.class); + DataMotionStrategy pluginStrategy = mock(DataMotionStrategy.class); + DataMotionStrategy highestStrategy = mock(DataMotionStrategy.class); + + doReturn(Priority.CANT_HANDLE).when(cantHandleStrategy).canHandle(any(Map.class), any(Host.class), any(Host.class)); + doReturn(Priority.DEFAULT).when(defaultStrategy).canHandle(any(Map.class), any(Host.class), any(Host.class)); + doReturn(Priority.HYPERVISOR).when(hyperStrategy).canHandle(any(Map.class), any(Host.class), any(Host.class)); + doReturn(Priority.PLUGIN).when(pluginStrategy).canHandle(any(Map.class), any(Host.class), any(Host.class)); + doReturn(Priority.HIGHEST).when(highestStrategy).canHandle(any(Map.class), any(Host.class), any(Host.class)); + + List strategies = new ArrayList(5); + strategies.addAll(Arrays.asList(defaultStrategy, pluginStrategy, hyperStrategy, cantHandleStrategy, highestStrategy)); + + StrategyPriority.sortStrategies(strategies, mock(Map.class), mock(Host.class), mock(Host.class)); + + assertEquals("Highest was not 1st.", highestStrategy, strategies.get(0)); + assertEquals("Plugin was not 2nd.", pluginStrategy, strategies.get(1)); + assertEquals("Hypervisor was not 3rd.", hyperStrategy, strategies.get(2)); + assertEquals("Default was not 4th.", defaultStrategy, strategies.get(3)); + assertEquals("Can't Handle was not 5th.", cantHandleStrategy, strategies.get(4)); + } +} diff --git a/engine/orchestration/src/com/cloud/agent/manager/AgentAttache.java b/engine/orchestration/src/com/cloud/agent/manager/AgentAttache.java index 5b1007b26f0..ff35255c7db 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/AgentAttache.java +++ b/engine/orchestration/src/com/cloud/agent/manager/AgentAttache.java @@ -101,6 +101,7 @@ public abstract class AgentAttache { }; protected final long _id; + protected String _name = null; protected final ConcurrentHashMap _waitForList; protected final LinkedList _requests; protected Long _currentSequence; @@ -121,9 +122,9 @@ public abstract class AgentAttache { Arrays.sort(s_commandsNotAllowedInConnectingMode); } - - protected AgentAttache(AgentManagerImpl agentMgr, final long id, boolean maintenance) { + protected AgentAttache(AgentManagerImpl agentMgr, final long id, final String name, boolean maintenance) { _id = id; + _name = name; _waitForList = new ConcurrentHashMap(); _currentSequence = null; _maintenance = maintenance; @@ -164,7 +165,7 @@ public abstract class AgentAttache { if (_maintenance) { for (final Command cmd : cmds) { if (Arrays.binarySearch(s_commandsAllowedInMaintenanceMode, cmd.getClass().toString()) < 0) { - throw new AgentUnavailableException("Unable to send " + cmd.getClass().toString() + " because agent is in maintenance mode", _id); + throw new AgentUnavailableException("Unable to send " + cmd.getClass().toString() + " because agent " + _name + " is in maintenance mode", _id); } } } @@ -172,7 +173,7 @@ public abstract class AgentAttache { if (_status == Status.Connecting) { for (final Command cmd : cmds) { if (Arrays.binarySearch(s_commandsNotAllowedInConnectingMode, cmd.getClass().toString()) >= 0) { - throw new AgentUnavailableException("Unable to send " + cmd.getClass().toString() + " because agent is in connecting mode", _id); + throw new AgentUnavailableException("Unable to send " + cmd.getClass().toString() + " because agent " + _name + " is in connecting mode", _id); } } } @@ -242,6 +243,10 @@ public abstract class AgentAttache { return _id; } + public String getName() { + return _name; + } + public int getQueueSize() { return _requests.size(); } @@ -350,7 +355,7 @@ public abstract class AgentAttache { synchronized(this) { try { if (isClosed()) { - throw new AgentUnavailableException("The link to the agent has been closed", _id); + throw new AgentUnavailableException("The link to the agent " + _name + " has been closed", _id); } if (req.executeInSequence() && _currentSequence != null) { diff --git a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java index 42020153448..6804dc1ef68 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java +++ b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java @@ -384,7 +384,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl throw new AgentUnavailableException("agent not logged into this management server", hostId); } - Request req = new Request(hostId, _nodeId, cmds, commands.stopOnError(), true); + Request req = new Request(hostId, agent.getName(), _nodeId, cmds, commands.stopOnError(), true); req.setSequence(agent.getNextSequence()); Answer[] answers = agent.send(req, timeout); notifyAnswersToMonitors(hostId, req.getSequence(), answers); @@ -437,7 +437,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl if (cmds.length == 0) { throw new AgentUnavailableException("Empty command set for agent " + agent.getId(), agent.getId()); } - Request req = new Request(hostId, _nodeId, cmds, commands.stopOnError(), true); + Request req = new Request(hostId, agent.getName(), _nodeId, cmds, commands.stopOnError(), true); req.setSequence(agent.getNextSequence()); agent.send(req, listener); @@ -679,7 +679,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl // } s_logger.debug("create DirectAgentAttache for " + host.getId()); - DirectAgentAttache attache = new DirectAgentAttache(this, host.getId(), resource, host.isInMaintenanceStates(), this); + DirectAgentAttache attache = new DirectAgentAttache(this, host.getId(), host.getName(), resource, host.isInMaintenanceStates(), this); AgentAttache old = null; synchronized (_agents) { @@ -969,7 +969,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl protected AgentAttache createAttacheForConnect(HostVO host, Link link) throws ConnectionException { s_logger.debug("create ConnectedAgentAttache for " + host.getId()); - AgentAttache attache = new ConnectedAgentAttache(this, host.getId(), link, host.isInMaintenanceStates()); + AgentAttache attache = new ConnectedAgentAttache(this, host.getId(), host.getName(), link, host.isInMaintenanceStates()); link.attach(attache); AgentAttache old = null; diff --git a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentAttache.java b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentAttache.java index 058a90475fd..5bcde6be712 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentAttache.java +++ b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentAttache.java @@ -50,14 +50,14 @@ public class ClusteredAgentAttache extends ConnectedAgentAttache implements Rout s_clusteredAgentMgr = agentMgr; } - public ClusteredAgentAttache(AgentManagerImpl agentMgr, long id) { - super(agentMgr, id, null, false); + public ClusteredAgentAttache(AgentManagerImpl agentMgr, long id, String name) { + super(agentMgr, id, name, null, false); _forward = true; _transferRequests = new LinkedList(); } - public ClusteredAgentAttache(AgentManagerImpl agentMgr, long id, Link link, boolean maintenance) { - super(agentMgr, id, link, maintenance); + public ClusteredAgentAttache(AgentManagerImpl agentMgr, long id, String name, Link link, boolean maintenance) { + super(agentMgr, id, name, link, maintenance); _forward = link == null; _transferRequests = new LinkedList(); } diff --git a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java index 2b9e5419376..07fa73caae0 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java +++ b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java @@ -246,7 +246,8 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust protected AgentAttache createAttache(long id) { s_logger.debug("create forwarding ClusteredAgentAttache for " + id); - final AgentAttache attache = new ClusteredAgentAttache(this, id); + HostVO host = _hostDao.findById(id); + final AgentAttache attache = new ClusteredAgentAttache(this, id, host.getName()); AgentAttache old = null; synchronized (_agents) { old = _agents.get(id); @@ -261,7 +262,7 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust @Override protected AgentAttache createAttacheForConnect(HostVO host, Link link) { s_logger.debug("create ClusteredAgentAttache for " + host.getId()); - final AgentAttache attache = new ClusteredAgentAttache(this, host.getId(), link, host.isInMaintenanceStates()); + final AgentAttache attache = new ClusteredAgentAttache(this, host.getId(), host.getName(), link, host.isInMaintenanceStates()); link.attach(attache); AgentAttache old = null; synchronized (_agents) { @@ -280,7 +281,7 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust // return new DummyAttache(this, host.getId(), false); // } s_logger.debug("create ClusteredDirectAgentAttache for " + host.getId()); - final DirectAgentAttache attache = new ClusteredDirectAgentAttache(this, host.getId(), _nodeId, resource, host.isInMaintenanceStates(), this); + final DirectAgentAttache attache = new ClusteredDirectAgentAttache(this, host.getId(), host.getName(), _nodeId, resource, host.isInMaintenanceStates(), this); AgentAttache old = null; synchronized (_agents) { old = _agents.get(host.getId()); diff --git a/engine/orchestration/src/com/cloud/agent/manager/ClusteredDirectAgentAttache.java b/engine/orchestration/src/com/cloud/agent/manager/ClusteredDirectAgentAttache.java index 9012433b4d7..692f6ad67de 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/ClusteredDirectAgentAttache.java +++ b/engine/orchestration/src/com/cloud/agent/manager/ClusteredDirectAgentAttache.java @@ -28,8 +28,8 @@ public class ClusteredDirectAgentAttache extends DirectAgentAttache implements R private final ClusteredAgentManagerImpl _mgr; private final long _nodeId; - public ClusteredDirectAgentAttache(AgentManagerImpl agentMgr, long id, long mgmtId, ServerResource resource, boolean maintenance, ClusteredAgentManagerImpl mgr) { - super(agentMgr, id, resource, maintenance, mgr); + public ClusteredDirectAgentAttache(AgentManagerImpl agentMgr, long id, String name, long mgmtId, ServerResource resource, boolean maintenance, ClusteredAgentManagerImpl mgr) { + super(agentMgr, id, name, resource, maintenance, mgr); _mgr = mgr; _nodeId = mgmtId; } diff --git a/engine/orchestration/src/com/cloud/agent/manager/ConnectedAgentAttache.java b/engine/orchestration/src/com/cloud/agent/manager/ConnectedAgentAttache.java index e5d2867b96d..8ee47d55c26 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/ConnectedAgentAttache.java +++ b/engine/orchestration/src/com/cloud/agent/manager/ConnectedAgentAttache.java @@ -33,8 +33,8 @@ public class ConnectedAgentAttache extends AgentAttache { protected Link _link; - public ConnectedAgentAttache(AgentManagerImpl agentMgr, final long id, final Link link, boolean maintenance) { - super(agentMgr, id, maintenance); + public ConnectedAgentAttache(AgentManagerImpl agentMgr, final long id, final String name, final Link link, boolean maintenance) { + super(agentMgr, id, name, maintenance); _link = link; } @@ -83,7 +83,7 @@ public class ConnectedAgentAttache extends AgentAttache { assert _link == null : "Duh...Says you....Forgot to call disconnect()!"; synchronized (this) { if (_link != null) { - s_logger.warn("Lost attache " + _id); + s_logger.warn("Lost attache " + _id + "(" + _name + ")"); disconnect(Status.Alert); } } diff --git a/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java b/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java index 2808c6af91a..7d3f7659639 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java +++ b/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java @@ -44,8 +44,8 @@ public class DirectAgentAttache extends AgentAttache { AgentManagerImpl _mgr; long _seq = 0; - public DirectAgentAttache(AgentManagerImpl agentMgr, long id, ServerResource resource, boolean maintenance, AgentManagerImpl mgr) { - super(agentMgr, id, maintenance); + public DirectAgentAttache(AgentManagerImpl agentMgr, long id, String name, ServerResource resource, boolean maintenance, AgentManagerImpl mgr) { + super(agentMgr, id, name, maintenance); _resource = resource; _mgr = mgr; } @@ -53,7 +53,7 @@ public class DirectAgentAttache extends AgentAttache { @Override public void disconnect(Status state) { if (s_logger.isDebugEnabled()) { - s_logger.debug("Processing disconnect " + _id); + s_logger.debug("Processing disconnect " + _id + "(" + _name + ")"); } for (ScheduledFuture future : _futures) { @@ -119,7 +119,7 @@ public class DirectAgentAttache extends AgentAttache { assert _resource == null : "Come on now....If you're going to dabble in agent code, you better know how to close out our resources. Ever considered why there's a method called disconnect()?"; synchronized (this) { if (_resource != null) { - s_logger.warn("Lost attache for " + _id); + s_logger.warn("Lost attache for " + _id + "(" + _name + ")"); disconnect(Status.Alert); } } @@ -137,12 +137,12 @@ public class DirectAgentAttache extends AgentAttache { if (resource != null) { PingCommand cmd = resource.getCurrentStatus(_id); if (cmd == null) { - s_logger.warn("Unable to get current status on " + _id); + s_logger.warn("Unable to get current status on " + _id + "(" + _name + ")"); _mgr.disconnectWithInvestigation(DirectAgentAttache.this, Event.AgentDisconnected); return; } if (s_logger.isDebugEnabled()) { - s_logger.debug("Ping from " + _id); + s_logger.debug("Ping from " + _id + "(" + _name + ")"); } long seq = _seq++; @@ -152,7 +152,7 @@ public class DirectAgentAttache extends AgentAttache { _mgr.handleCommands(DirectAgentAttache.this, seq, new Command[]{cmd}); } else { - s_logger.debug("Unable to send ping because agent is disconnected " + _id); + s_logger.debug("Unable to send ping because agent is disconnected " + _id + "(" + _name + ")"); } } catch (Exception e) { s_logger.warn("Unable to complete the ping task", e); diff --git a/engine/orchestration/src/com/cloud/agent/manager/DummyAttache.java b/engine/orchestration/src/com/cloud/agent/manager/DummyAttache.java index 182c1b85d59..2c768480ffe 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/DummyAttache.java +++ b/engine/orchestration/src/com/cloud/agent/manager/DummyAttache.java @@ -23,8 +23,8 @@ import com.cloud.host.Status; public class DummyAttache extends AgentAttache { - public DummyAttache(AgentManagerImpl agentMgr, long id, boolean maintenance) { - super(agentMgr, id, maintenance); + public DummyAttache(AgentManagerImpl agentMgr, long id, String name, boolean maintenance) { + super(agentMgr, id, name, maintenance); } diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index 7258e2557f0..0817393ab9c 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -944,11 +944,16 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati } throw new CloudRuntimeException("Local volume " + vol + " cannot be recreated on storagepool " + assignedPool + " assigned by deploymentPlanner"); } else { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Shared volume " + vol + " will be migrated on storage pool " + assignedPool + " assigned by deploymentPlanner"); + //Check if storage migration is enabled in config + if (StorageHAMigrationEnabled.value()) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Shared volume " + vol + " will be migrated on storage pool " + assignedPool + " assigned by deploymentPlanner"); + } + VolumeTask task = new VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool); + tasks.add(task); + } else { + throw new CloudRuntimeException("Cannot migrate volumes. Volume Migration is disabled"); } - VolumeTask task = new VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool); - tasks.add(task); } } else { StoragePoolVO pool = _storagePoolDao.findById(vol.getPoolId()); @@ -1106,9 +1111,16 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati "If true, will recreate system vm root disk whenever starting system vm", true); + public static final ConfigKey StorageHAMigrationEnabled = new ConfigKey(Boolean.class, + "enable.ha.storage.migration", + "Storage", + "true", + "Enable/disable storage migration across primary storage during HA", + true); + @Override public ConfigKey[] getConfigKeys() { - return new ConfigKey[] {RecreatableSystemVmEnabled, MaxVolumeSize}; + return new ConfigKey[] {RecreatableSystemVmEnabled, MaxVolumeSize, StorageHAMigrationEnabled}; } @Override @@ -1164,6 +1176,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati return dataStoreMgr.getPrimaryDataStore(vol.getPoolId()).getUuid(); } + @Override public void updateVolumeDiskChain(long volumeId, String path, String chainInfo) { VolumeVO vol = _volsDao.findById(volumeId); boolean needUpdate = false; @@ -1174,7 +1187,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati needUpdate = true; if(needUpdate) { - s_logger.info("Update volume disk chain info. vol: " + vol.getId() + ", " + vol.getPath() + " -> " + path + s_logger.info("Update volume disk chain info. vol: " + vol.getId() + ", " + vol.getPath() + " -> " + path + ", " + vol.getChainInfo() + " -> " + chainInfo); vol.setPath(path); vol.setChainInfo(chainInfo); diff --git a/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java b/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java index c107fa021ff..85e36a5afc1 100755 --- a/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java +++ b/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java @@ -62,7 +62,8 @@ import com.cloud.upgrade.dao.Upgrade307to410; import com.cloud.upgrade.dao.Upgrade30to301; import com.cloud.upgrade.dao.Upgrade40to41; import com.cloud.upgrade.dao.Upgrade410to420; -import com.cloud.upgrade.dao.Upgrade420to430; +import com.cloud.upgrade.dao.Upgrade420to421; +import com.cloud.upgrade.dao.Upgrade421to430; import com.cloud.upgrade.dao.UpgradeSnapshot217to224; import com.cloud.upgrade.dao.UpgradeSnapshot223to224; import com.cloud.upgrade.dao.VersionDao; @@ -89,118 +90,127 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker { new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), - new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("2.1.8", new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), - new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), + new Upgrade421to430()}); _upgradeMap.put("2.1.9", new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), - new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("2.2.1", new DbUpgrade[] {new Upgrade221to222(), new UpgradeSnapshot223to224(), new Upgrade222to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), - new Upgrade420to430()}); + new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("2.2.2", new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), - new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), + new Upgrade421to430()}); _upgradeMap.put("2.2.3", new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), - new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), + new Upgrade421to430()}); _upgradeMap.put("2.2.4", new DbUpgrade[] {new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), - new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("2.2.5", new DbUpgrade[] {new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), - new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("2.2.6", new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), - new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), + new Upgrade421to430()}); _upgradeMap.put("2.2.7", new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), - new Upgrade420to430()}); + new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("2.2.8", new DbUpgrade[] {new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30() - , new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + , new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("2.2.9", new DbUpgrade[] {new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), - new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("2.2.10", new DbUpgrade[] {new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), - new Upgrade420to430()}); + new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("2.2.11", new DbUpgrade[] {new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), - new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), + new Upgrade421to430()}); _upgradeMap.put("2.2.12", new DbUpgrade[] {new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), - new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("2.2.13", new DbUpgrade[] {new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), - new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("2.2.14", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), - new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("3.0.0", new DbUpgrade[] {new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), - new Upgrade420to430()}); + new Upgrade420to421(), new Upgrade421to430()}); - _upgradeMap.put("3.0.1", new DbUpgrade[] {new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + _upgradeMap.put("3.0.1", new DbUpgrade[] {new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), + new Upgrade421to430()}); - _upgradeMap.put("3.0.2", new DbUpgrade[] {new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + _upgradeMap.put("3.0.2", new DbUpgrade[] {new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); - _upgradeMap.put("4.0.0", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + _upgradeMap.put("4.0.0", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); - _upgradeMap.put("4.0.1", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + _upgradeMap.put("4.0.1", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); - _upgradeMap.put("4.0.2", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to430()}); + _upgradeMap.put("4.0.2", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); - _upgradeMap.put("4.1.0", new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to430()}); + _upgradeMap.put("4.1.0", new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); - _upgradeMap.put("4.1.1", new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to430()}); + _upgradeMap.put("4.1.1", new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); - _upgradeMap.put("4.2.0", new DbUpgrade[] {new Upgrade420to430()}); + _upgradeMap.put("4.2.0", new DbUpgrade[] {new Upgrade420to421(), new Upgrade421to430()}); + + _upgradeMap.put("4.2.1", new DbUpgrade[] {new Upgrade421to430()}); //CP Upgrades _upgradeMap.put("3.0.3", new DbUpgrade[] {new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), - new Upgrade410to420(), new Upgrade420to430()}); + new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("3.0.4", new DbUpgrade[] {new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), - new Upgrade420to430()}); + new Upgrade420to421(), new Upgrade421to430()}); - _upgradeMap.put("3.0.5", new DbUpgrade[] {new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to430()}); + _upgradeMap.put("3.0.5", new DbUpgrade[] {new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), + new Upgrade421to430()}); - _upgradeMap.put("3.0.6", new DbUpgrade[] {new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to430()}); + _upgradeMap.put("3.0.6", new DbUpgrade[] {new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); - _upgradeMap.put("3.0.7", new DbUpgrade[] {new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to430()}); + _upgradeMap.put("3.0.7", new DbUpgrade[] {new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("2.2.15", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), - new Upgrade420to430()}); + new Upgrade420to421(), new Upgrade421to430()}); _upgradeMap.put("2.2.16", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), - new Upgrade420to430()}); + new Upgrade420to421(), new Upgrade421to430()}); } protected void runScript(Connection conn, File file) { diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade420to421.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade420to421.java new file mode 100644 index 00000000000..27704e8739e --- /dev/null +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade420to421.java @@ -0,0 +1,217 @@ +// 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.upgrade.dao; + +import java.io.File; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.log4j.Logger; + +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.script.Script; + +public class Upgrade420to421 implements DbUpgrade { + final static Logger s_logger = Logger.getLogger(Upgrade420to421.class); + + + @Override + public String[] getUpgradableVersionRange() { + return new String[] { "4.2.0", "4.2.1" }; + } + + @Override + public String getUpgradedVersion() { + return "4.2.1"; + } + + @Override + public boolean supportsRollingUpgrade() { + return false; + } + + @Override + public File[] getPrepareScripts() { + String script = Script.findScript("", "db/schema-420to421.sql"); + if (script == null) { + throw new CloudRuntimeException("Unable to find db/schema-420to421.sql"); + } + + return new File[] { new File(script) }; + } + + @Override + public File[] getCleanupScripts() { + return null; + } + + @Override + public void performDataMigration(Connection conn) { + upgradeResourceCount(conn); + } + + private void upgradeResourceCount(Connection conn) { + s_logger.debug("upgradeResourceCount start"); + PreparedStatement pstmt1 = null; + PreparedStatement pstmt2 = null; + PreparedStatement pstmt3 = null; + PreparedStatement pstmt4 = null; + PreparedStatement pstmt5 = null; + ResultSet rs = null; + ResultSet rsAccount = null; + ResultSet rsCount = null; + try { + pstmt1 = conn.prepareStatement("select id, domain_id FROM `cloud`.`account` where removed is NULL "); + rsAccount = pstmt1.executeQuery(); + while (rsAccount.next()) { + long account_id = rsAccount.getLong(1); + long domain_id = rsAccount.getLong(2); + // 1. update cpu,memory for all accounts + pstmt2 = conn.prepareStatement( "SELECT SUM(service_offering.cpu), SUM(service_offering.ram_size)" + + " FROM `cloud`.`vm_instance`, `cloud`.`service_offering`" + + " WHERE vm_instance.service_offering_id = service_offering.id AND vm_instance.account_id = ?" + " AND vm_instance.removed is NULL" + + " AND vm_instance.vm_type='User' AND state not in ('Destroyed', 'Error', 'Expunging')"); + pstmt2.setLong(1, account_id); + rsCount = pstmt2.executeQuery(); + if (rsCount.next()) { + upgradeResourceCountforAccount(conn, account_id, domain_id, "cpu", rsCount.getLong(1)); + upgradeResourceCountforAccount(conn, account_id, domain_id, "memory", rsCount.getLong(2)); + } else { + upgradeResourceCountforAccount(conn, account_id, domain_id, "cpu", 0L); + upgradeResourceCountforAccount(conn, account_id, domain_id, "memory", 0L); + } + // 2. update primary_storage for all accounts + pstmt3 = conn.prepareStatement("SELECT sum(size) FROM `cloud`.`volumes` WHERE account_id= ?" + + " AND (path is not NULL OR state in ('Allocated')) AND removed is NULL" + + " AND instance_id IN (SELECT id FROM `cloud`.`vm_instance` WHERE vm_type='User')"); + pstmt3.setLong(1, account_id); + rsCount = pstmt3.executeQuery(); + if (rsCount.next()) { + upgradeResourceCountforAccount(conn, account_id, domain_id, "primary_storage", rsCount.getLong(1)); + } else { + upgradeResourceCountforAccount(conn, account_id, domain_id, "primary_storage", 0L); + } + // 3. update secondary_storage for all accounts + long totalVolumesSize = 0; + long totalSnapshotsSize = 0; + long totalTemplatesSize = 0; + pstmt4 = conn.prepareStatement("SELECT sum(size) FROM `cloud`.`volumes` WHERE account_id= ?" + + " AND path is NULL AND state not in ('Allocated') AND removed is NULL"); + pstmt4.setLong(1, account_id); + rsCount = pstmt4.executeQuery(); + if (rsCount.next()) { + totalVolumesSize = rsCount.getLong(1); + } + pstmt4 = conn.prepareStatement("SELECT sum(size) FROM `cloud`.`snapshots` WHERE account_id= ? AND removed is NULL"); + pstmt4.setLong(1, account_id); + rsCount = pstmt4.executeQuery(); + if (rsCount.next()) { + totalSnapshotsSize = rsCount.getLong(1); + } + pstmt4 = conn.prepareStatement("SELECT sum(template_store_ref.size) FROM `cloud`.`template_store_ref`,`cloud`.`vm_template` WHERE account_id = ?" + + " AND template_store_ref.template_id = vm_template.id AND download_state = 'DOWNLOADED' AND destroyed = false AND removed is NULL"); + pstmt4.setLong(1, account_id); + rsCount = pstmt4.executeQuery(); + if (rsCount.next()) { + totalTemplatesSize = rsCount.getLong(1); + } + upgradeResourceCountforAccount(conn, account_id, domain_id, "secondary_storage", totalVolumesSize + totalSnapshotsSize + totalTemplatesSize); + } + // 4. upgrade cpu,memory,primary_storage,secondary_storage for domains + String resource_types[] = {"cpu","memory", "primary_storage", "secondary_storage"}; + pstmt5 = conn.prepareStatement("select id FROM `cloud`.`domain`"); + rsAccount = pstmt5.executeQuery(); + while (rsAccount.next()) { + long domain_id = rsAccount.getLong(1); + for(int count=0; count < resource_types.length; count++) { + String resource_type = resource_types[count]; + upgradeResourceCountforDomain(conn, domain_id, resource_type, 0L); // reset value to 0 before statistics + } + } + for(int count= 0; count < resource_types.length; count++) { + String resource_type = resource_types[count]; + pstmt5 = conn.prepareStatement("select account.domain_id,sum(resource_count.count) from `cloud`.`account` left join `cloud`.`resource_count` on account.id=resource_count.account_id " + + "where resource_count.type=? group by account.domain_id;"); + pstmt5.setString(1, resource_type); + rsCount = pstmt5.executeQuery(); + while (rsCount.next()) { + long domain_id = rsCount.getLong(1); + long resource_count = rsCount.getLong(2); + upgradeResourceCountforDomain(conn, domain_id, resource_type, resource_count); + } + } + s_logger.debug("upgradeResourceCount finish"); + } catch (SQLException e) { + throw new CloudRuntimeException("Unable to upgrade resource count (cpu,memory,primary_storage,secondary_storage) ", e); + } finally { + try { + if (rs != null) { + rs.close(); + } + if (rsAccount != null) { + rsAccount.close(); + } + if (rsCount != null) { + rsCount.close(); + } + if (pstmt1 != null) { + pstmt1.close(); + } + if (pstmt2 != null) { + pstmt2.close(); + } + if (pstmt3 != null) { + pstmt3.close(); + } + if (pstmt4 != null) { + pstmt4.close(); + } + if (pstmt5 != null) { + pstmt5.close(); + } + } catch (SQLException e) { + } + } + } + + private static void upgradeResourceCountforAccount(Connection conn, Long account_id, Long domain_id, String type, Long resource_count) throws SQLException { + //update or insert into resource_count table. + PreparedStatement pstmt = null; + pstmt = conn.prepareStatement("INSERT INTO `cloud`.`resource_count` (account_id, type, count) VALUES (?,?,?) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id), count=?"); + pstmt.setLong(1, account_id); + pstmt.setString(2, type); + pstmt.setLong(3, resource_count); + pstmt.setLong(4, resource_count); + pstmt.executeUpdate(); + pstmt.close(); + } + + private static void upgradeResourceCountforDomain(Connection conn, Long domain_id, String type, Long resource_count) throws SQLException { + //update or insert into resource_count table. + PreparedStatement pstmt = null; + pstmt = conn.prepareStatement("INSERT INTO `cloud`.`resource_count` (domain_id, type, count) VALUES (?,?,?) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id), count=?"); + pstmt.setLong(1, domain_id); + pstmt.setString(2, type); + pstmt.setLong(3, resource_count); + pstmt.setLong(4, resource_count); + pstmt.executeUpdate(); + pstmt.close(); + } +} diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade420to430.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java similarity index 83% rename from engine/schema/src/com/cloud/upgrade/dao/Upgrade420to430.java rename to engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java index ab82cc92396..5647289f489 100644 --- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade420to430.java +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java @@ -25,12 +25,12 @@ import org.apache.log4j.Logger; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; -public class Upgrade420to430 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade420to430.class); +public class Upgrade421to430 implements DbUpgrade { + final static Logger s_logger = Logger.getLogger(Upgrade421to430.class); @Override public String[] getUpgradableVersionRange() { - return new String[] { "4.2.0", "4.3.0" }; + return new String[] {"4.2.1", "4.3.0"}; } @Override @@ -45,9 +45,9 @@ public class Upgrade420to430 implements DbUpgrade { @Override public File[] getPrepareScripts() { - String script = Script.findScript("", "db/schema-420to430.sql"); + String script = Script.findScript("", "db/schema-421to430.sql"); if (script == null) { - throw new CloudRuntimeException("Unable to find db/schema-420to430.sql"); + throw new CloudRuntimeException("Unable to find db/schema-421to430.sql"); } return new File[] { new File(script) }; @@ -59,9 +59,9 @@ public class Upgrade420to430 implements DbUpgrade { @Override public File[] getCleanupScripts() { - String script = Script.findScript("", "db/schema-420to430-cleanup.sql"); + String script = Script.findScript("", "db/schema-421to430-cleanup.sql"); if (script == null) { - throw new CloudRuntimeException("Unable to find db/schema-420to430-cleanup.sql"); + throw new CloudRuntimeException("Unable to find db/schema-421to430-cleanup.sql"); } return new File[] { new File(script) }; diff --git a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java index fb6962a60f1..5f5f01e4e10 100644 --- a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java +++ b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java @@ -36,6 +36,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreState import org.apache.cloudstack.engine.subsystem.api.storage.Scope; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; import org.apache.cloudstack.engine.subsystem.api.storage.StorageCacheManager; +import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority.Priority; import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope; @@ -123,14 +124,13 @@ AncientDataMotionStrategy implements DataMotionStrategy { ManagementService _mgmtServer; @Override - public boolean canHandle(DataObject srcData, DataObject destData) { - // TODO Auto-generated method stub - return true; + public Priority canHandle(DataObject srcData, DataObject destData) { + return Priority.DEFAULT; } @Override - public boolean canHandle(Map volumeMap, Host srcHost, Host destHost) { - return false; + public Priority canHandle(Map volumeMap, Host srcHost, Host destHost) { + return Priority.CANT_HANDLE; } protected boolean needCacheStorage(DataObject srcData, DataObject destData) { diff --git a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java index 9f0f5311a28..2d3132095e3 100644 --- a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java +++ b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java @@ -18,21 +18,25 @@ */ package org.apache.cloudstack.storage.motion; -import com.cloud.agent.api.to.VirtualMachineTO; -import com.cloud.host.Host; -import com.cloud.utils.exception.CloudRuntimeException; +import java.util.List; +import java.util.Map; + +import javax.inject.Inject; + import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; import org.apache.cloudstack.engine.subsystem.api.storage.DataMotionService; import org.apache.cloudstack.engine.subsystem.api.storage.DataMotionStrategy; import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority; +import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority.Priority; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.framework.async.AsyncCompletionCallback; import org.springframework.stereotype.Component; -import javax.inject.Inject; -import java.util.List; -import java.util.Map; +import com.cloud.agent.api.to.VirtualMachineTO; +import com.cloud.host.Host; +import com.cloud.utils.exception.CloudRuntimeException; @Component public class DataMotionServiceImpl implements DataMotionService { @@ -53,8 +57,10 @@ public class DataMotionServiceImpl implements DataMotionService { return; } + StrategyPriority.sortStrategies(strategies, srcData, destData); + for (DataMotionStrategy strategy : strategies) { - if (strategy.canHandle(srcData, destData)) { + if (strategy.canHandle(srcData, destData) != Priority.CANT_HANDLE) { strategy.copyAsync(srcData, destData, callback); return; } @@ -65,8 +71,11 @@ public class DataMotionServiceImpl implements DataMotionService { @Override public void copyAsync(Map volumeMap, VirtualMachineTO vmTo, Host srcHost, Host destHost, AsyncCompletionCallback callback) { + + StrategyPriority.sortStrategies(strategies, volumeMap, srcHost, destHost); + for (DataMotionStrategy strategy : strategies) { - if (strategy.canHandle(volumeMap, srcHost, destHost)) { + if (strategy.canHandle(volumeMap, srcHost, destHost) != Priority.CANT_HANDLE) { strategy.copyAsync(volumeMap, vmTo, srcHost, destHost, callback); return; } diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockStorageMotionStrategy.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockStorageMotionStrategy.java index 6c0bd556480..79ed61bc849 100644 --- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockStorageMotionStrategy.java +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockStorageMotionStrategy.java @@ -21,31 +21,30 @@ package org.apache.cloudstack.storage.test; import java.util.Map; import java.util.UUID; -import com.cloud.agent.api.to.DataObjectType; -import com.cloud.agent.api.to.DataTO; -import com.cloud.storage.Storage; import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; import org.apache.cloudstack.engine.subsystem.api.storage.DataMotionStrategy; import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority.Priority; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.framework.async.AsyncCompletionCallback; - -import com.cloud.agent.api.to.VirtualMachineTO; -import com.cloud.host.Host; import org.apache.cloudstack.storage.command.CopyCmdAnswer; -import org.apache.cloudstack.storage.snapshot.SnapshotObject; import org.apache.cloudstack.storage.to.SnapshotObjectTO; import org.apache.cloudstack.storage.to.TemplateObjectTO; +import com.cloud.agent.api.to.DataObjectType; +import com.cloud.agent.api.to.DataTO; +import com.cloud.agent.api.to.VirtualMachineTO; +import com.cloud.host.Host; +import com.cloud.storage.Storage; + public class MockStorageMotionStrategy implements DataMotionStrategy { boolean success = true; @Override - public boolean canHandle(DataObject srcData, DataObject destData) { - // TODO Auto-generated method stub - return true; + public Priority canHandle(DataObject srcData, DataObject destData) { + return Priority.HIGHEST; } public void makeBackupSnapshotSucceed(boolean success) { @@ -53,8 +52,8 @@ public class MockStorageMotionStrategy implements DataMotionStrategy { } @Override - public boolean canHandle(Map volumeMap, Host srcHost, Host destHost) { - return true; + public Priority canHandle(Map volumeMap, Host srcHost, Host destHost) { + return Priority.HIGHEST; } @Override diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/SnapshotTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/SnapshotTest.java index f1eed3a4b62..81f77d62429 100644 --- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/SnapshotTest.java +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/SnapshotTest.java @@ -400,8 +400,11 @@ public class SnapshotTest extends CloudStackTestNGBase { SnapshotVO snapshotVO = createSnapshotInDb(vol); SnapshotInfo snapshot = this.snapshotFactory.getSnapshot(snapshotVO.getId(), vol.getDataStore()); boolean result = false; + + StrategyPriority.sortStrategies(snapshotStrategies, snapshot); + for (SnapshotStrategy strategy : this.snapshotStrategies) { - if (strategy.canHandle(snapshot)) { + if (strategy.canHandle(snapshot) != Priority.CANT_HANDLE) { snapshot = strategy.takeSnapshot(snapshot); result = true; } @@ -422,8 +425,11 @@ public class SnapshotTest extends CloudStackTestNGBase { SnapshotVO snapshotVO = createSnapshotInDb(vol); SnapshotInfo snapshot = this.snapshotFactory.getSnapshot(snapshotVO.getId(), vol.getDataStore()); SnapshotInfo newSnapshot = null; + + StrategyPriority.sortStrategies(snapshotStrategies, newSnapshot); + for (SnapshotStrategy strategy : this.snapshotStrategies) { - if (strategy.canHandle(snapshot)) { + if (strategy.canHandle(snapshot) != Priority.CANT_HANDLE) { newSnapshot = strategy.takeSnapshot(snapshot); } } @@ -431,7 +437,7 @@ public class SnapshotTest extends CloudStackTestNGBase { // create another snapshot for (SnapshotStrategy strategy : this.snapshotStrategies) { - if (strategy.canHandle(snapshot)) { + if (strategy.canHandle(snapshot) != Priority.CANT_HANDLE) { strategy.deleteSnapshot(newSnapshot.getId()); } } @@ -444,8 +450,11 @@ public class SnapshotTest extends CloudStackTestNGBase { SnapshotVO snapshotVO = createSnapshotInDb(vol); SnapshotInfo snapshot = this.snapshotFactory.getSnapshot(snapshotVO.getId(), vol.getDataStore()); boolean result = false; + + StrategyPriority.sortStrategies(snapshotStrategies, snapshot); + for (SnapshotStrategy strategy : this.snapshotStrategies) { - if (strategy.canHandle(snapshot)) { + if (strategy.canHandle(snapshot) != Priority.CANT_HANDLE) { snapshot = strategy.takeSnapshot(snapshot); result = true; } @@ -467,15 +476,18 @@ public class SnapshotTest extends CloudStackTestNGBase { Mockito.when(epSelector.select(Matchers.any(DataObject.class), Matchers.any(DataObject.class))).thenReturn(remoteEp); } } - + @Test public void createSnapshot() throws InterruptedException, ExecutionException { VolumeInfo vol = createCopyBaseImage(); SnapshotVO snapshotVO = createSnapshotInDb(vol); SnapshotInfo snapshot = this.snapshotFactory.getSnapshot(snapshotVO.getId(), vol.getDataStore()); SnapshotInfo newSnapshot = null; + + StrategyPriority.sortStrategies(snapshotStrategies, newSnapshot); + for (SnapshotStrategy strategy : this.snapshotStrategies) { - if (strategy.canHandle(snapshot)) { + if (strategy.canHandle(snapshot) != Priority.CANT_HANDLE) { newSnapshot = strategy.takeSnapshot(snapshot); } } @@ -487,7 +499,7 @@ public class SnapshotTest extends CloudStackTestNGBase { try { for (SnapshotStrategy strategy : this.snapshotStrategies) { - if (strategy.canHandle(snapshot)) { + if (strategy.canHandle(snapshot) != Priority.CANT_HANDLE) { boolean res = strategy.deleteSnapshot(newSnapshot.getId()); Assert.assertTrue(res); } diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java index c09adcad12d..a4014b070e8 100644 --- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java @@ -42,6 +42,7 @@ import org.apache.cloudstack.framework.async.AsyncRpcContext; import org.apache.cloudstack.storage.command.CommandResult; import org.apache.cloudstack.storage.command.CopyCmdAnswer; import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; +import org.apache.cloudstack.storage.datastore.PrimaryDataStore; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao; import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO; @@ -132,6 +133,19 @@ public class SnapshotServiceImpl implements SnapshotService { } + static private class RevertSnapshotContext extends AsyncRpcContext { + final SnapshotInfo snapshot; + final AsyncCallFuture future; + + public RevertSnapshotContext(AsyncCompletionCallback callback, SnapshotInfo snapshot, + AsyncCallFuture future) { + super(callback); + this.snapshot = snapshot; + this.future = future; + } + + } + protected Void createSnapshotAsyncCallback(AsyncCallbackDispatcher callback, CreateSnapshotContext context) { CreateCmdResult result = callback.getResult(); @@ -364,6 +378,28 @@ public class SnapshotServiceImpl implements SnapshotService { return null; } + protected Void revertSnapshotCallback(AsyncCallbackDispatcher callback, + RevertSnapshotContext context) { + + CommandResult result = callback.getResult(); + AsyncCallFuture future = context.future; + SnapshotResult res = null; + try { + if (result.isFailed()) { + s_logger.debug("revert snapshot failed" + result.getResult()); + res = new SnapshotResult(context.snapshot, null); + res.setResult(result.getResult()); + } else { + res = new SnapshotResult(context.snapshot, null); + } + } catch (Exception e) { + s_logger.debug("Failed to in revertSnapshotCallback", e); + res.setResult(e.toString()); + } + future.complete(res); + return null; + } + @Override public boolean deleteSnapshot(SnapshotInfo snapInfo) { snapInfo.processEvent(ObjectInDataStoreStateMachine.Event.DestroyRequested); @@ -394,6 +430,29 @@ public class SnapshotServiceImpl implements SnapshotService { @Override public boolean revertSnapshot(Long snapshotId) { + SnapshotInfo snapshot = snapshotfactory.getSnapshot(snapshotId, DataStoreRole.Primary); + PrimaryDataStore store = (PrimaryDataStore)snapshot.getDataStore(); + + AsyncCallFuture future = new AsyncCallFuture(); + RevertSnapshotContext context = new RevertSnapshotContext(null, snapshot, future); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().revertSnapshotCallback(null, null)).setContext(context); + + ((PrimaryDataStoreDriver)store.getDriver()).revertSnapshot(snapshot, caller); + + SnapshotResult result = null; + try { + result = future.get(); + if (result.isFailed()) { + throw new CloudRuntimeException(result.getResult()); + } + return true; + } catch (InterruptedException e) { + s_logger.debug("revert snapshot is failed: " + e.toString()); + } catch (ExecutionException e) { + s_logger.debug("revert snapshot is failed: " + e.toString()); + } + return false; } diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java index aae4cde115a..6a874d67b8b 100644 --- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java @@ -26,6 +26,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotResult; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotService; +import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.storage.command.CreateObjectAnswer; @@ -309,7 +310,7 @@ public class XenserverSnapshotStrategy extends SnapshotStrategyBase { } @Override - public boolean canHandle(Snapshot snapshot) { - return true; + public StrategyPriority.Priority canHandle(Snapshot snapshot) { + return StrategyPriority.Priority.DEFAULT; } } diff --git a/plugins/hypervisors/kvm/agent-descriptor.xml b/plugins/hypervisors/kvm/agent-descriptor.xml deleted file mode 100644 index 2923c58d141..00000000000 --- a/plugins/hypervisors/kvm/agent-descriptor.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - kvm-agent - - zip - - true - - - - - - - - - ../../../agent/scripts - - 774 - - run.sh - _run.sh - agent.sh - - - - target - - 555 - - cloud-plugin-hypervisor-kvm-*.jar - - - - ../../../scripts - scripts - 555 - - - ../../../agent/conf - conf - 555 - 774 - - agent.properties - log4j-cloud.xml - - - - diff --git a/plugins/hypervisors/kvm/pom.xml b/plugins/hypervisors/kvm/pom.xml index 024cafe834c..e2796218985 100644 --- a/plugins/hypervisors/kvm/pom.xml +++ b/plugins/hypervisors/kvm/pom.xml @@ -87,52 +87,6 @@ - - maven-assembly-plugin - 2.3 - - kvm-agent - false - - agent-descriptor.xml - - - - - make-agent - package - - single - - - - - - maven-resources-plugin - 2.6 - - - copy-resources - - package - - copy-resources - - - dist - - - target - - kvm-agent.zip - - - - - - - - diff --git a/plugins/hypervisors/simulator/src/org/apache/cloudstack/storage/motion/SimulatorDataMotionStrategy.java b/plugins/hypervisors/simulator/src/org/apache/cloudstack/storage/motion/SimulatorDataMotionStrategy.java index 05b3e6bc99b..74868c44515 100644 --- a/plugins/hypervisors/simulator/src/org/apache/cloudstack/storage/motion/SimulatorDataMotionStrategy.java +++ b/plugins/hypervisors/simulator/src/org/apache/cloudstack/storage/motion/SimulatorDataMotionStrategy.java @@ -18,22 +18,28 @@ */ package org.apache.cloudstack.storage.motion; -import com.cloud.agent.api.to.VirtualMachineTO; -import com.cloud.host.Host; -import org.apache.cloudstack.engine.subsystem.api.storage.*; +import java.util.Map; + +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataMotionStrategy; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority.Priority; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.framework.async.AsyncCompletionCallback; -import java.util.Map; +import com.cloud.agent.api.to.VirtualMachineTO; +import com.cloud.host.Host; public class SimulatorDataMotionStrategy implements DataMotionStrategy { @Override - public boolean canHandle(DataObject srcData, DataObject destData) { - return true; + public Priority canHandle(DataObject srcData, DataObject destData) { + return Priority.HYPERVISOR; } @Override - public boolean canHandle(Map volumeMap, Host srcHost, Host destHost) { - return true; + public Priority canHandle(Map volumeMap, Host srcHost, Host destHost) { + return Priority.HYPERVISOR; } @Override diff --git a/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java b/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java index bdba61ba028..f5f23a2b4e0 100644 --- a/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java +++ b/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java @@ -21,12 +21,14 @@ package org.apache.cloudstack.storage.motion; import java.util.HashMap; import java.util.Map; + import javax.inject.Inject; import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; import org.apache.cloudstack.engine.subsystem.api.storage.DataMotionStrategy; import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority.Priority; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.framework.async.AsyncCompletionCallback; @@ -62,17 +64,17 @@ public class VmwareStorageMotionStrategy implements DataMotionStrategy { @Inject VMInstanceDao instanceDao; @Override - public boolean canHandle(DataObject srcData, DataObject destData) { - return false; + public Priority canHandle(DataObject srcData, DataObject destData) { + return Priority.CANT_HANDLE; } @Override - public boolean canHandle(Map volumeMap, Host srcHost, Host destHost) { + public Priority canHandle(Map volumeMap, Host srcHost, Host destHost) { if (srcHost.getHypervisorType() == HypervisorType.VMware && destHost.getHypervisorType() == HypervisorType.VMware) { s_logger.debug(this.getClass() + " can handle the request because the hosts have VMware hypervisor"); - return true; + return Priority.HYPERVISOR; } - return false; + return Priority.CANT_HANDLE; } @Override diff --git a/plugins/hypervisors/vmware/test/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategyTest.java b/plugins/hypervisors/vmware/test/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategyTest.java index b3ea5d53269..c19480c2c59 100644 --- a/plugins/hypervisors/vmware/test/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategyTest.java +++ b/plugins/hypervisors/vmware/test/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategyTest.java @@ -16,13 +16,6 @@ // under the License. package org.apache.cloudstack.storage.motion; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.isA; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -32,6 +25,7 @@ import javax.naming.ConfigurationException; import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority.Priority; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.framework.async.AsyncCallFuture; @@ -69,6 +63,14 @@ import com.cloud.utils.component.ComponentContext; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.dao.VMInstanceDao; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import static org.mockito.Matchers.anyLong; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(loader = AnnotationConfigContextLoader.class) public class VmwareStorageMotionStrategyTest { @@ -98,8 +100,8 @@ public class VmwareStorageMotionStrategyTest { when(srcHost.getHypervisorType()).thenReturn(HypervisorType.VMware); when(destHost.getHypervisorType()).thenReturn(HypervisorType.VMware); Map volumeMap = new HashMap(); - boolean canHandle = strategy.canHandle(volumeMap, srcHost, destHost); - assertTrue("The strategy is only supposed to handle vmware hosts", canHandle); + Priority canHandle = strategy.canHandle(volumeMap, srcHost, destHost); + assertTrue("The strategy is only supposed to handle vmware hosts", canHandle == Priority.HYPERVISOR); } @Test @@ -109,8 +111,8 @@ public class VmwareStorageMotionStrategyTest { when(srcHost.getHypervisorType()).thenReturn(HypervisorType.XenServer); when(destHost.getHypervisorType()).thenReturn(HypervisorType.XenServer); Map volumeMap = new HashMap(); - boolean canHandle = strategy.canHandle(volumeMap, srcHost, destHost); - assertFalse("The strategy is only supposed to handle vmware hosts", canHandle); + Priority canHandle = strategy.canHandle(volumeMap, srcHost, destHost); + assertFalse("The strategy is only supposed to handle vmware hosts", canHandle == Priority.HYPERVISOR); } @Test @@ -231,8 +233,8 @@ public class VmwareStorageMotionStrategyTest { @Configuration @ComponentScan(basePackageClasses = { VmwareStorageMotionStrategy.class }, - includeFilters = {@Filter(value = TestConfiguration.Library.class, type = FilterType.CUSTOM)}, - useDefaultFilters = false) + includeFilters = {@Filter(value = TestConfiguration.Library.class, type = FilterType.CUSTOM)}, + useDefaultFilters = false) public static class TestConfiguration extends SpringUtils.CloudStackTestConfiguration { @Bean diff --git a/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java b/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java index c796b691d8d..8578a9aa46c 100644 --- a/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java +++ b/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java @@ -24,18 +24,18 @@ import java.util.Map; import javax.inject.Inject; -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; import org.apache.cloudstack.engine.subsystem.api.storage.DataMotionStrategy; import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority.Priority; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.framework.async.AsyncCompletionCallback; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.to.VolumeObjectTO; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -71,18 +71,18 @@ public class XenServerStorageMotionStrategy implements DataMotionStrategy { @Inject VMInstanceDao instanceDao; @Override - public boolean canHandle(DataObject srcData, DataObject destData) { - return false; + public Priority canHandle(DataObject srcData, DataObject destData) { + return Priority.CANT_HANDLE; } @Override - public boolean canHandle(Map volumeMap, Host srcHost, Host destHost) { - boolean canHandle = false; + public Priority canHandle(Map volumeMap, Host srcHost, Host destHost) { if (srcHost.getHypervisorType() == HypervisorType.XenServer && destHost.getHypervisorType() == HypervisorType.XenServer) { - canHandle = true; + return Priority.HYPERVISOR; } - return canHandle; + + return Priority.CANT_HANDLE; } @Override diff --git a/scripts/vm/hypervisor/xenserver/xcposs/vmops b/scripts/vm/hypervisor/xenserver/xcposs/vmops index c5a9f943b51..20725e4ec85 100644 --- a/scripts/vm/hypervisor/xenserver/xcposs/vmops +++ b/scripts/vm/hypervisor/xenserver/xcposs/vmops @@ -1389,6 +1389,9 @@ def setDNATRule(session, args): @echo def createISOVHD(session, args): + # Should not create the VDI if the systemvm.iso does not exist + if not os.path.exists('/usr/share/xcp/packages/iso/systemvm.iso'): + return "Failed" #hack for XCP on ubuntu 12.04, as can't attach iso to a vm vdis = session.xenapi.VDI.get_by_name_label("systemvm-vdi"); util.SMlog(vdis) diff --git a/server/src/com/cloud/api/query/vo/AccountJoinVO.java b/server/src/com/cloud/api/query/vo/AccountJoinVO.java index fbcc9342b22..2ec45d3f7e0 100644 --- a/server/src/com/cloud/api/query/vo/AccountJoinVO.java +++ b/server/src/com/cloud/api/query/vo/AccountJoinVO.java @@ -17,17 +17,20 @@ package com.cloud.api.query.vo; import java.util.Date; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.Table; -import com.cloud.user.Account.State; -import com.cloud.utils.db.GenericDao; + import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.user.Account.State; +import com.cloud.utils.db.GenericDao; + @Entity @Table(name="account_view") public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Identity { @@ -45,7 +48,6 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident @Column(name="type") private short type; - @Column(name="state") @Enumerated(value=EnumType.STRING) private State state; @@ -59,7 +61,6 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident @Column(name="network_domain") private String networkDomain; - @Column(name="domain_id") private long domainId; @@ -72,7 +73,6 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident @Column(name="domain_path") private String domainPath = null; - @Column(name="data_center_id") private long dataCenterId; @@ -94,7 +94,6 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident @Column(name="vmTotal") private Long vmTotal; - @Column(name="ipLimit") private Long ipLimit; @@ -134,42 +133,36 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident @Column(name="projectTotal") private Long projectTotal; - @Column(name="networkLimit") private Long networkLimit; @Column(name="networkTotal") private Long networkTotal; - @Column(name="vpcLimit") private Long vpcLimit; @Column(name="vpcTotal") private Long vpcTotal; - @Column(name="cpuLimit") private Long cpuLimit; @Column(name="cpuTotal") private Long cpuTotal; - @Column(name="memoryLimit") private Long memoryLimit; @Column(name="memoryTotal") private Long memoryTotal; - @Column(name="primaryStorageLimit") private Long primaryStorageLimit; @Column(name="primaryStorageTotal") private Long primaryStorageTotal; - @Column(name="secondaryStorageLimit") private Long secondaryStorageLimit; @@ -184,504 +177,204 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident @Column(name="job_status") private int jobStatus; - + @Column(name = "default") boolean isDefault; public AccountJoinVO() { } - @Override public long getId() { return id; } - - @Override - public void setId(long id) { - this.id = id; - } - - @Override public String getUuid() { return uuid; } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getAccountName() { return accountName; } - - public void setAccountName(String accountName) { - this.accountName = accountName; - } - - public short getType() { return type; } - - public void setType(short type) { - this.type = type; - } - - public State getState() { return state; } - - public void setState(State state) { - this.state = state; - } - - public Date getRemoved() { return removed; } - - public void setRemoved(Date removed) { - this.removed = removed; - } - - public boolean isNeedsCleanup() { return needsCleanup; } - - public void setNeedsCleanup(boolean needsCleanup) { - this.needsCleanup = needsCleanup; - } - - public String getNetworkDomain() { return networkDomain; } - - public void setNetworkDomain(String networkDomain) { - this.networkDomain = networkDomain; - } - - public long getDomainId() { return domainId; } - - public void setDomainId(long domainId) { - this.domainId = domainId; - } - - public String getDomainUuid() { return domainUuid; } - - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - - public String getDomainName() { return domainName; } - - public void setDomainName(String domainName) { - this.domainName = domainName; - } - - public String getDomainPath() { return domainPath; } - - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - - public long getDataCenterId() { return dataCenterId; } - - public void setDataCenterId(long dataCenterId) { - this.dataCenterId = dataCenterId; - } - - public String getDataCenterUuid() { return dataCenterUuid; } - - public void setDataCenterUuid(String dataCenterUuid) { - this.dataCenterUuid = dataCenterUuid; - } - - public String getDataCenterName() { return dataCenterName; } - - public void setDataCenterName(String dataCenterName) { - this.dataCenterName = dataCenterName; - } - - public Long getBytesReceived() { return bytesReceived; } - - public void setBytesReceived(Long bytesReceived) { - this.bytesReceived = bytesReceived; - } - - public Long getBytesSent() { return bytesSent; } - - public void setBytesSent(Long bytesSent) { - this.bytesSent = bytesSent; - } - - - - public Long getVmTotal() { return vmTotal; } - - public void setVmTotal(Long vmTotal) { - this.vmTotal = vmTotal; - } - - - - - public Long getIpTotal() { return ipTotal; } - - public void setIpTotal(Long ipTotal) { - this.ipTotal = ipTotal; - } - - public Long getIpFree() { return ipFree; } - - public void setIpFree(Long ipFree) { - this.ipFree = ipFree; - } - - - public Long getVolumeTotal() { return volumeTotal; } - - public void setVolumeTotal(Long volumeTotal) { - this.volumeTotal = volumeTotal; - } - - - public Long getSnapshotTotal() { return snapshotTotal; } - - public void setSnapshotTotal(Long snapshotTotal) { - this.snapshotTotal = snapshotTotal; - } - - - - public Long getTemplateTotal() { return templateTotal; } - - public void setTemplateTotal(Long templateTotal) { - this.templateTotal = templateTotal; - } - - public Integer getVmStopped() { return vmStopped; } - - public void setVmStopped(Integer vmStopped) { - this.vmStopped = vmStopped; - } - - public Integer getVmRunning() { return vmRunning; } - - public void setVmRunning(Integer vmRunning) { - this.vmRunning = vmRunning; - } - - - public Long getProjectTotal() { return projectTotal; } - - public void setProjectTotal(Long projectTotal) { - this.projectTotal = projectTotal; - } - - - public Long getNetworkTotal() { return networkTotal; } - - public void setNetworkTotal(Long networkTotal) { - this.networkTotal = networkTotal; - } - - public Long getVpcTotal() { return vpcTotal; } - - public void setVpcTotal(Long vpcTotal) { - this.vpcTotal = vpcTotal; - } - - public Long getCpuTotal() { return cpuTotal; } - - public void setCpuTotal(Long cpuTotal) { - this.cpuTotal = cpuTotal; - } - - public Long getMemoryTotal() { return memoryTotal; } - - public void setMemoryTotal(Long memoryTotal) { - this.memoryTotal = memoryTotal; - } - - public Long getPrimaryStorageTotal() { return primaryStorageTotal; } - - public void setPrimaryStorageTotal(Long primaryStorageTotal) { - this.primaryStorageTotal = primaryStorageTotal; - } - public Long getSecondaryStorageTotal() { return secondaryStorageTotal; } - - public void setSecondaryStorageTotal(Long secondaryStorageTotal) { - this.secondaryStorageTotal = secondaryStorageTotal; - } - - public Long getVmLimit() { return vmLimit; } - - public void setVmLimit(Long vmLimit) { - this.vmLimit = vmLimit; - } - - public Long getIpLimit() { return ipLimit; } - - public void setIpLimit(Long ipLimit) { - this.ipLimit = ipLimit; - } - - public Long getVolumeLimit() { return volumeLimit; } - - public void setVolumeLimit(Long volumeLimit) { - this.volumeLimit = volumeLimit; - } - - public Long getSnapshotLimit() { return snapshotLimit; } - - public void setSnapshotLimit(Long snapshotLimit) { - this.snapshotLimit = snapshotLimit; - } - - public Long getTemplateLimit() { return templateLimit; } - - public void setTemplateLimit(Long templateLimit) { - this.templateLimit = templateLimit; - } - - public Long getProjectLimit() { return projectLimit; } - - public void setProjectLimit(Long projectLimit) { - this.projectLimit = projectLimit; - } - - public Long getNetworkLimit() { return networkLimit; } - - public void setNetworkLimit(Long networkLimit) { - this.networkLimit = networkLimit; - } - - public Long getVpcLimit() { return vpcLimit; } - - public void setVpcLimit(Long vpcLimit) { - this.vpcLimit = vpcLimit; - } - - public Long getCpuLimit() { return cpuLimit; } - - public void setCpuLimit(Long cpuLimit) { - this.cpuLimit = cpuLimit; - } - - public Long getMemoryLimit() { return memoryLimit; } - - public void setMemoryLimit(Long memoryLimit) { - this.memoryLimit = memoryLimit; - } - - public Long getPrimaryStorageLimit() { return primaryStorageLimit; } - - public void setPrimaryStorageLimit(Long primaryStorageLimit) { - this.primaryStorageLimit = primaryStorageLimit; - } - - public Long getSecondaryStorageLimit() { return secondaryStorageLimit; } - - public void setSecondaryStorageLimit(Long secondaryStorageLimit) { - this.secondaryStorageLimit = secondaryStorageLimit; - } - - public Long getJobId() { return jobId; } - - public void setJobId(Long jobId) { - this.jobId = jobId; - } - - public String getJobUuid() { return jobUuid; } - - public void setJobUuid(String jobUuid) { - this.jobUuid = jobUuid; - } - - public int getJobStatus() { return jobStatus; } - - public void setJobStatus(int jobStatus) { - this.jobStatus = jobStatus; - } - - public boolean isDefault() { return isDefault; } - - - public void setDefault(boolean isDefault) { - this.isDefault = isDefault; - } - } diff --git a/server/src/com/cloud/api/query/vo/AffinityGroupJoinVO.java b/server/src/com/cloud/api/query/vo/AffinityGroupJoinVO.java index ae63a8a6627..3710957cbec 100644 --- a/server/src/com/cloud/api/query/vo/AffinityGroupJoinVO.java +++ b/server/src/com/cloud/api/query/vo/AffinityGroupJoinVO.java @@ -91,7 +91,6 @@ public class AffinityGroupJoinVO extends BaseViewVO implements ControlledViewEnt @Enumerated(value = EnumType.STRING) ControlledEntity.ACLType aclType; - public AffinityGroupJoinVO() { } @@ -100,157 +99,83 @@ public class AffinityGroupJoinVO extends BaseViewVO implements ControlledViewEnt return id; } - @Override - public void setId(long id) { - this.id = id; - } - @Override public String getUuid() { return uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getName() { return name; } - public void setName(String name) { - this.name = name; - } - public String getType() { return type; } - public void setType(String type) { - this.type = type; - } - @Override public long getAccountId() { return accountId; } - public void setAccountId(long accountId) { - this.accountId = accountId; - } - @Override public String getAccountUuid() { return accountUuid; } - public void setAccountUuid(String accountUuid) { - this.accountUuid = accountUuid; - } - @Override public String getAccountName() { return accountName; } - public void setAccountName(String accountName) { - this.accountName = accountName; - } - @Override public short getAccountType() { return accountType; } - public void setAccountType(short accountType) { - this.accountType = accountType; - } - @Override public long getDomainId() { return domainId; } - public void setDomainId(long domainId) { - this.domainId = domainId; - } - @Override public String getDomainUuid() { return domainUuid; } - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - @Override public String getDomainName() { return domainName; } - public void setDomainName(String domainName) { - this.domainName = domainName; - } - @Override public String getDomainPath() { return domainPath; } - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - public String getDescription() { return description; } - public void setDescription(String description) { - this.description = description; - } - public long getVmId() { return vmId; } - public void setVmId(long vmId) { - this.vmId = vmId; - } - public String getVmUuid() { return vmUuid; } - public void setVmUuid(String vmUuid) { - this.vmUuid = vmUuid; - } - public String getVmName() { return vmName; } - public void setVmName(String vmName) { - this.vmName = vmName; - } - public String getVmDisplayName() { return vmDisplayName; } - public void setVmDisplayName(String vmDisplayName) { - this.vmDisplayName = vmDisplayName; - } - public VirtualMachine.State getVmState() { return vmState; } - public void setVmState(VirtualMachine.State vmState) { - this.vmState = vmState; - } - @Override public String getProjectUuid() { // TODO Auto-generated method stub @@ -267,9 +192,5 @@ public class AffinityGroupJoinVO extends BaseViewVO implements ControlledViewEnt return aclType; } - public void setAclType(ControlledEntity.ACLType aclType) { - this.aclType = aclType; - } - } diff --git a/server/src/com/cloud/api/query/vo/AsyncJobJoinVO.java b/server/src/com/cloud/api/query/vo/AsyncJobJoinVO.java index c45be1cc642..a30e253f4d5 100644 --- a/server/src/com/cloud/api/query/vo/AsyncJobJoinVO.java +++ b/server/src/com/cloud/api/query/vo/AsyncJobJoinVO.java @@ -17,6 +17,7 @@ package com.cloud.api.query.vo; import java.util.Date; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; @@ -24,12 +25,12 @@ import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.Table; -import com.cloud.utils.db.GenericDao; - import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.utils.db.GenericDao; + @Entity @Table(name="async_job_view") public class AsyncJobJoinVO extends BaseViewVO implements InternalIdentity, Identity { @@ -53,7 +54,6 @@ public class AsyncJobJoinVO extends BaseViewVO implements InternalIdentity, Iden @Column(name="account_type") private short accountType; - @Column(name="domain_id") private long domainId; @@ -66,7 +66,6 @@ public class AsyncJobJoinVO extends BaseViewVO implements InternalIdentity, Iden @Column(name="domain_path") private String domainPath = null; - @Column(name="user_id") private long userId; @@ -104,231 +103,96 @@ public class AsyncJobJoinVO extends BaseViewVO implements InternalIdentity, Iden @Column(name="instance_uuid") private String instanceUuid; - public AsyncJobJoinVO() { } - @Override public long getId() { return id; } - - @Override - public void setId(long id) { - this.id = id; - } - - @Override public String getUuid() { return uuid; } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public long getAccountId() { return accountId; } - - public void setAccountId(long accountId) { - this.accountId = accountId; - } - - public String getAccountUuid() { return accountUuid; } - - public void setAccountUuid(String accountUuid) { - this.accountUuid = accountUuid; - } - - public String getAccountName() { return accountName; } - - public void setAccountName(String accountName) { - this.accountName = accountName; - } - - public short getAccountType() { return accountType; } - - public void setAccountType(short accountType) { - this.accountType = accountType; - } - - public long getDomainId() { return domainId; } - - public void setDomainId(long domainId) { - this.domainId = domainId; - } - - public String getDomainUuid() { return domainUuid; } - - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - - public String getDomainName() { return domainName; } - - public void setDomainName(String domainName) { - this.domainName = domainName; - } - - public String getDomainPath() { return domainPath; } - - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - - public long getUserId() { return userId; } - - public void setUserId(long userId) { - this.userId = userId; - } - - public String getUserUuid() { return userUuid; } - - public void setUserUuid(String userUuid) { - this.userUuid = userUuid; - } - - public String getCmd() { return cmd; } - - public void setCmd(String cmd) { - this.cmd = cmd; - } - - public int getStatus() { return status; } - - public void setStatus(int status) { - this.status = status; - } - - public int getProcessStatus() { return processStatus; } - - public void setProcessStatus(int processStatus) { - this.processStatus = processStatus; - } - - public int getResultCode() { return resultCode; } - - public void setResultCode(int resultCode) { - this.resultCode = resultCode; - } - - public String getResult() { return result; } - - public void setResult(String result) { - this.result = result; - } - - public Date getCreated() { return created; } - - public void setCreated(Date created) { - this.created = created; - } - - public Date getRemoved() { return removed; } - - public void setRemoved(Date removed) { - this.removed = removed; - } - - public ApiCommandJobType getInstanceType() { return instanceType; } - - public void setInstanceType(ApiCommandJobType instanceType) { - this.instanceType = instanceType; - } - - public Long getInstanceId() { return instanceId; } - - public void setInstanceId(Long instanceId) { - this.instanceId = instanceId; - } - - public String getInstanceUuid() { return instanceUuid; } - - - public void setInstanceUuid(String instanceUuid) { - this.instanceUuid = instanceUuid; - } - } diff --git a/server/src/com/cloud/api/query/vo/BaseViewVO.java b/server/src/com/cloud/api/query/vo/BaseViewVO.java index 6b1ddd6561a..923bfd95dcf 100644 --- a/server/src/com/cloud/api/query/vo/BaseViewVO.java +++ b/server/src/com/cloud/api/query/vo/BaseViewVO.java @@ -20,9 +20,6 @@ public abstract class BaseViewVO { public abstract long getId(); - public abstract void setId(long id); - - @Override public int hashCode() { final int prime = 31; diff --git a/server/src/com/cloud/api/query/vo/DataCenterJoinVO.java b/server/src/com/cloud/api/query/vo/DataCenterJoinVO.java index c6a80e7d5b2..70fc35db837 100644 --- a/server/src/com/cloud/api/query/vo/DataCenterJoinVO.java +++ b/server/src/com/cloud/api/query/vo/DataCenterJoinVO.java @@ -25,13 +25,13 @@ import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.Table; +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.dc.DataCenter.NetworkType; import com.cloud.org.Grouping.AllocationState; import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.Identity; -import org.apache.cloudstack.api.InternalIdentity; - @Entity @Table(name="data_center_view") public class DataCenterJoinVO extends BaseViewVO implements InternalIdentity, Identity { @@ -117,7 +117,6 @@ public class DataCenterJoinVO extends BaseViewVO implements InternalIdentity, Id @Column(name = "account_id") private long accountId; - public DataCenterJoinVO() { } @@ -126,191 +125,94 @@ public class DataCenterJoinVO extends BaseViewVO implements InternalIdentity, Id return id; } - @Override - public void setId(long id) { - this.id = id; - } - @Override public String getUuid() { return uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; - } - public String getName() { return name; } - public void setName(String name) { - this.name = name; - } - - - public String getDescription() { return description; } - public void setDescription(String description) { - this.description = description; - } - public String getDns1() { return dns1; } - public void setDns1(String dns1) { - this.dns1 = dns1; - } - public String getDns2() { return dns2; } - public void setDns2(String dns2) { - this.dns2 = dns2; - } - public String getInternalDns1() { return internalDns1; } - public void setInternalDns1(String internalDns1) { - this.internalDns1 = internalDns1; - } - public String getInternalDns2() { return internalDns2; } - public void setInternalDns2(String internalDns2) { - this.internalDns2 = internalDns2; - } - public String getGuestNetworkCidr() { return guestNetworkCidr; } - public void setGuestNetworkCidr(String guestNetworkCidr) { - this.guestNetworkCidr = guestNetworkCidr; - } - public String getDomain() { return domain; } - public void setDomain(String domain) { - this.domain = domain; - } - public NetworkType getNetworkType() { return networkType; } - public void setNetworkType(NetworkType networkType) { - this.networkType = networkType; - } - public String getDhcpProvider() { return dhcpProvider; } - public void setDhcpProvider(String dhcpProvider) { - this.dhcpProvider = dhcpProvider; - } - public String getZoneToken() { return zoneToken; } - public void setZoneToken(String zoneToken) { - this.zoneToken = zoneToken; - } - public AllocationState getAllocationState() { return allocationState; } - public void setAllocationState(AllocationState allocationState) { - this.allocationState = allocationState; - } - public boolean isSecurityGroupEnabled() { return securityGroupEnabled; } - public void setSecurityGroupEnabled(boolean securityGroupEnabled) { - this.securityGroupEnabled = securityGroupEnabled; - } - - public boolean isLocalStorageEnabled() { return localStorageEnabled; } - public void setLocalStorageEnabled(boolean localStorageEnabled) { - this.localStorageEnabled = localStorageEnabled; - } - public Date getRemoved() { return removed; } - public void setRemoved(Date removed) { - this.removed = removed; - } - public long getDomainId() { return domainId; } - public void setDomainId(long domainId) { - this.domainId = domainId; - } - public String getDomainUuid() { return domainUuid; } - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - public String getDomainName() { return domainName; } - public void setDomainName(String domainName) { - this.domainName = domainName; - } - public String getDomainPath() { return domainPath; } - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; + public String getIp6Dns1() { + return ip6Dns1; } - public String getIp6Dns1() { - return ip6Dns1; - } - - public void setIp6Dns1(String ip6Dns1) { - this.ip6Dns1 = ip6Dns1; - } - - public String getIp6Dns2() { - return ip6Dns2; - } - - public void setIp6Dns2(String ip6Dns2) { - this.ip6Dns2 = ip6Dns2; - } - + public String getIp6Dns2() { + return ip6Dns2; + } public String getAffinityGroupUuid() { return affinityGroupUuid; @@ -319,8 +221,4 @@ public class DataCenterJoinVO extends BaseViewVO implements InternalIdentity, Id public long getAccountId() { return accountId; } - - public void setAccountId(long accountId) { - this.accountId = accountId; - } } diff --git a/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java b/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java index 58e8370644c..9a679de1f25 100644 --- a/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java +++ b/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java @@ -23,12 +23,12 @@ import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; -import com.cloud.storage.DiskOfferingVO.Type; -import com.cloud.utils.db.GenericDao; - import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.storage.DiskOfferingVO.Type; +import com.cloud.utils.db.GenericDao; + @Entity @Table(name="disk_offering_view") public class DiskOfferingJoinVO extends BaseViewVO implements InternalIdentity, Identity { @@ -109,7 +109,6 @@ public class DiskOfferingJoinVO extends BaseViewVO implements InternalIdentity, @Column(name="display_offering") boolean displayOffering; - public DiskOfferingJoinVO() { } @@ -118,202 +117,100 @@ public class DiskOfferingJoinVO extends BaseViewVO implements InternalIdentity, return id; } - @Override - public void setId(long id) { - this.id = id; - } - @Override public String getUuid() { return uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; - } - public String getName() { return name; } - public void setName(String name) { - this.name = name; - } - public String getDisplayText() { return displayText; } - public void setDisplayText(String displayText) { - this.displayText = displayText; - } - public long getDiskSize() { return diskSize; } - public void setDiskSize(long diskSize) { - this.diskSize = diskSize; - } - public String getTags() { return tags; } - public void setTags(String tags) { - this.tags = tags; - } - public boolean isUseLocalStorage() { return useLocalStorage; } - public void setUseLocalStorage(boolean useLocalStorage) { - this.useLocalStorage = useLocalStorage; - } - public boolean isSystemUse() { return systemUse; } - public void setSystemUse(boolean systemUse) { - this.systemUse = systemUse; - } - public boolean isCustomized() { return customized; } - public void setCustomized(boolean customized) { - this.customized = customized; - } - public Boolean isCustomizedIops() { return customizedIops; } - public void setCustomizedIops(Boolean customizedIops) { - this.customizedIops = customizedIops; - } - public Long getMinIops() { return minIops; } - public void setMinIops(Long minIops) { - this.minIops = minIops; - } - public Long getMaxIops() { return maxIops; } - public void setMaxIops(Long maxIops) { - this.maxIops = maxIops; - } - public boolean isDisplayOffering() { return displayOffering; } - public void setDisplayOffering(boolean displayOffering) { - this.displayOffering = displayOffering; - } - public Date getCreated() { return created; } - public void setCreated(Date created) { - this.created = created; - } - public Date getRemoved() { return removed; } - public void setRemoved(Date removed) { - this.removed = removed; - } - public long getDomainId() { return domainId; } - public void setDomainId(long domainId) { - this.domainId = domainId; - } - public String getDomainUuid() { return domainUuid; } - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - public String getDomainName() { return domainName; } - public void setDomainName(String domainName) { - this.domainName = domainName; - } - public String getDomainPath() { return domainPath; } - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - public int getSortKey() { return sortKey; } - public void setSortKey(int sortKey) { - this.sortKey = sortKey; - } - public Type getType() { return type; } - public void setType(Type type) { - this.type = type; - } - - public void setBytesReadRate(Long bytesReadRate) { - this.bytesReadRate = bytesReadRate; - } - public Long getBytesReadRate() { return bytesReadRate; } - public void setBytesWriteRate(Long bytesWriteRate) { - this.bytesWriteRate = bytesWriteRate; - } - public Long getBytesWriteRate() { return bytesWriteRate; } - public void setIopsReadRate(Long iopsReadRate) { - this.iopsReadRate = iopsReadRate; - } - public Long getIopsReadRate() { return iopsReadRate; } - public void setIopsWriteRate(Long iopsWriteRate) { - this.iopsWriteRate = iopsWriteRate; - } - public Long getIopsWriteRate() { return iopsWriteRate; } - } diff --git a/server/src/com/cloud/api/query/vo/DomainRouterJoinVO.java b/server/src/com/cloud/api/query/vo/DomainRouterJoinVO.java index bfe44869b2a..33865e258b9 100644 --- a/server/src/com/cloud/api/query/vo/DomainRouterJoinVO.java +++ b/server/src/com/cloud/api/query/vo/DomainRouterJoinVO.java @@ -44,7 +44,6 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti @Column(name="name", updatable=false, nullable=false, length=255) private String name = null; - @Column(name="account_id") private long accountId; @@ -138,7 +137,6 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti @Column(name="service_offering_name") private String serviceOfferingName; - @Column(name = "vpc_id") private long vpcId; @@ -197,7 +195,6 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti @Enumerated(value=EnumType.STRING) private TrafficType trafficType; - @Column(name="project_id") private long projectId; @@ -216,7 +213,6 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti @Column(name="job_status") private int jobStatus; - @Column(name="uuid") private String uuid; @@ -236,772 +232,275 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti @Column(name="guest_type") @Enumerated(value=EnumType.STRING) private GuestType guestType; - + @Column(name="role") @Enumerated(value=EnumType.STRING) private VirtualRouter.Role role; - public DomainRouterJoinVO() { } - @Override public long getId() { return id; } - - @Override - public void setId(long id) { - this.id = id; - - } - - - - @Override public String getUuid() { return uuid; } - - - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - - public String getName() { return name; } - - public void setName(String name) { - this.name = name; - } - - - - @Override public long getAccountId() { return accountId; } - - public void setAccountId(long accountId) { - this.accountId = accountId; - } - - @Override public String getAccountUuid() { return accountUuid; } - - - - public void setAccountUuid(String accountUuid) { - this.accountUuid = accountUuid; - } - - - - @Override public String getAccountName() { return accountName; } - - public void setAccountName(String accountName) { - this.accountName = accountName; - } - - @Override public short getAccountType() { return accountType; } - - public void setAccountType(short accountType) { - this.accountType = accountType; - } - - @Override public long getDomainId() { return domainId; } - - public void setDomainId(long domainId) { - this.domainId = domainId; - } - @Override public String getDomainUuid() { return domainUuid; } - - - - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - - - - @Override public String getDomainName() { return domainName; } - - public void setDomainName(String domainName) { - this.domainName = domainName; - } - @Override public String getDomainPath() { return domainPath; } - - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - - public State getState() { return state; } - - public void setState(State state) { - this.state = state; - } - - public Date getCreated() { return created; } - - public void setCreated(Date created) { - this.created = created; - } - - public Date getRemoved() { return removed; } - - public void setRemoved(Date removed) { - this.removed = removed; - } - - public String getInstanceName() { return instanceName; } - - public void setInstanceName(String instanceName) { - this.instanceName = instanceName; - } - - public String getPodUuid() { return podUuid; } - - - - public void setPodUuid(String podUuid) { - this.podUuid = podUuid; - } - - public String getDataCenterUuid() { return dataCenterUuid; } - public void setDataCenterUuid(String zoneUuid) { - this.dataCenterUuid = zoneUuid; - } - public String getDataCenterName() { return dataCenterName; } - - public void setDataCenterName(String zoneName) { - this.dataCenterName = zoneName; - } - - public Long getHostId() { return hostId; } - - public void setHostId(long hostId) { - this.hostId = hostId; - } - - public String getHostUuid() { return hostUuid; } - - - - public void setHostUuid(String hostUuid) { - this.hostUuid = hostUuid; - } - - - - public String getHostName() { return hostName; } - - public void setHostName(String hostName) { - this.hostName = hostName; - } - - public long getTemplateId() { return templateId; } - - public void setTemplateId(long templateId) { - this.templateId = templateId; - } - - - public String getTemplateUuid() { return templateUuid; } - - - - public void setTemplateUuid(String templateUuid) { - this.templateUuid = templateUuid; - } - - - - - public String getServiceOfferingUuid() { return serviceOfferingUuid; } - - public void setServiceOfferingUuid(String serviceOfferingUuid) { - this.serviceOfferingUuid = serviceOfferingUuid; - } - - - - public String getServiceOfferingName() { return serviceOfferingName; } - - public void setServiceOfferingName(String serviceOfferingName) { - this.serviceOfferingName = serviceOfferingName; - } - public long getVpcId() { return vpcId; } - public void setVpcId(long vpcId) { - this.vpcId = vpcId; - } - - - - public long getNicId() { return nicId; } - - public void setNicId(long nicId) { - this.nicId = nicId; - } - - public boolean isDefaultNic() { return isDefaultNic; } - - public void setDefaultNic(boolean isDefaultNic) { - this.isDefaultNic = isDefaultNic; - } - - public String getIpAddress() { return ipAddress; } - - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } - - public String getGateway() { return gateway; } - - public void setGateway(String gateway) { - this.gateway = gateway; - } - - public String getNetmask() { return netmask; } - - public void setNetmask(String netmask) { - this.netmask = netmask; - } - - public String getMacAddress() { return macAddress; } - - public void setMacAddress(String macAddress) { - this.macAddress = macAddress; - } - - public URI getBroadcastUri() { return broadcastUri; } - - public void setBroadcastUri(URI broadcastUri) { - this.broadcastUri = broadcastUri; - } - - public URI getIsolationUri() { return isolationUri; } - - public void setIsolationUri(URI isolationUri) { - this.isolationUri = isolationUri; - } - - public long getNetworkId() { return networkId; } - - public void setNetworkId(long networkId) { - this.networkId = networkId; - } - - public String getNetworkName() { return networkName; } - - - - public void setNetworkName(String networkName) { - this.networkName = networkName; - } - - - - public String getNetworkDomain() { return networkDomain; } - - - - public void setNetworkDomain(String networkDomain) { - this.networkDomain = networkDomain; - } - - - - public TrafficType getTrafficType() { return trafficType; } - - public void setTrafficType(TrafficType trafficType) { - this.trafficType = trafficType; - } - - - public long getServiceOfferingId() { return serviceOfferingId; } - - - - public void setServiceOfferingId(long serviceOfferingId) { - this.serviceOfferingId = serviceOfferingId; - } - - - - public long getProjectId() { return projectId; } - - - - public void setProjectId(long projectId) { - this.projectId = projectId; - } - - - - @Override public String getProjectUuid() { return projectUuid; } - - - - public void setProjectUuid(String projectUuid) { - this.projectUuid = projectUuid; - } - - - - @Override public String getProjectName() { return projectName; } - - - - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - - - - - public String getVpcUuid() { return vpcUuid; } - - - - public void setVpcUuid(String vpcUuid) { - this.vpcUuid = vpcUuid; - } - - - - public String getNicUuid() { return nicUuid; } - - - - public void setNicUuid(String nicUuid) { - this.nicUuid = nicUuid; - } - - - - public String getNetworkUuid() { return networkUuid; } - - - - public void setNetworkUuid(String networkUuid) { - this.networkUuid = networkUuid; - } - - public Long getJobId() { return jobId; } - - - - public void setJobId(Long jobId) { - this.jobId = jobId; - } - - - - public String getJobUuid() { return jobUuid; } - - - - public void setJobUuid(String jobUuid) { - this.jobUuid = jobUuid; - } - - - - public int getJobStatus() { return jobStatus; } - - - - public void setJobStatus(int jobStatus) { - this.jobStatus = jobStatus; - } - - - public Long getPodId() { return podId; } - - - - public void setPodId(Long podId) { - this.podId = podId; - } - - - - public long getDataCenterId() { return dataCenterId; } - - - - public void setDataCenterId(long zoneId) { - this.dataCenterId = zoneId; - } - - - - public String getDns1() { return dns1; } - - - - public void setDns1(String dns1) { - this.dns1 = dns1; - } - - - - public String getDns2() { return dns2; } - - - - public void setDns2(String dns2) { - this.dns2 = dns2; - } - - - - public String getTemplateVersion() { return templateVersion; } - - - - public void setTemplateVersion(String templateVersion) { - this.templateVersion = templateVersion; - } - - - - public String getScriptsVersion() { return scriptsVersion; } - - - - public void setScriptsVersion(String scriptsVersion) { - this.scriptsVersion = scriptsVersion; - } - - - - public RedundantState getRedundantState() { return redundantState; } - - - - public void setRedundantState(RedundantState redundantState) { - this.redundantState = redundantState; - } - - - - public boolean isRedundantRouter() { return isRedundantRouter; } - - - - public void setRedundantRouter(boolean isRedundantRouter) { - this.isRedundantRouter = isRedundantRouter; - } - - - - public GuestType getGuestType() { return guestType; } - - - - public void setGuestType(GuestType guestType) { - this.guestType = guestType; + public String getIp6Address() { + return ip6Address; } + public String getIp6Gateway() { + return ip6Gateway; + } + public String getIp6Cidr() { + return ip6Cidr; + } + public String getIp6Dns1() { + return ip6Dns1; + } - public String getIp6Address() { - return ip6Address; - } - - - - - public void setIp6Address(String ip6Address) { - this.ip6Address = ip6Address; - } - - - - - public String getIp6Gateway() { - return ip6Gateway; - } - - - - - public void setIp6Gateway(String ip6Gateway) { - this.ip6Gateway = ip6Gateway; - } - - - - - public String getIp6Cidr() { - return ip6Cidr; - } - - - - - public void setIp6Cidr(String ip6Cidr) { - this.ip6Cidr = ip6Cidr; - } - - - public String getIp6Dns1() { - return ip6Dns1; - } - - public void setIp6Dns1(String ip6Dns1) { - this.ip6Dns1 = ip6Dns1; - } - - public String getIp6Dns2() { - return ip6Dns2; - } - - public void setIp6Dns2(String ip6Dns2) { - this.ip6Dns2 = ip6Dns2; - } - + public String getIp6Dns2() { + return ip6Dns2; + } public VirtualRouter.Role getRole() { return role; } - - - public void setRole(VirtualRouter.Role role) { - this.role = role; - } } diff --git a/server/src/com/cloud/api/query/vo/EventJoinVO.java b/server/src/com/cloud/api/query/vo/EventJoinVO.java index 12d7e5ae4d0..87d20b9ea04 100644 --- a/server/src/com/cloud/api/query/vo/EventJoinVO.java +++ b/server/src/com/cloud/api/query/vo/EventJoinVO.java @@ -25,8 +25,8 @@ import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.Table; -import com.cloud.utils.db.GenericDao; import com.cloud.event.Event.State; +import com.cloud.utils.db.GenericDao; @Entity @Table(name="event_view") @@ -70,7 +70,6 @@ public class EventJoinVO extends BaseViewVO implements ControlledViewEntity { @Column(name="parameters", length=1024) private String parameters; - @Column(name="account_id") private long accountId; @@ -107,7 +106,6 @@ public class EventJoinVO extends BaseViewVO implements ControlledViewEntity { @Column(name="archived") private boolean archived; - public EventJoinVO() { } @@ -116,211 +114,106 @@ public class EventJoinVO extends BaseViewVO implements ControlledViewEntity { return id; } - @Override - public void setId(long id) { - this.id = id; - - } - @Override public String getUuid() { return uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; - } - - @Override public long getAccountId() { return accountId; } - public void setAccountId(long accountId) { - this.accountId = accountId; - } - @Override public String getAccountUuid() { return accountUuid; } - public void setAccountUuid(String accountUuid) { - this.accountUuid = accountUuid; - } - @Override public String getAccountName() { return accountName; } - public void setAccountName(String accountName) { - this.accountName = accountName; - } - @Override public short getAccountType() { return accountType; } - public void setAccountType(short accountType) { - this.accountType = accountType; - } - @Override public long getDomainId() { return domainId; } - public void setDomainId(long domainId) { - this.domainId = domainId; - } - @Override public String getDomainUuid() { return domainUuid; } - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - @Override public String getDomainName() { return domainName; } - public void setDomainName(String domainName) { - this.domainName = domainName; - } - @Override public String getDomainPath() { return domainPath; } - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - public long getProjectId() { return projectId; } - public void setProjectId(long projectId) { - this.projectId = projectId; - } - @Override public String getProjectUuid() { return projectUuid; } - public void setProjectUuid(String projectUuid) { - this.projectUuid = projectUuid; - } - @Override public String getProjectName() { return projectName; } - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - - - - public String getType() { return type; } - public void setType(String type) { - this.type = type; - } - public State getState() { return state; } - public void setState(State state) { - this.state = state; - } - public String getDescription() { return description; } - public void setDescription(String description) { - this.description = description; - } - public Date getCreateDate() { return createDate; } - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } - public long getUserId() { return userId; } - public void setUserId(long userId) { - this.userId = userId; - } - public String getUserName() { return userName; } - public void setUserName(String userName) { - this.userName = userName; - } - public String getLevel() { return level; } - public void setLevel(String level) { - this.level = level; - } - public long getStartId() { return startId; } - public void setStartId(long startId) { - this.startId = startId; - } - - public String getStartUuid() { return startUuid; } - public void setStartUuid(String startUuid) { - this.startUuid = startUuid; - } - public String getParameters() { return parameters; } - public void setParameters(String parameters) { - this.parameters = parameters; - } - public boolean getArchived() { return archived; } - - public void setArchived(Boolean archived) { - this.archived = archived; - } - } diff --git a/server/src/com/cloud/api/query/vo/HostJoinVO.java b/server/src/com/cloud/api/query/vo/HostJoinVO.java index cf3cfdc4486..fbc59cd5884 100644 --- a/server/src/com/cloud/api/query/vo/HostJoinVO.java +++ b/server/src/com/cloud/api/query/vo/HostJoinVO.java @@ -27,16 +27,16 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import com.cloud.host.Status; +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.host.Host.Type; +import com.cloud.host.Status; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.org.Cluster; import com.cloud.resource.ResourceState; import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.Identity; -import org.apache.cloudstack.api.InternalIdentity; - /** * Host DB view. * @@ -55,7 +55,6 @@ public class HostJoinVO extends BaseViewVO implements InternalIdentity, Identity @Column(name="name") private String name; - @Column(name="status") private Status status = null; @@ -139,7 +138,6 @@ public class HostJoinVO extends BaseViewVO implements InternalIdentity, Identity @Column(name="pod_name") private String podName; - @Column(name="guest_os_category_id") private long osCategoryId; @@ -173,336 +171,165 @@ public class HostJoinVO extends BaseViewVO implements InternalIdentity, Identity @Column(name="job_status") private int jobStatus; - - /* (non-Javadoc) - * @see com.cloud.api.query.vo.BaseViewVO#getId() - */ @Override public long getId() { return this.id; } - /* (non-Javadoc) - * @see com.cloud.api.query.vo.BaseViewVO#setId(long) - */ - @Override - public void setId(long id) { - this.id = id; - } - - @Override public String getUuid() { return uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; - } - public String getVersion() { return version; } - public void setVersion(String version) { - this.version = version; - } - public long getZoneId() { return zoneId; } - public void setZoneId(long zoneId) { - this.zoneId = zoneId; - } - public String getZoneUuid() { return zoneUuid; } - public void setZoneUuid(String zoneUuid) { - this.zoneUuid = zoneUuid; - } - public String getZoneName() { return zoneName; } - public void setZoneName(String zoneName) { - this.zoneName = zoneName; - } - public String getName() { return name; } - public void setName(String name) { - this.name = name; - } - public Status getStatus() { return status; } - public void setStatus(Status status) { - this.status = status; - } - public Type getType() { return type; } - public void setType(Type type) { - this.type = type; - } - public String getPrivateIpAddress() { return privateIpAddress; } - public void setPrivateIpAddress(String privateIpAddress) { - this.privateIpAddress = privateIpAddress; - } - public Date getDisconnectedOn() { return disconnectedOn; } - public void setDisconnectedOn(Date disconnectedOn) { - this.disconnectedOn = disconnectedOn; - } - public HypervisorType getHypervisorType() { return hypervisorType; } - public void setHypervisorType(HypervisorType hypervisorType) { - this.hypervisorType = hypervisorType; - } - public String getHypervisorVersion() { return hypervisorVersion; } - public void setHypervisorVersion(String hypervisorVersion) { - this.hypervisorVersion = hypervisorVersion; - } - public String getCapabilities() { return caps; } - public void setCapabilities(String caps) { - this.caps = caps; - } - public long getLastPinged() { return lastPinged; } - public void setLastPinged(long lastPinged) { - this.lastPinged = lastPinged; - } - public Date getCreated() { return created; } - public void setCreated(Date created) { - this.created = created; - } - public Date getRemoved() { return removed; } - public void setRemoved(Date removed) { - this.removed = removed; - } - public ResourceState getResourceState() { return resourceState; } - public void setResourceState(ResourceState resourceState) { - this.resourceState = resourceState; - } - public Long getManagementServerId() { return managementServerId; } - public void setManagementServerId(Long managementServerId) { - this.managementServerId = managementServerId; - } - public Integer getCpus() { return cpus; } - public void setCpus(Integer cpus) { - this.cpus = cpus; - } - public Long getSpeed() { return speed; } - public void setSpeed(Long speed) { - this.speed = speed; - } - public long getTotalMemory() { return totalMemory; } - public void setTotalMemory(long totalMemory) { - this.totalMemory = totalMemory; - } - public long getClusterId() { return clusterId; } - public void setClusterId(long clusterId) { - this.clusterId = clusterId; - } - public String getClusterUuid() { return clusterUuid; } - public void setClusterUuid(String clusterUuid) { - this.clusterUuid = clusterUuid; - } - public String getClusterName() { return clusterName; } - public void setClusterName(String clusterName) { - this.clusterName = clusterName; - } - public Cluster.ClusterType getClusterType() { return clusterType; } - public void setClusterType(Cluster.ClusterType clusterType) { - this.clusterType = clusterType; - } - public long getOsCategoryId() { return osCategoryId; } - public void setOsCategoryId(long osCategoryId) { - this.osCategoryId = osCategoryId; - } - public String getOsCategoryUuid() { return osCategoryUuid; } - public void setOsCategoryUuid(String osCategoryUuid) { - this.osCategoryUuid = osCategoryUuid; - } - public String getOsCategoryName() { return osCategoryName; } - public void setOsCategoryName(String osCategoryName) { - this.osCategoryName = osCategoryName; - } - public Long getJobId() { return jobId; } - public void setJobId(Long jobId) { - this.jobId = jobId; - } - public String getJobUuid() { return jobUuid; } - public void setJobUuid(String jobUuid) { - this.jobUuid = jobUuid; - } - public int getJobStatus() { return jobStatus; } - public void setJobStatus(int jobStatus) { - this.jobStatus = jobStatus; - } - public long getPodId() { return podId; } - public void setPodId(long podId) { - this.podId = podId; - } - public String getPodUuid() { return podUuid; } - public void setPodUuid(String podUuid) { - this.podUuid = podUuid; - } - public String getPodName() { return podName; } - public void setPodName(String podName) { - this.podName = podName; - } - public long getMemUsedCapacity() { return memUsedCapacity; } - public void setMemUsedCapacity(long memUsedCapacity) { - this.memUsedCapacity = memUsedCapacity; - } - public long getMemReservedCapacity() { return memReservedCapacity; } - public void setMemReservedCapacity(long memReservedCapacity) { - this.memReservedCapacity = memReservedCapacity; - } - public long getCpuUsedCapacity() { return cpuUsedCapacity; } - public void setCpuUsedCapacity(long cpuUsedCapacity) { - this.cpuUsedCapacity = cpuUsedCapacity; - } - public long getCpuReservedCapacity() { return cpuReservedCapacity; } - public void setCpuReservedCapacity(long cpuReservedCapacity) { - this.cpuReservedCapacity = cpuReservedCapacity; - } - public String getTag() { return tag; } - - public void setTag(String tag) { - this.tag = tag; - } - - } diff --git a/server/src/com/cloud/api/query/vo/ImageStoreJoinVO.java b/server/src/com/cloud/api/query/vo/ImageStoreJoinVO.java index ac161afe47d..5003ea7290e 100644 --- a/server/src/com/cloud/api/query/vo/ImageStoreJoinVO.java +++ b/server/src/com/cloud/api/query/vo/ImageStoreJoinVO.java @@ -25,14 +25,13 @@ import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.Table; -import com.cloud.storage.DataStoreRole; -import com.cloud.storage.ImageStore; -import com.cloud.storage.ScopeType; -import com.cloud.utils.db.GenericDao; - import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.storage.DataStoreRole; +import com.cloud.storage.ScopeType; +import com.cloud.utils.db.GenericDao; + /** * Image Data Store DB view. * @@ -91,117 +90,56 @@ public class ImageStoreJoinVO extends BaseViewVO implements InternalIdentity, Id return id; } - @Override - public void setId(long id) { - this.id = id; - } - @Override public String getUuid() { return uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; - } - public String getName() { return name; } - - public long getZoneId() { return zoneId; } - public void setZoneId(long zoneId) { - this.zoneId = zoneId; - } - public String getZoneUuid() { return zoneUuid; } - public void setZoneUuid(String zoneUuid) { - this.zoneUuid = zoneUuid; - } - public String getZoneName() { return zoneName; } - public void setZoneName(String zoneName) { - this.zoneName = zoneName; - } - public String getUrl() { return url; } - public void setUrl(String url) { - this.url = url; - } - public String getProtocol() { return protocol; } - public void setProtocol(String protocol) { - this.protocol = protocol; - } - public String getProviderName() { return providerName; } - public void setProviderName(String providerName) { - this.providerName = providerName; - } - public ScopeType getScope() { return scope; } - public void setScope(ScopeType scope) { - this.scope = scope; - } - - public void setName(String name) { - this.name = name; - } - public String getDetailName() { return detailName; } - public void setDetailName(String detailName) { - this.detailName = detailName; - } - public String getDetailValue() { return detailValue; } - public void setDetailValue(String detailValue) { - this.detailValue = detailValue; - } - public DataStoreRole getRole() { return role; } - public void setRole(DataStoreRole role) { - this.role = role; - } - public Date getRemoved() { return removed; } - - public void setRemoved(Date removed) { - this.removed = removed; - } - - } diff --git a/server/src/com/cloud/api/query/vo/InstanceGroupJoinVO.java b/server/src/com/cloud/api/query/vo/InstanceGroupJoinVO.java index 3fb43094ad3..f4ce8d64e8d 100644 --- a/server/src/com/cloud/api/query/vo/InstanceGroupJoinVO.java +++ b/server/src/com/cloud/api/query/vo/InstanceGroupJoinVO.java @@ -39,14 +39,12 @@ public class InstanceGroupJoinVO extends BaseViewVO implements ControlledViewEnt @Column(name="name") String name; - @Column(name=GenericDao.REMOVED_COLUMN) private Date removed; @Column(name=GenericDao.CREATED_COLUMN) private Date created; - @Column(name="account_id") private long accountId; @@ -80,8 +78,6 @@ public class InstanceGroupJoinVO extends BaseViewVO implements ControlledViewEnt @Column(name="project_name") private String projectName; - - public InstanceGroupJoinVO() { } @@ -90,144 +86,74 @@ public class InstanceGroupJoinVO extends BaseViewVO implements ControlledViewEnt return id; } - - @Override - public void setId(long id) { - this.id = id; - - } - @Override public String getUuid() { return uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; - } - - @Override public long getAccountId() { return accountId; } - public void setAccountId(long accountId) { - this.accountId = accountId; - } - @Override public String getAccountUuid() { return accountUuid; } - public void setAccountUuid(String accountUuid) { - this.accountUuid = accountUuid; - } - @Override public String getAccountName() { return accountName; } - public void setAccountName(String accountName) { - this.accountName = accountName; - } - @Override public short getAccountType() { return accountType; } - public void setAccountType(short accountType) { - this.accountType = accountType; - } - @Override public long getDomainId() { return domainId; } - public void setDomainId(long domainId) { - this.domainId = domainId; - } - @Override public String getDomainUuid() { return domainUuid; } - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - @Override public String getDomainName() { return domainName; } - public void setDomainName(String domainName) { - this.domainName = domainName; - } - @Override public String getDomainPath() { return domainPath; } - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - public long getProjectId() { return projectId; } - public void setProjectId(long projectId) { - this.projectId = projectId; - } - @Override public String getProjectUuid() { return projectUuid; } - public void setProjectUuid(String projectUuid) { - this.projectUuid = projectUuid; - } - @Override public String getProjectName() { return projectName; } - public void setProjectName(String projectName) { - this.projectName = projectName; - } - public String getName() { return name; } - public void setName(String name) { - this.name = name; - } - public Date getRemoved() { return removed; } - public void setRemoved(Date removed) { - this.removed = removed; - } - public Date getCreated() { return created; } - - public void setCreated(Date created) { - this.created = created; - } - - } diff --git a/server/src/com/cloud/api/query/vo/ProjectAccountJoinVO.java b/server/src/com/cloud/api/query/vo/ProjectAccountJoinVO.java index 1a8818a22e4..91ff561b2a6 100644 --- a/server/src/com/cloud/api/query/vo/ProjectAccountJoinVO.java +++ b/server/src/com/cloud/api/query/vo/ProjectAccountJoinVO.java @@ -23,9 +23,10 @@ import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.Table; -import com.cloud.projects.ProjectAccount.Role; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.projects.ProjectAccount.Role; + @Entity @Table(name="project_account_view") public class ProjectAccountJoinVO extends BaseViewVO implements InternalIdentity { @@ -71,7 +72,6 @@ public class ProjectAccountJoinVO extends BaseViewVO implements InternalIdentity @Column(name="project_name") private String projectName; - public ProjectAccountJoinVO() { } @@ -80,137 +80,51 @@ public class ProjectAccountJoinVO extends BaseViewVO implements InternalIdentity return id; } - - @Override - public void setId(long id) { - this.id = id; - - } - public long getDomainId() { return domainId; } - public void setDomainId(long domainId) { - this.domainId = domainId; - } - public String getDomainUuid() { return domainUuid; } - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - public String getDomainName() { return domainName; } - public void setDomainName(String domainName) { - this.domainName = domainName; - } - public String getDomainPath() { return domainPath; } - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - public long getAccountId() { return accountId; } - public void setAccountId(long accountId) { - this.accountId = accountId; - } - - - public String getAccountUuid() { return accountUuid; } - - - public void setAccountUuid(String accountUuid) { - this.accountUuid = accountUuid; - } - - - public String getAccountName() { return accountName; } - - - public void setAccountName(String accountName) { - this.accountName = accountName; - } - - - public short getAccountType() { return accountType; } - - - public void setAccountType(short accountType) { - this.accountType = accountType; - } - - - public Role getAccountRole() { return accountRole; } - - - public void setAccountRole(Role accountRole) { - this.accountRole = accountRole; - } - - - public long getProjectId() { return projectId; } - - - public void setProjectId(long projectId) { - this.projectId = projectId; - } - - - public String getProjectUuid() { return projectUuid; } - - - public void setProjectUuid(String projectUuid) { - this.projectUuid = projectUuid; - } - - - public String getProjectName() { return projectName; } - - - - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - - } diff --git a/server/src/com/cloud/api/query/vo/ProjectInvitationJoinVO.java b/server/src/com/cloud/api/query/vo/ProjectInvitationJoinVO.java index f6e67609c79..b598ba18845 100644 --- a/server/src/com/cloud/api/query/vo/ProjectInvitationJoinVO.java +++ b/server/src/com/cloud/api/query/vo/ProjectInvitationJoinVO.java @@ -91,146 +91,74 @@ public class ProjectInvitationJoinVO extends BaseViewVO implements ControlledVie return id; } - - @Override - public void setId(long id) { - this.id = id; - - } - @Override public String getUuid() { return uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; - } - - @Override public long getDomainId() { return domainId; } - public void setDomainId(long domainId) { - this.domainId = domainId; - } - @Override public String getDomainUuid() { return domainUuid; } - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - @Override public String getDomainName() { return domainName; } - public void setDomainName(String domainName) { - this.domainName = domainName; - } - - - public State getState() { return state; } - public void setState(State state) { - this.state = state; - } - @Override public long getAccountId() { return accountId; } - public void setAccountId(long accountId) { - this.accountId = accountId; - } - public String getEmail() { return email; } - public void setEmail(String email) { - this.email = email; - } - @Override public String getAccountName() { return accountName; } - public void setAccountName(String accountName) { - this.accountName = accountName; - } - public long getProjectId() { return projectId; } - public void setProjectId(long projectId) { - this.projectId = projectId; - } - @Override public String getProjectUuid() { return projectUuid; } - public void setProjectUuid(String projectUuid) { - this.projectUuid = projectUuid; - } - @Override public String getProjectName() { return projectName; } - public void setProjectName(String projectName) { - this.projectName = projectName; - } - public Date getCreated() { return created; } - public void setCreated(Date created) { - this.created = created; - } - @Override public String getAccountUuid() { return accountUuid; } - public void setAccountUuid(String accountUuid) { - this.accountUuid = accountUuid; - } - @Override public short getAccountType() { return accountType; } - public void setAccountType(short accountType) { - this.accountType = accountType; - } - @Override public String getDomainPath() { return domainPath; } - - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - - } diff --git a/server/src/com/cloud/api/query/vo/ProjectJoinVO.java b/server/src/com/cloud/api/query/vo/ProjectJoinVO.java index 3885fa087d4..77b013183fa 100644 --- a/server/src/com/cloud/api/query/vo/ProjectJoinVO.java +++ b/server/src/com/cloud/api/query/vo/ProjectJoinVO.java @@ -25,13 +25,13 @@ import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.Table; +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.projects.Project.State; import com.cloud.server.ResourceTag.TaggedResourceType; import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.Identity; -import org.apache.cloudstack.api.InternalIdentity; - @Entity @Table(name="project_view") public class ProjectJoinVO extends BaseViewVO implements InternalIdentity, Identity { @@ -107,10 +107,9 @@ public class ProjectJoinVO extends BaseViewVO implements InternalIdentity, Ident @Column(name="tag_customer") private String tagCustomer; - + @Column(name="project_account_id") private long projectAccountId; - public ProjectJoinVO() { } @@ -120,190 +119,95 @@ public class ProjectJoinVO extends BaseViewVO implements InternalIdentity, Ident return id; } - - @Override - public void setId(long id) { - this.id = id; - - } - @Override public String getUuid() { return uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; - } - public String getName() { return name; } - public void setName(String name) { - this.name = name; - } - public long getDomainId() { return domainId; } - public void setDomainId(long domainId) { - this.domainId = domainId; - } - public String getDomainUuid() { return domainUuid; } - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - public String getDomainName() { return domainName; } - public void setDomainName(String domainName) { - this.domainName = domainName; - } - public String getDomainPath() { return domainPath; } - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - public State getState() { return state; } - public void setState(State state) { - this.state = state; - } - public Date getCreated() { return created; } - public void setCreated(Date created) { - this.created = created; - } - public Date getRemoved() { return removed; } - public void setRemoved(Date removed) { - this.removed = removed; - } - public String getDisplayText() { return displayText; } - public void setDisplayText(String displayText) { - this.displayText = displayText; - } - public String getOwner() { return owner; } - public void setOwner(String owner) { - this.owner = owner; - } - public long getTagId() { return tagId; } - public void setTagId(long tagId) { - this.tagId = tagId; - } - public String getTagUuid() { return tagUuid; } - public void setTagUuid(String tagUuid) { - this.tagUuid = tagUuid; - } - public String getTagKey() { return tagKey; } - public void setTagKey(String tagKey) { - this.tagKey = tagKey; - } - public String getTagValue() { return tagValue; } - public void setTagValue(String tagValue) { - this.tagValue = tagValue; - } - public long getTagDomainId() { return tagDomainId; } - public void setTagDomainId(long tagDomainId) { - this.tagDomainId = tagDomainId; - } - public long getTagAccountId() { return tagAccountId; } - public void setTagAccountId(long tagAccountId) { - this.tagAccountId = tagAccountId; - } - public long getTagResourceId() { return tagResourceId; } - public void setTagResourceId(long tagResourceId) { - this.tagResourceId = tagResourceId; - } - public String getTagResourceUuid() { return tagResourceUuid; } - public void setTagResourceUuid(String tagResourceUuid) { - this.tagResourceUuid = tagResourceUuid; - } - public TaggedResourceType getTagResourceType() { return tagResourceType; } - public void setTagResourceType(TaggedResourceType tagResourceType) { - this.tagResourceType = tagResourceType; - } - public String getTagCustomer() { return tagCustomer; } - public void setTagCustomer(String tagCustomer) { - this.tagCustomer = tagCustomer; - } - public long getAccountId() { return accountId; } - public void setAccountId(long accountId) { - this.accountId = accountId; - } - public long getProjectAccountId() { return projectAccountId; } diff --git a/server/src/com/cloud/api/query/vo/ResourceTagJoinVO.java b/server/src/com/cloud/api/query/vo/ResourceTagJoinVO.java index 9ce9555d1be..a13d107583a 100644 --- a/server/src/com/cloud/api/query/vo/ResourceTagJoinVO.java +++ b/server/src/com/cloud/api/query/vo/ResourceTagJoinVO.java @@ -42,7 +42,6 @@ public class ResourceTagJoinVO extends BaseViewVO implements ControlledViewEntit @Column(name="value") String value; - @Column(name="resource_id") long resourceId; @@ -56,8 +55,6 @@ public class ResourceTagJoinVO extends BaseViewVO implements ControlledViewEntit @Column(name="customer") String customer; - - @Column(name="account_id") private long accountId; @@ -91,8 +88,6 @@ public class ResourceTagJoinVO extends BaseViewVO implements ControlledViewEntit @Column(name="project_name") private String projectName; - - public ResourceTagJoinVO() { } @@ -101,168 +96,86 @@ public class ResourceTagJoinVO extends BaseViewVO implements ControlledViewEntit return uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; - } - @Override public long getId() { return id; } - @Override - public void setId(long id) { - this.id = id; - } - - @Override public long getAccountId() { return accountId; } - public void setAccountId(long accountId) { - this.accountId = accountId; - } - @Override public String getAccountUuid() { return accountUuid; } - public void setAccountUuid(String accountUuid) { - this.accountUuid = accountUuid; - } - @Override public String getAccountName() { return accountName; } - public void setAccountName(String accountName) { - this.accountName = accountName; - } - @Override public short getAccountType() { return accountType; } - public void setAccountType(short accountType) { - this.accountType = accountType; - } - @Override public long getDomainId() { return domainId; } - public void setDomainId(long domainId) { - this.domainId = domainId; - } - @Override public String getDomainUuid() { return domainUuid; } - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - @Override public String getDomainName() { return domainName; } - public void setDomainName(String domainName) { - this.domainName = domainName; - } - @Override public String getDomainPath() { return domainPath; } - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - public long getProjectId() { return projectId; } - public void setProjectId(long projectId) { - this.projectId = projectId; - } - @Override public String getProjectUuid() { return projectUuid; } - public void setProjectUuid(String projectUuid) { - this.projectUuid = projectUuid; - } - @Override public String getProjectName() { return projectName; } - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - - public String getKey() { return key; } - public void setKey(String key) { - this.key = key; - } - public String getValue() { return value; } - public void setValue(String value) { - this.value = value; - } - public long getResourceId() { return resourceId; } - public void setResourceId(long resourceId) { - this.resourceId = resourceId; - } - public String getResourceUuid() { return resourceUuid; } - public void setResourceUuid(String resourceUuid) { - this.resourceUuid = resourceUuid; - } - public TaggedResourceType getResourceType() { return resourceType; } - public void setResourceType(TaggedResourceType resourceType) { - this.resourceType = resourceType; - } - public String getCustomer() { return customer; } - - public void setCustomer(String customer) { - this.customer = customer; - } - - } diff --git a/server/src/com/cloud/api/query/vo/SecurityGroupJoinVO.java b/server/src/com/cloud/api/query/vo/SecurityGroupJoinVO.java index 258b6136224..50b30f30e49 100644 --- a/server/src/com/cloud/api/query/vo/SecurityGroupJoinVO.java +++ b/server/src/com/cloud/api/query/vo/SecurityGroupJoinVO.java @@ -148,199 +148,105 @@ public class SecurityGroupJoinVO extends BaseViewVO implements ControlledViewEnt return id; } - @Override - public void setId(long id) { - this.id = id; - } - @Override public String getUuid() { return uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getName() { return name; } - public void setName(String name) { - this.name = name; - } - @Override public long getAccountId() { return accountId; } - public void setAccountId(long accountId) { - this.accountId = accountId; - } - @Override public String getAccountUuid() { return accountUuid; } - public void setAccountUuid(String accountUuid) { - this.accountUuid = accountUuid; - } - @Override public String getAccountName() { return accountName; } - public void setAccountName(String accountName) { - this.accountName = accountName; - } - @Override public short getAccountType() { return accountType; } - public void setAccountType(short accountType) { - this.accountType = accountType; - } - @Override public long getDomainId() { return domainId; } - public void setDomainId(long domainId) { - this.domainId = domainId; - } - @Override public String getDomainUuid() { return domainUuid; } - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - @Override public String getDomainName() { return domainName; } - public void setDomainName(String domainName) { - this.domainName = domainName; - } - @Override public String getDomainPath() { return domainPath; } - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - public long getProjectId() { return projectId; } - public void setProjectId(long projectId) { - this.projectId = projectId; - } - @Override public String getProjectUuid() { return projectUuid; } - public void setProjectUuid(String projectUuid) { - this.projectUuid = projectUuid; - } - @Override public String getProjectName() { return projectName; } - public void setProjectName(String projectName) { - this.projectName = projectName; - } - public Long getJobId() { return jobId; } - public void setJobId(Long jobId) { - this.jobId = jobId; - } - public String getJobUuid() { return jobUuid; } - public void setJobUuid(String jobUuid) { - this.jobUuid = jobUuid; - } - public int getJobStatus() { return jobStatus; } - public void setJobStatus(int jobStatus) { - this.jobStatus = jobStatus; - } - public String getDescription() { return description; } - public void setDescription(String description) { - this.description = description; - } - public Long getRuleId() { return ruleId; } - public void setRuleId(Long ruleId) { - this.ruleId = ruleId; - } - public String getRuleUuid() { return ruleUuid; } - public void setRuleUuid(String ruleUuid) { - this.ruleUuid = ruleUuid; - } - public int getRuleStartPort() { return ruleStartPort; } - public void setRuleStartPort(int ruleStartPort) { - this.ruleStartPort = ruleStartPort; - } - public int getRuleEndPort() { return ruleEndPort; } - public void setRuleEndPort(int ruleEndPort) { - this.ruleEndPort = ruleEndPort; - } - public String getRuleProtocol() { return ruleProtocol; } - public void setRuleProtocol(String ruleProtocol) { - this.ruleProtocol = ruleProtocol; - } - public SecurityRuleType getRuleType() { if ("ingress".equalsIgnoreCase(ruleType)) { return SecurityRuleType.IngressRule; @@ -349,104 +255,51 @@ public class SecurityGroupJoinVO extends BaseViewVO implements ControlledViewEnt } } - public void setRuleType(String ruleType) { - this.ruleType = ruleType; - } - public Long getRuleAllowedNetworkId() { return ruleAllowedNetworkId; } - public void setRuleAllowedNetworkId(Long ruleAllowedNetworkId) { - this.ruleAllowedNetworkId = ruleAllowedNetworkId; - } - public String getRuleAllowedSourceIpCidr() { return ruleAllowedSourceIpCidr; } - public void setRuleAllowedSourceIpCidr(String ruleAllowedSourceIpCidr) { - this.ruleAllowedSourceIpCidr = ruleAllowedSourceIpCidr; - } - public long getTagId() { return tagId; } - public void setTagId(long tagId) { - this.tagId = tagId; - } - public String getTagUuid() { return tagUuid; } - public void setTagUuid(String tagUuid) { - this.tagUuid = tagUuid; - } - public String getTagKey() { return tagKey; } - public void setTagKey(String tagKey) { - this.tagKey = tagKey; - } - public String getTagValue() { return tagValue; } - public void setTagValue(String tagValue) { - this.tagValue = tagValue; - } - public long getTagDomainId() { return tagDomainId; } - public void setTagDomainId(long tagDomainId) { - this.tagDomainId = tagDomainId; - } - public long getTagAccountId() { return tagAccountId; } - public void setTagAccountId(long tagAccountId) { - this.tagAccountId = tagAccountId; - } - public long getTagResourceId() { return tagResourceId; } - public void setTagResourceId(long tagResourceId) { - this.tagResourceId = tagResourceId; - } - public String getTagResourceUuid() { return tagResourceUuid; } - public void setTagResourceUuid(String tagResourceUuid) { - this.tagResourceUuid = tagResourceUuid; - } - public TaggedResourceType getTagResourceType() { return tagResourceType; } - public void setTagResourceType(TaggedResourceType tagResourceType) { - this.tagResourceType = tagResourceType; - } - public String getTagCustomer() { return tagCustomer; } - - public void setTagCustomer(String tagCustomer) { - this.tagCustomer = tagCustomer; - } - } diff --git a/server/src/com/cloud/api/query/vo/ServiceOfferingJoinVO.java b/server/src/com/cloud/api/query/vo/ServiceOfferingJoinVO.java index 05ff5f3f44a..3c843bbef34 100644 --- a/server/src/com/cloud/api/query/vo/ServiceOfferingJoinVO.java +++ b/server/src/com/cloud/api/query/vo/ServiceOfferingJoinVO.java @@ -132,242 +132,119 @@ public class ServiceOfferingJoinVO extends BaseViewVO implements InternalIdentit return id; } - @Override - public void setId(long id) { - this.id = id; - } - @Override public String getUuid() { return uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; - } - public String getName() { return name; } - public void setName(String name) { - this.name = name; - } - public String getDisplayText() { return displayText; } - public void setDisplayText(String displayText) { - this.displayText = displayText; - } - - public String getTags() { return tags; } - public void setTags(String tags) { - this.tags = tags; - } - public boolean isUseLocalStorage() { return useLocalStorage; } - public void setUseLocalStorage(boolean useLocalStorage) { - this.useLocalStorage = useLocalStorage; - } - public boolean isSystemUse() { return systemUse; } - public void setSystemUse(boolean systemUse) { - this.systemUse = systemUse; - } - - public Date getCreated() { return created; } - public void setCreated(Date created) { - this.created = created; - } - public Date getRemoved() { return removed; } - public void setRemoved(Date removed) { - this.removed = removed; - } - public long getDomainId() { return domainId; } - public void setDomainId(long domainId) { - this.domainId = domainId; - } - public String getDomainUuid() { return domainUuid; } - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - public String getDomainName() { return domainName; } - public void setDomainName(String domainName) { - this.domainName = domainName; - } - public String getDomainPath() { return domainPath; } - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - public int getSortKey() { return sortKey; } - public void setSortKey(int sortKey) { - this.sortKey = sortKey; - } - public int getCpu() { return cpu; } - public void setCpu(int cpu) { - this.cpu = cpu; - } - public int getSpeed() { return speed; } - public void setSpeed(int speed) { - this.speed = speed; - } - public int getRamSize() { return ramSize; } - public void setRamSize(int ramSize) { - this.ramSize = ramSize; - } - public Integer getRateMbps() { return rateMbps; } - public void setRateMbps(Integer rateMbps) { - this.rateMbps = rateMbps; - } - public Integer getMulticastRateMbps() { return multicastRateMbps; } - public void setMulticastRateMbps(Integer multicastRateMbps) { - this.multicastRateMbps = multicastRateMbps; - } - public boolean isOfferHA() { return offerHA; } - public void setOfferHA(boolean offerHA) { - this.offerHA = offerHA; - } - public boolean isLimitCpuUse() { return limitCpuUse; } - public void setLimitCpuUse(boolean limitCpuUse) { - this.limitCpuUse = limitCpuUse; - } - public String getHostTag() { return hostTag; } - public void setHostTag(String hostTag) { - this.hostTag = hostTag; - } - public boolean isDefaultUse() { return default_use; } - public void setDefaultUse(boolean default_use) { - this.default_use = default_use; - } - public String getSystemVmType() { return vm_type; } - public void setSystemVmType(String vm_type) { - this.vm_type = vm_type; - } - public String getDeploymentPlanner() { return deploymentPlanner; } - public void setDeploymentPlanner(String deploymentPlanner) { - this.deploymentPlanner = deploymentPlanner; - } - public boolean getVolatileVm() { return volatileVm; } - public void setVolatileVm(boolean volatileVm) { - this.volatileVm = volatileVm; - } - - public void setBytesReadRate(Long bytesReadRate) { - this.bytesReadRate = bytesReadRate; - } - public Long getBytesReadRate() { return bytesReadRate; } - public void setBytesWriteRate(Long bytesWriteRate) { - this.bytesWriteRate = bytesWriteRate; - } - public Long getBytesWriteRate() { return bytesWriteRate; } - public void setIopsReadRate(Long iopsReadRate) { - this.iopsReadRate = iopsReadRate; - } - public Long getIopsReadRate() { return iopsReadRate; } - public void setIopsWriteRate(Long iopsWriteRate) { - this.iopsWriteRate = iopsWriteRate; - } - public Long getIopsWriteRate() { return iopsWriteRate; } diff --git a/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java b/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java index d98bb3b45bf..260d6ae71ad 100644 --- a/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java +++ b/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java @@ -146,240 +146,120 @@ public class StoragePoolJoinVO extends BaseViewVO implements InternalIdentity, I return scope; } - /** - * @param scope the scope to set - */ - public void setScope(ScopeType scope) { - this.scope = scope; - } - public HypervisorType getHypervisor() { return hypervisor; } - public void setHypervisor(HypervisorType hypervisor) { - this.hypervisor = hypervisor; - } - @Override public long getId() { return id; } - @Override - public void setId(long id) { - this.id = id; - } - @Override public String getUuid() { return uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; - } - public String getName() { return name; } - public void setName(String name) { - this.name = name; - } - public String getPath() { return path; } - public void setPath(String path) { - this.path = path; - } - public String getHostAddress() { return hostAddress; } - public void setHostAddress(String hostAddress) { - this.hostAddress = hostAddress; - } - public StoragePoolStatus getStatus() { return status; } - public void setStatus(StoragePoolStatus status) { - this.status = status; - } - public StoragePoolType getPoolType() { return poolType; } - public void setPoolType(StoragePoolType poolType) { - this.poolType = poolType; - } - public Date getCreated() { return created; } - public void setCreated(Date created) { - this.created = created; - } - public Date getRemoved() { return removed; } - public void setRemoved(Date removed) { - this.removed = removed; - } - public long getCapacityBytes() { return capacityBytes; } - public void setCapacityBytes(long capacityBytes) { - this.capacityBytes = capacityBytes; - } - public Long getCapacityIops() { return capacityIops; } - public void setCapacityIops(Long capacityIops) { - this.capacityIops = capacityIops; - } - public long getClusterId() { return clusterId; } - public void setClusterId(long clusterId) { - this.clusterId = clusterId; - } - public String getClusterUuid() { return clusterUuid; } - public void setClusterUuid(String clusterUuid) { - this.clusterUuid = clusterUuid; - } - public String getClusterName() { return clusterName; } - public void setClusterName(String clusterName) { - this.clusterName = clusterName; - } - public Cluster.ClusterType getClusterType() { return clusterType; } - public void setClusterType(Cluster.ClusterType clusterType) { - this.clusterType = clusterType; - } - public long getZoneId() { return zoneId; } - public void setZoneId(long zoneId) { - this.zoneId = zoneId; - } - public String getZoneUuid() { return zoneUuid; } - public void setZoneUuid(String zoneUuid) { - this.zoneUuid = zoneUuid; - } - public String getZoneName() { return zoneName; } - public void setZoneName(String zoneName) { - this.zoneName = zoneName; - } - public long getPodId() { return podId; } - public void setPodId(long podId) { - this.podId = podId; - } - public String getPodUuid() { return podUuid; } - public void setPodUuid(String podUuid) { - this.podUuid = podUuid; - } - public String getPodName() { return podName; } - public void setPodName(String podName) { - this.podName = podName; - } - public String getTag() { return tag; } - public void setTag(String tag) { - this.tag = tag; - } - public long getUsedCapacity() { return usedCapacity; } - public void setUsedCapacity(long usedCapacity) { - this.usedCapacity = usedCapacity; - } - public long getReservedCapacity() { return reservedCapacity; } - public void setReservedCapacity(long reservedCapacity) { - this.reservedCapacity = reservedCapacity; - } - public Long getJobId() { return jobId; } - public void setJobId(Long jobId) { - this.jobId = jobId; - } - public String getJobUuid() { return jobUuid; } - public void setJobUuid(String jobUuid) { - this.jobUuid = jobUuid; - } - public int getJobStatus() { return jobStatus; } - public void setJobStatus(int jobStatus) { - this.jobStatus = jobStatus; - } - public String getStorageProviderName() { return storageProviderName; } diff --git a/server/src/com/cloud/api/query/vo/TemplateJoinVO.java b/server/src/com/cloud/api/query/vo/TemplateJoinVO.java index bb1cfedd781..4cfdf6ac3f8 100644 --- a/server/src/com/cloud/api/query/vo/TemplateJoinVO.java +++ b/server/src/com/cloud/api/query/vo/TemplateJoinVO.java @@ -97,7 +97,7 @@ public class TemplateJoinVO extends BaseViewVO implements ControlledViewEntity { @Column(name="dynamically_scalable") private boolean dynamicallyScalable; - + @Column(name="guest_os_id") private long guestOSId; @@ -129,7 +129,6 @@ public class TemplateJoinVO extends BaseViewVO implements ControlledViewEntity { @Column(name="source_template_uuid") private String sourceTemplateUuid; - @Column(name="template_tag") private String templateTag; @@ -213,7 +212,6 @@ public class TemplateJoinVO extends BaseViewVO implements ControlledViewEntity { @Column(name="detail_value") private String detailValue; - @Column(name="tag_id") private long tagId; @@ -255,821 +253,283 @@ public class TemplateJoinVO extends BaseViewVO implements ControlledViewEntity { public TemplateJoinVO() { } - - @Override public long getId() { return id; } - - - @Override - public void setId(long id) { - this.id = id; - } - - - @Override public String getUuid() { return uuid; } - - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - - public String getName() { return name; } - - - public void setName(String name) { - this.name = name; - } - - public Date getCreated() { return created; } - - - public void setCreated(Date created) { - this.created = created; - } - - - public Date getRemoved() { return removed; } - - - public void setRemoved(Date removed) { - this.removed = removed; - } - - - @Override public long getAccountId() { return accountId; } - - - public void setAccountId(long accountId) { - this.accountId = accountId; - } - - - @Override public String getAccountUuid() { return accountUuid; } - - - public void setAccountUuid(String accountUuid) { - this.accountUuid = accountUuid; - } - - - @Override public String getAccountName() { return accountName; } - - - public void setAccountName(String accountName) { - this.accountName = accountName; - } - - - @Override public short getAccountType() { return accountType; } - - - public void setAccountType(short accountType) { - this.accountType = accountType; - } - - - @Override public long getDomainId() { return domainId; } - - - public void setDomainId(long domainId) { - this.domainId = domainId; - } - - - @Override public String getDomainUuid() { return domainUuid; } - - - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - - - @Override public String getDomainName() { return domainName; } - - - public void setDomainName(String domainName) { - this.domainName = domainName; - } - - - @Override public String getDomainPath() { return domainPath; } - - - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - - - public long getProjectId() { return projectId; } - - - public void setProjectId(long projectId) { - this.projectId = projectId; - } - - - @Override public String getProjectUuid() { return projectUuid; } - - - public void setProjectUuid(String projectUuid) { - this.projectUuid = projectUuid; - } - - - @Override public String getProjectName() { return projectName; } - - - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - - - public boolean isExtractable() { return extractable; } - - - public void setExtractable(boolean extractable) { - this.extractable = extractable; - } - - - public Storage.TemplateType getTemplateType() { return templateType; } - - - public void setTemplateType(Storage.TemplateType templateType) { - this.templateType = templateType; - } - - - - - - public long getTagId() { return tagId; } - - - public void setTagId(long tagId) { - this.tagId = tagId; - } - - - public String getTagUuid() { return tagUuid; } - - - public void setTagUuid(String tagUuid) { - this.tagUuid = tagUuid; - } - - - public String getTagKey() { return tagKey; } - - - public void setTagKey(String tagKey) { - this.tagKey = tagKey; - } - - - public String getTagValue() { return tagValue; } - - - public void setTagValue(String tagValue) { - this.tagValue = tagValue; - } - - - public long getTagDomainId() { return tagDomainId; } - - - public void setTagDomainId(long tagDomainId) { - this.tagDomainId = tagDomainId; - } - - - public long getTagAccountId() { return tagAccountId; } - - - public void setTagAccountId(long tagAccountId) { - this.tagAccountId = tagAccountId; - } - - - public long getTagResourceId() { return tagResourceId; } - - - public void setTagResourceId(long tagResourceId) { - this.tagResourceId = tagResourceId; - } - - - public String getTagResourceUuid() { return tagResourceUuid; } - - - public void setTagResourceUuid(String tagResourceUuid) { - this.tagResourceUuid = tagResourceUuid; - } - - - public TaggedResourceType getTagResourceType() { return tagResourceType; } - - - public void setTagResourceType(TaggedResourceType tagResourceType) { - this.tagResourceType = tagResourceType; - } - - - public String getTagCustomer() { return tagCustomer; } - - - public void setTagCustomer(String tagCustomer) { - this.tagCustomer = tagCustomer; - } - - - public long getDataCenterId() { return dataCenterId; } - - - public void setDataCenterId(long dataCenterId) { - this.dataCenterId = dataCenterId; - } - - - public String getDataCenterUuid() { return dataCenterUuid; } - - - public void setDataCenterUuid(String dataCenterUuid) { - this.dataCenterUuid = dataCenterUuid; - } - - - public String getDataCenterName() { return dataCenterName; } - - - public void setDataCenterName(String dataCenterName) { - this.dataCenterName = dataCenterName; - } - - - public String getUniqueName() { return uniqueName; } - - - public void setUniqueName(String uniqueName) { - this.uniqueName = uniqueName; - } - - - public boolean isPublicTemplate() { return publicTemplate; } - - - public void setPublicTemplate(boolean publicTemplate) { - this.publicTemplate = publicTemplate; - } - - - public boolean isFeatured() { return featured; } - - - public void setFeatured(boolean featured) { - this.featured = featured; - } - - - public String getUrl() { return url; } - - - public void setUrl(String url) { - this.url = url; - } - - - public boolean isRequiresHvm() { return requiresHvm; } - - - public void setRequiresHvm(boolean requiresHvm) { - this.requiresHvm = requiresHvm; - } - - - public int getBits() { return bits; } - - - public void setBits(int bits) { - this.bits = bits; - } - - - public String getChecksum() { return checksum; } - - - public void setChecksum(String checksum) { - this.checksum = checksum; - } - - - public String getDisplayText() { return displayText; } - - - public void setDisplayText(String displayText) { - this.displayText = displayText; - } - - - public boolean isEnablePassword() { return enablePassword; } - - - public void setEnablePassword(boolean enablePassword) { - this.enablePassword = enablePassword; - } - - - public boolean isDynamicallyScalable() { return dynamicallyScalable; } - public void setDynamicallyScalable(boolean dynamicallyScalable) { - this.dynamicallyScalable = dynamicallyScalable; - } - - - public long getGuestOSId() { return guestOSId; } - - - public void setGuestOSId(long guestOSId) { - this.guestOSId = guestOSId; - } - - - public String getGuestOSUuid() { return guestOSUuid; } - - - public void setGuestOSUuid(String guestOSUuid) { - this.guestOSUuid = guestOSUuid; - } - - - public String getGuestOSName() { return guestOSName; } - - - public void setGuestOSName(String guestOSName) { - this.guestOSName = guestOSName; - } - - - public boolean isBootable() { return bootable; } - - - public void setBootable(boolean bootable) { - this.bootable = bootable; - } - - - public boolean isPrepopulate() { return prepopulate; } - - - public void setPrepopulate(boolean prepopulate) { - this.prepopulate = prepopulate; - } - - - public boolean isCrossZones() { return crossZones; } - - - public void setCrossZones(boolean crossZones) { - this.crossZones = crossZones; - } - - - public HypervisorType getHypervisorType() { return hypervisorType; } - - - public void setHypervisorType(HypervisorType hypervisorType) { - this.hypervisorType = hypervisorType; - } - - - public Long getSourceTemplateId() { return sourceTemplateId; } - - - public void setSourceTemplateId(Long sourceTemplateId) { - this.sourceTemplateId = sourceTemplateId; - } - - - public String getSourceTemplateUuid() { return sourceTemplateUuid; } - - - public void setSourceTemplateUuid(String sourceTemplateUuid) { - this.sourceTemplateUuid = sourceTemplateUuid; - } - - - public String getTemplateTag() { return templateTag; } - - - public void setTemplateTag(String templateTag) { - this.templateTag = templateTag; - } - - - public int getSortKey() { return sortKey; } - - - public void setSortKey(int sortKey) { - this.sortKey = sortKey; - } - - - public boolean isEnableSshKey() { return enableSshKey; } - - - public void setEnableSshKey(boolean enableSshKey) { - this.enableSshKey = enableSshKey; - } - - - public Status getDownloadState() { return downloadState; } - - - public void setDownloadState(Status downloadState) { - this.downloadState = downloadState; - } - - - public long getSize() { return size; } - - - public void setSize(long size) { - this.size = size; - } - - - public boolean isDestroyed() { return destroyed; } - - - public void setDestroyed(boolean destroyed) { - this.destroyed = destroyed; - } - - - public Long getSharedAccountId() { return sharedAccountId; } - - - public void setSharedAccountId(Long sharedAccountId) { - this.sharedAccountId = sharedAccountId; - } - - - public String getDetailName() { return detailName; } - - - public void setDetailName(String detailName) { - this.detailName = detailName; - } - - - public String getDetailValue() { return detailValue; } - - - public void setDetailValue(String detailValue) { - this.detailValue = detailValue; - } - - - public Date getCreatedOnStore() { return createdOnStore; } - - - public void setCreatedOnStore(Date createdOnStore) { - this.createdOnStore = createdOnStore; - } - - - public Storage.ImageFormat getFormat() { return format; } - - - public void setFormat(Storage.ImageFormat format) { - this.format = format; - } - - - public int getDownloadPercent() { return downloadPercent; } - - - public void setDownloadPercent(int downloadPercent) { - this.downloadPercent = downloadPercent; - } - - - public String getErrorString() { return errorString; } - - - public void setErrorString(String errorString) { - this.errorString = errorString; - } - - - public Long getDataStoreId() { return dataStoreId; } - - - public void setDataStoreId(Long dataStoreId) { - this.dataStoreId = dataStoreId; - } - - - public ObjectInDataStoreStateMachine.State getState() { return state; } - - - public void setState(ObjectInDataStoreStateMachine.State state) { - this.state = state; - } - - - public ScopeType getDataStoreScope() { return dataStoreScope; } - - public void setDataStoreScope(ScopeType dataStoreScope) { - this.dataStoreScope = dataStoreScope; - } - - public String getTempZonePair() { return tempZonePair; } - - - - public void setTempZonePair(String tempZonePair) { - this.tempZonePair = tempZonePair; - } - - } diff --git a/server/src/com/cloud/api/query/vo/UserAccountJoinVO.java b/server/src/com/cloud/api/query/vo/UserAccountJoinVO.java index c44027b8bc0..c020c01798a 100644 --- a/server/src/com/cloud/api/query/vo/UserAccountJoinVO.java +++ b/server/src/com/cloud/api/query/vo/UserAccountJoinVO.java @@ -83,7 +83,6 @@ public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity, I @Column (name="incorrect_login_attempts") int loginAttempts; - @Column(name="account_id") private long accountId; @@ -116,7 +115,7 @@ public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity, I @Column(name="job_status") private int jobStatus; - + @Column(name = "default") boolean isDefault; @@ -128,233 +127,112 @@ public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity, I return id; } - @Override - public void setId(long id) { - this.id = id; - } - @Override public String getUuid() { return uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public long getAccountId() { return accountId; } - public void setAccountId(long accountId) { - this.accountId = accountId; - } - public String getAccountUuid() { return accountUuid; } - public void setAccountUuid(String accountUuid) { - this.accountUuid = accountUuid; - } - public String getAccountName() { return accountName; } - public void setAccountName(String accountName) { - this.accountName = accountName; - } - - public short getAccountType() { return accountType; } - public void setAccountType(short accountType) { - this.accountType = accountType; - } - - public long getDomainId() { return domainId; } - public void setDomainId(long domainId) { - this.domainId = domainId; - } - - public String getDomainUuid() { return domainUuid; } - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - - public String getDomainName() { return domainName; } - public void setDomainName(String domainName) { - this.domainName = domainName; - } - - public String getDomainPath() { return domainPath; } - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - public String getUsername() { return username; } - public void setUsername(String username) { - this.username = username; - } - public String getPassword() { return password; } - public void setPassword(String password) { - this.password = password; - } - public String getFirstname() { return firstname; } - public void setFirstname(String firstname) { - this.firstname = firstname; - } - public String getLastname() { return lastname; } - public void setLastname(String lastname) { - this.lastname = lastname; - } - public String getEmail() { return email; } - public void setEmail(String email) { - this.email = email; - } - public String getState() { return state; } - public void setState(String state) { - this.state = state; - } - public String getApiKey() { return apiKey; } - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - public String getSecretKey() { return secretKey; } - public void setSecretKey(String secretKey) { - this.secretKey = secretKey; - } - public Date getCreated() { return created; } - public void setCreated(Date created) { - this.created = created; - } - public Date getRemoved() { return removed; } - public void setRemoved(Date removed) { - this.removed = removed; - } - public String getTimezone() { return timezone; } - public void setTimezone(String timezone) { - this.timezone = timezone; - } - public String getRegistrationToken() { return registrationToken; } - public void setRegistrationToken(String registrationToken) { - this.registrationToken = registrationToken; - } - public boolean isRegistered() { return registered; } - public void setRegistered(boolean registered) { - this.registered = registered; - } - public int getLoginAttempts() { return loginAttempts; } - public void setLoginAttempts(int loginAttempts) { - this.loginAttempts = loginAttempts; - } - public Long getJobId() { return jobId; } - public void setJobId(Long jobId) { - this.jobId = jobId; - } - public String getJobUuid() { return jobUuid; } - public void setJobUuid(String jobUuid) { - this.jobUuid = jobUuid; - } - public int getJobStatus() { return jobStatus; } - public void setJobStatus(int jobStatus) { - this.jobStatus = jobStatus; - } - public boolean isDefault() { return isDefault; } - - public void setDefault(boolean isDefault) { - this.isDefault = isDefault; - } - - } diff --git a/server/src/com/cloud/api/query/vo/UserVmJoinVO.java b/server/src/com/cloud/api/query/vo/UserVmJoinVO.java index 745db566a74..c9d5ddcc374 100644 --- a/server/src/com/cloud/api/query/vo/UserVmJoinVO.java +++ b/server/src/com/cloud/api/query/vo/UserVmJoinVO.java @@ -32,8 +32,8 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.Network.GuestType; import com.cloud.network.Networks.TrafficType; import com.cloud.server.ResourceTag.TaggedResourceType; -import com.cloud.storage.Volume; import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.storage.Volume; import com.cloud.utils.db.Encrypt; import com.cloud.utils.db.GenericDao; import com.cloud.vm.VirtualMachine; @@ -403,25 +403,11 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity { return id; } - @Override - public void setId(long id) { - this.id = id; - } - - @Override public String getUuid() { return uuid; } - - - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getPassword() { return password; } @@ -430,839 +416,314 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity { this.password = password; } - public String getName() { return name; } - - public void setName(String name) { - this.name = name; - } - - public String getDisplayName() { return displayName; } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - @Override public long getAccountId() { return accountId; } - - public void setAccountId(long accountId) { - this.accountId = accountId; - } - - @Override public String getAccountUuid() { return accountUuid; } - - - - public void setAccountUuid(String accountUuid) { - this.accountUuid = accountUuid; - } - - - - @Override public String getAccountName() { return accountName; } - - public void setAccountName(String accountName) { - this.accountName = accountName; - } - - @Override public short getAccountType() { return accountType; } - - public void setAccountType(short accountType) { - this.accountType = accountType; - } - - @Override public long getDomainId() { return domainId; } - - public void setDomainId(long domainId) { - this.domainId = domainId; - } - - @Override public String getDomainUuid() { return domainUuid; } - - - - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - - - - @Override public String getDomainName() { return domainName; } - - public void setDomainName(String domainName) { - this.domainName = domainName; - } - - @Override public String getDomainPath() { return domainPath; } - - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - - - - public long getInstanceGroupId() { return instanceGroupId; } - - public void setInstanceGroupId(long instanceGroupId) { - this.instanceGroupId = instanceGroupId; - } - - public String getInstanceGroupUuid() { return instanceGroupUuid; } - - - - public void setInstanceGroupUuid(String instanceGroupUuid) { - this.instanceGroupUuid = instanceGroupUuid; - } - - - - public String getInstanceGroupName() { return instanceGroupName; } - - public void setInstanceGroupName(String instanceGroupName) { - this.instanceGroupName = instanceGroupName; - } - - public VirtualMachine.Type getType() { return type; } - - - - public void setType(VirtualMachine.Type type) { - this.type = type; - } - - - - public State getState() { return state; } - - public void setState(State state) { - this.state = state; - } - - public Date getCreated() { return created; } - - public void setCreated(Date created) { - this.created = created; - } - - public Date getRemoved() { return removed; } - - public void setRemoved(Date removed) { - this.removed = removed; - } - - public String getInstanceName() { return instanceName; } - - public void setInstanceName(String instanceName) { - this.instanceName = instanceName; - } - - public long getGuestOSId() { return guestOsId; } - - public void setGuestOSId(long guestOSId) { - this.guestOsId = guestOSId; - } - - public String getGuestOsUuid() { return guestOsUuid; } - - - - public void setGuestOsUuid(String guestOsUuid) { - this.guestOsUuid = guestOsUuid; - } - - - - public HypervisorType getHypervisorType() { return hypervisorType; } - - public void setHypervisorType(HypervisorType hypervisorType) { - this.hypervisorType = hypervisorType; - } - - public boolean isHaEnabled() { return haEnabled; } - - public void setHaEnabled(boolean haEnabled) { - this.haEnabled = haEnabled; - } - - public void setVncPassword(String vncPassword) { - this.vncPassword = vncPassword; - } - public String getVncPassword() { return vncPassword; } - - - public String getPrivateIpAddress() { return privateIpAddress; } - - - - public void setPrivateIpAddress(String privateIpAddress) { - this.privateIpAddress = privateIpAddress; - } - - - - public String getPrivateMacAddress() { return privateMacAddress; } - - - - public void setPrivateMacAddress(String privateMacAddress) { - this.privateMacAddress = privateMacAddress; - } - - - - public Long getLastHostId() { return lastHostId; } - - - - public void setLastHostId(Long lastHostId) { - this.lastHostId = lastHostId; - } - - - - - - public Long getPodId() { return podId; } - - - - public void setPodId(Long podIdToDeployIn) { - this.podId = podIdToDeployIn; - } - - - - public String getPodUuid() { return podUuid; } - - - - public void setPodUuid(String podUuid) { - this.podUuid = podUuid; - } - - - - public long getDataCenterId() { return dataCenterId; } - - - - public void setDataCenterId(long dataCenterIdToDeployIn) { - this.dataCenterId = dataCenterIdToDeployIn; - } - - public boolean limitCpuUse() { return limitCpuUse; } - public void setLimitCpuUse(boolean value) { - limitCpuUse = value; - } - public boolean isDisplayVm() { return displayVm; } - public void setDisplayVm(boolean displayVm) { - this.displayVm = displayVm; - } - public String getDataCenterUuid() { return dataCenterUuid; } - - - - public void setDataCenterUuid(String zoneUuid) { - this.dataCenterUuid = zoneUuid; - } - - - - public String getDataCenterName() { return dataCenterName; } - - public void setDataCenterName(String zoneName) { - this.dataCenterName = zoneName; - } - - public boolean isSecurityGroupEnabled() { return securityGroupEnabled; } - - public void setSecurityGroupEnabled(boolean securityGroupEnabled) { - this.securityGroupEnabled = securityGroupEnabled; - } - - public Long getHostId() { return hostId; } - - public void setHostId(long hostId) { - this.hostId = hostId; - } - - public String getHostUuid() { return hostUuid; } - - - - public void setHostUuid(String hostUuid) { - this.hostUuid = hostUuid; - } - - - - public String getHostName() { return hostName; } - - public void setHostName(String hostName) { - this.hostName = hostName; - } - - public long getTemplateId() { return templateId; } - - public void setTemplateId(long templateId) { - this.templateId = templateId; - } - - - public String getTemplateUuid() { return templateUuid; } - - - - public void setTemplateUuid(String templateUuid) { - this.templateUuid = templateUuid; - } - - - - public String getTemplateName() { return templateName; } - - public void setTemplateName(String templateName) { - this.templateName = templateName; - } - - public String getTemplateDisplayText() { return templateDisplayText; } - - public void setTemplateDisplayText(String templateDisplayText) { - this.templateDisplayText = templateDisplayText; - } - - public boolean isPasswordEnabled() { return passwordEnabled; } - - public void setPasswordEnabled(boolean passwordEnabled) { - this.passwordEnabled = passwordEnabled; - } - - public Long getIsoId() { return isoId; } - - public void setIsoId(long isoId) { - this.isoId = isoId; - } - - public String getIsoUuid() { return isoUuid; } - - - - public void setIsoUuid(String isoUuid) { - this.isoUuid = isoUuid; - } - - - - public String getIsoName() { return isoName; } - - public void setIsoName(String isoName) { - this.isoName = isoName; - } - - public String getIsoDisplayText() { return isoDisplayText; } - public void setIsoDisplayText(String isoDisplayText) { - this.isoDisplayText = isoDisplayText; - } - - - - public String getServiceOfferingUuid() { return serviceOfferingUuid; } - - - - public void setServiceOfferingUuid(String serviceOfferingUuid) { - this.serviceOfferingUuid = serviceOfferingUuid; - } - - - - public String getServiceOfferingName() { return serviceOfferingName; } - - public void setServiceOfferingName(String serviceOfferingName) { - this.serviceOfferingName = serviceOfferingName; - } - - public int getCpu() { return cpu; } - - public void setCpu(int cpu) { - this.cpu = cpu; - } - - public int getSpeed() { return speed; } - - public void setSpeed(int speed) { - this.speed = speed; - } - - public int getRamSize() { return ramSize; } - - public void setRamSize(int ramSize) { - this.ramSize = ramSize; - } - - public long getPoolId() { return poolId; } - - public void setPoolId(long poolId) { - this.poolId = poolId; - } - - public StoragePoolType getPoolType() { return poolType; } - - public void setPoolType(StoragePoolType poolType) { - this.poolType = poolType; - } - - public long getVolume_id() { return volume_id; } - - public void setVolume_id(long volume_id) { - this.volume_id = volume_id; - } - - public Long getVolumeDeviceId() { return volumeDeviceId; } - - public void setVolumeDeviceId(Long volumeDeviceId) { - this.volumeDeviceId = volumeDeviceId; - } - - public Volume.Type getVolumeType() { return volumeType; } - - public void setVolumeType(Volume.Type volumeType) { - this.volumeType = volumeType; - } - - public long getSecurityGroupId() { return securityGroupId; } - - public void setSecurityGroupId(long securityGroupId) { - this.securityGroupId = securityGroupId; - } - - public String getSecurityGroupName() { return securityGroupName; } - - public void setSecurityGroupName(String securityGroupName) { - this.securityGroupName = securityGroupName; - } - - public String getSecurityGroupDescription() { return securityGroupDescription; } - - public void setSecurityGroupDescription(String securityGroupDescription) { - this.securityGroupDescription = securityGroupDescription; - } - - public long getVpcId() { return vpcId; } - - - public void setVpcId(long vpcId) { - this.vpcId = vpcId; - } - - - - public long getNicId() { return nicId; } - - public void setNicId(long nicId) { - this.nicId = nicId; - } - - public boolean isDefaultNic() { return isDefaultNic; } - - public void setDefaultNic(boolean isDefaultNic) { - this.isDefaultNic = isDefaultNic; - } - - public String getIpAddress() { return ipAddress; } - - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } - - public String getGateway() { return gateway; } - - public void setGateway(String gateway) { - this.gateway = gateway; - } - - public String getNetmask() { return netmask; } - - public void setNetmask(String netmask) { - this.netmask = netmask; - } - - public String getMacAddress() { return macAddress; } - - public void setMacAddress(String macAddress) { - this.macAddress = macAddress; - } - - public URI getBroadcastUri() { return broadcastUri; } - - public void setBroadcastUri(URI broadcastUri) { - this.broadcastUri = broadcastUri; - } - - public URI getIsolationUri() { return isolationUri; } - - public void setIsolationUri(URI isolationUri) { - this.isolationUri = isolationUri; - } - - public long getNetworkId() { return networkId; } - - public void setNetworkId(long networkId) { - this.networkId = networkId; - } - - public String getNetworkName() { return networkName; } - - public void setNetworkName(String networkName) { - this.networkName = networkName; - } - - public TrafficType getTrafficType() { return trafficType; } - - public void setTrafficType(TrafficType trafficType) { - this.trafficType = trafficType; - } - - public GuestType getGuestType() { return guestType; } - - public void setGuestType(GuestType guestType) { - this.guestType = guestType; - } - - public long getPublicIpId() { return publicIpId; } - - - - public void setPublicIpId(long publicIpId) { - this.publicIpId = publicIpId; - } - - - - public String getPublicIpAddress() { return publicIpAddress; } - - public void setPublicIpAddress(String publicIpAddress) { - this.publicIpAddress = publicIpAddress; - } - - - public long getServiceOfferingId() { return serviceOfferingId; } - - - - public void setServiceOfferingId(long serviceOfferingId) { - this.serviceOfferingId = serviceOfferingId; - } - - public Map getDetails() { return details; } @@ -1273,382 +734,116 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity { return details != null ? details.get(name) : null; } - public void setDetail(String name, String value) { - assert (details != null) : "Did you forget to load the details?"; - - details.put(name, value); - } - - public void setDetails(Map details) { - this.details = details; - } - - public void setUserData(String userData) { - this.userData = userData; - } - public String getUserData() { return userData; } - - public long getGuestOsId() { return guestOsId; } - - - - public void setGuestOsId(long guestOsId) { - this.guestOsId = guestOsId; - } - - - - public long getProjectId() { return projectId; } - - - - public void setProjectId(long projectId) { - this.projectId = projectId; - } - - - - @Override public String getProjectUuid() { return projectUuid; } - - - - public void setProjectUuid(String projectUuid) { - this.projectUuid = projectUuid; - } - - - - @Override public String getProjectName() { return projectName; } - - - - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - - - public String getKeypairName() { return keypairName; } - - - - public void setKeypairName(String keypairName) { - this.keypairName = keypairName; - } - - - - public long getTagId() { return tagId; } - - - - public void setTagId(long tagId) { - this.tagId = tagId; - } - - - - public String getTagUuid() { return tagUuid; } - - - - public void setTagUuid(String tagUuid) { - this.tagUuid = tagUuid; - } - - - - public String getTagKey() { return tagKey; } - - - - public void setTagKey(String tagKey) { - this.tagKey = tagKey; - } - - - - public String getTagValue() { return tagValue; } - - - - public void setTagValue(String tagValue) { - this.tagValue = tagValue; - } - - - - public long getTagDomainId() { return tagDomainId; } - - - - public void setTagDomainId(long tagDomainId) { - this.tagDomainId = tagDomainId; - } - - - - public long getTagAccountId() { return tagAccountId; } - - - - public void setTagAccountId(long tagAccountId) { - this.tagAccountId = tagAccountId; - } - - - - public long getTagResourceId() { return tagResourceId; } - - - - public void setTagResourceId(long tagResourceId) { - this.tagResourceId = tagResourceId; - } - - - - public String getTagResourceUuid() { return tagResourceUuid; } - - - - public void setTagResourceUuid(String tagResourceUuid) { - this.tagResourceUuid = tagResourceUuid; - } - - - - public TaggedResourceType getTagResourceType() { return tagResourceType; } - - - - public void setTagResourceType(TaggedResourceType tagResourceType) { - this.tagResourceType = tagResourceType; - } - - - - public String getTagCustomer() { return tagCustomer; } - - - - public void setTagCustomer(String tagCustomer) { - this.tagCustomer = tagCustomer; - } - - - - public boolean isLimitCpuUse() { return limitCpuUse; } - - public String getPoolUuid() { return poolUuid; } - - - - public void setPoolUuid(String poolUuid) { - this.poolUuid = poolUuid; - } - - - - public String getVolume_uuid() { return volume_uuid; } - - - - public void setVolume_uuid(String volume_uuid) { - this.volume_uuid = volume_uuid; - } - - - - public String getSecurityGroupUuid() { return securityGroupUuid; } - - - - public void setSecurityGroupUuid(String securityGroupUuid) { - this.securityGroupUuid = securityGroupUuid; - } - - - - public String getVpcUuid() { return vpcUuid; } - - - - public void setVpcUuid(String vpcUuid) { - this.vpcUuid = vpcUuid; - } - - - - public String getNicUuid() { return nicUuid; } - - - - public void setNicUuid(String nicUuid) { - this.nicUuid = nicUuid; - } - - - - public String getNetworkUuid() { return networkUuid; } - - - - public void setNetworkUuid(String networkUuid) { - this.networkUuid = networkUuid; - } - - - - public String getPublicIpUuid() { return publicIpUuid; } - - - - public void setPublicIpUuid(String publicIpUuid) { - this.publicIpUuid = publicIpUuid; - } - - - public Long getJobId() { return jobId; } - - - - public void setJobId(Long jobId) { - this.jobId = jobId; - } - - - - public String getJobUuid() { return jobUuid; } - - - - public void setJobUuid(String jobUuid) { - this.jobUuid = jobUuid; - } - - - - public int getJobStatus() { return jobStatus; } - - - - public void setJobStatus(int jobStatus) { - this.jobStatus = jobStatus; - } - - - transient String toString; @Override public String toString() { @@ -1658,64 +853,30 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity { return toString; } - public String getIp6Address() { - return ip6Address; - } + public String getIp6Address() { + return ip6Address; + } + public String getIp6Gateway() { + return ip6Gateway; + } - - - public void setIp6Address(String ip6Address) { - this.ip6Address = ip6Address; - } - - - - - public String getIp6Gateway() { - return ip6Gateway; - } - - - - - public void setIp6Gateway(String ip6Gateway) { - this.ip6Gateway = ip6Gateway; - } - - - - - public String getIp6Cidr() { - return ip6Cidr; - } - - - - - public void setIp6Cidr(String ip6Cidr) { - this.ip6Cidr = ip6Cidr; - } - + public String getIp6Cidr() { + return ip6Cidr; + } public long getAffinityGroupId() { return affinityGroupId; } - - public String getAffinityGroupUuid() { return affinityGroupUuid; } - - public String getAffinityGroupName() { return affinityGroupName; } - - public String getAffinityGroupDescription() { return affinityGroupDescription; } @@ -1723,10 +884,4 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity { public Boolean isDynamicallyScalable() { return isDynamicallyScalable; } - - public void setDynamicallyScalable(boolean isDynamicallyScalable) { - this.isDynamicallyScalable = isDynamicallyScalable; - } - - } diff --git a/server/src/com/cloud/api/query/vo/VolumeJoinVO.java b/server/src/com/cloud/api/query/vo/VolumeJoinVO.java index 9fe9fd1fe5b..066ed94a382 100644 --- a/server/src/com/cloud/api/query/vo/VolumeJoinVO.java +++ b/server/src/com/cloud/api/query/vo/VolumeJoinVO.java @@ -279,13 +279,6 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { - @Override - public void setId(long id) { - this.id = id; - } - - - @Override public String getUuid() { return uuid; @@ -293,121 +286,61 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { - public void setUuid(String uuid) { - this.uuid = uuid; - } - - - public String getName() { return name; } - public void setName(String name) { - this.name = name; - } - - - public Long getDeviceId() { return deviceId; } - public void setDeviceId(Long deviceId) { - this.deviceId = deviceId; - } - - - public Volume.Type getVolumeType() { return volumeType; } - public void setVolumeType(Volume.Type volumeType) { - this.volumeType = volumeType; - } - - - public long getSize() { return size; } - public void setSize(long size) { - this.size = size; - } - public Long getMinIops() { return minIops; } - public void setMinIops(Long minIops) { - this.minIops = minIops; - } - public Long getMaxIops() { return maxIops; } - public void setMaxIops(Long maxIops) { - this.maxIops = maxIops; - } - public Volume.State getState() { return state; } - public void setState(Volume.State state) { - this.state = state; - } - - - public Date getCreated() { return created; } - public void setCreated(Date created) { - this.created = created; - } - - - public Date getAttached() { return attached; } - public void setAttached(Date attached) { - this.attached = attached; - } - - - public Date getRemoved() { return removed; } - public void setRemoved(Date removed) { - this.removed = removed; - } - - - @Override public long getAccountId() { return accountId; @@ -415,19 +348,10 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { - public void setAccountId(long accountId) { - this.accountId = accountId; - } - - public boolean isDisplayVolume() { return displayVolume; } - public void setDisplayVolume(boolean displayVolume) { - this.displayVolume = displayVolume; - } - @Override public String getAccountUuid() { return accountUuid; @@ -435,12 +359,6 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { - public void setAccountUuid(String accountUuid) { - this.accountUuid = accountUuid; - } - - - @Override public String getAccountName() { return accountName; @@ -448,12 +366,6 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { - public void setAccountName(String accountName) { - this.accountName = accountName; - } - - - @Override public short getAccountType() { return accountType; @@ -461,12 +373,6 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { - public void setAccountType(short accountType) { - this.accountType = accountType; - } - - - @Override public long getDomainId() { return domainId; @@ -474,12 +380,6 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { - public void setDomainId(long domainId) { - this.domainId = domainId; - } - - - @Override public String getDomainUuid() { return domainUuid; @@ -487,12 +387,6 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { - public void setDomainUuid(String domainUuid) { - this.domainUuid = domainUuid; - } - - - @Override public String getDomainName() { return domainName; @@ -500,12 +394,6 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { - public void setDomainName(String domainName) { - this.domainName = domainName; - } - - - @Override public String getDomainPath() { return domainPath; @@ -513,24 +401,12 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { - public void setDomainPath(String domainPath) { - this.domainPath = domainPath; - } - - - public long getProjectId() { return projectId; } - public void setProjectId(long projectId) { - this.projectId = projectId; - } - - - @Override public String getProjectUuid() { return projectUuid; @@ -538,12 +414,6 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { - public void setProjectUuid(String projectUuid) { - this.projectUuid = projectUuid; - } - - - @Override public String getProjectName() { return projectName; @@ -551,245 +421,122 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - - public long getVmId() { return vmId; } - public void setVmId(long vmId) { - this.vmId = vmId; - } - - - public String getVmUuid() { return vmUuid; } - public void setVmUuid(String vmUuid) { - this.vmUuid = vmUuid; - } - - - public String getVmName() { return vmName; } - public void setVmName(String vmName) { - this.vmName = vmName; - } - - - public String getVmDisplayName() { return vmDisplayName; } - public void setVmDisplayName(String vmDisplayName) { - this.vmDisplayName = vmDisplayName; - } - - - public VirtualMachine.State getVmState() { return vmState; } - public void setVmState(VirtualMachine.State vmState) { - this.vmState = vmState; - } - - - public VirtualMachine.Type getVmType() { return vmType; } - public void setVmType(VirtualMachine.Type vmType) { - this.vmType = vmType; - } - public long getVolumeStoreSize() { return volumeStoreSize; } - public void setVolumeStoreSize(long volumeStoreSize) { - this.volumeStoreSize = volumeStoreSize; - } - public Date getCreatedOnStore() { return createdOnStore; } - public void setCreatedOnStore(Date createdOnStore) { - this.createdOnStore = createdOnStore; - } - public Storage.ImageFormat getFormat() { return format; } - public void setFormat(Storage.ImageFormat format) { - this.format = format; - } - - - public int getDownloadPercent() { return downloadPercent; } - public void setDownloadPercent(int downloadPercent) { - this.downloadPercent = downloadPercent; - } - - - public Status getDownloadState() { return downloadState; } - public void setDownloadState(Status downloadState) { - this.downloadState = downloadState; - } - - - public String getErrorString() { return errorString; } - public void setErrorString(String errorString) { - this.errorString = errorString; - } - - - public HypervisorType getHypervisorType() { return hypervisorType; } - public void setHypervisorType(HypervisorType hypervisorType) { - this.hypervisorType = hypervisorType; - } - - - public long getDiskOfferingId() { return diskOfferingId; } - public void setDiskOfferingId(long diskOfferingId) { - this.diskOfferingId = diskOfferingId; - } - - - public String getDiskOfferingUuid() { return diskOfferingUuid; } - public void setDiskOfferingUuid(String diskOfferingUuid) { - this.diskOfferingUuid = diskOfferingUuid; - } - - - public String getDiskOfferingName() { return diskOfferingName; } - public void setDiskOfferingName(String diskOfferingName) { - this.diskOfferingName = diskOfferingName; - } - - - public String getDiskOfferingDisplayText() { return diskOfferingDisplayText; } - public void setDiskOfferingDisplayText(String diskOfferingDisplayText) { - this.diskOfferingDisplayText = diskOfferingDisplayText; - } - - - public boolean isUseLocalStorage() { return useLocalStorage; } - public void setUseLocalStorage(boolean useLocalStorage) { - this.useLocalStorage = useLocalStorage; - } - - - public void setBytesReadRate(Long bytesReadRate) { - this.bytesReadRate = bytesReadRate; - } - public Long getBytesReadRate() { return bytesReadRate; } - public void setBytesWriteRate(Long bytesWriteRate) { - this.bytesWriteRate = bytesWriteRate; - } - public Long getBytesWriteRate() { return bytesWriteRate; } - public void setIopsReadRate(Long iopsReadRate) { - this.iopsReadRate = iopsReadRate; - } - public Long getIopsReadRate() { return iopsReadRate; } - public void setIopsWriteRate(Long iopsWriteRate) { - this.iopsWriteRate = iopsWriteRate; - } - public Long getIopsWriteRate() { return iopsWriteRate; } @@ -800,306 +547,153 @@ public class VolumeJoinVO extends BaseViewVO implements ControlledViewEntity { - public void setPoolId(long poolId) { - this.poolId = poolId; - } - - - public String getPoolUuid() { return poolUuid; } - public void setPoolUuid(String poolUuid) { - this.poolUuid = poolUuid; - } - - - public String getPoolName() { return poolName; } - public void setPoolName(String poolName) { - this.poolName = poolName; - } - - - public long getTemplateId() { return templateId; } - public void setTemplateId(long templateId) { - this.templateId = templateId; - } - - - public String getTemplateUuid() { return templateUuid; } - public void setTemplateUuid(String templateUuid) { - this.templateUuid = templateUuid; - } - - - public boolean isExtractable() { return extractable; } - public void setExtractable(boolean extractable) { - this.extractable = extractable; - } - - - public Storage.TemplateType getTemplateType() { return templateType; } - public void setTemplateType(Storage.TemplateType templateType) { - this.templateType = templateType; - } - - - public Long getJobId() { return jobId; } - public void setJobId(Long jobId) { - this.jobId = jobId; - } - - - public String getJobUuid() { return jobUuid; } - public void setJobUuid(String jobUuid) { - this.jobUuid = jobUuid; - } - - - public int getJobStatus() { return jobStatus; } - public void setJobStatus(int jobStatus) { - this.jobStatus = jobStatus; - } - - - public long getTagId() { return tagId; } - public void setTagId(long tagId) { - this.tagId = tagId; - } - - - public String getTagUuid() { return tagUuid; } - public void setTagUuid(String tagUuid) { - this.tagUuid = tagUuid; - } - - - public String getTagKey() { return tagKey; } - public void setTagKey(String tagKey) { - this.tagKey = tagKey; - } - - - public String getTagValue() { return tagValue; } - public void setTagValue(String tagValue) { - this.tagValue = tagValue; - } - - - public long getTagDomainId() { return tagDomainId; } - public void setTagDomainId(long tagDomainId) { - this.tagDomainId = tagDomainId; - } - - - public long getTagAccountId() { return tagAccountId; } - public void setTagAccountId(long tagAccountId) { - this.tagAccountId = tagAccountId; - } - - - public long getTagResourceId() { return tagResourceId; } - public void setTagResourceId(long tagResourceId) { - this.tagResourceId = tagResourceId; - } - - - public String getTagResourceUuid() { return tagResourceUuid; } - public void setTagResourceUuid(String tagResourceUuid) { - this.tagResourceUuid = tagResourceUuid; - } - - - public TaggedResourceType getTagResourceType() { return tagResourceType; } - public void setTagResourceType(TaggedResourceType tagResourceType) { - this.tagResourceType = tagResourceType; - } - - - public String getTagCustomer() { return tagCustomer; } - public void setTagCustomer(String tagCustomer) { - this.tagCustomer = tagCustomer; - } - - - public long getDataCenterId() { return dataCenterId; } - public void setDataCenterId(long dataCenterId) { - this.dataCenterId = dataCenterId; - } - - - public String getDataCenterUuid() { return dataCenterUuid; } - public void setDataCenterUuid(String dataCenterUuid) { - this.dataCenterUuid = dataCenterUuid; - } - - - public String getDataCenterName() { return dataCenterName; } - public void setDataCenterName(String dataCenterName) { - this.dataCenterName = dataCenterName; - } - - - public long getPodId() { return podId; } - public void setPodId(long podId) { - this.podId = podId; - } - - - public boolean isSystemUse() { return systemUse; } - public void setSystemUse(boolean systemUse) { - this.systemUse = systemUse; - } - - public String getPath() { return path; } - public void setPath(String path) { - this.path = path; - } - } diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index 1377bf72161..9d94bbaa481 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -79,7 +79,8 @@ public enum Config { CreatePrivateTemplateFromSnapshotWait("Storage", UserVmManager.class, Integer.class, "create.private.template.from.snapshot.wait", "10800", "In second, timeout for CreatePrivateTemplateFromSnapshotCommand", null), BackupSnapshotWait( "Storage", StorageManager.class, Integer.class, "backup.snapshot.wait", "21600", "In second, timeout for BackupSnapshotCommand", null), - + HAStorageMigration("Storage", ManagementServer.class, Boolean.class, "enable.ha.storage.migration", "true", "Enable/disable storage migration across primary storage during HA", null), + // Network NetworkLBHaproxyStatsVisbility("Network", ManagementServer.class, String.class, "network.loadbalancer.haproxy.stats.visibility", "global", "Load Balancer(haproxy) stats visibilty, the value can be one of the following six parameters : global,guest-network,link-local,disabled,all,default", null), NetworkLBHaproxyStatsUri("Network", ManagementServer.class, String.class, "network.loadbalancer.haproxy.stats.uri","/admin?stats","Load Balancer(haproxy) uri.",null), diff --git a/server/src/com/cloud/network/element/VirtualRouterElement.java b/server/src/com/cloud/network/element/VirtualRouterElement.java index 0cd3bcf6db0..eb53db6be8e 100755 --- a/server/src/com/cloud/network/element/VirtualRouterElement.java +++ b/server/src/com/cloud/network/element/VirtualRouterElement.java @@ -78,6 +78,7 @@ import com.cloud.network.rules.StaticNat; import com.cloud.offering.NetworkOffering; import com.cloud.offerings.NetworkOfferingVO; import com.cloud.offerings.dao.NetworkOfferingDao; +import com.cloud.user.Account; import com.cloud.user.AccountManager; import com.cloud.utils.Pair; import com.cloud.utils.component.AdapterBase; @@ -662,8 +663,11 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl return true; } boolean result = true; + // NOTE that we need to pass caller account to destroyRouter, otherwise it will fail permission check there. Context passed in from deleteNetwork is the network account, + // not caller account + Account callerAccount = _accountMgr.getAccount(context.getCaller().getAccountId()); for (DomainRouterVO router : routers) { - result = result && (_routerMgr.destroyRouter(router.getId(), context.getAccount(), context.getCaller().getId()) != null); + result = result && (_routerMgr.destroyRouter(router.getId(), callerAccount, context.getCaller().getId()) != null); } return result; } diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 0a0fcdc08c3..71730442589 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -42,9 +42,6 @@ import javax.crypto.spec.SecretKeySpec; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.commons.codec.binary.Base64; -import org.apache.log4j.Logger; - import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.affinity.AffinityGroupProcessor; @@ -339,6 +336,7 @@ import org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotCmd; import org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotPoliciesCmd; import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotPoliciesCmd; import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotsCmd; +import org.apache.cloudstack.api.command.user.snapshot.RevertSnapshotCmd; import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd; import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd; import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd; @@ -438,6 +436,8 @@ import org.apache.cloudstack.storage.datastore.db.ImageStoreVO; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.utils.identity.ManagementServerNode; +import org.apache.commons.codec.binary.Base64; +import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.api.GetVncPortAnswer; @@ -2731,6 +2731,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe cmdList.add(DeleteSnapshotPoliciesCmd.class); cmdList.add(ListSnapshotPoliciesCmd.class); cmdList.add(ListSnapshotsCmd.class); + cmdList.add(RevertSnapshotCmd.class); cmdList.add(CreateSSHKeyPairCmd.class); cmdList.add(DeleteSSHKeyPairCmd.class); cmdList.add(ListSSHKeyPairsCmd.class); @@ -3164,7 +3165,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe } @Override - @ActionEvent(eventType = "", eventDescription = "", async = true) + @ActionEvent(eventType = "", eventDescription = "", async = true) public VMInstanceVO destroySystemVM(DestroySystemVmCmd cmd) { VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(cmd.getId(), VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm); @@ -3640,7 +3641,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe String password = vm.getDetail("Encrypted.Password"); if (password == null || password.equals("")) { InvalidParameterValueException ex = new InvalidParameterValueException("No password for VM with specified id found. " + - "If VM is created from password enabled template and SSH keypair is assigned to VM then only password can be retrieved."); + "If VM is created from password enabled template and SSH keypair is assigned to VM then only password can be retrieved."); ex.addProxyObject(vm.getUuid(), "vmId"); throw ex; } diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index 0b53cfda11f..dade9837d90 100755 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -40,6 +40,8 @@ import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotService; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy; +import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority; +import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority.Priority; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope; @@ -264,9 +266,23 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, throw new InvalidParameterValueException("No such snapshot"); } + Volume volume = _volsDao.findById(snapshot.getVolumeId()); + Long instanceId = volume.getInstanceId(); + + // If this volume is attached to an VM, then the VM needs to be in the stopped state + // in order to revert the volume + if (instanceId != null) { + UserVmVO vm = _vmDao.findById(instanceId); + if (vm.getState() != State.Stopped && vm.getState() != State.Shutdowned) { + throw new InvalidParameterValueException("The VM the specified disk is attached to is not in the shutdown state."); + } + } + + StrategyPriority.sortStrategies(snapshotStrategies, snapshot); + SnapshotStrategy snapshotStrategy = null; for (SnapshotStrategy strategy : snapshotStrategies) { - if (strategy.canHandle(snapshot)) { + if (strategy.canHandle(snapshot) != Priority.CANT_HANDLE) { snapshotStrategy = strategy; break; } @@ -366,7 +382,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, <<<<<<< HEAD downloadSnapshotFromSwiftCommand cmd = new downloadSnapshotFromSwiftCommand(swift, secStore.getUri(), dcId, accountId, volumeId, parent, backupUuid, _backupsnapshotwait); ======= - DownloadSnapshotFromSwiftCommand cmd = new DownloadSnapshotFromSwiftCommand(swift, secondaryStoragePoolUrl, dcId, accountId, volumeId, parent, backupUuid, _backupsnapshotwait); + DownloadSnapshotFromSwiftCommand cmd = new DownloadSnapshotFromSwiftCommand(swift, secondaryStoragePoolUrl, dcId, accountId, volumeId, parent, backupUuid, _backupsnapshotwait); >>>>>>> master Answer answer = _agentMgr.sendToSSVM(dcId, cmd); if ((answer == null) || !answer.getResult()) { @@ -501,10 +517,12 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, throw new InvalidParameterValueException("unable to find a snapshot with id " + snapshotId); } + StrategyPriority.sortStrategies(snapshotStrategies, snapshotCheck); + _accountMgr.checkAccess(caller, null, true, snapshotCheck); SnapshotStrategy snapshotStrategy = null; for (SnapshotStrategy strategy : snapshotStrategies) { - if (strategy.canHandle(snapshotCheck)) { + if (strategy.canHandle(snapshotCheck) != Priority.CANT_HANDLE) { snapshotStrategy = strategy; break; } @@ -695,8 +713,11 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, for (SnapshotVO snapshot : snapshots) { SnapshotVO snap = _snapshotDao.findById(snapshot.getId()); SnapshotStrategy snapshotStrategy = null; + + StrategyPriority.sortStrategies(snapshotStrategies, snapshot); + for (SnapshotStrategy strategy : snapshotStrategies) { - if (strategy.canHandle(snap)) { + if (strategy.canHandle(snap) != Priority.CANT_HANDLE) { snapshotStrategy = strategy; break; } @@ -1026,9 +1047,11 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, SnapshotInfo snapshot = snapshotFactory.getSnapshot(snapshotId, volume.getDataStore()); boolean processed = false; + StrategyPriority.sortStrategies(snapshotStrategies, snapshot); + try { for (SnapshotStrategy strategy : snapshotStrategies) { - if (strategy.canHandle(snapshot)) { + if (strategy.canHandle(snapshot) != Priority.CANT_HANDLE) { processed = true; snapshot = strategy.takeSnapshot(snapshot); break; diff --git a/setup/db/db/schema-420to421.sql b/setup/db/db/schema-420to421.sql new file mode 100644 index 00000000000..fc43fe50661 --- /dev/null +++ b/setup/db/db/schema-420to421.sql @@ -0,0 +1,26 @@ +-- 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. + +--; +-- Schema upgrade from 4.2.0 to 4.2.1; +--; + + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 's3.multipart.enabled', 'true', 'enable s3 multipart upload'); + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Storage", 'DEFAULT', 'management-server', "enable.ha.storage.migration", "true", "Enable/disable storage migration across primary storage during HA"); + diff --git a/setup/db/db/schema-420to430-cleanup.sql b/setup/db/db/schema-421to430-cleanup.sql similarity index 100% rename from setup/db/db/schema-420to430-cleanup.sql rename to setup/db/db/schema-421to430-cleanup.sql diff --git a/setup/db/db/schema-420to430.sql b/setup/db/db/schema-421to430.sql similarity index 98% rename from setup/db/db/schema-420to430.sql rename to setup/db/db/schema-421to430.sql index a7651895699..8e4aa939e03 100644 --- a/setup/db/db/schema-420to430.sql +++ b/setup/db/db/schema-421to430.sql @@ -391,8 +391,6 @@ CREATE VIEW `cloud`.`volume_view` AS and async_job.instance_type = 'Volume' and async_job.job_status = 0; -INSERT IGNORE INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Advanced', 'DEFAULT', 'management-server', 's3.multipart.enabled', 'true', 'enable s3 multipart upload', 'true'); - DROP VIEW IF EXISTS `cloud`.`storage_pool_view`; CREATE VIEW `cloud`.`storage_pool_view` AS select diff --git a/systemvm/conf/agent.properties b/systemvm/conf/agent.properties index 246cb1c3d08..051cf610710 100644 --- a/systemvm/conf/agent.properties +++ b/systemvm/conf/agent.properties @@ -1,2 +1,18 @@ +# 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. instance=ConsoleProxy resource=com.cloud.agent.resource.consoleproxy.ConsoleProxyResource diff --git a/systemvm/conf/agent.properties.ssvm b/systemvm/conf/agent.properties.ssvm index 507ea4d0c4a..2f87b88dba1 100644 --- a/systemvm/conf/agent.properties.ssvm +++ b/systemvm/conf/agent.properties.ssvm @@ -1,3 +1,20 @@ +# 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. + #mount.path=~/secondary-storage/ resource=org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource testCifsMount=cifs://192.168.1.1/CSHV3?user=administrator&password=1pass%40word1 diff --git a/test/integration/component/test_accounts.py b/test/integration/component/test_accounts.py index 1af408e03c9..4c73c3acc84 100644 --- a/test/integration/component/test_accounts.py +++ b/test/integration/component/test_accounts.py @@ -77,13 +77,14 @@ class Services: "template": { "displaytext": "Public Template", "name": "Public template", - "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2", - "hypervisor": 'XenServer', - "format": 'VHD', + "ostype": 'CentOS 5.3 (64-bit)', + "url": "", + "hypervisor": '', + "format": '', "isfeatured": True, "ispublic": True, "isextractable": True, - "ostype": 'CentOS 5.3 (64-bit)', + "templatefilter": "self" }, "natrule": { "publicport": 22, @@ -731,8 +732,7 @@ class TestTemplateHierarchy(cloudstackTestCase): cls.services = Services().services # Get Zone settings cls.zone = get_zone(cls.api_client, cls.services) - cls.services['mode'] = cls.zone.networktype - cls.services["template"]["zoneid"] = cls.zone.id + cls.services['mode'] = cls.zone.networktype # Create domains, accounts and template cls.domain_1 = Domain.create( @@ -761,11 +761,18 @@ class TestTemplateHierarchy(cloudstackTestCase): domainid=cls.domain_2.id ) + builtin_info = get_builtin_template_info(cls.api_client, cls.zone.id) + cls.services["template"]["url"] = builtin_info[0] + cls.services["template"]["hypervisor"] = builtin_info[1] + cls.services["template"]["format"] = builtin_info[2] + + # Register new template cls.template = Template.register( - cls.api_client, - cls.services["template"], - account=cls.account_1.name, - domainid=cls.domain_1.id + cls.api_client, + cls.services["template"], + zoneid=cls.zone.id, + account=cls.account_1.name, + domainid=cls.domain_1.id ) # Wait for template to download diff --git a/test/integration/component/test_blocker_bugs.py b/test/integration/component/test_blocker_bugs.py index 2cdc2707020..62800f8be03 100644 --- a/test/integration/component/test_blocker_bugs.py +++ b/test/integration/component/test_blocker_bugs.py @@ -67,14 +67,14 @@ class Services: "publicport": 22, "protocol": 'TCP', }, - "templates": { + "template": { "displaytext": 'Template from snapshot', "name": 'Template from snapshot', "ostype": 'CentOS 5.3 (64-bit)', "templatefilter": 'self', - "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2", - "hypervisor": 'XenServer', - "format": 'VHD', + "url": "", + "hypervisor": '', + "format": '', "isfeatured": True, "ispublic": True, "isextractable": True, @@ -118,7 +118,7 @@ class TestTemplate(cloudstackTestCase): cls.zone = get_zone(cls.api_client, cls.services) cls.services['mode'] = cls.zone.networktype cls.services["virtual_machine"]["zoneid"] = cls.zone.id - cls.services["templates"]["zoneid"] = cls.zone.id + cls.services["template"]["zoneid"] = cls.zone.id cls.service_offering = ServiceOffering.create( cls.api_client, @@ -160,16 +160,26 @@ class TestTemplate(cloudstackTestCase): #2. Deploy VM using this template #3. Deploy VM should return password set in template. + builtin_info = get_builtin_template_info(self.apiclient, self.zone.id) + self.services["template"]["url"] = builtin_info[0] + self.services["template"]["hypervisor"] = builtin_info[1] + self.services["template"]["format"] = builtin_info[2] + self.debug("Registering a new template") + # Register new template template = Template.register( - self.apiclient, - self.services["templates"], - zoneid=self.zone.id, - account=self.account.name, - domainid=self.account.domainid - ) - self.debug("Registering template with ID: %s" % template.id) + self.apiclient, + self.services["template"], + zoneid=self.zone.id, + account=self.account.name, + domainid=self.account.domainid + ) + self.debug( + "Registered a template of format: %s with ID: %s" % ( + self.services["template"]["format"], + template.id + )) try: # Wait for template to download template.download(self.apiclient) @@ -185,7 +195,7 @@ class TestTemplate(cloudstackTestCase): list_template_response = Template.list( self.apiclient, templatefilter=\ - self.services["templates"]["templatefilter"], + self.services["template"]["templatefilter"], id=template.id, zoneid=self.zone.id ) @@ -796,7 +806,7 @@ class TestTemplates(cloudstackTestCase): #Create template from volume template = Template.create( self.apiclient, - self.services["templates"], + self.services["template"], self.volume.id, account=self.account.name, domainid=self.account.domainid @@ -856,7 +866,7 @@ class TestTemplates(cloudstackTestCase): template = Template.create_from_snapshot( self.apiclient, snapshot, - self.services["templates"] + self.services["template"] ) self.cleanup.append(template) @@ -864,7 +874,7 @@ class TestTemplates(cloudstackTestCase): templates = Template.list( self.apiclient, templatefilter=\ - self.services["templates"]["templatefilter"], + self.services["template"]["templatefilter"], id=template.id ) self.assertEqual( @@ -938,14 +948,14 @@ class TestTemplates(cloudstackTestCase): template = Template.create_from_snapshot( self.apiclient, snapshot, - self.services["templates"], + self.services["template"], random_name=False ) self.debug("Created template from snapshot: %s" % template.id) templates = Template.list( self.apiclient, templatefilter=\ - self.services["templates"]["templatefilter"], + self.services["template"]["templatefilter"], id=template.id ) self.assertEqual( @@ -977,14 +987,14 @@ class TestTemplates(cloudstackTestCase): template = Template.create_from_snapshot( self.apiclient, snapshot, - self.services["templates"], + self.services["template"], random_name=False ) templates = Template.list( self.apiclient, templatefilter=\ - self.services["templates"]["templatefilter"], + self.services["template"]["templatefilter"], id=template.id ) self.assertEqual( @@ -1000,7 +1010,7 @@ class TestTemplates(cloudstackTestCase): self.assertEqual( templates[0].name, - self.services["templates"]["name"], + self.services["template"]["name"], "Check the name of the template" ) return diff --git a/test/integration/component/test_haproxy.py b/test/integration/component/test_haproxy.py new file mode 100644 index 00000000000..799cfa3e925 --- /dev/null +++ b/test/integration/component/test_haproxy.py @@ -0,0 +1,874 @@ +# 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. +""" P1 tests for VPN users +""" +# Import Local Modules +from nose.plugins.attrib import attr +from marvin.cloudstackTestCase import cloudstackTestCase +from marvin.integration.lib.base import ( + Account, + ServiceOffering, + VirtualMachine, + PublicIPAddress, + Network, + LoadBalancerRule, + Alert, + Router, + Vpn, + NATRule + ) +from marvin.integration.lib.common import (get_domain, + get_zone, + get_template, + cleanup_resources, + random_gen + ) +from marvin.cloudstackAPI import createLBStickinessPolicy +from marvin.remoteSSHClient import remoteSSHClient + + +class Services: + """Test VPN users Services + """ + + def __init__(self): + self.services = { + "account": { + "email": "test@test.com", + "firstname": "Test", + "lastname": "User", + "username": "test", + # Random characters are appended for unique + # username + "password": "password", + }, + "service_offering": { + "name": "Tiny Instance", + "displaytext": "Tiny Instance", + "cpunumber": 1, + "cpuspeed": 100, # in MHz + "memory": 128, # In MBs + }, + "disk_offering": { + "displaytext": "Small Disk Offering", + "name": "Small Disk Offering", + "disksize": 1 + }, + "virtual_machine": { + "displayname": "TestVM", + "username": "root", + "password": "password", + "ssh_port": 22, + "hypervisor": 'XenServer', + "privateport": 22, + "publicport": 22, + "protocol": 'TCP', + }, + "vpn_user": { + "username": "test", + "password": "test", + }, + "natrule": { + "privateport": 22, + "publicport": 22, + "protocol": "TCP", + "username":"root", + "password": "password" + }, + "network": { + "name": "Test Network", + "displaytext": "Test Network", + "netmask": '255.255.255.0' + }, + "lbrule": { + "name": "SSH", + "alg": "roundrobin", + # Algorithm used for load balancing + "privateport": 22, + "publicport": 2222, + "openfirewall": False, + "startport": 22, + "endport": 2222, + "protocol": "TCP", + "cidrlist": '0.0.0.0/0', + }, + "ostype": 'CentOS 5.3 (64-bit)', + "sleep": 60, + "timeout": 10, + "mode": 'advanced', + # Networking mode: Advanced, Basic + } + + +class TestHAProxyStickyness(cloudstackTestCase): + + @classmethod + def setUpClass(cls): + cls.api_client = super(TestHAProxyStickyness, + cls).getClsTestClient().getApiClient() + cls.services = Services().services + # Get Zone, Domain and templates + cls.domain = get_domain(cls.api_client, cls.services) + cls.zone = get_zone(cls.api_client, cls.services) + + cls.template = get_template( + cls.api_client, + cls.zone.id, + cls.services["ostype"] + ) + + cls.services["virtual_machine"]["zoneid"] = cls.zone.id + cls.service_offering = ServiceOffering.create( + cls.api_client, + cls.services["service_offering"] + ) + + cls._cleanup = [cls.service_offering, ] + return + + @classmethod + def tearDownClass(cls): + try: + # Cleanup resources used + cleanup_resources(cls.api_client, cls._cleanup) + except Exception as e: + raise Exception("Warning: Exception during cleanup : %s" % e) + return + + def setUp(self): + self.apiclient = self.testClient.getApiClient() + self.dbclient = self.testClient.getDbConnection() + self.account = Account.create( + self.apiclient, + self.services["account"], + domainid=self.domain.id + ) + self.virtual_machine = VirtualMachine.create( + self.apiclient, + self.services["virtual_machine"], + templateid=self.template.id, + accountid=self.account.name, + domainid=self.account.domainid, + serviceofferingid=self.service_offering.id + ) + + self.virtual_machine_2 = VirtualMachine.create( + self.apiclient, + self.services["virtual_machine"], + templateid=self.template.id, + accountid=self.account.name, + domainid=self.account.domainid, + serviceofferingid=self.service_offering.id + ) + self.public_ip = PublicIPAddress.create( + self.apiclient, + self.virtual_machine.account, + self.virtual_machine.zoneid, + self.virtual_machine.domainid, + self.services["virtual_machine"] + ) + + NATRule.create( + self.apiclient, + self.virtual_machine, + self.services["natrule"], + ipaddressid=self.public_ip.ipaddress.id + ) + + self.cleanup = [self.account, ] + return + + def tearDown(self): + try: + # Clean up, terminate the created instance, volumes and snapshots + cleanup_resources(self.apiclient, self.cleanup) + pass + except Exception as e: + raise Exception("Warning: Exception during cleanup : %s" % e) + return + + def get_Network(self, account): + """Returns a network for account""" + + networks = Network.list( + self.apiclient, + account=account.name, + domainid=account.domainid, + listall=True + ) + self.assertIsInstance(networks, + list, + "List networks should return a valid response") + return networks[0] + + def create_LB_Rule(self, public_ip, network, vmarray, services=None): + """Create and validate the load balancing rule""" + + self.debug("Creating LB rule for IP address: %s" % + public_ip.ipaddress.ipaddress) + objservices = None + if services: + objservices = services + else: + objservices = self.services["lbrule"] + + lb_rule = LoadBalancerRule.create( + self.apiclient, + objservices, + ipaddressid=public_ip.ipaddress.id, + accountid=self.account.name, + networkid=network.id, + domainid=self.account.domainid + ) + self.debug("Adding virtual machines %s to LB rule" % str(vmarray)) + lb_rule.assign(self.apiclient, vmarray) + return lb_rule + + def configure_Stickiness_Policy(self, lb_rule, method, paramDict=None): + """Configure the stickiness policy on lb rule""" + try: + result = lb_rule.createSticky( + self.apiclient, + methodname=method, + name="-".join([method, random_gen()]), + param=paramDict + ) + self.debug("Response: %s" % result) + return result + except Exception as e: + self.fail("Configure sticky policy failed with exception: %s" % e) + + def validate_Stickiness_Policy(self, lb_rule, method, publicip): + """Validates the stickiness policy""" + + sticky_policies = lb_rule.listStickyPolicies(self.apiclient, + lbruleid=lb_rule.id, + listall=True) + self.assertIsInstance(sticky_policies, + list, + "List sticky policies should return a valid list") + sticky_policy = sticky_policies[0] + + self.debug("Stickiness policy method: %s" % + sticky_policy.stickinesspolicy[0].methodname) + self.assertEqual(sticky_policy.stickinesspolicy[0].methodname, + method, + "Stickiness policy should have method as - %s" % method) + + hostnames = [] + + hostnames = self.try_ssh(publicip, hostnames) + hostnames = self.try_ssh(publicip, hostnames) + + self.debug("hostnames: %s" % hostnames) + self.debug("set(hostnames): %s" % set(hostnames)) + + #For each ssh, host should be the same, else stickiness policy is not working properly + if len(hostnames) == len(set(hostnames)): + raise Exception("Stickyness policy: %s not working properly, got hostnames %s" + % (method, hostnames)) + return + + def delete_Stickiness_policy(self, policy, lb_rule): + """Deletes the stickiness policy""" + + try: + lb_rule.deleteSticky(self.apiclient, id=policy.id) + except Exception as e: + self.fail("Failed to delete the stickiness policy: %s" % e) + + sticky_policies = lb_rule.listStickyPolicies(self.apiclient, + lbruleid=lb_rule.id, + listall=True) + self.assertIsInstance(sticky_policies, list, + "List stickiness policies shall return a valid response") + + policy = sticky_policies[0] + + self.assertEqual(len(policy.stickinesspolicy), + 0, + "List stickiness policy should return nothing") + return + + def check_stickiness_supported_methods(self, supportedMethods, value): + + for i, dic in enumerate(supportedMethods): + if dic["methodname"] == value: + return True + return False + + def acquire_Public_Ip(self): + """Acquires the public IP""" + + try: + self.debug("Acquiring public IP for account: %s" % + self.account.name) + public_ip = PublicIPAddress.create( + self.apiclient, + self.virtual_machine.account, + self.virtual_machine.zoneid, + self.virtual_machine.domainid, + self.services["virtual_machine"] + ) + self.debug("Acquired public IP: %s" % + public_ip.ipaddress.ipaddress) + + self.debug("Configuring NAT rule for the acquired public ip") + + NATRule.create( + self.apiclient, + self.virtual_machine, + self.services["natrule"], + ipaddressid=public_ip.ipaddress.id + ) + + return public_ip + except Exception as e: + self.fail("Failed to acquire new public IP: %s" % e) + + def get_router(self, account): + """Returns a default router for account""" + + routers = Router.list(self.apiclient, + account=self.account.name, + domainid=self.account.domainid, + listall=True) + self.assertIsInstance(routers, list, + "List routers should return a valid repsonse") + return routers[0] + + def create_VPN(self, public_ip): + """Creates VPN for the network""" + + self.debug("Creating VPN with public IP: %s" % public_ip.ipaddress.id) + try: + # Assign VPN to Public IP + vpn = Vpn.create(self.apiclient, + self.public_ip.ipaddress.id, + account=self.account.name, + domainid=self.account.domainid) + + self.debug("Verifying the remote VPN access") + vpns = Vpn.list(self.apiclient, + publicipid=public_ip.ipaddress.id, + listall=True) + self.assertEqual( + isinstance(vpns, list), + True, + "List VPNs shall return a valid response" + ) + return vpn + except Exception as e: + self.fail("Failed to create remote VPN access: %s" % e) + + def try_ssh(self, ip_addr, hostnames): + try: + self.debug( + "SSH into NAT Rule (Public IP: %s)" % ip_addr) + + # If Round Robin Algorithm is chosen, + # each ssh command should alternate between VMs + + ssh_1 = remoteSSHClient( + ip_addr, + 22, + self.services["natrule"]["username"], + self.services["natrule"]["password"] + ) + hostnames.append(ssh_1.execute("hostname")[0]) + self.debug(hostnames) + except Exception as e: + self.fail("%s: SSH failed for VM with IP Address: %s" % + (e, ip_addr)) + return hostnames + + @attr(tags=["advanced", "advancedns"]) + @attr(speed="slow") + def test_01_create_sticky_policy_default_values(self): + """Test Configure stickiness policies with default values""" + + # Validate the following + # 1. Create a LB rule with round robin. listLoadBalancerRules should + # show newly created load balancer rule. + # 2. Configure the Source based, app cookie and lb cookie based policy + # listLBStickinessPolicies should show newly created stickiness + + self.debug("Creating a load balancing rule on IP: %s" % + self.public_ip.ipaddress.ipaddress) + + lb_rule = self.create_LB_Rule(self.public_ip, + network=self.get_Network(self.account), + vmarray=[self.virtual_machine, self.virtual_machine_2]) + + methods = ["SourceBased", "AppCookie", "LBCookie"] + for method in methods: + self.debug("Creating stickiness policy for the LB rule: %s" % + lb_rule.id) + policies = self.configure_Stickiness_Policy(lb_rule, method=method) + + policy = policies.stickinesspolicy[0] + + self.debug("Policy: %s" % str(policy)) + self.debug("Validating the stickiness policy") + self.validate_Stickiness_Policy(lb_rule, method, self.public_ip.ipaddress.ipaddress) + self.debug("Deleting the stickiness policy for lb rule: %s" % + lb_rule.name) + self.delete_Stickiness_policy(policy, lb_rule) + return + + @attr(tags=["advanced", "advancedns"]) + @attr(speed="slow") + def test_02_create_sticky_policy_custom_values(self): + """Test Configure stickiness policies with custom values""" + + # Validate the following + # 1. Create a LB rule with roundrobin, leastconn and source. + # listLoadBalancerRules should show newly created load balancer rule + # 2. Configure the Source based, app cookie and lb cookie based policy + # with custom parameters + # listLBStickinessPolicies should show newly created stickiness + + lb_methods = ["roundrobin", "leastconn", "source"] + + configs = {"SourceBased": {"tablesize": '100k'}, + "AppCookie": {"request-learn": "true"}, + "LBCookie": {"nocache": "true"}} + + for lb_method in lb_methods: + self.debug("Creating a load balancing rule on IP %s and algo %s" % + (self.public_ip.ipaddress.ipaddress, lb_method)) + + services = self.services["lbrule"] + services["alg"] = lb_method + + lb_rule = self.create_LB_Rule(self.public_ip, + network=self.get_Network(self.account), + vmarray=[self.virtual_machine, self.virtual_machine_2], + services=services) + + for method, params in configs.items(): + self.debug("Creating stickiness policy for the LB rule: %s" % + lb_rule.id) + policies = self.configure_Stickiness_Policy(lb_rule, + method=method, + paramDict=params) + + policy = policies.stickinesspolicy[0] + self.debug("Policy: %s" % str(policy)) + + self.debug("Validating the stickiness policy") + self.validate_Stickiness_Policy(lb_rule, method, self.public_ip.ipaddress.ipaddress) + self.debug("Deleting the stickiness policy for lb rule: %s" % + lb_rule.name) + self.delete_Stickiness_policy(policy, lb_rule) + self.debug("Deleting the LB rule: %s" % lb_rule.name) + lb_rule.delete(self.apiclient) + return + + @attr(tags=["advanced", "advancedns"]) + @attr(speed="slow") + def test_03_supported_policies_by_network(self): + """Test listnetworks response to check supported stickiness policies""" + + # Validate the following + # 1. List networks for the account in advance network mode + # 2. List of supported sticky methods should be present under + # SupportedStickinessMethods tag + + self.debug("List networks for account: %s" % self.account.name) + networks = Network.list(self.apiclient, + account=self.account.name, + domainid=self.account.domainid, + listall=True) + + self.assertIsInstance(networks, + list, + "List network should return a valid response") + network = networks[0] + self.debug("Network: %s" % network) + self.assertEqual(hasattr(network, "SupportedStickinessMethods"), + True, + "Network should have SupportedStickinessMethods param") + + self.assertEqual(hasattr(network, "LbCookie"), + True, + "Network should have LbCookie LB method param") + + self.assertEqual(hasattr(network, "AppCookie"), + True, + "Network should have AppCookie LB method param") + + self.assertEqual(hasattr(network, "SourceBased"), + True, + "Network should have SourceBased LB method param") + + return + + @attr(tags=["advanced", "advancedns"]) + @attr(speed="slow") + def test_04_delete_lb_rule(self): + """Test LB rule before/after stickiness policy creation""" + + # Validate the following + # 1. Create a LB rule with roundrobin, leastconn and source. + # listLoadBalancerRules should show newly created load balancer rule + # 2. Delete the loadbalancer rule. Delete loadbalancer rule should be + # successful + # 3. Configure the Source based, app cookie and lb cookie based policy + # with custom parameters listLBStickinessPolicies should show newly + # created stickiness + # 4. Delete load balancer rule. Delete should be successful + + lb_methods = ["roundrobin", "leastconn", "source"] + + configs = {"SourceBased": {"tablesize": '100k'}, + "AppCookie": {"request-learn": "true"}, + "LBCookie": {"nocache": "true"}} + for lb_method in lb_methods: + for method, params in configs.items(): + self.debug("Creating load balancing rule on IP %s & algo %s" % + (self.public_ip.ipaddress.ipaddress, lb_method)) + + services = self.services["lbrule"] + services["alg"] = lb_method + + lb_rule = self.create_LB_Rule(self.public_ip, + network=self.get_Network(self.account), + vmarray=[self.virtual_machine, self.virtual_machine_2], + services=services) + self.debug( + "Deleting the LB rule before stickiness policy creation") + lb_rule.delete(self.apiclient) + + with self.assertRaises(Exception): + LoadBalancerRule.list(self.apiclient, + id=lb_rule.id, + listall=True) + + lb_rule = self.create_LB_Rule(self.public_ip, + network=self.get_Network(self.account), + vmarray=[self.virtual_machine, self.virtual_machine_2], + services=services) + self.debug("Creating stickiness policy for the LB rule: %s" % + lb_rule.id) + policies = self.configure_Stickiness_Policy(lb_rule, + method=method, + paramDict=params) + + policy = policies.stickinesspolicy[0] + + self.debug("Policy: %s" % str(policy)) + self.debug("Validating the stickiness policy") + self.validate_Stickiness_Policy(lb_rule, method, self.public_ip.ipaddress.ipaddress) + + self.debug("Deleting the LB rule: %s" % lb_rule.name) + lb_rule.delete(self.apiclient) + with self.assertRaises(Exception): + LoadBalancerRule.list(self.apiclient, id=lb_rule.id) + return + + @attr(tags=["advanced", "advancedns"]) + @attr(speed="slow") + def test_05_error_alerts_after_create(self): + """Test error/alerts after creating stickiness policy""" + + # Validate the following + # 1. Create a LB rule with round Robin/Least connections/Source + # listLoadBalancerRules should show newly created load balancer rule + # 2. Configure the Stickiness policy to above created LB rule. + # listLBStickinessPolicies Api should show newly created stickiness + # 3. update & delete stickiness policy see error related to stickiness + # 4. No errors should be shown in the logs and alerts + + lb_methods = ["roundrobin", "leastconn", "source"] + configs = {"SourceBased": {"tablesize": '100k'}, + "AppCookie": {"request-learn": "true"}, + "LBCookie": {"nocache": "true"}} + for lb_method in lb_methods: + for method, params in configs.items(): + self.debug("Creating load balancing rule on IP %s & algo %s" % + (self.public_ip.ipaddress.ipaddress, lb_method)) + + services = self.services["lbrule"] + services["alg"] = lb_method + + lb_rule = self.create_LB_Rule(self.public_ip, + network=self.get_Network(self.account), + vmarray=[self.virtual_machine, self.virtual_machine_2], + services=services) + + self.debug("Creating stickiness policy for the LB rule: %s" % + lb_rule.id) + policies = self.configure_Stickiness_Policy(lb_rule, + method=method, + paramDict=params) + + policy = policies.stickinesspolicy[0] + + self.debug("Policy: %s" % str(policy)) + self.debug("Validating the stickiness policy") + self.validate_Stickiness_Policy(lb_rule, method, self.public_ip.ipaddress.ipaddress) + + self.debug("Deleting the LB rule: %s" % lb_rule.name) + lb_rule.delete(self.apiclient) + + with self.assertRaises(Exception): + LoadBalancerRule.list(self.apiclient, + id=lb_rule.id, + listall=True) + alerts = Alert.list(self.apiclient, keyword="stickiness", + listall=True) + self.debug( + "Create/update/delete should not produce any alert/error") + self.assertEqual(alerts, None, + "Create/update/delete should not produce any alert/error") + return + + @attr(tags=["advanced", "advancedns"]) + @attr(speed="slow") + def test_06_release_ip(self): + """Test release public IP with stickiness policy""" + + # 1. Configure load balancing rule. Listloadbalancerrule should list + # valid list + # 2. Create stickiness policy. liststickinesspolicy should return valid + # response + # 3. Release public Ip. liststickiness policy should return a valid + # response + + lb_methods = ["roundrobin", "leastconn", "source"] + + configs = {"SourceBased": {"tablesize": '100k'}, + "AppCookie": {"request-learn": "true"}, + "LBCookie": {"nocache": "true"}} + + for lb_method in lb_methods: + for method, params in configs.items(): + self.debug("Setting up environment - acquire public IP") + public_ip = self.acquire_Public_Ip() + + self.debug( + "Creating a load balancing rule on IP %s and algo %s" % + (public_ip.ipaddress.ipaddress, lb_method)) + + services = self.services["lbrule"] + services["alg"] = lb_method + + lb_rule = self.create_LB_Rule(public_ip, + network=self.get_Network(self.account), + vmarray=[self.virtual_machine, self.virtual_machine_2], + services=services) + + policies = self.configure_Stickiness_Policy(lb_rule, + method=method, + paramDict=params) + policy = policies.stickinesspolicy[0] + + self.debug("Policy: %s" % str(policy)) + self.debug("Validating the stickiness policy") + self.validate_Stickiness_Policy(lb_rule, method, public_ip.ipaddress.ipaddress) + + self.debug("Releasing public Ip: %s" % + public_ip.ipaddress.ipaddress) + public_ip.delete(self.apiclient) + + self.debug("Checking the response of liststickiness policies") + + with self.assertRaises(Exception): + lb_rule.listStickyPolicies(self.apiclient, + lbruleid=lb_rule.id, + listall=True) + return + + @attr(tags=["advanced", "advancedns"]) + def test_07_delete_account(self): + """Test Delete account and check the router and its rules""" + + # Validate the following + # 1. create an account + # 2. using that account,create an instances + # 3. select the Source NAT IP and configure the stikiness policy + # 4. Delete account + # 5. The corresponding stikiness policy should be removed + # listLBStickinessPolicies Api shouldnot show deleted stikiness policy + + self.debug("Creating LB rule for account: %s" % + self.account.name) + lb_rule = self.create_LB_Rule(self.public_ip, + network=self.get_Network(self.account), + vmarray=[self.virtual_machine, self.virtual_machine_2]) + + policies = self.configure_Stickiness_Policy(lb_rule, method="LbCookie") + policy = policies.stickinesspolicy[0] + + self.debug("Policy: %s" % str(policy)) + self.debug("Validating the stickiness policy") + self.validate_Stickiness_Policy(lb_rule, "LbCookie", self.public_ip.ipaddress.ipaddress) + + # removing account from cleanup list as we're deleting account + self.cleanup.pop() + self.debug("Deleting account: %s" % self.account.name) + + try: + self.account.delete(self.apiclient) + except Exception as e: + self.fail("Failed to delete account: %s" % e) + self.debug("Checking the response of liststickiness policies") + + with self.assertRaises(Exception): + lb_rule.listStickyPolicies(self.apiclient, + lbruleid=lb_rule.id, + listall=True) + return + + @attr(tags=["advanced", "advancedns"]) + def test_08_create_policy_router_stopped(self): + """Test verify create stickiness policy when router is stopped state""" + + # Validate the following + # 1. stop the router + # 2. create stikiness policy from UI + # 3. start the router. listLBStickinessPolicies Api should show created + # stikiness policy + + self.debug("Creating LB rule for account: %s" % self.account.name) + lb_rule = self.create_LB_Rule(self.public_ip, + network=self.get_Network(self.account), + vmarray=[self.virtual_machine, self.virtual_machine_2]) + + self.debug("Fetching routers for the account: %s" % + self.account.name) + router = self.get_router(self.account) + + self.debug("Stopping the router: %s" % router.name) + Router.stop(self.apiclient, id=router.id) + + policies = self.configure_Stickiness_Policy(lb_rule, method="LbCookie") + policy = policies.stickinesspolicy[0] + + self.debug("Starting the router: %s" % router.name) + Router.start(self.apiclient, id=router.id) + + self.debug("Policy: %s" % str(policy)) + self.debug("Validating the stickiness policy") + self.validate_Stickiness_Policy(lb_rule, "LbCookie", self.public_ip.ipaddress.ipaddress) + return + + @attr(tags=["advanced", "advancedns"]) + def test_09_create_policy_router_destroy(self): + """Test check the stickiness policy rules after destroying router""" + + # Validate the following + # 1. create an account + # 2. using that account,create an instances + # 3. select the Source NAT IP and configure the stikiness policy + # 4. destroy the router. + + self.debug("Creating LB rule for account: %s" % self.account.name) + lb_rule = self.create_LB_Rule(self.public_ip, + network=self.get_Network(self.account), + vmarray=[self.virtual_machine, self.virtual_machine_2]) + + self.debug("Fetching routers for the account: %s" % + self.account.name) + router = self.get_router(self.account) + + policies = self.configure_Stickiness_Policy(lb_rule, method="LbCookie") + policy = policies.stickinesspolicy[0] + + self.debug("Policy: %s" % str(policy)) + self.debug("Validating the stickiness policy") + self.validate_Stickiness_Policy(lb_rule, "LbCookie", self.public_ip.ipaddress.ipaddress) + + self.debug("Destroying the router: %s" % router.name) + Router.destroy(self.apiclient, id=router.id) + + return + + @attr(tags=["advanced", "advancedns"]) + def test_10_create_policy_enable_disable_vpn(self): + """Test enable/disable the VPN after applying sticky policy rules""" + + # Validate the following + # 1. create an account + # 2. using that account,create an instances + # 3. select the Source NAT IP and configure the stikiness policy + # 4. enable /disable the VPN. It should not impact the ceated rules + # listLBStickinessPolicies Api should show created stikiness policy + + self.debug("Creating LB rule for account: %s" % self.account.name) + lb_rule = self.create_LB_Rule(self.public_ip, + network=self.get_Network(self.account), + vmarray=[self.virtual_machine, self.virtual_machine_2]) + + policies = self.configure_Stickiness_Policy(lb_rule, method="LbCookie") + policy = policies.stickinesspolicy[0] + + self.debug("Policy: %s" % str(policy)) + self.debug("Validating the stickiness policy") + self.validate_Stickiness_Policy(lb_rule, "LbCookie", self.public_ip.ipaddress.ipaddress) + + self.debug("Enabling VPN on Public Ip: %s" % + self.public_ip.ipaddress.ipaddress) + self.create_VPN(self.public_ip) + + self.debug("Validating the stickiness policy after enabling VPN") + self.validate_Stickiness_Policy(lb_rule, "LbCookie", self.public_ip.ipaddress.ipaddress) + return + + @attr(tags=["advanced", "advancedns"]) + def test_11_invalid_params(self): + """Test verfify functionality syncronous and asyncronous validations""" + + # Validate the following + # verify the validation while creating or attaching stikiness policy + # by doing the following scenaios + # * by passing the Invlaid parameter + # * Invalid method name + # * required parameter not present + # * passing invalid values to valid paramters. + + self.debug("Creating LB rule for account: %s" % self.account.name) + lb_rule = self.create_LB_Rule(self.public_ip, + network=self.get_Network(self.account), + vmarray=[self.virtual_machine, self.virtual_machine_2]) + + self.debug("Creating stickiness policy with invalid method") + with self.assertRaises(Exception): + self.configure_Stickiness_Policy(lb_rule, method="InvalidMethod") + + self.debug("Creating stickiness policy with invalid params") + with self.assertRaises(Exception): + self.configure_Stickiness_Policy(lb_rule, method="LbCookie", + params={"Test": 10}) + + self.debug("Passing invalid parameter") + with self.assertRaises(Exception): + cmd = createLBStickinessPolicy.createLBStickinessPolicyCmd() + cmd.lbruleid = lb_rule.id + cmd.method = "LbCookie" + cmd.name = "LbCookie" + self.apiclient.createLBStickinessPolicy(cmd) + + self.debug("Creating stickiness policy not passing required param") + with self.assertRaises(Exception): + cmd = createLBStickinessPolicy.createLBStickinessPolicyCmd() + cmd.lbruleid = lb_rule.id + cmd.name = "LbCookie" + self.apiclient.createLBStickinessPolicy(cmd) + + return diff --git a/test/integration/component/test_shared_networks.py b/test/integration/component/test_shared_networks.py index 88bb018d404..732e1447b50 100644 --- a/test/integration/component/test_shared_networks.py +++ b/test/integration/component/test_shared_networks.py @@ -82,10 +82,10 @@ class Services: "network1": { "name": "MySharedNetwork - Test1", "displaytext": "MySharedNetwork1", - "gateway" :"172.16.15.1", + "gateway" :"172.16.16.1", "netmask" :"255.255.255.0", - "startip" :"172.16.15.21", - "endip" :"172.16.15.41", + "startip" :"172.16.16.21", + "endip" :"172.16.16.41", "acltype" : "Domain", "scope":"all", }, @@ -2189,7 +2189,7 @@ class TestSharedNetworks(cloudstackTestCase): self.services["network1"]["acltype"] = "domain" self.services["network1"]["networkofferingid"] = self.shared_network_offering.id self.services["network1"]["physicalnetworkid"] = physical_network.id - self.services["network1"]["vlan"] = self.getFreeVlan(self.api_client, self.zone.id) + self.services["network1"]["vlan"] = self.getFreeVlan(self.api_client, self.zone.id)[1] #vlan id is second return value of function self.network1 = Network.create( self.api_client, diff --git a/test/integration/component/test_snapshot_gc.py b/test/integration/component/test_snapshot_gc.py index aec976103a3..1e1cc5dd801 100644 --- a/test/integration/component/test_snapshot_gc.py +++ b/test/integration/component/test_snapshot_gc.py @@ -148,7 +148,6 @@ class TestAccountSnapshotClean(cloudstackTestCase): ) cls.services["account"] = cls.account.name - cls._cleanup.append(cls.account) if cls.zone.localstorageenabled: cls.services["service_offering"]["storagetype"] = "local" @@ -156,7 +155,7 @@ class TestAccountSnapshotClean(cloudstackTestCase): cls.api_client, cls.services["service_offering"] ) - cls._cleanup.append(cls.service_offering) + cls.virtual_machine = VirtualMachine.create( cls.api_client, cls.services["server"], @@ -165,7 +164,7 @@ class TestAccountSnapshotClean(cloudstackTestCase): domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id ) - cls._cleanup.append(cls.virtual_machine) + # Get the Root disk of VM volumes = list_volumes( cls.api_client, @@ -177,13 +176,10 @@ class TestAccountSnapshotClean(cloudstackTestCase): # Create a snapshot from the ROOTDISK cls.snapshot = Snapshot.create(cls.api_client, volumes[0].id) - cls._cleanup.append(cls.snapshot) except Exception, e: cls.tearDownClass() unittest.SkipTest("setupClass fails for %s" % cls.__name__) raise e - else: - cls._cleanup.remove(cls.account) return @classmethod @@ -296,15 +292,12 @@ class TestAccountSnapshotClean(cloudstackTestCase): # Wait for account cleanup interval wait_for_cleanup(self.apiclient, configs=["account.cleanup.interval"]) - accounts = list_accounts( + + with self.assertRaises(Exception): + accounts = list_accounts( self.apiclient, id=self.account.id ) - self.assertEqual( - accounts, - None, - "List accounts should return empty list after account deletion" - ) self.assertFalse(is_snapshot_on_nfs(self.apiclient, self.dbclient, self.config, self.zone.id, self.snapshot.id), "Snapshot was still found on NFS after account gc") diff --git a/test/integration/component/test_stopped_vm.py b/test/integration/component/test_stopped_vm.py index 7903f0e8cbf..3be915166ee 100644 --- a/test/integration/component/test_stopped_vm.py +++ b/test/integration/component/test_stopped_vm.py @@ -84,9 +84,9 @@ class Services: "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO }, "template": { - "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2", - "hypervisor": 'XenServer', - "format": 'VHD', + "url": "", + "hypervisor": '', + "format": '', "isfeatured": True, "ispublic": True, "isextractable": True, @@ -647,7 +647,7 @@ class TestDeployVM(cloudstackTestCase): self.debug("Successfully created ISO with ID: %s" % iso.id) try: iso.download(self.apiclient) - self.cleanup.append(iso) + except Exception as e: self.fail("Exception while downloading ISO %s: %s"\ % (iso.id, e)) @@ -1092,9 +1092,9 @@ class TestDeployHaEnabledVM(cloudstackTestCase): domainid=self.account.domainid ) try: - # Dowanload the ISO + # Download the ISO self.iso.download(self.apiclient) - self.cleanup.append(self.iso) + except Exception as e: raise Exception("Exception while downloading ISO %s: %s"\ % (self.iso.id, e)) @@ -1522,6 +1522,13 @@ class TestDeployVMFromTemplate(cloudstackTestCase): self.services["account"], domainid=self.domain.id ) + + builtin_info = get_builtin_template_info(self.apiclient, self.zone.id) + self.services["template"]["url"] = builtin_info[0] + self.services["template"]["hypervisor"] = builtin_info[1] + self.services["template"]["format"] = builtin_info[2] + + # Register new template self.template = Template.register( self.apiclient, self.services["template"], @@ -1529,6 +1536,11 @@ class TestDeployVMFromTemplate(cloudstackTestCase): account=self.account.name, domainid=self.account.domainid ) + self.debug( + "Registered a template of format: %s with ID: %s" % ( + self.services["template"]["format"], + self.template.id + )) try: self.template.download(self.apiclient) except Exception as e: diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py index 06777e4eb60..6ee7c6271c9 100644 --- a/test/integration/smoke/test_snapshots.py +++ b/test/integration/smoke/test_snapshots.py @@ -269,77 +269,5 @@ class TestSnapshotRootDisk(cloudstackTestCase): "Check if backup_snap_id is not null" ) - # Get the Secondary Storage details from list Hosts - hosts = list_hosts( - self.apiclient, - type='SecondaryStorage', - zoneid=self.zone.id - ) - self.assertEqual( - isinstance(hosts, list), - True, - "Check list response returns a valid list" - ) - uuids = [] - for host in hosts: - # hosts[0].name = "nfs://192.168.100.21/export/test" - parse_url = (host.name).split('/') - # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test'] - - # Split IP address and export path from name - sec_storage_ip = parse_url[2] - # Sec Storage IP: 192.168.100.21 - - export_path = '/'.join(parse_url[3:]) - # Export path: export/test - - try: - # Login to VM to check snapshot present on sec disk - ssh_client = self.virtual_machine_with_disk.get_ssh_client() - - cmds = [ - "mkdir -p %s" % self.services["paths"]["mount_dir"], - "mount %s/%s %s" % ( - sec_storage_ip, - export_path, - self.services["paths"]["mount_dir"] - ), - "ls %s/snapshots/%s/%s" % ( - self.services["paths"]["mount_dir"], - account_id, - volume_id - ), - ] - - for c in cmds: - self.debug(c) - result = ssh_client.execute(c) - self.debug(result) - - except Exception: - self.fail("SSH failed for Virtual machine: %s" % - self.virtual_machine_with_disk.ipaddress) - - uuids.append(result) - # Unmount the Sec Storage - cmds = [ - "umount %s" % (self.services["mount_dir"]), - ] - try: - for c in cmds: - self.debug(c) - result = ssh_client.execute(c) - self.debug(result) - - except Exception as e: - self.fail("SSH failed for Virtual machine: %s" % - self.virtual_machine_with_disk.ipaddress) - - res = str(uuids) - # Check snapshot UUID in secondary storage and database - self.assertEqual( - res.count(snapshot_uuid), - 1, - "Check snapshot UUID in secondary storage and database" - ) - return \ No newline at end of file + self.assertTrue(is_snapshot_on_nfs(self.apiclient, self.dbclient, self.config, self.zone.id, snapshot.id)) + return diff --git a/tools/marvin/marvin/integration/lib/base.py b/tools/marvin/marvin/integration/lib/base.py index 0d52224c535..4f151378cc9 100755 --- a/tools/marvin/marvin/integration/lib/base.py +++ b/tools/marvin/marvin/integration/lib/base.py @@ -1514,7 +1514,8 @@ class NetworkOffering: cmd.specifyVlan = services["specifyVlan"] if "specifyIpRanges" in services: cmd.specifyIpRanges = services["specifyIpRanges"] - + if "ispersistent" in services: + cmd.ispersistent = services["ispersistent"] if "egress_policy" in services: cmd.egressdefaultpolicy = services["egress_policy"] diff --git a/tools/marvin/marvin/integration/lib/utils.py b/tools/marvin/marvin/integration/lib/utils.py index a6abe0665eb..d81e80d8025 100644 --- a/tools/marvin/marvin/integration/lib/utils.py +++ b/tools/marvin/marvin/integration/lib/utils.py @@ -5,9 +5,9 @@ # 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 @@ -269,30 +269,32 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid): ) assert isinstance(qresultset, list), "Invalid db query response for snapshot %s" % snapshotid - assert len(qresultset) != 0, "No such snapshot %s found in the cloudstack db" % snapshotid + + if len(qresultset) == 0: + #Snapshot does not exist + return False snapshotPath = qresultset[0][0] nfsurl = secondaryStore.url - # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test'] from urllib2 import urlparse parse_url = urlparse.urlsplit(nfsurl, scheme='nfs') host, path = parse_url.netloc, parse_url.path if not config.mgtSvr: raise Exception("Your marvin configuration does not contain mgmt server credentials") - host, user, passwd = config.mgtSvr[0].mgtSvrIp, config.mgtSvr[0].user, config.mgtSvr[0].passwd + mgtSvr, user, passwd = config.mgtSvr[0].mgtSvrIp, config.mgtSvr[0].user, config.mgtSvr[0].passwd try: ssh_client = remoteSSHClient( - host, + mgtSvr, 22, user, - passwd, + passwd ) cmds = [ "mkdir -p %s /mnt/tmp", - "mount -t %s %s:%s /mnt/tmp" % ( + "mount -t %s %s%s /mnt/tmp" % ( 'nfs', host, path, @@ -314,5 +316,5 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid): ssh_client.execute(c) except Exception as e: raise Exception("SSH failed for management server: %s - %s" % - (config[0].mgtSvrIp, e)) + (config.mgtSvr[0].mgtSvrIp, e)) return 'snapshot exists' in result diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp index 6e9a7fc4146..752a433b972 100644 --- a/ui/dictionary.jsp +++ b/ui/dictionary.jsp @@ -264,6 +264,8 @@ dictionary = { 'label.action.stop.systemvm.processing': '', 'label.action.take.snapshot': '', 'label.action.take.snapshot.processing': '', +'label.action.revert.snapshot': '', +'label.action.revert.snapshot.processing': '', 'label.action.unmanage.cluster': '', 'label.action.unmanage.cluster.processing': '', 'label.action.update.OS.preference': '', @@ -1268,6 +1270,7 @@ dictionary = { 'message.action.stop.router': '', 'message.action.stop.systemvm': '', 'message.action.take.snapshot': '', +'message.action.revert.snapshot': '', 'message.action.unmanage.cluster': '', 'message.action.vmsnapshot.delete': '', 'message.action.vmsnapshot.revert': '', diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js index 88fb9f28713..b16f4d4e77e 100644 --- a/ui/scripts/storage.js +++ b/ui/scripts/storage.js @@ -1760,6 +1760,36 @@ } }, + revertSnapshot: { + label: 'label.action.revert.snapshot', + messages: { + confirm: function(args) { + return 'message.action.revert.snapshot'; + }, + notification: function(args) { + return 'label.action.revert.snapshot'; + } + }, + action: function(args) { + $.ajax({ + url: createURL("revertSnapshot&id="+args.context.snapshots[0].id), + dataType: "json", + async: true, + success: function(json) { + var jid = json.revertsnapshotresponse.jobid; + args.response.success({ + _custom: { + jobId: jid + } + }); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + }, + remove: { label: 'label.action.delete.snapshot', messages: { @@ -1929,6 +1959,10 @@ if (jsonObj.state == "BackedUp") { allowedActions.push("createTemplate"); allowedActions.push("createVolume"); + + if (args.context.volumes[0].vmstate == "Stopped") { + allowedActions.push("revertSnapshot"); + } } allowedActions.push("remove"); diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 3d25f3487eb..0af39525175 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -13843,24 +13843,107 @@ }); }, actions: { - associateProfileToBlade: { - label: 'Associate Profile to Blade', + refreshUcsBlades: { + isHeader: true, + label: 'Refresh Blades', + messages: { + confirm: function(args) { + return 'Please confirm that you want to refresh blades.'; + }, + notification: function(args) { + return 'Refresh Blades'; + } + }, + action: function(args) { + $.ajax({ + url: createURL('refreshUcsBlades'), + data: { + ucsmanagerid: args.context.ucsManagers[0].id + }, + success: function(json) { + //for testing only (begin) + /* + json = { + "refreshucsbladesresponse": { + "count": 7, + "ucsblade": [ + { + "id": "6c6a2d2c-575e-41ac-9782-eee51b0b80f8", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-5" + }, + { + "id": "d371d470-a51f-489c-aded-54a63dfd76c7", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-6" + }, + { + "id": "c0f64591-4a80-4083-bb7b-576220b436a2", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-7" + }, + { + "id": "74b9b69a-cb16-42f5-aad6-06391ebdd759", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-1" + }, + { + "id": "713a5adb-0136-484f-9acb-d9203af497be", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-2" + }, + { + "id": "da633578-21cb-4678-9eb4-981a53198b41", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-4" + }, + { + "id": "3d491c6e-f0b6-40b0-bf6e-f89efdd73c30", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-3" + } + ] + } + }; + */ + //for testing only (end) + + /* + var item = json.refreshucsbladesresponse.ucsblade[0]; + addExtraPropertiesToUcsBladeObject(item); + args.response.success({ + data: item + }); + */ + $(window).trigger('cloudStack.fullRefresh'); + } + }); + }, + notification: { + poll: function(args) { + args.complete(); + } + } + }, + + associateTemplateToBlade: { + label: 'Instanciate Template and Associate Profile to Blade', addRow: 'false', messages: { notification: function(args) { - return 'Associate Profile to Blade'; + return 'Instanciate Template and Associate Profile to Blade'; } }, createForm: { - title: 'Associate Profile to Blade', + title: 'Instanciate Template and Associate Profile to Blade', fields: { - profiledn: { - label: 'Select Profile', + templatedn: { + label: 'Select Template', select: function(args) { var items = []; $.ajax({ - url: createURL('listUcsProfiles'), + url: createURL('listUcsTemplates'), data: { ucsmanagerid: args.context.ucsManagers[0].id }, @@ -13869,23 +13952,11 @@ //for testing only (begin) /* json = { - "listucsprofileresponse": { - "count": 5, - "ucsprofile": [ + "listucstemplatesresponse": { + "count": 1, + "ucstemplate": [ { - "ucsdn": "org-root/ls-profile-for-blade-2" - }, - { - "ucsdn": "org-root/ls-profile-for-blade-1" - }, - { - "ucsdn": "org-root/ls-simpleProfile" - }, - { - "ucsdn": "org-root/ls-testProfile" - }, - { - "ucsdn": "org-root/ls-UCS_Test" + "ucsdn": "org-root/ls-test" } ] } @@ -13893,30 +13964,18 @@ */ //for testing only (end) - var ucsprofiles = json.listucsprofileresponse.ucsprofile; - if (ucsprofiles != null) { - for (var i = 0; i < ucsprofiles.length; i++) { + var ucstemplates = json.listucstemplatesresponse.ucstemplate; + if (ucstemplates != null) { + for (var i = 0; i < ucstemplates.length; i++) { items.push({ - id: ucsprofiles[i].ucsdn, - description: ucsprofiles[i].ucsdn + id: ucstemplates[i].ucsdn, + description: ucstemplates[i].ucsdn }); } } } }); - //for testing only (begin) - /* - items.push({id: 'org-root/ls-testProfile1', description: 'org-root/ls-testProfile1'}); - items.push({id: 'org-root/ls-testProfile2', description: 'org-root/ls-testProfile2'}); - items.push({id: 'org-root/ls-testProfile3', description: 'org-root/ls-testProfile3'}); - items.push({id: 'org-root/ls-testProfile4', description: 'org-root/ls-testProfile4'}); - items.push({id: 'org-root/ls-testProfile5', description: 'org-root/ls-testProfile5'}); - items.push({id: 'org-root/ls-testProfile6', description: 'org-root/ls-testProfile6'}); - items.push({id: 'org-root/ls-testProfile7', description: 'org-root/ls-testProfile7'}); - */ - //for testing only (end) - args.response.success({ data: items }); @@ -13925,29 +13984,40 @@ validation: { required: true } + }, + profilename: { + label: 'Profile' } } }, action: function(args) { - $.ajax({ - url: createURL('associateUcsProfileToBlade'), //This API has been changed from sync to async at 7/25/2013 - data: { + var data = { ucsmanagerid: args.context.ucsManagers[0].id, - profiledn: args.data.profiledn, + templatedn: args.data.templatedn, bladeid: args.context.blades[0].id - }, + }; + + if (args.data.profilename != null && args.data.profilename.length > 0) { + $.extend(data, { + profilename: args.data.profilename + }); + } + + $.ajax({ + url: createURL('instantiateUcsTemplateAndAssocaciateToBlade'), + data: data, success: function(json) { //for testing only (begin) /* json = { - "associateucsprofiletobladeresponse": { - "jobid": "770bec68-7739-4127-8609-4b87bd7867d2" + "instantiateucstemplateandassociatetobladeresponse": { + "jobid": "cd9d0282-4dae-463f-80b6-451e168e2e92" } } */ //for testing only (end) - var jid = json.associateucsprofiletobladeresponse.jobid; + var jid = json.instantiateucstemplateandassociatetobladeresponse.jobid; args.response.success({ _custom: { jobId: jid, @@ -13956,23 +14026,23 @@ /* json = { "queryasyncjobresultresponse": { - "accountid": "b24f6e36-f0ca-11e2-8c16-d637902e3581", - "userid": "b24f7d8d-f0ca-11e2-8c16-d637902e3581", - "cmd": "org.apache.cloudstack.api.AssociateUcsProfileToBladeCmd", + "accountid": "970b694a-2f8c-11e3-a77d-000c29b36ff5", + "userid": "970b7b4f-2f8c-11e3-a77d-000c29b36ff5", + "cmd": "org.apache.cloudstack.api.InstantiateUcsTemplateAndAssociateToBladeCmd", "jobstatus": 1, "jobprocstatus": 0, "jobresultcode": 0, "jobresulttype": "object", "jobresult": { "ucsblade": { - "id": "80ab25c8-3dcf-400e-8849-84dc5e1e6594", - "ucsmanagerid": "07b5b813-83ed-4859-952c-c95cafb63ac4", - "bladedn": "sys/chassis-1/blade-4", - "profiledn": "org-root/ls-profile-for-blade-4" + "id": "3d491c6e-f0b6-40b0-bf6e-f89efdd73c30", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-3", + "profiledn": "org-root/ls-xxxx" } }, - "created": "2013-07-26T13:53:01-0700", - "jobid": "770bec68-7739-4127-8609-4b87bd7867d2" + "created": "2013-10-10T17:29:00-0700", + "jobid": "cd9d0282-4dae-463f-80b6-451e168e2e92" } }; */ @@ -13995,19 +14065,26 @@ label: 'Disassociate Profile from Blade', addRow: 'false', messages: { - confirm: function(args) { - return 'Please confirm that you want to disassociate Profile from Blade.'; - }, notification: function(args) { return 'Disassociate Profile from Blade'; } }, + createForm: { + title: 'Disassociate Profile from Blade', + fields: { + deleteprofile: { + label: 'Delete Profile', + isBoolean: true, + isChecked: true + } + } + }, action: function(args) { $.ajax({ url: createURL('disassociateUcsProfileFromBlade'), data: { - //ucsmanagerid: args.context.ucsManagers[0].id, - bladeid: args.context.blades[0].id + bladeid: args.context.blades[0].id, + deleteprofile: (args.data.deleteprofile == 'on'? true: false) }, success: function(json) { //for testing only (begin) @@ -16152,7 +16229,7 @@ var jsonObj = args.context.item; var allowedActions = []; if(jsonObj.profiledn == null) { - allowedActions.push("associateProfileToBlade"); + allowedActions.push("associateTemplateToBlade"); } else { allowedActions.push("disassociateProfileFromBlade"); } diff --git a/utils/test/com/cloud/utils/PasswordGeneratorTest.java b/utils/test/com/cloud/utils/PasswordGeneratorTest.java index 50f956005d7..ebcd7fbac93 100644 --- a/utils/test/com/cloud/utils/PasswordGeneratorTest.java +++ b/utils/test/com/cloud/utils/PasswordGeneratorTest.java @@ -1,3 +1,19 @@ +// 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 +// 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.utils; import org.junit.Assert; diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java index 07b8be431ff..108a3ecb194 100755 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HostMO.java @@ -910,7 +910,7 @@ public class HostMO extends BaseMO implements VmwareHypervisorHost { HostHardwareSummary hardwareSummary = getHostHardwareSummary(); // TODO: not sure how hyper-thread is counted in VMware resource pool - summary.setCpuCount(hardwareSummary.getNumCpuCores()); + summary.setCpuCount(hardwareSummary.getNumCpuThreads()); summary.setMemoryBytes(hardwareSummary.getMemorySize()); summary.setCpuSpeed(hardwareSummary.getCpuMhz());