Merge branch 'master' into network-refactor-merge2

Conflicts:
	api/src/com/cloud/network/NetworkService.java
	api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java
	plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java
	server/src/com/cloud/acl/DomainChecker.java
	server/src/com/cloud/network/ExternalFirewallDeviceManagerImpl.java
	server/src/com/cloud/network/NetworkManager.java
	server/src/com/cloud/network/NetworkManagerImpl.java
	server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
	server/src/com/cloud/vm/UserVmManagerImpl.java
	server/test/com/cloud/network/MockNetworkManagerImpl.java
	server/test/com/cloud/vpc/MockNetworkManagerImpl.java
This commit is contained in:
Chiradeep Vittal 2013-01-16 19:17:14 -08:00
commit cadca5fc0c
1348 changed files with 40681 additions and 22005 deletions

View File

@ -1,4 +1,4 @@
Copyright (c) 2012 The Apache Software Foundation
Copyright (c) 2013 The Apache Software Foundation
Apache License

View File

@ -55,6 +55,57 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>generate-resource</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<copy
todir="${basedir}/target/transformed">
<fileset dir="${basedir}/conf">
<include name="agent.properties" />
</fileset>
</copy>
<copy overwrite="true"
todir="${basedir}/target/transformed">
<fileset dir="${basedir}/conf">
<include name="*.in" />
</fileset>
<globmapper from="*.in" to="*" />
<filterchain>
<filterreader
classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="propertiesfile"
value="${basedir}/../build/replace.properties" />
</filterreader>
</filterchain>
</copy>
<copy overwrite="true"
todir="${basedir}/target/transformed">
<fileset dir="${basedir}/bindir">
<include name="*.in" />
</fileset>
<globmapper from="*.in" to="*" />
<filterchain>
<filterreader
classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="propertiesfile"
value="${basedir}/../build/replace.properties" />
</filterreader>
</filterchain>
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -19,11 +19,11 @@ package com.cloud.agent.api;
public class AgentControlAnswer extends Answer {
public AgentControlAnswer() {
}
public AgentControlAnswer(Command command) {
super(command);
}
public AgentControlAnswer(Command command, boolean success, String details) {
super(command, success, details);
}

View File

@ -17,10 +17,10 @@
package com.cloud.agent.api;
public class AgentControlCommand extends Command {
public AgentControlCommand() {
}
public boolean executeInSequence() {
return false;
}

View File

@ -21,40 +21,40 @@ import com.cloud.utils.exception.ExceptionUtil;
public class Answer extends Command {
protected boolean result;
protected String details;
protected Answer() {
}
public Answer(Command command) {
this(command, true, null);
}
public Answer(Command command, boolean success, String details) {
result = success;
this.details = details;
}
public Answer(Command command, Exception e) {
this(command, false, ExceptionUtil.toString(e));
}
public boolean getResult() {
return result;
}
public String getDetails() {
return details;
}
@Override
public boolean executeInSequence() {
return false;
}
public static UnsupportedAnswer createUnsupportedCommandAnswer(Command cmd) {
return new UnsupportedAnswer(cmd, "Unsupported command issued:" + cmd.toString() + ". Are you sure you got the right type of server?");
}
public static UnsupportedAnswer createUnsupportedVersionAnswer(Command cmd) {
return new UnsupportedAnswer(cmd, "Unsuppored Version.");
}

View File

@ -48,11 +48,11 @@ public class AttachIsoCommand extends Command {
public boolean isAttach() {
return attach;
}
public String getStoreUrl() {
return storeUrl;
}
public void setStoreUrl(String url) {
storeUrl = url;
}

View File

@ -20,38 +20,38 @@ package com.cloud.agent.api;
public class AttachVolumeAnswer extends Answer {
private Long deviceId;
private String chainInfo;
protected AttachVolumeAnswer() {
}
public AttachVolumeAnswer(AttachVolumeCommand cmd, String result) {
super(cmd, false, result);
this.deviceId = null;
}
public AttachVolumeAnswer(AttachVolumeCommand cmd, Long deviceId) {
super(cmd);
this.deviceId = deviceId;
}
public AttachVolumeAnswer(AttachVolumeCommand cmd) {
super(cmd);
this.deviceId = null;
}
/**
* @return the deviceId
*/
public Long getDeviceId() {
return deviceId;
}
public void setChainInfo(String chainInfo) {
this.chainInfo = chainInfo;
}
public String getChainInfo() {
return chainInfo;
}

View File

@ -19,7 +19,7 @@ package com.cloud.agent.api;
import com.cloud.storage.Storage.StoragePoolType;
public class AttachVolumeCommand extends Command {
boolean attach;
String vmName;
StoragePoolType pooltype;
@ -29,10 +29,10 @@ public class AttachVolumeCommand extends Command {
String volumeName;
Long deviceId;
String chainInfo;
protected AttachVolumeCommand() {
}
public AttachVolumeCommand(boolean attach, String vmName, StoragePoolType pooltype, String volumeFolder, String volumePath, String volumeName, Long deviceId, String chainInfo) {
this.attach = attach;
this.vmName = vmName;
@ -43,20 +43,20 @@ public class AttachVolumeCommand extends Command {
this.deviceId = deviceId;
this.chainInfo = chainInfo;
}
@Override
public boolean executeInSequence() {
return true;
}
public boolean getAttach() {
return attach;
}
public String getVmName() {
return vmName;
}
public StoragePoolType getPooltype() {
return pooltype;
}
@ -68,11 +68,11 @@ public class AttachVolumeCommand extends Command {
public String getVolumeFolder() {
return volumeFolder;
}
public String getVolumePath() {
return volumePath;
}
public String getVolumeName() {
return volumeName;
}
@ -84,15 +84,15 @@ public class AttachVolumeCommand extends Command {
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public String getPoolUuid() {
return poolUuid;
}
public void setPoolUuid(String poolUuid) {
this.poolUuid = poolUuid;
}
public String getChainInfo() {
return chainInfo;
}

View File

@ -20,11 +20,11 @@ package com.cloud.agent.api;
public class BackupSnapshotAnswer extends Answer {
private String backupSnapshotName;
private boolean full;
protected BackupSnapshotAnswer() {
}
public BackupSnapshotAnswer(BackupSnapshotCommand cmd, boolean success, String result, String backupSnapshotName, boolean full) {
super(cmd, success, result);
this.backupSnapshotName = backupSnapshotName;
@ -37,7 +37,7 @@ public class BackupSnapshotAnswer extends Answer {
public String getBackupSnapshotName() {
return backupSnapshotName;
}
public boolean isFull() {
return full;
}

View File

@ -23,7 +23,7 @@ import com.cloud.agent.api.to.SwiftTO;
import com.cloud.storage.StoragePool;
/**
* This currently assumes that both primary and secondary storage are mounted on the XenServer.
* This currently assumes that both primary and secondary storage are mounted on the XenServer.
*/
public class BackupSnapshotCommand extends SnapshotCommand {
private String prevSnapshotUuid;
@ -37,18 +37,18 @@ public class BackupSnapshotCommand extends SnapshotCommand {
StorageFilerTO pool;
protected BackupSnapshotCommand() {
}
/**
* @param primaryStoragePoolNameLabel The UUID of the primary storage Pool
* @param secondaryStoragePoolURL This is what shows up in the UI when you click on Secondary storage.
* @param snapshotUuid The UUID of the snapshot which is going to be backed up
* @param prevSnapshotUuid The UUID of the previous snapshot for this volume. This will be destroyed on the primary storage.
* @param prevBackupUuid This is the UUID of the vhd file which was last backed up on secondary storage.
* @param firstBackupUuid This is the backup of the first ever snapshot taken by the volume.
* @param firstBackupUuid This is the backup of the first ever snapshot taken by the volume.
* @param isFirstSnapshotOfRootVolume true if this is the first snapshot of a root volume. Set the parent of the backup to null.
* @param isVolumeInactive True if the volume belongs to a VM that is not running or is detached.
* @param isVolumeInactive True if the volume belongs to a VM that is not running or is detached.
*/
public BackupSnapshotCommand(String secondaryStoragePoolURL,
Long dcId,
@ -63,7 +63,7 @@ public class BackupSnapshotCommand extends SnapshotCommand {
String prevBackupUuid,
boolean isVolumeInactive,
String vmName,
int wait)
int wait)
{
super(pool, secondaryStoragePoolURL, snapshotUuid, snapshotName, dcId, accountId, volumeId);
this.snapshotId = snapshotId;
@ -82,11 +82,11 @@ public class BackupSnapshotCommand extends SnapshotCommand {
public String getPrevBackupUuid() {
return prevBackupUuid;
}
public boolean isVolumeInactive() {
return isVolumeInactive;
}
public String getVmName() {
return vmName;
}

View File

@ -21,19 +21,19 @@ package com.cloud.agent.api;
public class CancelCommand extends Command {
protected long sequence;
protected String reason;
protected CancelCommand() {
}
public CancelCommand(long sequence, String reason) {
this.sequence = sequence;
this.reason = reason;
}
public long getSequence() {
return sequence;
}
public String getReason() {
return reason;
}

View File

@ -19,7 +19,7 @@ package com.cloud.agent.api;
public class ChangeAgentAnswer extends Answer {
protected ChangeAgentAnswer() {
}
public ChangeAgentAnswer(ChangeAgentCommand cmd, boolean result) {
super(cmd, result, null);
}

View File

@ -21,19 +21,19 @@ import com.cloud.host.Status.Event;
public class ChangeAgentCommand extends Command {
long agentId;
Event event;
protected ChangeAgentCommand() {
}
public ChangeAgentCommand(long agentId, Event event) {
this.agentId = agentId;
this.event = event;
}
public long getAgentId() {
return agentId;
}
public Event getEvent() {
return event;
}

View File

@ -22,7 +22,7 @@ public class CheckHealthCommand extends Command {
setWait(50);
}
@Override
public boolean executeInSequence() {
return false;

View File

@ -20,7 +20,7 @@ public class CheckNetworkAnswer extends Answer {
// indicate if agent reconnect is needed after setupNetworkNames command
private boolean _reconnect;
public CheckNetworkAnswer() {}
public CheckNetworkAnswer(CheckNetworkCommand cmd, boolean result, String details, boolean reconnect) {
super(cmd, result, details);
@ -34,5 +34,5 @@ public class CheckNetworkAnswer extends Answer {
public boolean needReconnect() {
return _reconnect;
}
}

View File

@ -19,10 +19,10 @@ package com.cloud.agent.api;
public class CheckOnHostAnswer extends Answer {
boolean determined;
boolean alive;
protected CheckOnHostAnswer() {
}
public CheckOnHostAnswer(CheckOnHostCommand cmd, Boolean alive, String details) {
super(cmd, true, details);
if (alive == null) {
@ -32,7 +32,7 @@ public class CheckOnHostAnswer extends Answer {
this.alive = alive;
}
}
public CheckOnHostAnswer(CheckOnHostCommand cmd, String details) {
super(cmd, false, details);
}

View File

@ -24,17 +24,17 @@ public class CheckOnHostCommand extends Command {
protected CheckOnHostCommand() {
}
public CheckOnHostCommand(Host host) {
this.host = new HostTO(host);
setWait(20);
}
public HostTO getHost() {
return host;
}
@Override
public boolean executeInSequence() {
return false;

View File

@ -23,10 +23,10 @@ public class CheckRouterAnswer extends Answer {
public static final String ROUTER_IP = "router.ip";
RedundantState state;
boolean isBumped;
protected CheckRouterAnswer() {
}
public CheckRouterAnswer(CheckRouterCommand cmd, String details, boolean parse) {
super(cmd, true, details);
if (parse) {
@ -35,7 +35,7 @@ public class CheckRouterAnswer extends Answer {
}
}
}
public CheckRouterAnswer(CheckRouterCommand cmd, String details) {
super(cmd, false, details);
}
@ -61,11 +61,11 @@ public class CheckRouterAnswer extends Answer {
}
return true;
}
public void setState(RedundantState state) {
this.state = state;
}
public RedundantState getState() {
return state;
}
@ -73,9 +73,9 @@ public class CheckRouterAnswer extends Answer {
public boolean isBumped() {
return isBumped;
}
public void setIsBumped(boolean isBumped) {
this.isBumped = isBumped;
}
}

View File

@ -5,7 +5,7 @@
// 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,
@ -23,12 +23,12 @@ public class CheckS2SVpnConnectionsAnswer extends Answer {
Map<String, Boolean> ipToConnected;
Map<String, String> ipToDetail;
String details;
protected CheckS2SVpnConnectionsAnswer() {
ipToConnected = new HashMap<String, Boolean>();
ipToDetail = new HashMap<String, String>();
}
public CheckS2SVpnConnectionsAnswer(CheckS2SVpnConnectionsCommand cmd, boolean result, String details) {
super(cmd, result, details);
ipToConnected = new HashMap<String, Boolean>();
@ -38,7 +38,7 @@ public class CheckS2SVpnConnectionsAnswer extends Answer {
parseDetails(details);
}
}
protected void parseDetails(String details) {
String[] lines = details.split("&");
for (String line : lines) {
@ -54,14 +54,14 @@ public class CheckS2SVpnConnectionsAnswer extends Answer {
ipToDetail.put(ip, detail);
}
}
public boolean isConnected(String ip) {
if (this.getResult()) {
return ipToConnected.get(ip);
}
return false;
}
public String getDetail(String ip) {
if (this.getResult()) {
return ipToDetail.get(ip);

View File

@ -5,7 +5,7 @@
// 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,
@ -22,17 +22,17 @@ import com.cloud.agent.api.routing.NetworkElementCommand;
public class CheckS2SVpnConnectionsCommand extends NetworkElementCommand {
List<String> vpnIps;
@Override
public boolean executeInSequence() {
return true;
}
public CheckS2SVpnConnectionsCommand(List<String> vpnIps) {
super();
this.vpnIps = vpnIps;
}
public List<String> getVpnIps() {
return vpnIps;
}

View File

@ -28,17 +28,17 @@ public class CheckStateAnswer extends Answer {
public CheckStateAnswer(CheckStateCommand cmd, State state) {
this(cmd, state, null);
}
public CheckStateAnswer(CheckStateCommand cmd, String details) {
super(cmd, false, details);
this.state = null;
}
public CheckStateAnswer(CheckStateCommand cmd, State state, String details) {
super(cmd, true, details);
this.state = state;
}
public State getState() {
return state;
}

View File

@ -17,7 +17,7 @@
package com.cloud.agent.api;
/**
*
*
*
*/
public class CheckStateCommand extends Command {
@ -28,12 +28,12 @@ public class CheckStateCommand extends Command {
public CheckStateCommand(String vmName) {
this.vmName = vmName;
}
@Override
public boolean executeInSequence() {
return true;
}
public String getVmName() {
return vmName;
}

View File

@ -19,33 +19,33 @@ package com.cloud.agent.api;
import com.cloud.vm.VirtualMachine.State;
public class CheckVirtualMachineAnswer extends Answer {
Integer vncPort;
State state;
protected CheckVirtualMachineAnswer() {
}
public CheckVirtualMachineAnswer(CheckVirtualMachineCommand cmd, State state, Integer vncPort, String detail) {
super(cmd, true, detail);
this.state = state;
this.vncPort = vncPort;
}
public CheckVirtualMachineAnswer(CheckVirtualMachineCommand cmd, State state, Integer vncPort) {
this(cmd, state, vncPort, null);
}
public CheckVirtualMachineAnswer(CheckVirtualMachineCommand cmd, String detail) {
super(cmd, false, detail);
}
public Integer getVncPort() {
return vncPort;
}
public State getState() {
return state;
}

View File

@ -17,18 +17,18 @@
package com.cloud.agent.api;
public class CheckVirtualMachineCommand extends Command {
private String vmName;
protected CheckVirtualMachineCommand() {
}
public CheckVirtualMachineCommand(String vmName) {
this.vmName = vmName;
setWait(20);
}
public String getVmName() {
return vmName;
}

View File

@ -20,22 +20,22 @@ package com.cloud.agent.api;
public class CleanupNetworkRulesCmd extends Command implements CronCommand {
private int interval = 10*60;
@Override
public boolean executeInSequence() {
return false;
}
public CleanupNetworkRulesCmd(int intervalSecs) {
super();
interval = intervalSecs;
}
public CleanupNetworkRulesCmd() {
}

View File

@ -26,20 +26,20 @@ public class CleanupSnapshotBackupCommand extends Command {
private List<String> validBackupUUIDs;
protected CleanupSnapshotBackupCommand() {
}
/*
* @param secondaryStoragePoolURL This is what shows up in the UI when you click on Secondary storage.
/*
* @param secondaryStoragePoolURL This is what shows up in the UI when you click on Secondary storage.
* In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
* If you have better ideas on how to get it, you are welcome.
* @param validBackupUUID The VHD which are valid
* If you have better ideas on how to get it, you are welcome.
* @param validBackupUUID The VHD which are valid
*/
public CleanupSnapshotBackupCommand(String secondaryStoragePoolURL,
Long dcId,
Long accountId,
Long volumeId,
List<String> validBackupUUIDs)
List<String> validBackupUUIDs)
{
this.secondaryStoragePoolURL = secondaryStoragePoolURL;
this.dcId = dcId;
@ -67,9 +67,9 @@ public class CleanupSnapshotBackupCommand extends Command {
public List<String> getValidBackupUUIDs() {
return validBackupUUIDs;
}
@Override
public boolean executeInSequence() {
return false;
}
}
}

View File

@ -25,31 +25,31 @@ public class ClusterSyncAnswer extends Answer {
private long _clusterId;
private HashMap<String, Pair<String, State>> _newStates;
private boolean _isExecuted=false;
// this is here because a cron command answer is being sent twice
// AgentAttache.processAnswers
// AgentManagerImpl.notifyAnswersToMonitors
public boolean isExceuted(){
return _isExecuted;
}
public void setExecuted(){
_isExecuted = true;
}
public ClusterSyncAnswer(long clusterId, HashMap<String, Pair<String, State>> newStates){
_clusterId = clusterId;
_newStates = newStates;
result = true;
}
public long getClusterId() {
return _clusterId;
}
public HashMap<String, Pair<String, State>> getNewStates() {
return _newStates;
}
}
}
}

View File

@ -21,10 +21,10 @@ public class ClusterSyncCommand extends Command implements CronCommand {
int _interval;
long _clusterId;
public ClusterSyncCommand() {
}
public ClusterSyncCommand(int interval, long clusterId){
_interval = interval;
_clusterId = clusterId;
@ -34,7 +34,7 @@ public class ClusterSyncCommand extends Command implements CronCommand {
public int getInterval() {
return _interval;
}
public long getClusterId() {
return _clusterId;
}
@ -43,5 +43,5 @@ public class ClusterSyncCommand extends Command implements CronCommand {
public boolean executeInSequence() {
return false;
}
}
}

View File

@ -23,9 +23,9 @@ import com.cloud.agent.api.LogLevel.Log4jLevel;
/**
* implemented by classes that extends the Command class. Command specifies
*
*
*/
public abstract class Command {
public abstract class Command {
// allow command to carry over hypervisor or other environment related context info
@LogLevel(Log4jLevel.Trace)
@ -63,7 +63,7 @@ public abstract class Command {
public String getContextParam(String name) {
return contextMap.get(name);
}
public boolean allowCaching() {
return true;
}

View File

@ -26,12 +26,12 @@ public class ComputeChecksumCommand extends ssCommand {
public ComputeChecksumCommand() {
super();
}
public ComputeChecksumCommand(String secUrl, String templatePath) {
super(secUrl);
this.templatePath = templatePath;
}
}
public String getTemplatePath() {
return templatePath;
}

View File

@ -14,75 +14,75 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.agent.api;
public class ConsoleAccessAuthenticationAnswer extends AgentControlAnswer {
package com.cloud.agent.api;
public class ConsoleAccessAuthenticationAnswer extends AgentControlAnswer {
private boolean _success;
private boolean _isReauthenticating;
private String _host;
private int _port;
private String _tunnelUrl;
private String _tunnelSession;
public ConsoleAccessAuthenticationAnswer() {
_success = false;
_isReauthenticating = false;
_port = 0;
}
public ConsoleAccessAuthenticationAnswer(Command cmd, boolean success) {
super(cmd);
_success = success;
}
public boolean succeeded() {
return _success;
_port = 0;
}
public ConsoleAccessAuthenticationAnswer(Command cmd, boolean success) {
super(cmd);
_success = success;
}
public boolean succeeded() {
return _success;
}
public void setSuccess(boolean value) {
_success = value;
}
public boolean isReauthenticating() {
return _isReauthenticating;
}
public void setReauthenticating(boolean value) {
_isReauthenticating = value;
}
public String getHost() {
return _host;
}
public void setHost(String host) {
_host = host;
}
public int getPort() {
return _port;
}
public void setPort(int port) {
_port = port;
}
public String getTunnelUrl() {
return _tunnelUrl;
}
public void setTunnelUrl(String tunnelUrl) {
_tunnelUrl = tunnelUrl;
_tunnelUrl = tunnelUrl;
}
public String getTunnelSession() {
return _tunnelSession;
}
public void setTunnelSession(String tunnelSession) {
_tunnelSession = tunnelSession;
}
}
}
}

View File

@ -17,19 +17,19 @@
package com.cloud.agent.api;
public class ConsoleAccessAuthenticationCommand extends AgentControlCommand {
private String _host;
private String _port;
private String _vmId;
private String _sid;
private String _ticket;
private boolean _isReauthenticating;
private boolean _isReauthenticating;
public ConsoleAccessAuthenticationCommand() {
_isReauthenticating = false;
}
_isReauthenticating = false;
}
public ConsoleAccessAuthenticationCommand(String host, String port, String vmId, String sid, String ticket) {
_host = host;
_port = port;
@ -37,32 +37,32 @@ public class ConsoleAccessAuthenticationCommand extends AgentControlCommand {
_sid = sid;
_ticket = ticket;
}
public String getHost() {
return _host;
}
public String getPort() {
return _port;
}
public String getVmId() {
return _vmId;
}
public String getSid() {
return _sid;
}
public String getTicket() {
return _ticket;
}
public boolean isReauthenticating() {
return _isReauthenticating;
}
public void setReauthenticating(boolean value) {
_isReauthenticating = value;
}
}
}
}

View File

@ -17,22 +17,22 @@
package com.cloud.agent.api;
public class ConsoleProxyLoadReportCommand extends AgentControlCommand {
private long _proxyVmId;
private String _loadInfo;
public ConsoleProxyLoadReportCommand() {
}
public ConsoleProxyLoadReportCommand(long proxyVmId, String loadInfo) {
_proxyVmId = proxyVmId;
_loadInfo = loadInfo;
}
public long getProxyVmId() {
return _proxyVmId;
}
public String getLoadInfo() {
return _loadInfo;
}

View File

@ -19,28 +19,28 @@ package com.cloud.agent.api;
import com.cloud.storage.StoragePool;
/**
* This currently assumes that both primary and secondary storage are mounted on the XenServer.
* This currently assumes that both primary and secondary storage are mounted on the XenServer.
*/
public class CreatePrivateTemplateFromSnapshotCommand extends SnapshotCommand {
private String origTemplateInstallPath;
private Long newTemplateId;
private String templateName;
protected CreatePrivateTemplateFromSnapshotCommand() {
}
/**
* Given the UUID of a backed up snapshot VHD file on the secondary storage, the execute of this command does
* 1) Get the parent chain of this VHD all the way up to the root, say VHDList
* 2) Copy all the files in the VHDlist to some temp location
* 3) Coalesce all the VHDs to one VHD which contains all the data of the volume. This invokes the DeletePreviousBackupCommand for each VHD
* 4) Rename the UUID of this VHD
* @param secondaryStoragePoolURL This is what shows up in the UI when you click on Secondary storage.
* @param secondaryStoragePoolURL This is what shows up in the UI when you click on Secondary storage.
* In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
* If you have better ideas on how to get it, you are welcome.
* It may not be the UUID of the base copy of the snapshot, if no data was written since last snapshot.
* @param origTemplateInstallPath The install path of the original template VHD on the secondary
* @param origTemplateInstallPath The install path of the original template VHD on the secondary
*/
public CreatePrivateTemplateFromSnapshotCommand(StoragePool pool,
@ -53,7 +53,7 @@ public class CreatePrivateTemplateFromSnapshotCommand extends SnapshotCommand {
String origTemplateInstallPath,
Long newTemplateId,
String templateName,
int wait)
int wait)
{
super(pool, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
this.origTemplateInstallPath = origTemplateInstallPath;
@ -68,7 +68,7 @@ public class CreatePrivateTemplateFromSnapshotCommand extends SnapshotCommand {
public String getOrigTemplateInstallPath() {
return origTemplateInstallPath;
}
public Long getNewTemplateId() {
return newTemplateId;
}

View File

@ -20,10 +20,10 @@ import com.cloud.storage.StoragePool;
public class CreateStoragePoolCommand extends ModifyStoragePoolCommand {
public CreateStoragePoolCommand() {
}
public CreateStoragePoolCommand(boolean add, StoragePool pool) {
super(add, pool);
}

View File

@ -19,11 +19,11 @@ package com.cloud.agent.api;
public class CreateVolumeFromSnapshotAnswer extends Answer {
private String vdiUUID;
protected CreateVolumeFromSnapshotAnswer() {
}
public CreateVolumeFromSnapshotAnswer(CreateVolumeFromSnapshotCommand cmd, boolean success, String result, String vdiUUID) {
super(cmd, success, result);
this.vdiUUID = vdiUUID;

View File

@ -19,14 +19,14 @@ package com.cloud.agent.api;
import com.cloud.storage.StoragePool;
/**
* This currently assumes that both primary and secondary storage are mounted on the XenServer.
* This currently assumes that both primary and secondary storage are mounted on the XenServer.
*/
public class CreateVolumeFromSnapshotCommand extends SnapshotCommand {
protected CreateVolumeFromSnapshotCommand() {
}
/**
* Given the UUID of a backed up snapshot VHD file on the secondary storage, the execute of this command does
* 1) Get the parent chain of this VHD all the way up to the root, say VHDList
@ -35,11 +35,11 @@ public class CreateVolumeFromSnapshotCommand extends SnapshotCommand {
* 4) Rename the UUID of this VHD
* 5) Move this VHD to primary storage
* @param primaryStoragePoolNameLabel The primary storage Pool
* @param secondaryStoragePoolURL This is what shows up in the UI when you click on Secondary storage.
* @param secondaryStoragePoolURL This is what shows up in the UI when you click on Secondary storage.
* In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
* If you have better ideas on how to get it, you are welcome.
* It may not be the UUID of the base copy of the snapshot, if no data was written since last snapshot.
* @param templatePath The install path of the template VHD on the secondary, if this a root volume
* @param templatePath The install path of the template VHD on the secondary, if this a root volume
*/
public CreateVolumeFromSnapshotCommand(StoragePool pool,

View File

@ -20,8 +20,8 @@ import com.cloud.agent.api.LogLevel.Log4jLevel;
import com.cloud.agent.api.to.SwiftTO;
/**
*
*
*
*
*/
public class DeleteObjectFromSwiftCommand extends Command {
@ -31,9 +31,9 @@ public class DeleteObjectFromSwiftCommand extends Command {
private String object;
protected DeleteObjectFromSwiftCommand() {
}
public DeleteObjectFromSwiftCommand(SwiftTO swift, String container, String object) {
this.swift = swift;
this.container = container;
@ -58,4 +58,4 @@ public class DeleteObjectFromSwiftCommand extends Command {
return true;
}
}
}

View File

@ -18,15 +18,15 @@ package com.cloud.agent.api;
public class DeleteSnapshotBackupAnswer extends Answer {
protected DeleteSnapshotBackupAnswer() {
}
public DeleteSnapshotBackupAnswer(DeleteSnapshotBackupCommand cmd, boolean success, String details) {
super(cmd, success, details);
}
}

View File

@ -22,7 +22,7 @@ import com.cloud.agent.api.to.SwiftTO;
/**
* This command encapsulates a primitive operation which enables coalescing the backed up VHD snapshots on the secondary server
* This currently assumes that the secondary storage are mounted on the XenServer.
* This currently assumes that the secondary storage are mounted on the XenServer.
*/
public class DeleteSnapshotBackupCommand extends SnapshotCommand {
@LogLevel(Log4jLevel.Off)
@ -52,31 +52,31 @@ public class DeleteSnapshotBackupCommand extends SnapshotCommand {
protected DeleteSnapshotBackupCommand() {
}
/**
* Given 2 VHD files on the secondary storage which are linked in a parent chain as follows:
* backupUUID = parent(childUUID)
* It gets another VHD
* It gets another VHD
* previousBackupVHD = parent(backupUUID)
*
*
* And
* 1) it coalesces backupUuid into its parent.
* 2) It deletes the VHD file corresponding to backupUuid
* 3) It sets the parent VHD of childUUID to that of previousBackupUuid
*
*
* It takes care of the cases when
* 1) childUUID is null. - Step 3 is not done.
* 2) previousBackupUUID is null
* 2) previousBackupUUID is null
* - Merge childUUID into its parent backupUUID
* - Set the UUID of the resultant VHD to childUUID
* - Essentially we are deleting the oldest VHD file and setting the current oldest VHD to childUUID
*
* @param volumeName The name of the volume whose snapshot was taken (something like i-3-SV-ROOT)
* @param secondaryStoragePoolURL This is what shows up in the UI when you click on Secondary storage.
* - Essentially we are deleting the oldest VHD file and setting the current oldest VHD to childUUID
*
* @param volumeName The name of the volume whose snapshot was taken (something like i-3-SV-ROOT)
* @param secondaryStoragePoolURL This is what shows up in the UI when you click on Secondary storage.
* In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
* If you have better ideas on how to get it, you are welcome.
* @param backupUUID The VHD which has to be deleted
* @param childUUID The child VHD file of the backup whose parent is reset to its grandparent.
* If you have better ideas on how to get it, you are welcome.
* @param backupUUID The VHD which has to be deleted
* @param childUUID The child VHD file of the backup whose parent is reset to its grandparent.
*/
public DeleteSnapshotBackupCommand(SwiftTO swift,
S3TO s3,
@ -91,4 +91,4 @@ public class DeleteSnapshotBackupCommand extends SnapshotCommand {
this.s3 = s3;
setAll(all);
}
}
}

View File

@ -18,18 +18,18 @@ package com.cloud.agent.api;
/**
* This command encapsulates a primitive operation which enables coalescing the backed up VHD snapshots on the secondary server
* This currently assumes that the secondary storage are mounted on the XenServer.
* This currently assumes that the secondary storage are mounted on the XenServer.
*/
public class DeleteSnapshotsDirCommand extends Command {
String secondaryStorageUrl;
Long dcId;
Long accountId;
Long volumeId;
protected DeleteSnapshotsDirCommand() {
}
public DeleteSnapshotsDirCommand(String secondaryStorageUrl,
Long dcId, Long accountId, Long volumeId)
{
@ -60,4 +60,4 @@ public class DeleteSnapshotsDirCommand extends Command {
return volumeId;
}
}
}

View File

@ -23,20 +23,20 @@ import com.cloud.agent.api.to.StorageFilerTO;
import com.cloud.storage.StoragePool;
public class DeleteStoragePoolCommand extends Command {
StorageFilerTO pool;
public static final String LOCAL_PATH_PREFIX="/mnt/";
String localPath;
public DeleteStoragePoolCommand() {
}
public DeleteStoragePoolCommand(StoragePool pool, String localPath) {
this.pool = new StorageFilerTO(pool);
this.localPath = localPath;
}
public DeleteStoragePoolCommand(StoragePool pool) {
this(pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes()));
}
@ -48,7 +48,7 @@ public class DeleteStoragePoolCommand extends Command {
public void setPool(StoragePool pool) {
this.pool = new StorageFilerTO(pool);
}
@Override
public boolean executeInSequence() {
return false;
@ -57,5 +57,5 @@ public class DeleteStoragePoolCommand extends Command {
public String getLocalPath() {
return localPath;
}
}

View File

@ -20,15 +20,15 @@ public class FenceAnswer extends Answer {
public FenceAnswer() {
super();
}
public FenceAnswer(FenceCommand cmd) {
super(cmd, true, null);
}
public FenceAnswer(FenceCommand cmd, String details) {
super(cmd, true, details);
}
public FenceAnswer(FenceCommand cmd, boolean result, String details) {
super(cmd, result, details);
}

View File

@ -20,16 +20,16 @@ import com.cloud.host.Host;
import com.cloud.vm.VirtualMachine;
public class FenceCommand extends Command {
public FenceCommand() {
super();
}
String vmName;
String hostGuid;
String hostIp;
boolean inSeq;
public FenceCommand(VirtualMachine vm, Host host) {
super();
vmName = vm.getInstanceName();
@ -37,19 +37,19 @@ public class FenceCommand extends Command {
hostIp = host.getPrivateIpAddress();
inSeq = false;
}
public void setSeq(boolean inseq) {
inSeq = inseq;
}
public String getVmName() {
return vmName;
}
public String getHostGuid() {
return hostGuid;
}
public String getHostIp() {
return hostIp;
}

View File

@ -21,24 +21,24 @@ public class GetDomRVersionAnswer extends Answer {
public static final String ROUTER_IP = "router.ip";
String templateVersion;
String scriptsVersion;
protected GetDomRVersionAnswer() {
}
public GetDomRVersionAnswer(GetDomRVersionCmd cmd, String details, String templateVersion, String scriptsVersion) {
super(cmd, true, details);
this.templateVersion = templateVersion;
this.scriptsVersion = scriptsVersion;
}
public GetDomRVersionAnswer(GetDomRVersionCmd cmd, String details) {
super(cmd, false, details);
}
public String getTemplateVersion() {
return this.templateVersion;
}
public String getScriptsVersion() {
return this.scriptsVersion;
}

View File

@ -19,29 +19,29 @@ package com.cloud.agent.api;
public class GetVncPortAnswer extends Answer {
String address;
int port;
protected GetVncPortAnswer() {
}
public GetVncPortAnswer(GetVncPortCommand cmd, int port) {
super(cmd, true, null);
this.port = port;
}
public GetVncPortAnswer(GetVncPortCommand cmd, String address, int port) {
super(cmd, true, null);
this.address = address;
this.port = port;
}
public GetVncPortAnswer(GetVncPortCommand cmd, String details) {
super(cmd, false, details);
}
public String getAddress() {
return address;
}
public int getPort() {
return port;
}

View File

@ -22,21 +22,21 @@ public class GetVncPortCommand extends Command {
public GetVncPortCommand() {
}
public GetVncPortCommand(long id, String name) {
this.id = id;
this.name = name;
}
@Override
public boolean executeInSequence() {
return false;
}
public String getName() {
return name;
}
public long getId() {
return id;
}

View File

@ -19,7 +19,7 @@ package com.cloud.agent.api;
import com.cloud.host.HostStats;
public class HostStatsEntry implements HostStats {
long hostId;
String entityType;
double cpuUtilization;
@ -27,12 +27,12 @@ public class HostStatsEntry implements HostStats {
double networkWriteKBs;
double totalMemoryKBs;
double freeMemoryKBs;
public HostStatsEntry() {
}
public HostStatsEntry(long hostId,double cpuUtilization, double networkReadKBs, double networkWriteKBs, String entityType,
double totalMemoryKBs, double freeMemoryKBs, double xapiMemoryUsageKBs, double averageLoad)
double totalMemoryKBs, double freeMemoryKBs, double xapiMemoryUsageKBs, double averageLoad)
{
this.hostId = hostId;
this.entityType = entityType;
@ -47,16 +47,16 @@ public class HostStatsEntry implements HostStats {
public double getNetworkReadKBs() {
return networkReadKBs;
}
public void setNetworkReadKBs(double networkReadKBs) {
this.networkReadKBs = networkReadKBs;
}
@Override
public double getNetworkWriteKBs() {
return networkWriteKBs;
}
public void setNetworkWriteKBs(double networkWriteKBs) {
this.networkWriteKBs = networkWriteKBs;
}
@ -65,16 +65,16 @@ public class HostStatsEntry implements HostStats {
public String getEntityType(){
return this.entityType;
}
public void setEntityType(String entityType){
this.entityType = entityType;
}
@Override
public double getTotalMemoryKBs(){
return this.totalMemoryKBs;
}
public void setTotalMemoryKBs(double totalMemoryKBs){
this.totalMemoryKBs = totalMemoryKBs;
}
@ -83,11 +83,11 @@ public class HostStatsEntry implements HostStats {
public double getFreeMemoryKBs(){
return this.freeMemoryKBs;
}
public void setFreeMemoryKBs(double freeMemoryKBs){
this.freeMemoryKBs = freeMemoryKBs;
}
@Override
public double getCpuUtilization() {
return this.cpuUtilization;
@ -106,7 +106,7 @@ public class HostStatsEntry implements HostStats {
public HostStats getHostStats() {
return this;
}
public void setHostId(long hostId) {
this.hostId = hostId;
}

View File

@ -18,28 +18,28 @@ package com.cloud.agent.api;
public class MaintainAnswer extends Answer {
boolean willMigrate;
public MaintainAnswer() {
}
public MaintainAnswer(MaintainCommand cmd) {
this(cmd, true, null);
}
public MaintainAnswer(MaintainCommand cmd, boolean willMigrate) {
this(cmd, true, null);
this.willMigrate = willMigrate;
}
public MaintainAnswer(MaintainCommand cmd, String details) {
this(cmd, true, details);
}
public MaintainAnswer(MaintainCommand cmd, boolean result, String details) {
super(cmd, result, details);
this.willMigrate = true;
}
public boolean getMigrate() {
return this.willMigrate;
}

View File

@ -20,7 +20,7 @@ public class MaintainCommand extends Command {
public MaintainCommand() {
}
@Override
public boolean executeInSequence() {
return true;

View File

@ -20,13 +20,13 @@ package com.cloud.agent.api;
public class ManageSnapshotAnswer extends Answer {
// For create Snapshot
private String _snapshotPath;
public ManageSnapshotAnswer() {}
public ManageSnapshotAnswer(Command cmd, boolean success, String result) {
super(cmd, success, result);
}
// For XenServer
public ManageSnapshotAnswer(ManageSnapshotCommand cmd, long snapshotId, String snapshotPath, boolean success, String result) {
super(cmd, success, result);
@ -36,5 +36,5 @@ public class ManageSnapshotAnswer extends Answer {
public String getSnapshotPath() {
return _snapshotPath;
}
}

View File

@ -25,9 +25,9 @@ public class ManageSnapshotCommand extends Command {
// XXX: Anyway there is something called inheritance in Java
public static String CREATE_SNAPSHOT = "-c";
public static String DESTROY_SNAPSHOT = "-d";
private String _commandSwitch;
// Information about the volume that the snapshot is based on
private String _volumePath = null;
StorageFilerTO _pool;
@ -43,7 +43,7 @@ public class ManageSnapshotCommand extends Command {
public ManageSnapshotCommand(long snapshotId, String volumePath, StoragePool pool, String preSnapshotPath ,String snapshotName, String vmName) {
_commandSwitch = ManageSnapshotCommand.CREATE_SNAPSHOT;
_volumePath = volumePath;
_pool = new StorageFilerTO(pool);
_pool = new StorageFilerTO(pool);
_snapshotPath = preSnapshotPath;
_snapshotName = snapshotName;
_snapshotId = snapshotId;
@ -54,8 +54,8 @@ public class ManageSnapshotCommand extends Command {
_commandSwitch = ManageSnapshotCommand.DESTROY_SNAPSHOT;
_snapshotPath = snapshotPath;
}
@Override
public boolean executeInSequence() {
return false;
@ -64,15 +64,15 @@ public class ManageSnapshotCommand extends Command {
public String getCommandSwitch() {
return _commandSwitch;
}
public String getVolumePath() {
return _volumePath;
}
public StorageFilerTO getPool() {
return _pool;
}
public String getSnapshotPath() {
return _snapshotPath;
}
@ -84,9 +84,9 @@ public class ManageSnapshotCommand extends Command {
public long getSnapshotId() {
return _snapshotId;
}
public String getVmName() {
return _vmName;
}
}
}

View File

@ -18,15 +18,15 @@ package com.cloud.agent.api;
public class MigrateAnswer extends Answer {
Integer vncPort = null;
protected MigrateAnswer() {
}
public MigrateAnswer(MigrateCommand cmd, boolean result, String detail, Integer vncPort) {
super(cmd, result, detail);
this.vncPort = vncPort;
}
public Integer getVncPort() {
return vncPort;
}

View File

@ -25,29 +25,29 @@ public class MigrateCommand extends Command {
protected MigrateCommand() {
}
public MigrateCommand(String vmName, String destIp, boolean isWindows) {
this.vmName = vmName;
this.destIp = destIp;
this.isWindows = isWindows;
}
public boolean isWindows() {
return isWindows;
}
public String getDestinationIp() {
return destIp;
}
public String getVmName() {
return vmName;
}
public void setHostGuid(String guid) {
this.hostGuid = guid;
}
public String getHostGuid() {
return this.hostGuid;
}

View File

@ -30,13 +30,13 @@ public class ModifyStoragePoolAnswer extends Answer {
public ModifyStoragePoolAnswer(ModifyStoragePoolCommand cmd, long capacityBytes, long availableBytes, Map<String, TemplateInfo> tInfo) {
super(cmd);
this.result = true;
this.poolInfo = new StoragePoolInfo(null,
cmd.getPool().getHost(), cmd.getPool().getPath(), cmd.getLocalPath(),
this.poolInfo = new StoragePoolInfo(null,
cmd.getPool().getHost(), cmd.getPool().getPath(), cmd.getLocalPath(),
cmd.getPool().getType(), capacityBytes, availableBytes );
this.templateInfo = tInfo;
}
public StoragePoolInfo getPoolInfo() {
return poolInfo;
}

View File

@ -23,25 +23,25 @@ import com.cloud.agent.api.to.StorageFilerTO;
import com.cloud.storage.StoragePool;
public class ModifyStoragePoolCommand extends Command {
boolean add;
StorageFilerTO pool;
String localPath;
String [] options;
public static final String LOCAL_PATH_PREFIX="/mnt/";
public ModifyStoragePoolCommand() {
}
public ModifyStoragePoolCommand(boolean add, StoragePool pool, String localPath) {
this.add = add;
this.pool = new StorageFilerTO(pool);
this.localPath = localPath;
}
public ModifyStoragePoolCommand(boolean add, StoragePool pool) {
this(add, pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes()));
}
@ -53,11 +53,11 @@ public class ModifyStoragePoolCommand extends Command {
public void setPool(StoragePool pool) {
this.pool = new StorageFilerTO(pool);
}
public boolean getAdd() {
return add;
}
@Override
public boolean executeInSequence() {
return false;
@ -71,5 +71,5 @@ public class ModifyStoragePoolCommand extends Command {
this.options = options;
}
}

View File

@ -33,7 +33,7 @@ public class NetworkUsageAnswer extends Answer {
this.bytesSent = bytesSent;
routerName = cmd.getDomRName();
}
public NetworkUsageAnswer(Command command, Exception e) {
super(command, e);
}

View File

@ -57,7 +57,7 @@ public class NetworkUsageCommand extends Command {
this.option = "create";
this.vpcCIDR = vpcCIDR;
}
public NetworkUsageCommand(String privateIP, String domRName, String option, boolean forVpc, String gatewayIP)
{
this.privateIP = privateIP;
@ -66,7 +66,7 @@ public class NetworkUsageCommand extends Command {
this.gatewayIP = gatewayIP;
this.option = option;
}
public String getPrivateIP() {
return privateIP;
}

View File

@ -21,7 +21,7 @@ public class PingAnswer extends Answer {
protected PingAnswer() {
}
public PingAnswer(PingCommand cmd) {
super(cmd);
_command = cmd;

View File

@ -21,23 +21,23 @@ import com.cloud.host.Host;
public class PingCommand extends Command {
Host.Type hostType;
long hostId;
protected PingCommand() {
}
public PingCommand(Host.Type type, long id) {
hostType = type;
hostId = id;
}
public Host.Type getHostType() {
return hostType;
}
public long getHostId() {
return hostId;
}
@Override
public boolean executeInSequence() {
return false;

View File

@ -25,15 +25,15 @@ public class PingRoutingCommand extends PingCommand {
Map<String, State> newStates;
boolean _gatewayAccessible = true;
boolean _vnetAccessible = true;
protected PingRoutingCommand() {
}
public PingRoutingCommand(Host.Type type, long id, Map<String, State> states) {
super(type, id);
this.newStates = states;
}
public Map<String, State> getNewStates() {
return newStates;
}

View File

@ -25,17 +25,17 @@ import com.cloud.vm.VirtualMachine.State;
public class PingRoutingWithOvsCommand extends PingRoutingCommand {
List<Pair<String, Long>> states;
protected PingRoutingWithOvsCommand() {
super();
}
public PingRoutingWithOvsCommand(Host.Type type, long id,
Map<String, State> states, List<Pair<String, Long>> ovsStates) {
super(type, id, states);
this.states = ovsStates;
}
public List<Pair<String, Long>> getStates() {
return states;
}

View File

@ -25,12 +25,12 @@ public class PingStorageCommand extends PingCommand {
protected PingStorageCommand() {
}
public PingStorageCommand(Host.Type type, long id, Map<String, Boolean> changes) {
super(type, id);
this.changes = changes;
}
public Map<String, Boolean> getChanges() {
return changes;
}

View File

@ -19,22 +19,22 @@ package com.cloud.agent.api;
import com.cloud.agent.api.to.NicTO;
public class PlugNicCommand extends Command {
NicTO nic;
String instanceName;
public NicTO getNic() {
return nic;
}
@Override
public boolean executeInSequence() {
return true;
}
protected PlugNicCommand() {
}
public PlugNicCommand(NicTO nic, String instanceName) {
this.nic = nic;
this.instanceName = instanceName;

View File

@ -18,22 +18,22 @@ package com.cloud.agent.api;
public class PoolEjectCommand extends Command {
private String hostuuid;
public String getHostuuid() {
return hostuuid;
}
public void setHostuuid(String hostuuid) {
this.hostuuid = hostuuid;
}
public PoolEjectCommand() {
super();
}
public PoolEjectCommand(String hostuuid) {
public PoolEjectCommand(String hostuuid) {
super();
setHostuuid(hostuuid);
}
@Override
public boolean executeInSequence() {
return true;

View File

@ -19,15 +19,15 @@ package com.cloud.agent.api;
public class PrepareForMigrationAnswer extends Answer {
protected PrepareForMigrationAnswer() {
}
public PrepareForMigrationAnswer(PrepareForMigrationCommand cmd, String detail) {
super(cmd, false, detail);
}
public PrepareForMigrationAnswer(PrepareForMigrationCommand cmd, Exception ex) {
super(cmd, ex);
}
public PrepareForMigrationAnswer(PrepareForMigrationCommand cmd) {
super(cmd, true, null);
}

View File

@ -20,18 +20,18 @@ import com.cloud.agent.api.to.VirtualMachineTO;
public class PrepareForMigrationCommand extends Command {
VirtualMachineTO vm;
protected PrepareForMigrationCommand() {
}
public PrepareForMigrationCommand(VirtualMachineTO vm) {
this.vm = vm;
}
public VirtualMachineTO getVirtualMachine() {
return vm;
}
@Override
public boolean executeInSequence() {
return true;

View File

@ -23,7 +23,7 @@ import com.cloud.utils.Ternary;
public class PrepareOCFS2NodesCommand extends Command {
List<Ternary<Integer, String, String>> nodes;
String clusterName;
@Override
public boolean executeInSequence() {
return true;
@ -33,11 +33,11 @@ public class PrepareOCFS2NodesCommand extends Command {
this.nodes = nodes;
this.clusterName = clusterName;
}
public List<Ternary<Integer, String, String>> getNodes() {
return nodes;
}
public String getClusterName() {
return clusterName;
}

View File

@ -21,24 +21,24 @@ import com.cloud.resource.ResourceState;
public class PropagateResourceEventCommand extends Command {
long hostId;
ResourceState.Event event;
protected PropagateResourceEventCommand() {
}
public PropagateResourceEventCommand(long hostId, ResourceState.Event event) {
this.hostId = hostId;
this.event = event;
}
public long getHostId() {
return hostId;
}
public ResourceState.Event getEvent() {
return event;
}
@Override
public boolean executeInSequence() {
// TODO Auto-generated method stub

View File

@ -19,11 +19,11 @@ package com.cloud.agent.api;
public class ReadyAnswer extends Answer {
protected ReadyAnswer() {
}
public ReadyAnswer(ReadyCommand cmd) {
super(cmd, true, null);
}
public ReadyAnswer(ReadyCommand cmd, String details) {
super(cmd, false, details);
}

View File

@ -24,29 +24,29 @@ public class ReadyCommand extends Command {
private Long dcId;
private Long hostId;
public ReadyCommand(Long dcId) {
super();
this.dcId = dcId;
}
public ReadyCommand(Long dcId, Long hostId) {
this(dcId);
this.hostId = hostId;
}
public void setDetails(String details) {
_details = details;
}
public String getDetails() {
return _details;
}
public Long getDataCenterId() {
return dcId;
}
@Override
public boolean executeInSequence() {
return true;

View File

@ -18,24 +18,24 @@ package com.cloud.agent.api;
public class RebootAnswer extends Answer {
Integer vncPort;
protected RebootAnswer() {
}
public RebootAnswer(RebootCommand cmd, String details, Integer vncport) {
super(cmd, true, details);
this.vncPort = vncport;
}
public RebootAnswer(RebootCommand cmd, String details, boolean success) {
super(cmd, success, details);
this.vncPort = null;
}
public RebootAnswer(RebootCommand cmd, Exception e) {
super(cmd, e);
}
public Integer getVncPort() {
return vncPort;
}

View File

@ -20,25 +20,25 @@ import com.cloud.vm.VirtualMachine;
public class RebootCommand extends Command {
String vmName;
protected RebootCommand() {
}
public RebootCommand(VirtualMachine vm) {
vmName = vm.getInstanceName();
}
public RebootCommand(String vmName) {
this.vmName = vmName;
}
public String getVmName() {
return vmName;
}
@Override
public boolean executeInSequence() {
return true;
}
}

View File

@ -18,7 +18,7 @@ package com.cloud.agent.api;
public class RebootRouterCommand extends RebootCommand {
protected String privateIp;
protected RebootRouterCommand() {

View File

@ -33,7 +33,7 @@ public class SecStorageFirewallCfgCommand extends Command {
this.intf = intf;
}
public PortConfig() {
}
public boolean isAdd() {
return add;
@ -48,28 +48,28 @@ public class SecStorageFirewallCfgCommand extends Command {
return intf;
}
}
private List<PortConfig> portConfigs = new ArrayList<PortConfig>();
private boolean isAppendAIp = false;
private boolean isAppendAIp = false;
public SecStorageFirewallCfgCommand() {
}
public SecStorageFirewallCfgCommand(boolean isAppend) {
this.isAppendAIp = isAppend;
}
}
public void addPortConfig(String sourceIp, String port, boolean add, String intf) {
PortConfig pc = new PortConfig(sourceIp, port, add, intf);
this.portConfigs.add(pc);
}
public boolean getIsAppendAIp() {
return isAppendAIp;
}
@Override
public boolean executeInSequence() {
return false;

View File

@ -20,12 +20,12 @@ public class SecStorageSetupAnswer extends Answer {
private String _dir;
protected SecStorageSetupAnswer() {
}
public SecStorageSetupAnswer(String dir) {
super(null, true, "success");
this._dir = dir;
}
public String get_dir() {
return _dir;
}

View File

@ -21,7 +21,7 @@ import com.cloud.agent.api.LogLevel.Log4jLevel;
public class SecStorageSetupCommand extends Command {
private String secUrl;
private Certificates certs;
public static class Certificates {
@LogLevel(Log4jLevel.Off)
private String privKey;
@ -29,30 +29,30 @@ public class SecStorageSetupCommand extends Command {
private String privCert;
@LogLevel(Log4jLevel.Off)
private String certChain;
public Certificates() {
}
public Certificates(String prvKey, String privCert, String certChain) {
this.privKey = prvKey;
this.privCert = privCert;
this.certChain = certChain;
}
public String getPrivKey() {
return this.privKey;
}
public String getPrivCert() {
return this.privCert;
}
public String getCertChain() {
return this.certChain;
}
}
public SecStorageSetupCommand() {
super();
}
@ -62,7 +62,7 @@ public class SecStorageSetupCommand extends Command {
this.secUrl = secUrl;
this.certs = certs;
}
@Override
public boolean executeInSequence() {
return true;
@ -71,13 +71,13 @@ public class SecStorageSetupCommand extends Command {
public String getSecUrl() {
return secUrl;
}
public Certificates getCerts() {
return this.certs;
}
public void setSecUrl(String secUrl) {
this.secUrl = secUrl;
}
}

View File

@ -20,11 +20,11 @@ public class SecStorageVMSetupCommand extends Command {
String [] allowedInternalSites = new String[0];
String copyUserName;
String copyPassword;
public SecStorageVMSetupCommand() {
super();
}
@Override
public boolean executeInSequence() {
return true;

View File

@ -26,24 +26,24 @@ public class SecurityGroupRuleAnswer extends Answer {
Long logSequenceNumber = null;
Long vmId = null;
FailureReason reason = FailureReason.NONE;
protected SecurityGroupRuleAnswer() {
}
public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd) {
super(cmd);
this.logSequenceNumber = cmd.getSeqNum();
this.vmId = cmd.getVmId();
}
public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd, boolean result, String detail) {
super(cmd, result, detail);
this.logSequenceNumber = cmd.getSeqNum();
this.vmId = cmd.getVmId();
reason = FailureReason.PROGRAMMING_FAILED;
}
public SecurityGroupRuleAnswer(SecurityGroupRulesCmd cmd, boolean result, String detail, FailureReason r) {
super(cmd, result, detail);
this.logSequenceNumber = cmd.getSeqNum();

View File

@ -126,7 +126,7 @@ public class SecurityGroupRulesCmd extends Command {
public void setEgressRuleSet(IpPortAndProto[] egressRuleSet) {
this.egressRuleSet = egressRuleSet;
}
public String getGuestIp() {
return guestIp;
}
@ -156,15 +156,15 @@ public class SecurityGroupRulesCmd extends Command {
}
return ruleBuilder.toString();
}
//convert cidrs in the form "a.b.c.d/e" to "hexvalue of 32bit ip/e"
private String compressCidr(String cidr) {
String [] toks = cidr.split("/");
long ipnum = NetUtils.ip2Long(toks[0]);
return Long.toHexString(ipnum) + "/" + toks[1];
}
public String stringifyCompressedRules() {
StringBuilder ruleBuilder = new StringBuilder();
for (SecurityGroupRulesCmd.IpPortAndProto ipPandP : getIngressRuleSet()) {
@ -187,7 +187,7 @@ public class SecurityGroupRulesCmd extends Command {
}
return ruleBuilder.toString();
}
/*
* Compress the security group rules using zlib compression to allow the call to the hypervisor
* to scale beyond 8k cidrs.
@ -243,7 +243,7 @@ public class SecurityGroupRulesCmd extends Command {
public Long getVmId() {
return vmId;
}
public int getTotalNumCidrs() {
//useful for logging
int count = 0;
@ -255,11 +255,11 @@ public class SecurityGroupRulesCmd extends Command {
}
return count;
}
public void setMsId(long msId) {
this.msId = msId;
}
public Long getMsId() {
return msId;
}

View File

@ -33,5 +33,5 @@ public class SetupAnswer extends Answer {
public boolean needReconnect() {
return _reconnect;
}
}

View File

@ -23,7 +23,7 @@ public class SetupCommand extends Command {
HostEnvironment env;
boolean multipath;
boolean needSetup;
public boolean needSetup() {
return needSetup;
}
@ -37,18 +37,18 @@ public class SetupCommand extends Command {
this.multipath = false;
this.needSetup = false;
}
public HostEnvironment getEnvironment() {
return env;
}
protected SetupCommand() {
}
public void setMultipathOn() {
this.multipath = true;
}
public boolean useMultipath() {
return multipath;
}

View File

@ -28,7 +28,7 @@ public class SetupGuestNetworkCommand extends NetworkElementCommand{
Integer priority;
boolean add = true;
NicTO nic;
public NicTO getNic() {
return nic;
}
@ -53,12 +53,12 @@ public class SetupGuestNetworkCommand extends NetworkElementCommand{
public boolean executeInSequence() {
return true;
}
protected SetupGuestNetworkCommand() {
}
public SetupGuestNetworkCommand(String dhcpRange, String networkDomain, boolean isRedundant, Integer priority,
public SetupGuestNetworkCommand(String dhcpRange, String networkDomain, boolean isRedundant, Integer priority,
String defaultDns1, String defaultDns2, boolean add, NicTO nic) {
this.dhcpRange = dhcpRange;
this.networkDomain = networkDomain;

View File

@ -24,31 +24,31 @@ public class ShutdownCommand extends Command {
public static final String Update = "update";
public static final String Unknown = "unknown";
public static final String DeleteHost = "deleteHost";
private String reason;
private String detail;
protected ShutdownCommand() {
super();
}
public ShutdownCommand(String reason, String detail) {
super();
this.reason = reason;
this.detail = detail;
}
/**
* @return return the reason the agent shutdown. If Unknown, call getDetail() for any details.
* @return return the reason the agent shutdown. If Unknown, call getDetail() for any details.
*/
public String getReason() {
return reason;
}
public String getDetail() {
return detail;
}
@Override
public boolean executeInSequence() {
return true;

View File

@ -21,20 +21,20 @@ import com.cloud.agent.api.to.VirtualMachineTO;
public class StartAnswer extends Answer {
VirtualMachineTO vm;
String host_guid;
protected StartAnswer() {
}
public StartAnswer(StartCommand cmd, String msg) {
super(cmd, false, msg);
this.vm = cmd.getVirtualMachine();
}
public StartAnswer(StartCommand cmd, Exception e) {
super(cmd, false, e.getMessage());
this.vm = cmd.getVirtualMachine();
}
public StartAnswer(StartCommand cmd) {
super(cmd, true, null);
this.vm = cmd.getVirtualMachine();
@ -46,7 +46,7 @@ public class StartAnswer extends Answer {
this.vm = cmd.getVirtualMachine();
this.host_guid = guid;
}
public VirtualMachineTO getVirtualMachine() {
return vm;
}

View File

@ -28,12 +28,12 @@ public class StartCommand extends Command {
public VirtualMachineTO getVirtualMachine() {
return vm;
}
@Override
public boolean executeInSequence() {
return true;
}
protected StartCommand() {
}

View File

@ -20,24 +20,24 @@ package com.cloud.agent.api;
public class StartupAnswer extends Answer {
long hostId;
int pingInterval;
protected StartupAnswer() {
}
public StartupAnswer(StartupCommand cmd, long hostId, int pingInterval) {
super(cmd);
this.hostId = hostId;
this.pingInterval = pingInterval;
}
public StartupAnswer(StartupCommand cmd, String details) {
super(cmd, false, details);
}
public long getHostId() {
return hostId;
}
public int getPingInterval() {
return pingInterval;
}

View File

@ -43,11 +43,11 @@ public class StartupCommand extends Command {
String agentTag;
String resourceName;
String gatewayIpAddress;
public StartupCommand(Host.Type type) {
this.type = type;
}
public StartupCommand(Long id, Host.Type type, String name, String dataCenter, String pod, String guid, String version) {
super();
this.id = id;
@ -58,48 +58,48 @@ public class StartupCommand extends Command {
this.version = version;
this.type = type;
}
public StartupCommand(Long id, Host.Type type, String name, String dataCenter, String pod, String guid, String version, String gatewayIpAddress) {
this(id, type, name, dataCenter, pod, guid, version);
this.gatewayIpAddress = gatewayIpAddress;
}
}
public Host.Type getHostType() {
return type;
}
public void setHostType(Host.Type type) {
this.type = type;
}
public String getIqn() {
return iqn;
}
public void setCluster(String cluster) {
this.cluster = cluster;
}
public String getCluster() {
return cluster;
}
public void setIqn(String iqn) {
this.iqn = iqn;
}
public String getDataCenter() {
return dataCenter;
}
public String getPod() {
return pod;
}
public Long getId() {
return id;
}
public String getStorageIpAddressDeux() {
return storageIpAddressDeux;
}
@ -131,11 +131,11 @@ public class StartupCommand extends Command {
public String getName() {
return name;
}
public String getVersion() {
return version;
}
public void setDataCenter(String dataCenter) {
this.dataCenter = dataCenter;
}
@ -147,7 +147,7 @@ public class StartupCommand extends Command {
public void setGuid(String guid) {
this.guid = guid;
}
public void setGuid(String guid, String resourceName) {
this.resourceName = resourceName;
this.guid = guid + "-" + resourceName;
@ -232,15 +232,15 @@ public class StartupCommand extends Command {
public void setVersion(String version) {
this.version = version;
}
public void setPublicIpAddress(String publicIpAddress) {
this.publicIpAddress = publicIpAddress;
}
public String getAgentTag() {
return agentTag;
}
public void setAgentTag(String tag) {
agentTag = tag;
}
@ -248,7 +248,7 @@ public class StartupCommand extends Command {
public void setResourceName(String resourceName) {
this.resourceName = resourceName;
}
public String getGuidWithoutResource() {
if (resourceName == null) {
return guid;
@ -265,11 +265,11 @@ public class StartupCommand extends Command {
}
}
}
public String getResourceName() {
return resourceName;
}
public String getGatewayIpAddress() {
return gatewayIpAddress;
}
@ -277,8 +277,8 @@ public class StartupCommand extends Command {
public void setGatewayIpAddress(String gatewayIpAddress) {
this.gatewayIpAddress = gatewayIpAddress;
}
@Override
public boolean executeInSequence() {
return false;

View File

@ -19,7 +19,7 @@ package com.cloud.agent.api;
import com.cloud.host.Host;
public class StartupExternalFirewallCommand extends StartupCommand {
public StartupExternalFirewallCommand() {
super(Host.Type.ExternalFirewall);
}

View File

@ -21,12 +21,12 @@ import com.cloud.host.Host;
public class StartupProxyCommand extends StartupCommand {
private int proxyPort;
private long proxyVmId;
public StartupProxyCommand() {
super(Host.Type.ConsoleProxy);
setIqn("NoIqn");
}
@Override
public boolean executeInSequence() {
return true;

View File

@ -90,7 +90,7 @@ getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), privIpStr
long memory,
long dom0MinMemory,
final String caps,
final HypervisorType hypervisorType,
final HypervisorType hypervisorType,
final Map<String, String> hostDetails,
Map<String, VmState> vms) {
super(Host.Type.Routing);
@ -114,7 +114,7 @@ getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), privIpStr
public StartupRoutingCommand(int cpus, long speed, long memory, long dom0MinMemory, final String caps, final HypervisorType hypervisorType, final Map<String, String> hostDetails, Map<String, VmState> vms, String hypervisorVersion) {
this(cpus, speed, memory, dom0MinMemory, caps, hypervisorType, hostDetails, vms);
this.hypervisorVersion = hypervisorVersion;
}
}
public void setChanges(Map<String, VmState> vms) {
this.vms = vms;
@ -128,7 +128,7 @@ getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), privIpStr
this.vms.put(vm_name, new VmState(vms.get(vm_name), null));
}
}
public void setClusterVMStateChanges(HashMap<String, Pair<String, State>> allStates){
_clusterVMStates = allStates;
}
@ -156,7 +156,7 @@ getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), privIpStr
public Map<String, VmState> getVmStates() {
return vms;
}
public HashMap<String, Pair<String, State>> getClusterVMStateChanges() {
return _clusterVMStates;
}
@ -219,6 +219,6 @@ getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), privIpStr
public void setHypervisorVersion(String hypervisorVersion) {
this.hypervisorVersion = hypervisorVersion;
}
}
}

View File

@ -19,12 +19,12 @@ package com.cloud.agent.api;
import com.cloud.host.Host;
public class StartupSecondaryStorageCommand extends StartupCommand {
public StartupSecondaryStorageCommand() {
super(Host.Type.SecondaryStorage);
setIqn("NoIqn");
}
@Override
public boolean executeInSequence() {
return true;

View File

@ -26,7 +26,7 @@ import com.cloud.storage.template.TemplateInfo;
public class StartupStorageCommand extends StartupCommand {
String parent;
Map<String, TemplateInfo> templateInfo;
long totalSize;
@ -39,7 +39,7 @@ public class StartupStorageCommand extends StartupCommand {
public StartupStorageCommand() {
super(Host.Type.Storage);
}
public StartupStorageCommand(String parent, StoragePoolType fsType, long totalSize, Map<String, TemplateInfo> info) {
super(Host.Type.Storage);
this.parent = parent;
@ -48,7 +48,7 @@ public class StartupStorageCommand extends StartupCommand {
this.poolInfo = null;
this.fsType = fsType;
}
public StartupStorageCommand(String parent, StoragePoolType fsType, Map<String, TemplateInfo> templateInfo, StoragePoolInfo poolInfo) {
super(Host.Type.Storage);
@ -62,7 +62,7 @@ public class StartupStorageCommand extends StartupCommand {
public String getParent() {
return parent;
}
public void setParent(String parent) {
this.parent = parent;
}
@ -70,15 +70,15 @@ public class StartupStorageCommand extends StartupCommand {
public void setNfsShare(String nfsShare) {
this.nfsShare = nfsShare;
}
public String getNfsShare() {
return nfsShare;
}
public long getTotalSize() {
return totalSize;
}
public Map<String, TemplateInfo> getTemplateInfo() {
return templateInfo;
}

View File

@ -18,28 +18,28 @@ package com.cloud.agent.api;
public class StopAnswer extends RebootAnswer {
Integer vncPort;
protected StopAnswer() {
}
public StopAnswer(StopCommand cmd, String details, Integer vncPort, boolean success) {
super(cmd, details, success);
this.vncPort = vncPort;
}
public StopAnswer(StopCommand cmd, String details, boolean success) {
super(cmd, details, success);
vncPort = null;
}
public StopAnswer(StopCommand cmd, Exception e) {
super(cmd, e);
}
@Override
public Integer getVncPort() {
return vncPort;
}
}

View File

@ -23,35 +23,35 @@ public class StopCommand extends RebootCommand {
private boolean isProxy=false;
private String urlPort=null;
private String publicConsoleProxyIpAddress=null;
protected StopCommand() {
}
public StopCommand(VirtualMachine vm, boolean isProxy, String urlPort, String publicConsoleProxyIpAddress) {
super(vm);
this.isProxy = isProxy;
this.urlPort = urlPort;
this.publicConsoleProxyIpAddress = publicConsoleProxyIpAddress;
}
public StopCommand(VirtualMachine vm, String vnet) {
super(vm);
this.vnet = vnet;
}
public StopCommand(VirtualMachine vm, String vmName, String vnet) {
super(vmName);
this.vnet = vnet;
}
public StopCommand(String vmName) {
super(vmName);
}
public String getVnet() {
return vnet;
}
@Override
public boolean executeInSequence() {
return true;
@ -60,11 +60,11 @@ public class StopCommand extends RebootCommand {
public boolean isProxy() {
return this.isProxy;
}
public String getURLPort() {
return this.urlPort;
}
public String getPublicConsoleProxyIpAddress() {
return this.publicConsoleProxyIpAddress;
}

View File

@ -29,7 +29,7 @@ public class StoragePoolInfo {
long capacityBytes;
long availableBytes;
Map<String, String> details;
protected StoragePoolInfo() {
super();
}
@ -46,14 +46,14 @@ public class StoragePoolInfo {
this.capacityBytes = capacityBytes;
this.availableBytes = availableBytes;
}
public StoragePoolInfo(String uuid, String host, String hostPath,
String localPath, StoragePoolType poolType, long capacityBytes,
long availableBytes, Map<String, String> details) {
this(uuid, host, hostPath, localPath, poolType, capacityBytes, availableBytes);
this.details = details;
}
public long getCapacityBytes() {
return capacityBytes;
}
@ -84,4 +84,4 @@ public class StoragePoolInfo {
public Map<String, String> getDetails() {
return details;
}
}
}

View File

@ -23,10 +23,10 @@ public class TransferAgentCommand extends Command {
protected long futureOwner;
protected long currentOwner;
Event event;
protected TransferAgentCommand() {
}
public TransferAgentCommand(long agentId, long currentOwner, long futureOwner, Event event) {
this.agentId = agentId;
this.currentOwner = currentOwner;

View File

@ -21,7 +21,7 @@ import com.cloud.agent.api.to.NicTO;
public class UnPlugNicCommand extends Command{
NicTO nic;
String instanceName;
public NicTO getNic() {
return nic;
}
@ -30,10 +30,10 @@ public class UnPlugNicCommand extends Command{
public boolean executeInSequence() {
return true;
}
protected UnPlugNicCommand() {
}
public UnPlugNicCommand(NicTO nic, String instanceName) {
this.nic = nic;
this.instanceName = instanceName;

View File

@ -20,7 +20,7 @@ public class UnsupportedAnswer extends Answer {
protected UnsupportedAnswer() {
super();
}
public UnsupportedAnswer(Command cmd, String details) {
super(cmd, false, details);
}

View File

@ -19,7 +19,7 @@ package com.cloud.agent.api;
public class UpgradeAnswer extends Answer {
protected UpgradeAnswer() {
}
public UpgradeAnswer(UpgradeCommand cmd, String failure) {
super(cmd, false, failure);
}

Some files were not shown because too many files have changed in this diff Show More