You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ni...@apache.org on 2013/05/11 11:59:57 UTC
[32/51] [partial] merge master
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckOnHostCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckOnHostCommand.java b/core/src/com/cloud/agent/api/CheckOnHostCommand.java
new file mode 100644
index 0000000..596a532
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckOnHostCommand.java
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.HostTO;
+import com.cloud.host.Host;
+
+public class CheckOnHostCommand extends Command {
+ HostTO host;
+
+ protected CheckOnHostCommand() {
+ }
+
+
+ public CheckOnHostCommand(Host host) {
+ this.host = new HostTO(host);
+ setWait(20);
+ }
+
+ public HostTO getHost() {
+ return host;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckRouterAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckRouterAnswer.java b/core/src/com/cloud/agent/api/CheckRouterAnswer.java
new file mode 100644
index 0000000..da8189f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckRouterAnswer.java
@@ -0,0 +1,81 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.network.router.VirtualRouter.RedundantState;
+
+public class CheckRouterAnswer extends Answer {
+ public static final String ROUTER_NAME = "router.name";
+ 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) {
+ if (!parseDetails(details)) {
+ this.result = false;
+ }
+ }
+ }
+
+ public CheckRouterAnswer(CheckRouterCommand cmd, String details) {
+ super(cmd, false, details);
+ }
+
+ protected boolean parseDetails(String details) {
+ String[] lines = details.split("&");
+ if (lines.length != 2) {
+ return false;
+ }
+ if (lines[0].startsWith("Status: MASTER")) {
+ state = RedundantState.MASTER;
+ } else if (lines[0].startsWith("Status: BACKUP")) {
+ state = RedundantState.BACKUP;
+ } else if (lines[0].startsWith("Status: FAULT")) {
+ state = RedundantState.FAULT;
+ } else {
+ state = RedundantState.UNKNOWN;
+ }
+ if (lines[1].startsWith("Bumped: YES")) {
+ isBumped = true;
+ } else {
+ isBumped = false;
+ }
+ return true;
+ }
+
+ public void setState(RedundantState state) {
+ this.state = state;
+ }
+
+ public RedundantState getState() {
+ return state;
+ }
+
+ public boolean isBumped() {
+ return isBumped;
+ }
+
+ public void setIsBumped(boolean isBumped) {
+ this.isBumped = isBumped;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckRouterCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckRouterCommand.java b/core/src/com/cloud/agent/api/CheckRouterCommand.java
new file mode 100644
index 0000000..6215fc3
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckRouterCommand.java
@@ -0,0 +1,30 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.routing.NetworkElementCommand;
+
+public class CheckRouterCommand extends NetworkElementCommand {
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+ public CheckRouterCommand() {
+ super();
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java b/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java
new file mode 100644
index 0000000..0e9db96
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java
@@ -0,0 +1,71 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import java.util.HashMap;
+import java.util.Map;
+
+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>();
+ ipToDetail = new HashMap<String, String>();
+ this.details = details;
+ if (result) {
+ parseDetails(details);
+ }
+ }
+
+ protected void parseDetails(String details) {
+ String[] lines = details.split("&");
+ for (String line : lines) {
+ String[] words = line.split(":");
+ if (words.length != 3) {
+ //Not something we can parse
+ return;
+ }
+ String ip = words[0];
+ boolean connected = words[1].equals("0");
+ String detail = words[2];
+ ipToConnected.put(ip, connected);
+ 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);
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java b/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java
new file mode 100644
index 0000000..9cfb53b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckS2SVpnConnectionsCommand.java
@@ -0,0 +1,39 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import java.util.List;
+
+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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckStateAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckStateAnswer.java b/core/src/com/cloud/agent/api/CheckStateAnswer.java
new file mode 100755
index 0000000..bf8ae0f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckStateAnswer.java
@@ -0,0 +1,45 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.vm.VirtualMachine.State;
+
+/**
+ */
+public class CheckStateAnswer extends Answer {
+ State state;
+
+ public CheckStateAnswer() {}
+
+ 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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckStateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckStateCommand.java b/core/src/com/cloud/agent/api/CheckStateCommand.java
new file mode 100755
index 0000000..89fc773
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckStateCommand.java
@@ -0,0 +1,40 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+/**
+ *
+ *
+ */
+public class CheckStateCommand extends Command {
+ String vmName;
+
+ public CheckStateCommand() {}
+
+ public CheckStateCommand(String vmName) {
+ this.vmName = vmName;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public String getVmName() {
+ return vmName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java b/core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java
new file mode 100644
index 0000000..3f0ffdb
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java
@@ -0,0 +1,52 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import 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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CheckVirtualMachineCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CheckVirtualMachineCommand.java b/core/src/com/cloud/agent/api/CheckVirtualMachineCommand.java
new file mode 100644
index 0000000..62f4420
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CheckVirtualMachineCommand.java
@@ -0,0 +1,41 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class CheckVirtualMachineCommand extends Command {
+
+ private String vmName;
+
+ protected CheckVirtualMachineCommand() {
+
+ }
+
+ public CheckVirtualMachineCommand(String vmName) {
+ this.vmName = vmName;
+ setWait(20);
+ }
+
+ public String getVmName() {
+ return vmName;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java b/core/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java
new file mode 100644
index 0000000..8b5172d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+
+public class 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() {
+
+ }
+
+
+ @Override
+ public int getInterval() {
+ return interval;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CleanupSnapshotBackupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CleanupSnapshotBackupCommand.java b/core/src/com/cloud/agent/api/CleanupSnapshotBackupCommand.java
new file mode 100644
index 0000000..ae65a52
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CleanupSnapshotBackupCommand.java
@@ -0,0 +1,75 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import java.util.List;
+
+public class CleanupSnapshotBackupCommand extends Command {
+ private String secondaryStoragePoolURL;
+ private Long dcId;
+ private Long accountId;
+ private Long volumeId;
+ private List<String> validBackupUUIDs;
+
+ protected CleanupSnapshotBackupCommand() {
+
+ }
+
+ /*
+ * @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
+ */
+ public CleanupSnapshotBackupCommand(String secondaryStoragePoolURL,
+ Long dcId,
+ Long accountId,
+ Long volumeId,
+ List<String> validBackupUUIDs)
+ {
+ this.secondaryStoragePoolURL = secondaryStoragePoolURL;
+ this.dcId = dcId;
+ this.accountId = accountId;
+ this.volumeId = volumeId;
+ this.validBackupUUIDs = validBackupUUIDs;
+ }
+
+ public String getSecondaryStoragePoolURL() {
+ return secondaryStoragePoolURL;
+ }
+
+ public Long getDcId() {
+ return dcId;
+ }
+
+ public Long getAccountId() {
+ return accountId;
+ }
+
+ public Long getVolumeId() {
+ return volumeId;
+ }
+
+ public List<String> getValidBackupUUIDs() {
+ return validBackupUUIDs;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ClusterSyncAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ClusterSyncAnswer.java b/core/src/com/cloud/agent/api/ClusterSyncAnswer.java
new file mode 100644
index 0000000..99fee2a
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ClusterSyncAnswer.java
@@ -0,0 +1,55 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import java.util.HashMap;
+
+import com.cloud.utils.Pair;
+import com.cloud.vm.VirtualMachine.State;
+
+public class ClusterSyncAnswer extends Answer {
+ private long _clusterId;
+ private HashMap<String, Pair<String, State>> _newStates;
+ private boolean _isExecuted=false;
+
+ // this is here because a cron command answer is being sent twice
+ // AgentAttache.processAnswers
+ // AgentManagerImpl.notifyAnswersToMonitors
+ public boolean 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;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ClusterSyncCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ClusterSyncCommand.java b/core/src/com/cloud/agent/api/ClusterSyncCommand.java
new file mode 100644
index 0000000..17dbbd8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ClusterSyncCommand.java
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+
+public class ClusterSyncCommand extends Command implements CronCommand {
+ int _interval;
+
+ long _clusterId;
+
+ public ClusterSyncCommand() {
+ }
+
+ public ClusterSyncCommand(int interval, long clusterId){
+ _interval = interval;
+ _clusterId = clusterId;
+ }
+
+ @Override
+ public int getInterval() {
+ return _interval;
+ }
+
+ public long getClusterId() {
+ return _clusterId;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ComputeChecksumCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ComputeChecksumCommand.java b/core/src/com/cloud/agent/api/ComputeChecksumCommand.java
new file mode 100755
index 0000000..a2c88c4
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ComputeChecksumCommand.java
@@ -0,0 +1,40 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.storage.ssCommand;
+
+
+public class ComputeChecksumCommand extends ssCommand {
+
+
+ private String templatePath;
+ public ComputeChecksumCommand() {
+ super();
+ }
+
+ public ComputeChecksumCommand(String secUrl, String templatePath) {
+ super(secUrl);
+ this.templatePath = templatePath;
+ }
+
+ public String getTemplatePath() {
+ return templatePath;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java b/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java
new file mode 100644
index 0000000..9f50a2f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java
@@ -0,0 +1,88 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class 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;
+ }
+
+ 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;
+ }
+
+ public String getTunnelSession() {
+ return _tunnelSession;
+ }
+
+ public void setTunnelSession(String tunnelSession) {
+ _tunnelSession = tunnelSession;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java b/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java
new file mode 100644
index 0000000..bd8093c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java
@@ -0,0 +1,68 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class ConsoleAccessAuthenticationCommand extends AgentControlCommand {
+
+ private String _host;
+ private String _port;
+ private String _vmId;
+ private String _sid;
+ private String _ticket;
+
+ private boolean _isReauthenticating;
+
+ public ConsoleAccessAuthenticationCommand() {
+ _isReauthenticating = false;
+ }
+
+ public ConsoleAccessAuthenticationCommand(String host, String port, String vmId, String sid, String ticket) {
+ _host = host;
+ _port = port;
+ _vmId = vmId;
+ _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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java b/core/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java
new file mode 100644
index 0000000..ebb06b6
--- /dev/null
+++ b/core/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java
@@ -0,0 +1,39 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public class 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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java b/core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java
new file mode 100644
index 0000000..9e2680e
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java
@@ -0,0 +1,82 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.storage.StoragePool;
+
+/**
+ * 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.
+ * 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
+ */
+
+ public CreatePrivateTemplateFromSnapshotCommand(StoragePool pool,
+ String secondaryStoragePoolURL,
+ Long dcId,
+ Long accountId,
+ Long volumeId,
+ String backedUpSnapshotUuid,
+ String backedUpSnapshotName,
+ String origTemplateInstallPath,
+ Long newTemplateId,
+ String templateName,
+ int wait)
+ {
+ super(pool, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
+ this.origTemplateInstallPath = origTemplateInstallPath;
+ this.newTemplateId = newTemplateId;
+ this.templateName = templateName;
+ setWait(wait);
+ }
+
+ /**
+ * @return the origTemplateInstallPath
+ */
+ public String getOrigTemplateInstallPath() {
+ return origTemplateInstallPath;
+ }
+
+ public Long getNewTemplateId() {
+ return newTemplateId;
+ }
+
+ /**
+ * @return templateName
+ */
+ public String getTemplateName() {
+ return templateName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java b/core/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java
new file mode 100644
index 0000000..4e0bf32
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java
@@ -0,0 +1,93 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.StoragePool;
+
+public class CreatePrivateTemplateFromVolumeCommand extends SnapshotCommand {
+ private String _vmName;
+ private String _volumePath;
+ private String _userSpecifiedName;
+ private String _uniqueName;
+ private long _templateId;
+ private long _accountId;
+ StorageFilerTO _primaryPool;
+ // For XenServer
+ private String _secondaryStorageUrl;
+
+ public CreatePrivateTemplateFromVolumeCommand() {
+ }
+
+ public CreatePrivateTemplateFromVolumeCommand(StoragePool pool, String secondaryStorageUrl, long templateId, long accountId, String userSpecifiedName, String uniqueName, String volumePath, String vmName, int wait) {
+ _secondaryStorageUrl = secondaryStorageUrl;
+ _templateId = templateId;
+ _accountId = accountId;
+ _userSpecifiedName = userSpecifiedName;
+ _uniqueName = uniqueName;
+ _volumePath = volumePath;
+ _vmName = vmName;
+ primaryStoragePoolNameLabel = pool.getUuid();
+ _primaryPool = new StorageFilerTO(pool);
+ setWait(wait);
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+ public StorageFilerTO getPool() {
+ return _primaryPool;
+ }
+
+ public String getSecondaryStorageUrl() {
+ return _secondaryStorageUrl;
+ }
+
+ public String getTemplateName() {
+ return _userSpecifiedName;
+ }
+
+ public String getUniqueName() {
+ return _uniqueName;
+ }
+
+ public long getTemplateId() {
+ return _templateId;
+ }
+
+ public String getVmName() {
+ return _vmName;
+ }
+
+ public void setVolumePath(String _volumePath) {
+ this._volumePath = _volumePath;
+ }
+
+ public String getVolumePath() {
+ return _volumePath;
+ }
+
+ public Long getAccountId() {
+ return _accountId;
+ }
+
+ public void setTemplateId(long templateId) {
+ _templateId = templateId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreateStoragePoolCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateStoragePoolCommand.java b/core/src/com/cloud/agent/api/CreateStoragePoolCommand.java
new file mode 100644
index 0000000..7a4d768
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreateStoragePoolCommand.java
@@ -0,0 +1,30 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.storage.StoragePool;
+
+public class CreateStoragePoolCommand extends ModifyStoragePoolCommand {
+
+
+ public CreateStoragePoolCommand() {
+ }
+
+ public CreateStoragePoolCommand(boolean add, StoragePool pool) {
+ super(add, pool);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java b/core/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java
new file mode 100644
index 0000000..f9fb164
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java
@@ -0,0 +1,62 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class CreateVMSnapshotAnswer extends Answer {
+
+ private List<VolumeTO> volumeTOs;
+ private VMSnapshotTO vmSnapshotTo;
+
+
+ public List<VolumeTO> getVolumeTOs() {
+ return volumeTOs;
+ }
+
+ public void setVolumeTOs(List<VolumeTO> volumeTOs) {
+ this.volumeTOs = volumeTOs;
+ }
+
+ public VMSnapshotTO getVmSnapshotTo() {
+ return vmSnapshotTo;
+ }
+
+ public void setVmSnapshotTo(VMSnapshotTO vmSnapshotTo) {
+ this.vmSnapshotTo = vmSnapshotTo;
+ }
+
+ public CreateVMSnapshotAnswer() {
+
+ }
+
+ public CreateVMSnapshotAnswer(CreateVMSnapshotCommand cmd, boolean success,
+ String result) {
+ super(cmd, success, result);
+ }
+
+ public CreateVMSnapshotAnswer(CreateVMSnapshotCommand cmd,
+ VMSnapshotTO vmSnapshotTo, List<VolumeTO> volumeTOs) {
+ super(cmd, true, "");
+ this.vmSnapshotTo = vmSnapshotTo;
+ this.volumeTOs = volumeTOs;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateVMSnapshotCommand.java b/core/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
new file mode 100644
index 0000000..478987d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.vm.VirtualMachine;
+
+public class CreateVMSnapshotCommand extends VMSnapshotBaseCommand {
+
+ public CreateVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType, VirtualMachine.State vmState) {
+ super(vmName, snapshot, volumeTOs, guestOSType);
+ this.vmState = vmState;
+ }
+
+ private VirtualMachine.State vmState;
+
+
+ public VirtualMachine.State getVmState() {
+ return vmState;
+ }
+
+ public void setVmState(VirtualMachine.State vmState) {
+ this.vmState = vmState;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java b/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java
new file mode 100644
index 0000000..2f7cd94
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java
@@ -0,0 +1,38 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+
+public class 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;
+ }
+
+ /**
+ * @return the vdi
+ */
+ public String getVdi() {
+ return vdiUUID;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java b/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
new file mode 100644
index 0000000..fbf6121
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
@@ -0,0 +1,58 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.storage.StoragePool;
+
+
+/**
+ * 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
+ * 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
+ * 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.
+ * 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
+ */
+
+ public CreateVolumeFromSnapshotCommand(StoragePool pool,
+ String secondaryStoragePoolURL,
+ Long dcId,
+ Long accountId,
+ Long volumeId,
+ String backedUpSnapshotUuid,
+ String backedUpSnapshotName,
+ int wait)
+ {
+ super(pool, secondaryStoragePoolURL, backedUpSnapshotUuid, backedUpSnapshotName, dcId, accountId, volumeId);
+ setWait(wait);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java b/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java
new file mode 100644
index 0000000..ed3bc62
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class CreateVolumeFromVMSnapshotAnswer extends Answer {
+ private String path;
+ private VolumeTO volumeTo;
+
+ public VolumeTO getVolumeTo() {
+ return volumeTo;
+ }
+
+ public CreateVolumeFromVMSnapshotAnswer(
+ CreateVolumeFromVMSnapshotCommand cmd, VolumeTO volumeTo) {
+ super(cmd, true, "");
+ this.volumeTo = volumeTo;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ protected CreateVolumeFromVMSnapshotAnswer() {
+
+ }
+
+ public CreateVolumeFromVMSnapshotAnswer(
+ CreateVolumeFromVMSnapshotCommand cmd, String path) {
+ super(cmd, true, "");
+ this.path = path;
+ }
+
+ public CreateVolumeFromVMSnapshotAnswer(
+ CreateVolumeFromVMSnapshotCommand cmd, boolean result, String string) {
+ super(cmd, result, string);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java b/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java
new file mode 100644
index 0000000..634e15c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java
@@ -0,0 +1,88 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.vm.DiskProfile;
+
+public class CreateVolumeFromVMSnapshotCommand extends Command {
+
+ protected String path;
+ protected String name;
+ protected Boolean fullClone;
+ protected String storagePoolUuid;
+ private StorageFilerTO pool;
+ private DiskProfile diskProfile;
+ private Long volumeId;
+
+ public DiskProfile getDskch() {
+ return diskProfile;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public Long getVolumeId() {
+ return volumeId;
+ }
+
+ protected CreateVolumeFromVMSnapshotCommand() {
+
+ }
+
+ public CreateVolumeFromVMSnapshotCommand(String path, String name,
+ Boolean fullClone, String storagePoolUuid) {
+ this.path = path;
+ this.name = name;
+ this.fullClone = fullClone;
+ this.storagePoolUuid = storagePoolUuid;
+ }
+
+ public CreateVolumeFromVMSnapshotCommand(String path, String name,
+ Boolean fullClone, String storagePoolUuid, StorageFilerTO pool,
+ DiskProfile diskProfile, Long volumeId) {
+ this.path = path;
+ this.name = name;
+ this.fullClone = fullClone;
+ this.storagePoolUuid = storagePoolUuid;
+ this.pool = pool;
+ this.diskProfile = diskProfile;
+ this.volumeId = volumeId;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Boolean getFullClone() {
+ return fullClone;
+ }
+
+ public String getStoragePoolUuid() {
+ return storagePoolUuid;
+ }
+
+ public StorageFilerTO getPool() {
+ return pool;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/CronCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CronCommand.java b/core/src/com/cloud/agent/api/CronCommand.java
new file mode 100755
index 0000000..c43237c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/CronCommand.java
@@ -0,0 +1,24 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+public interface CronCommand {
+ /**
+ * @return interval at which to run the command in seconds.
+ */
+ public int getInterval();
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteObjectFromSwiftCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteObjectFromSwiftCommand.java b/core/src/com/cloud/agent/api/DeleteObjectFromSwiftCommand.java
new file mode 100644
index 0000000..3d62c50
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteObjectFromSwiftCommand.java
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.agent.api.to.SwiftTO;
+
+/**
+ *
+ *
+ */
+
+public class DeleteObjectFromSwiftCommand extends Command {
+ @LogLevel(Log4jLevel.Off)
+ private SwiftTO swift;
+ private String container;
+ private String object;
+
+ protected DeleteObjectFromSwiftCommand() {
+
+ }
+
+ public DeleteObjectFromSwiftCommand(SwiftTO swift, String container, String object) {
+ this.swift = swift;
+ this.container = container;
+ this.object = object;
+ }
+
+ public SwiftTO getSwift() {
+ return this.swift;
+ }
+
+ public String getContainer() {
+ return container;
+ }
+
+ public String getObject() {
+ return object;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java b/core/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java
new file mode 100644
index 0000000..9a895d8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java
@@ -0,0 +1,32 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+
+public class DeleteSnapshotBackupAnswer extends Answer {
+
+ protected DeleteSnapshotBackupAnswer() {
+
+ }
+
+ public DeleteSnapshotBackupAnswer(DeleteSnapshotBackupCommand cmd, boolean success, String details) {
+ super(cmd, success, details);
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java b/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
new file mode 100644
index 0000000..128df84
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
@@ -0,0 +1,96 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.agent.api.to.S3TO;
+import com.cloud.agent.api.to.SwiftTO;
+import com.cloud.storage.StoragePool;
+
+/**
+ * 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.
+ */
+public class DeleteSnapshotBackupCommand extends SnapshotCommand {
+ @LogLevel(Log4jLevel.Off)
+ private SwiftTO swift;
+ private S3TO s3;
+ private Boolean all;
+
+ public SwiftTO getSwift() {
+ return swift;
+ }
+
+ public Boolean isAll() {
+ return all;
+ }
+
+ public void setAll(Boolean all) {
+ this.all = all;
+ }
+
+ public void setSwift(SwiftTO swift) {
+ this.swift = swift;
+ }
+
+ public S3TO getS3() {
+ return s3;
+ }
+
+ 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
+ * 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
+ * - 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.
+ * 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.
+ */
+ public DeleteSnapshotBackupCommand(StoragePool pool,
+ SwiftTO swift,
+ S3TO s3,
+ String secondaryStoragePoolURL,
+ Long dcId,
+ Long accountId,
+ Long volumeId,
+ String backupUUID, Boolean all)
+ {
+ super(pool, secondaryStoragePoolURL, backupUUID, null, dcId, accountId, volumeId);
+ setSwift(swift);
+ this.s3 = s3;
+ setAll(all);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java b/core/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java
new file mode 100644
index 0000000..e2071d7
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+/**
+ * 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.
+ */
+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)
+ {
+ this.secondaryStorageUrl = secondaryStorageUrl;
+ this.dcId = dcId;
+ this.accountId = accountId;
+ this.volumeId = volumeId;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public String getSecondaryStorageUrl() {
+ return secondaryStorageUrl;
+ }
+
+ public Long getDcId() {
+ return dcId;
+ }
+
+ public Long getAccountId() {
+ return accountId;
+ }
+
+ public Long getVolumeId() {
+ return volumeId;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteStoragePoolCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteStoragePoolCommand.java b/core/src/com/cloud/agent/api/DeleteStoragePoolCommand.java
new file mode 100644
index 0000000..4618d59
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteStoragePoolCommand.java
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import java.io.File;
+import java.util.UUID;
+
+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()));
+ }
+
+ public StorageFilerTO getPool() {
+ return pool;
+ }
+
+ public void setPool(StoragePool pool) {
+ this.pool = new StorageFilerTO(pool);
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+ public String getLocalPath() {
+ return localPath;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteTemplateFromS3Command.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteTemplateFromS3Command.java b/core/src/com/cloud/agent/api/DeleteTemplateFromS3Command.java
new file mode 100644
index 0000000..278669b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteTemplateFromS3Command.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.S3TO;
+
+public class DeleteTemplateFromS3Command extends Command {
+
+ private S3TO s3;
+ private Long templateId;
+ private Long accountId;
+
+ protected DeleteTemplateFromS3Command() {
+ super();
+ }
+
+ public DeleteTemplateFromS3Command(final S3TO s3, final Long accountId,
+ final Long templateId) {
+
+ super();
+
+ this.s3 = s3;
+ this.accountId = accountId;
+ this.templateId = templateId;
+
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((accountId == null) ? 0 : accountId.hashCode());
+ result = prime * result + ((s3 == null) ? 0 : s3.hashCode());
+ result = prime * result
+ + ((templateId == null) ? 0 : templateId.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object thatObject) {
+
+ if (this == thatObject) {
+ return true;
+ }
+
+ if (thatObject == null) {
+ return false;
+ }
+
+ if (getClass() != thatObject.getClass()) {
+ return false;
+ }
+
+ final DeleteTemplateFromS3Command thatCommand = (DeleteTemplateFromS3Command) thatObject;
+
+ if (!(accountId == thatCommand.accountId)
+ || (this.accountId != null && this.accountId
+ .equals(thatCommand.accountId))) {
+ return false;
+ }
+
+ if (!(templateId == thatCommand.templateId)
+ || (this.templateId != null && this.templateId
+ .equals(thatCommand.templateId))) {
+ return false;
+ }
+
+ return true;
+
+ }
+
+ public S3TO getS3() {
+ return s3;
+ }
+
+ public Long getTemplateId() {
+ return templateId;
+ }
+
+ public Long getAccountId() {
+ return accountId;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java b/core/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
new file mode 100644
index 0000000..8f4ecad
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
@@ -0,0 +1,49 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class DeleteVMSnapshotAnswer extends Answer {
+ private List<VolumeTO> volumeTOs;
+
+ public DeleteVMSnapshotAnswer() {
+ }
+
+ public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd, boolean result,
+ String message) {
+ super(cmd, result, message);
+ }
+
+ public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd,
+ List<VolumeTO> volumeTOs) {
+ super(cmd, true, "");
+ this.volumeTOs = volumeTOs;
+ }
+
+ public List<VolumeTO> getVolumeTOs() {
+ return volumeTOs;
+ }
+
+ public void setVolumeTOs(List<VolumeTO> volumeTOs) {
+ this.volumeTOs = volumeTOs;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java b/core/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java
new file mode 100644
index 0000000..c213448
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License
+package com.cloud.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+
+public class DeleteVMSnapshotCommand extends VMSnapshotBaseCommand {
+ public DeleteVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType) {
+ super( vmName, snapshot, volumeTOs, guestOSType);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DownloadSnapshotFromS3Command.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DownloadSnapshotFromS3Command.java b/core/src/com/cloud/agent/api/DownloadSnapshotFromS3Command.java
new file mode 100644
index 0000000..edf683a
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DownloadSnapshotFromS3Command.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.S3TO;
+
+public class DownloadSnapshotFromS3Command extends SnapshotCommand {
+
+ private S3TO s3;
+ private String parent;
+
+ protected DownloadSnapshotFromS3Command() {
+ super();
+ }
+
+ public DownloadSnapshotFromS3Command(S3TO s3, String parent,
+ String secondaryStorageUrl, Long dcId, Long accountId,
+ Long volumeId, String backupUuid, int wait) {
+
+ super(null, secondaryStorageUrl, backupUuid, "", dcId, accountId,
+ volumeId);
+
+ this.s3 = s3;
+ this.parent = parent;
+ setWait(wait);
+
+ }
+
+ public S3TO getS3() {
+ return s3;
+ }
+
+ public void setS3(S3TO s3) {
+ this.s3 = s3;
+ }
+
+ public String getParent() {
+ return parent;
+ }
+
+ public void setParent(String parent) {
+ this.parent = parent;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DownloadSnapshotFromSwiftCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DownloadSnapshotFromSwiftCommand.java b/core/src/com/cloud/agent/api/DownloadSnapshotFromSwiftCommand.java
new file mode 100644
index 0000000..0711b2e
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DownloadSnapshotFromSwiftCommand.java
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.agent.api.to.SwiftTO;
+
+/**
+ * This currently assumes that both primary and secondary storage are mounted on the XenServer.
+ */
+public class DownloadSnapshotFromSwiftCommand extends SnapshotCommand {
+ @LogLevel(Log4jLevel.Off)
+ private SwiftTO _swift;
+
+ private String _parent;
+
+ protected DownloadSnapshotFromSwiftCommand() {
+
+ }
+
+ public DownloadSnapshotFromSwiftCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long volumeId, String parent, String BackupUuid, int wait) {
+
+ super(null, secondaryStorageUrl, BackupUuid, "", dcId, accountId, volumeId);
+ setParent(parent);
+ setSwift(swift);
+ setWait(wait);
+ }
+
+
+ public SwiftTO getSwift() {
+ return this._swift;
+ }
+
+ public void setSwift(SwiftTO swift) {
+ this._swift = swift;
+ }
+
+ public String getParent() {
+ return _parent;
+ }
+
+ public void setParent(String parent) {
+ this._parent = parent;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/DownloadTemplateFromS3ToSecondaryStorageCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DownloadTemplateFromS3ToSecondaryStorageCommand.java b/core/src/com/cloud/agent/api/DownloadTemplateFromS3ToSecondaryStorageCommand.java
new file mode 100644
index 0000000..af61228
--- /dev/null
+++ b/core/src/com/cloud/agent/api/DownloadTemplateFromS3ToSecondaryStorageCommand.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.S3TO;
+
+public final class DownloadTemplateFromS3ToSecondaryStorageCommand extends Command {
+
+ private final S3TO s3;
+ private final Long accountId;
+ private final Long templateId;
+ private final String storagePath;
+
+ public DownloadTemplateFromS3ToSecondaryStorageCommand(final S3TO s3,
+ final Long accountId, final Long templateId,
+ final String storagePath, final int wait) {
+
+ super();
+
+ this.s3 = s3;
+ this.accountId = accountId;
+ this.templateId = templateId;
+ this.storagePath = storagePath;
+
+ setWait(wait);
+
+ }
+
+ public S3TO getS3() {
+ return this.s3;
+ }
+
+ public Long getAccountId() {
+ return this.accountId;
+ }
+
+ public Long getTemplateId() {
+ return this.templateId;
+ }
+
+ public String getStoragePath() {
+ return this.storagePath;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+}