You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mu...@apache.org on 2013/05/13 17:53:47 UTC
[27/93] [abbrv] [partial] merge master
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CreateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CreateCommand.java b/core/src/com/cloud/agent/api/storage/CreateCommand.java
new file mode 100644
index 0000000..fd0375a
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CreateCommand.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.storage;
+
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.StoragePool;
+import com.cloud.vm.DiskProfile;
+
+public class CreateCommand extends Command {
+ private long volId;
+ private StorageFilerTO pool;
+ private DiskProfile diskCharacteristics;
+ private String templateUrl;
+
+ protected CreateCommand() {
+ super();
+ }
+
+ /**
+ * Construction for template based volumes.
+ *
+ * @param vol
+ * @param vm
+ * @param diskCharacteristics
+ * @param templateUrl
+ * @param pool
+ */
+ public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StorageFilerTO pool) {
+ this(diskCharacteristics, pool);
+ this.templateUrl = templateUrl;
+ }
+
+ /**
+ * Construction for regular volumes.
+ *
+ * @param vol
+ * @param vm
+ * @param diskCharacteristics
+ * @param pool
+ */
+ public CreateCommand(DiskProfile diskCharacteristics, StorageFilerTO pool) {
+ this.volId = diskCharacteristics.getVolumeId();
+ this.diskCharacteristics = diskCharacteristics;
+ this.pool = pool;
+ this.templateUrl = null;
+ }
+
+ public CreateCommand(DiskProfile diskCharacteristics, String templateUrl, StoragePool pool) {
+ this(diskCharacteristics, templateUrl, new StorageFilerTO(pool));
+ }
+
+ public CreateCommand(DiskProfile diskCharacteristics, StoragePool pool) {
+ this(diskCharacteristics, new StorageFilerTO(pool));
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public String getTemplateUrl() {
+ return templateUrl;
+ }
+
+ public StorageFilerTO getPool() {
+ return pool;
+ }
+
+ public DiskProfile getDiskCharacteristics() {
+ return diskCharacteristics;
+ }
+
+ public long getVolumeId() {
+ return volId;
+ }
+
+ @Deprecated
+ public String getInstanceName() {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java b/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java
new file mode 100644
index 0000000..808a67f
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java
@@ -0,0 +1,37 @@
+// 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.storage;
+
+import com.cloud.agent.api.Answer;
+
+public class CreateEntityDownloadURLAnswer extends Answer{
+
+ String resultString;
+ short resultCode;
+ public static final short RESULT_SUCCESS = 1;
+ public static final short RESULT_FAILURE = 0;
+
+ public CreateEntityDownloadURLAnswer(String resultString, short resultCode) {
+ super();
+ this.resultString = resultString;
+ this.resultCode = resultCode;
+ }
+
+ public CreateEntityDownloadURLAnswer(){
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java b/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java
new file mode 100755
index 0000000..d928e0c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java
@@ -0,0 +1,72 @@
+// 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.storage;
+
+
+public class CreateEntityDownloadURLCommand extends AbstractDownloadCommand {
+
+ public CreateEntityDownloadURLCommand(String parent, String installPath, String uuid) { // this constructor is for creating template download url
+ super();
+ this.parent = parent; // parent is required as not the template can be child of one of many parents
+ this.installPath = installPath;
+ this.extractLinkUUID = uuid;
+ }
+
+ public CreateEntityDownloadURLCommand(String installPath, String uuid) {
+ super();
+ this.parent = parent;
+ this.installPath = installPath;
+ this.extractLinkUUID = uuid;
+ }
+
+ public CreateEntityDownloadURLCommand() {
+ }
+
+ private String installPath;
+ private String parent;
+ private String extractLinkUUID;
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+ public String getInstallPath() {
+ return installPath;
+ }
+
+ public void setInstallPath(String installPath) {
+ this.installPath = installPath;
+ }
+
+ public String getParent() {
+ return parent;
+ }
+
+ public void setParent(String parent) {
+ this.parent = parent;
+ }
+
+ public String getExtractLinkUUID() {
+ return extractLinkUUID;
+ }
+
+ public void setExtractLinkUUID(String extractLinkUUID) {
+ this.extractLinkUUID = extractLinkUUID;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java b/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java
new file mode 100644
index 0000000..83db84d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java
@@ -0,0 +1,77 @@
+// 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.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+import com.cloud.storage.Storage.ImageFormat;
+
+public class CreatePrivateTemplateAnswer extends Answer {
+ private String _path;
+ private long _virtualSize;
+ private long _physicalSize;
+ private String _uniqueName;
+ private ImageFormat _format;
+
+ public CreatePrivateTemplateAnswer() {}
+
+ public CreatePrivateTemplateAnswer(Command cmd, boolean success, String result, String path, long virtualSize,
+ long physicalSize, String uniqueName, ImageFormat format) {
+ super(cmd, success, result);
+ _path = path;
+ _virtualSize = virtualSize;
+ _physicalSize = physicalSize;
+ _uniqueName = uniqueName;
+ _format = format;
+ }
+
+ public CreatePrivateTemplateAnswer(Command cmd, boolean success, String result) {
+ super(cmd, success, result);
+ }
+
+ public String getPath() {
+ return _path;
+ }
+
+ public void setPath(String path) {
+ _path = path;
+ }
+
+ public long getVirtualSize() {
+ return _virtualSize;
+ }
+
+ public void setVirtualSize(long virtualSize) {
+ _virtualSize = virtualSize;
+ }
+
+ public void setphysicalSize(long _physicalSize) {
+ this._physicalSize = _physicalSize;
+ }
+
+ public long getphysicalSize() {
+ return _physicalSize;
+ }
+
+ public String getUniqueName() {
+ return _uniqueName;
+ }
+
+ public ImageFormat getImageFormat() {
+ return _format;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java b/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java
new file mode 100644
index 0000000..d392a89
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java
@@ -0,0 +1,90 @@
+// 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.storage;
+
+public class CreatePrivateTemplateCommand extends StorageCommand {
+ private String _snapshotFolder;
+ private String _snapshotPath;
+ private String _userFolder;
+ private String _userSpecifiedName;
+ private String _uniqueName;
+ private long _templateId;
+ private long _accountId;
+
+ // For XenServer
+ private String _secondaryStorageURL;
+ private String _snapshotName;
+
+ public CreatePrivateTemplateCommand() {}
+
+ public CreatePrivateTemplateCommand(String secondaryStorageURL, long templateId, long accountId, String userSpecifiedName, String uniqueName, String snapshotFolder, String snapshotPath, String snapshotName, String userFolder) {
+ _secondaryStorageURL = secondaryStorageURL;
+ _templateId = templateId;
+ _accountId = accountId;
+ _userSpecifiedName = userSpecifiedName;
+ _uniqueName = uniqueName;
+ _snapshotFolder = snapshotFolder;
+ _snapshotPath = snapshotPath;
+ _snapshotName = snapshotName;
+ _userFolder = userFolder;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+ public String getSecondaryStorageURL() {
+ return _secondaryStorageURL;
+ }
+
+ public String getTemplateName() {
+ return _userSpecifiedName;
+ }
+
+ public String getUniqueName() {
+ return _uniqueName;
+ }
+
+ public String getSnapshotFolder() {
+ return _snapshotFolder;
+ }
+
+ public String getSnapshotPath() {
+ return _snapshotPath;
+ }
+
+ public String getSnapshotName() {
+ return _snapshotName;
+ }
+
+ public String getUserFolder() {
+ return _userFolder;
+ }
+
+ public long getTemplateId() {
+ return _templateId;
+ }
+
+ 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/storage/DeleteEntityDownloadURLAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java b/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java
new file mode 100644
index 0000000..c6fdf3c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java
@@ -0,0 +1,37 @@
+// 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.storage;
+
+import com.cloud.agent.api.Answer;
+
+public class DeleteEntityDownloadURLAnswer extends Answer{
+
+ String resultString;
+ short resultCode;
+ public static final short RESULT_SUCCESS = 1;
+ public static final short RESULT_FAILURE = 0;
+
+ public DeleteEntityDownloadURLAnswer(String resultString, short resultCode) {
+ super();
+ this.resultString = resultString;
+ this.resultCode = resultCode;
+ }
+
+ public DeleteEntityDownloadURLAnswer(){
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java b/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java
new file mode 100755
index 0000000..fbfacb9
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java
@@ -0,0 +1,72 @@
+// 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.storage;
+
+import com.cloud.storage.Upload;
+
+public class DeleteEntityDownloadURLCommand extends AbstractDownloadCommand {
+
+ private String path;
+ private String extractUrl;
+ private Upload.Type type;
+ private String parentPath;
+
+ public DeleteEntityDownloadURLCommand(String path, Upload.Type type, String url, String parentPath) {
+ super();
+ this.path = path;
+ this.type = type;
+ this.extractUrl = url;
+ this.parentPath = parentPath;
+ }
+
+ public DeleteEntityDownloadURLCommand() {
+ super();
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public Upload.Type getType() {
+ return type;
+ }
+
+ public void setType(Upload.Type type) {
+ this.type = type;
+ }
+
+ public String getExtractUrl() {
+ return extractUrl;
+ }
+
+ public void setExtractUrl(String extractUrl) {
+ this.extractUrl = extractUrl;
+ }
+
+ public String getParentPath() {
+ return parentPath;
+ }
+
+ public void setParentPath(String parentPath) {
+ this.parentPath = parentPath;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java b/core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java
new file mode 100644
index 0000000..69f465c
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.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.storage;
+
+
+public class DeleteTemplateCommand extends ssCommand {
+ private String templatePath;
+
+
+ public DeleteTemplateCommand() {
+ }
+
+ public DeleteTemplateCommand(String secUrl, String templatePath) {
+ this.setSecUrl(secUrl);
+ this.templatePath = templatePath;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public String getTemplatePath() {
+ return templatePath;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java b/core/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java
new file mode 100755
index 0000000..949af01
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DeleteVolumeCommand.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.storage;
+
+public class DeleteVolumeCommand extends ssCommand {
+ private String volumePath;
+
+ public DeleteVolumeCommand() {
+ }
+
+ public DeleteVolumeCommand(String secUrl, String volumePath) {
+ this.setSecUrl(secUrl);
+ this.volumePath = volumePath;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public String getVolumePath() {
+ return volumePath;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DestroyAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DestroyAnswer.java b/core/src/com/cloud/agent/api/storage/DestroyAnswer.java
new file mode 100644
index 0000000..ac60015
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DestroyAnswer.java
@@ -0,0 +1,31 @@
+// 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.storage;
+
+import com.cloud.agent.api.Answer;
+
+public class DestroyAnswer extends Answer {
+ public DestroyAnswer(DestroyCommand cmd, boolean result, String details) {
+ super(cmd, result, details);
+ }
+
+ // Constructor for gson.
+ protected DestroyAnswer() {
+ super();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DestroyCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DestroyCommand.java b/core/src/com/cloud/agent/api/storage/DestroyCommand.java
new file mode 100755
index 0000000..6732ea5
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DestroyCommand.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.storage;
+
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.storage.StoragePool;
+import com.cloud.storage.VMTemplateStorageResourceAssoc;
+import com.cloud.storage.Volume;
+
+public class DestroyCommand extends StorageCommand {
+ // in VMware, things are designed around VM instead of volume, we need it the volume VM context if the volume is attached
+ String vmName;
+ VolumeTO volume;
+
+ protected DestroyCommand() {
+ }
+
+ public DestroyCommand(StoragePool pool, Volume volume, String vmName) {
+ this.volume = new VolumeTO(volume, pool);
+ this.vmName = vmName;
+ }
+
+ public DestroyCommand(StoragePool pool, VMTemplateStorageResourceAssoc templatePoolRef) {
+ volume = new VolumeTO(templatePoolRef.getId(), null, pool.getPoolType(), pool.getUuid(),
+ null, pool.getPath(), templatePoolRef.getInstallPath(),
+ templatePoolRef.getTemplateSize(), null);
+ }
+
+ public VolumeTO getVolume() {
+ return volume;
+ }
+
+ public String getVmName() {
+ return vmName;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DownloadAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DownloadAnswer.java b/core/src/com/cloud/agent/api/storage/DownloadAnswer.java
new file mode 100755
index 0000000..bb7b8a9
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DownloadAnswer.java
@@ -0,0 +1,141 @@
+// 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.storage;
+
+import java.io.File;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+import com.cloud.storage.VMTemplateStorageResourceAssoc;
+import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
+
+public class DownloadAnswer extends Answer {
+ private String jobId;
+ private int downloadPct;
+ private String errorString;
+ private VMTemplateStorageResourceAssoc.Status downloadStatus;
+ private String downloadPath;
+ private String installPath;
+ private long templateSize = 0L;
+ private long templatePhySicalSize = 0L;
+ private String checkSum;
+
+ public String getCheckSum() {
+ return checkSum;
+ }
+
+ public int getDownloadPct() {
+ return downloadPct;
+ }
+ public String getErrorString() {
+ return errorString;
+ }
+
+ public String getDownloadStatusString() {
+ return downloadStatus.toString();
+ }
+
+ public VMTemplateStorageResourceAssoc.Status getDownloadStatus() {
+ return downloadStatus;
+ }
+
+ public String getDownloadPath() {
+ return downloadPath;
+ }
+ protected DownloadAnswer() {
+
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public DownloadAnswer(String errorString, Status status) {
+ super();
+ this.downloadPct = 0;
+ this.errorString = errorString;
+ this.downloadStatus = status;
+ this.details = errorString;
+ }
+
+ public DownloadAnswer(String jobId, int downloadPct, String errorString,
+ Status downloadStatus, String fileSystemPath, String installPath, long templateSize, long templatePhySicalSize, String checkSum) {
+ super();
+ this.jobId = jobId;
+ this.downloadPct = downloadPct;
+ this.errorString = errorString;
+ this.details = errorString;
+ this.downloadStatus = downloadStatus;
+ this.downloadPath = fileSystemPath;
+ this.installPath = fixPath(installPath);
+ this.templateSize = templateSize;
+ this.templatePhySicalSize = templatePhySicalSize;
+ this.checkSum = checkSum;
+ }
+
+ public DownloadAnswer(String jobId, int downloadPct, Command command,
+ Status downloadStatus, String fileSystemPath, String installPath) {
+ super(command);
+ this.jobId = jobId;
+ this.downloadPct = downloadPct;
+ this.downloadStatus = downloadStatus;
+ this.downloadPath = fileSystemPath;
+ this.installPath = installPath;
+ }
+
+ private static String fixPath(String path){
+ if (path == null) {
+ return path;
+ }
+ if (path.startsWith(File.separator)) {
+ path=path.substring(File.separator.length());
+ }
+ if (path.endsWith(File.separator)) {
+ path=path.substring(0, path.length()-File.separator.length());
+ }
+ return path;
+ }
+
+ public void setDownloadStatus(VMTemplateStorageResourceAssoc.Status downloadStatus) {
+ this.downloadStatus = downloadStatus;
+ }
+
+ public String getInstallPath() {
+ return installPath;
+ }
+ public void setInstallPath(String installPath) {
+ this.installPath = fixPath(installPath);
+ }
+
+ public void setTemplateSize(long templateSize) {
+ this.templateSize = templateSize;
+ }
+
+ public Long getTemplateSize() {
+ return templateSize;
+ }
+ public void setTemplatePhySicalSize(long templatePhySicalSize) {
+ this.templatePhySicalSize = templatePhySicalSize;
+ }
+ public long getTemplatePhySicalSize() {
+ return templatePhySicalSize;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DownloadCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DownloadCommand.java b/core/src/com/cloud/agent/api/storage/DownloadCommand.java
new file mode 100644
index 0000000..c6ffe45
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DownloadCommand.java
@@ -0,0 +1,219 @@
+// 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.storage;
+
+import java.net.URI;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.Volume;
+import com.cloud.template.VirtualMachineTemplate;
+
+
+public class DownloadCommand extends AbstractDownloadCommand implements InternalIdentity {
+ public static class PasswordAuth {
+ String userName;
+ String password;
+ public PasswordAuth() {
+
+ }
+ public PasswordAuth(String user, String password) {
+ this.userName = user;
+ this.password = password;
+ }
+ public String getUserName() {
+ return userName;
+ }
+ public String getPassword() {
+ return password;
+ }
+ }
+
+ public static enum ResourceType {
+ VOLUME, TEMPLATE
+ }
+
+ public static class Proxy {
+ private String _host;
+ private int _port;
+ private String _userName;
+ private String _password;
+
+ public Proxy() {
+
+ }
+
+ public Proxy(String host, int port, String userName, String password) {
+ this._host = host;
+ this._port = port;
+ this._userName = userName;
+ this._password = password;
+ }
+
+ public Proxy(URI uri) {
+ this._host = uri.getHost();
+ this._port = uri.getPort() == -1 ? 3128 : uri.getPort();
+ String userInfo = uri.getUserInfo();
+ if (userInfo != null) {
+ String[] tokens = userInfo.split(":");
+ if (tokens.length == 1) {
+ this._userName = userInfo;
+ this._password = "";
+ } else if (tokens.length == 2) {
+ this._userName = tokens[0];
+ this._password = tokens[1];
+ }
+ }
+ }
+
+ public String getHost() {
+ return _host;
+ }
+
+ public int getPort() {
+ return _port;
+ }
+
+ public String getUserName() {
+ return _userName;
+ }
+
+ public String getPassword() {
+ return _password;
+ }
+ }
+ private boolean hvm;
+ private String description;
+ private String checksum;
+ private PasswordAuth auth;
+ private Proxy _proxy;
+ private Long maxDownloadSizeInBytes = null;
+ private long id;
+ private ResourceType resourceType = ResourceType.TEMPLATE;
+
+ protected DownloadCommand() {
+ }
+
+
+ public DownloadCommand(DownloadCommand that) {
+ super(that);
+ this.hvm = that.hvm;
+ this.checksum = that.checksum;
+ this.id = that.id;
+ this.description = that.description;
+ this.auth = that.getAuth();
+ this.setSecUrl(that.getSecUrl());
+ this.maxDownloadSizeInBytes = that.getMaxDownloadSizeInBytes();
+ this.resourceType = that.resourceType;
+ }
+
+ public DownloadCommand(String secUrl, VirtualMachineTemplate template, Long maxDownloadSizeInBytes) {
+ super(template.getUniqueName(), template.getUrl(), template.getFormat(), template.getAccountId());
+ this.hvm = template.isRequiresHvm();
+ this.checksum = template.getChecksum();
+ this.id = template.getId();
+ this.description = template.getDisplayText();
+ this.setSecUrl(secUrl);
+ this.maxDownloadSizeInBytes = maxDownloadSizeInBytes;
+ }
+
+ public DownloadCommand(String secUrl, Volume volume, Long maxDownloadSizeInBytes, String checkSum, String url, ImageFormat format) {
+ super(volume.getName(), url, format, volume.getAccountId());
+ //this.hvm = volume.isRequiresHvm();
+ this.checksum = checkSum;
+ this.id = volume.getId();
+ this.setSecUrl(secUrl);
+ this.maxDownloadSizeInBytes = maxDownloadSizeInBytes;
+ this.resourceType = ResourceType.VOLUME;
+ }
+
+ public DownloadCommand(String secUrl, String url, VirtualMachineTemplate template, String user, String passwd, Long maxDownloadSizeInBytes) {
+ super(template.getUniqueName(), url, template.getFormat(), template.getAccountId());
+ this.hvm = template.isRequiresHvm();
+ this.checksum = template.getChecksum();
+ this.id = template.getId();
+ this.description = template.getDisplayText();
+ this.setSecUrl(secUrl);
+ this.maxDownloadSizeInBytes = maxDownloadSizeInBytes;
+ auth = new PasswordAuth(user, passwd);
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setHvm(boolean hvm) {
+ this.hvm = hvm;
+ }
+
+ public boolean isHvm() {
+ return hvm;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getChecksum() {
+ return checksum;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void setChecksum(String checksum) {
+ this.checksum = checksum;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+
+ public PasswordAuth getAuth() {
+ return auth;
+ }
+
+ public void setCreds(String userName, String passwd) {
+ auth = new PasswordAuth(userName, passwd);
+ }
+
+ public Proxy getProxy() {
+ return _proxy;
+ }
+
+ public void setProxy(Proxy proxy) {
+ _proxy = proxy;
+ }
+
+ public Long getMaxDownloadSizeInBytes() {
+ return maxDownloadSizeInBytes;
+ }
+
+
+ public ResourceType getResourceType() {
+ return resourceType;
+ }
+
+
+ public void setResourceType(ResourceType resourceType) {
+ this.resourceType = resourceType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/DownloadProgressCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DownloadProgressCommand.java b/core/src/com/cloud/agent/api/storage/DownloadProgressCommand.java
new file mode 100644
index 0000000..835847b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/DownloadProgressCommand.java
@@ -0,0 +1,48 @@
+// 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.storage;
+
+
+
+public class DownloadProgressCommand extends DownloadCommand {
+ public static enum RequestType {GET_STATUS, ABORT, RESTART, PURGE, GET_OR_RESTART}
+ private String jobId;
+ private RequestType request;
+
+ protected DownloadProgressCommand() {
+ super();
+ }
+
+ public DownloadProgressCommand(DownloadCommand cmd, String jobId, RequestType req) {
+ super(cmd);
+
+ this.jobId = jobId;
+ this.setRequest(req);
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setRequest(RequestType request) {
+ this.request = request;
+ }
+
+ public RequestType getRequest() {
+ return request;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ListTemplateAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ListTemplateAnswer.java b/core/src/com/cloud/agent/api/storage/ListTemplateAnswer.java
new file mode 100644
index 0000000..a4e2e25
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ListTemplateAnswer.java
@@ -0,0 +1,53 @@
+// 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.storage;
+
+import java.util.Map;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.storage.template.TemplateInfo;
+
+public class ListTemplateAnswer extends Answer {
+ private String secUrl;
+ private Map<String, TemplateInfo> templateInfos;
+
+ public ListTemplateAnswer() {
+
+ }
+
+ public ListTemplateAnswer(String secUrl, Map<String, TemplateInfo> templateInfos) {
+ super(null, true, "success");
+ this.setSecUrl(secUrl);
+ this.templateInfos = templateInfos;
+ }
+
+ public Map<String, TemplateInfo> getTemplateInfo() {
+ return templateInfos;
+ }
+
+ public void setTemplateInfo(Map<String, TemplateInfo> templateInfos) {
+ this.templateInfos = templateInfos;
+ }
+
+ public void setSecUrl(String secUrl) {
+ this.secUrl = secUrl;
+ }
+
+ public String getSecUrl() {
+ return secUrl;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ListTemplateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ListTemplateCommand.java b/core/src/com/cloud/agent/api/storage/ListTemplateCommand.java
new file mode 100644
index 0000000..da25ed5
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ListTemplateCommand.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.storage;
+
+import com.cloud.agent.api.LogLevel;
+import com.cloud.agent.api.LogLevel.Log4jLevel;
+import com.cloud.agent.api.to.SwiftTO;
+
+public class ListTemplateCommand extends StorageCommand {
+ private String secUrl;
+ @LogLevel(Log4jLevel.Off)
+ private SwiftTO swift;
+
+ public ListTemplateCommand() {
+ }
+
+ public ListTemplateCommand(String secUrl) {
+ this.secUrl = secUrl;
+ this.swift = null;
+ }
+
+ public ListTemplateCommand(SwiftTO swift) {
+ this.secUrl = null;
+ this.swift = swift;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public String getSecUrl() {
+ return secUrl;
+ }
+
+ public SwiftTO getSwift() {
+ return swift;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ListVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ListVolumeAnswer.java b/core/src/com/cloud/agent/api/storage/ListVolumeAnswer.java
new file mode 100755
index 0000000..6bbb2e8
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ListVolumeAnswer.java
@@ -0,0 +1,53 @@
+// 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.storage;
+
+import java.util.Map;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.storage.template.TemplateInfo;
+
+public class ListVolumeAnswer extends Answer {
+ private String secUrl;
+ private Map<Long, TemplateInfo> templateInfos;
+
+ public ListVolumeAnswer() {
+
+ }
+
+ public ListVolumeAnswer(String secUrl, Map<Long, TemplateInfo> templateInfos) {
+ super(null, true, "success");
+ this.setSecUrl(secUrl);
+ this.templateInfos = templateInfos;
+ }
+
+ public Map<Long, TemplateInfo> getTemplateInfo() {
+ return templateInfos;
+ }
+
+ public void setTemplateInfo(Map<Long, TemplateInfo> templateInfos) {
+ this.templateInfos = templateInfos;
+ }
+
+ public void setSecUrl(String secUrl) {
+ this.secUrl = secUrl;
+ }
+
+ public String getSecUrl() {
+ return secUrl;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ListVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ListVolumeCommand.java b/core/src/com/cloud/agent/api/storage/ListVolumeCommand.java
new file mode 100755
index 0000000..63c5b62
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ListVolumeCommand.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.storage;
+
+
+public class ListVolumeCommand extends StorageCommand {
+
+ private String secUrl;
+
+ public ListVolumeCommand() {
+ }
+
+ public ListVolumeCommand(String secUrl) {
+ this.secUrl = secUrl;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public String getSecUrl() {
+ return secUrl;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java b/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java
new file mode 100644
index 0000000..edd2830
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java
@@ -0,0 +1,31 @@
+// 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.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public class ManageVolumeAvailabilityAnswer extends Answer {
+
+ protected ManageVolumeAvailabilityAnswer() {
+ }
+
+ public ManageVolumeAvailabilityAnswer(Command command, boolean success, String details) {
+ super(command, success, details);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java b/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java
new file mode 100644
index 0000000..1a7d480
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.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.storage;
+
+import com.cloud.agent.api.Command;
+
+public class ManageVolumeAvailabilityCommand extends Command {
+
+ boolean attach;
+ String primaryStorageSRUuid;
+ String volumeUuid;
+
+
+ public ManageVolumeAvailabilityCommand() {
+ }
+
+ public ManageVolumeAvailabilityCommand(boolean attach, String primaryStorageSRUuid, String volumeUuid) {
+ this.attach = attach;
+ this.primaryStorageSRUuid = primaryStorageSRUuid;
+ this.volumeUuid = volumeUuid;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+ public boolean getAttach() {
+ return attach;
+ }
+
+ public String getPrimaryStorageSRUuid() {
+ return primaryStorageSRUuid;
+ }
+
+ public String getVolumeUuid() {
+ return volumeUuid;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java b/core/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.java
new file mode 100644
index 0000000..d5efa95
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/MigrateVolumeAnswer.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.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public class MigrateVolumeAnswer extends Answer {
+ private String volumePath;
+
+ public MigrateVolumeAnswer(Command command, boolean success, String details, String volumePath) {
+ super(command, success, details);
+ this.volumePath = volumePath;
+ }
+
+ public MigrateVolumeAnswer(Command command) {
+ super(command);
+ this.volumePath = null;
+ }
+
+ public String getVolumePath() {
+ return volumePath;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java b/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java
new file mode 100644
index 0000000..b82d848
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java
@@ -0,0 +1,51 @@
+// 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.storage;
+
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.StoragePool;
+
+public class MigrateVolumeCommand extends Command {
+
+ long volumeId;
+ String volumePath;
+ StorageFilerTO pool;
+
+ public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool) {
+ this.volumeId = volumeId;
+ this.volumePath = volumePath;
+ this.pool = new StorageFilerTO(pool);
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public String getVolumePath() {
+ return volumePath;
+ }
+
+ public long getVolumeId() {
+ return volumeId;
+ }
+
+ public StorageFilerTO getPool() {
+ return pool;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java b/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java
new file mode 100644
index 0000000..a5a6c49
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.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.storage;
+
+import com.cloud.agent.api.Answer;
+
+public class PrimaryStorageDownloadAnswer extends Answer {
+ private String installPath;
+ private long templateSize = 0L;
+
+ protected PrimaryStorageDownloadAnswer() {
+ }
+
+ public PrimaryStorageDownloadAnswer(String detail) {
+ super(null, false, detail);
+ }
+
+ public PrimaryStorageDownloadAnswer(String installPath, long templateSize ) {
+ super(null);
+ this.installPath = installPath;
+ this.templateSize = templateSize;
+ }
+
+ public String getInstallPath() {
+ return installPath;
+ }
+
+ public void setInstallPath(String installPath) {
+ this.installPath = installPath;
+ }
+
+ public void setTemplateSize(long templateSize) {
+ this.templateSize = templateSize;
+ }
+
+ public Long getTemplateSize() {
+ return templateSize;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java b/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java
new file mode 100644
index 0000000..8d955bb
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java
@@ -0,0 +1,87 @@
+// 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.storage;
+
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.StoragePool;
+
+/**
+ *
+ */
+public class PrimaryStorageDownloadCommand extends AbstractDownloadCommand {
+ String localPath;
+ String poolUuid;
+ long poolId;
+
+ StorageFilerTO primaryPool;
+
+ String secondaryStorageUrl;
+ String primaryStorageUrl;
+
+ protected PrimaryStorageDownloadCommand() {
+ }
+
+ public PrimaryStorageDownloadCommand(String name, String url, ImageFormat format, long accountId, StoragePool pool, int wait) {
+ super(name, url, format, accountId);
+ this.poolId = pool.getId();
+ this.poolUuid = pool.getUuid();
+ this.primaryPool = new StorageFilerTO(pool);
+ setWait(wait);
+ }
+
+ public String getPoolUuid() {
+ return poolUuid;
+ }
+
+ public long getPoolId() {
+ return poolId;
+ }
+
+ public StorageFilerTO getPool() {
+ return primaryPool;
+ }
+
+ public void setLocalPath(String path) {
+ this.localPath = path;
+ }
+
+ public String getLocalPath() {
+ return localPath;
+ }
+
+ public void setSecondaryStorageUrl(String url) {
+ secondaryStorageUrl = url;
+ }
+
+ public String getSecondaryStorageUrl() {
+ return secondaryStorageUrl;
+ }
+
+ public void setPrimaryStorageUrl(String url) {
+ primaryStorageUrl = url;
+ }
+
+ public String getPrimaryStorageUrl() {
+ return primaryStorageUrl;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java b/core/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java
new file mode 100644
index 0000000..3434b98
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.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.storage;
+
+import com.cloud.agent.api.Answer;
+
+public class ResizeVolumeAnswer extends Answer {
+ private long newSize;
+
+ protected ResizeVolumeAnswer() {
+
+ }
+
+ public ResizeVolumeAnswer(ResizeVolumeCommand cmd, boolean result, String details, long newSize) {
+ super(cmd, result, details);
+ this.newSize = newSize;
+ }
+
+ public ResizeVolumeAnswer(ResizeVolumeCommand cmd, boolean result, String details) {
+ super(cmd, result, details);
+ }
+
+ public long getNewSize() {
+ return newSize;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java b/core/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
new file mode 100644
index 0000000..82d3ae7
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
@@ -0,0 +1,85 @@
+// 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.storage;
+
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.to.StorageFilerTO;
+
+public class ResizeVolumeCommand extends Command {
+ private String path;
+ private StorageFilerTO pool;
+ private String vmInstance;
+ private Long newSize;
+ private Long currentSize;
+ private boolean shrinkOk;
+
+ protected ResizeVolumeCommand() {
+
+ }
+
+ public ResizeVolumeCommand(String path,
+ StorageFilerTO pool,
+ Long currentSize,
+ Long newSize,
+ boolean shrinkOk,
+ String vmInstance)
+ {
+ this.path = path;
+ this.pool = pool;
+ this.vmInstance = vmInstance;
+ this.currentSize = currentSize;
+ this.newSize = newSize;
+ this.shrinkOk = shrinkOk;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getPoolUuid() {
+ return pool.getUuid();
+ }
+
+ public StorageFilerTO getPool() {
+ return pool;
+ }
+
+ public long getNewSize() {
+ return newSize;
+ }
+
+ public long getCurrentSize() {
+ return currentSize;
+ }
+
+ public boolean getShrinkOk() {
+ return shrinkOk;
+ }
+
+ public String getInstanceName() {
+ return vmInstance;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/StorageCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/StorageCommand.java b/core/src/com/cloud/agent/api/storage/StorageCommand.java
new file mode 100644
index 0000000..270143b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/StorageCommand.java
@@ -0,0 +1,26 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api.storage;
+
+import com.cloud.agent.api.Command;
+
+public abstract class StorageCommand extends Command {
+ protected StorageCommand() {
+ super();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java b/core/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java
new file mode 100644
index 0000000..9660136
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java
@@ -0,0 +1,29 @@
+// 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.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public class UpgradeDiskAnswer extends Answer {
+
+ public UpgradeDiskAnswer() {}
+
+ public UpgradeDiskAnswer(Command 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/storage/UpgradeDiskCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java b/core/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java
new file mode 100644
index 0000000..f8363e1
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java
@@ -0,0 +1,50 @@
+// 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.storage;
+
+
+public class UpgradeDiskCommand extends StorageCommand {
+
+ private String _imagePath;
+ private String _newSize;
+
+ public UpgradeDiskCommand() {}
+
+ public UpgradeDiskCommand(String imagePath, String newSize) {
+ _imagePath = imagePath;
+ _newSize = newSize;
+ }
+
+ public String getImagePath() {
+ return _imagePath;
+ }
+ public void setImagePath(String imagePath) {
+ _imagePath = imagePath;
+ }
+
+ public String getNewSize() {
+ return _newSize;
+ }
+ public void setNewSize(String newSize) {
+ _newSize = newSize;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/UploadAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/UploadAnswer.java b/core/src/com/cloud/agent/api/storage/UploadAnswer.java
new file mode 100755
index 0000000..f2d9788
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/UploadAnswer.java
@@ -0,0 +1,123 @@
+// 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.storage;
+
+import java.io.File;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+import com.cloud.storage.Upload;
+
+public class UploadAnswer extends Answer {
+
+
+ private String jobId;
+ private int uploadPct;
+ private String errorString;
+ private Upload.Status uploadStatus;
+ private String uploadPath;
+ private String installPath;
+ public Long templateSize = 0L;
+
+ public int getUploadPct() {
+ return uploadPct;
+ }
+ public String getErrorString() {
+ return errorString;
+ }
+
+ public String getUploadStatusString() {
+ return uploadStatus.toString();
+ }
+
+ public Upload.Status getUploadStatus() {
+ return uploadStatus;
+ }
+
+ public String getUploadPath() {
+ return uploadPath;
+ }
+ protected UploadAnswer() {
+
+ }
+
+ public void setErrorString(String errorString) {
+ this.errorString = errorString;
+ }
+ public String getJobId() {
+ return jobId;
+ }
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public UploadAnswer(String jobId, int uploadPct, String errorString,
+ Upload.Status uploadStatus, String fileSystemPath, String installPath, long templateSize) {
+ super();
+ this.jobId = jobId;
+ this.uploadPct = uploadPct;
+ this.errorString = errorString;
+ this.details = errorString;
+ this.uploadStatus = uploadStatus;
+ this.uploadPath = fileSystemPath;
+ this.installPath = fixPath(installPath);
+ this.templateSize = templateSize;
+ }
+
+ public UploadAnswer(String jobId, int uploadPct, Command command,
+ Upload.Status uploadStatus, String fileSystemPath, String installPath) {
+ super(command);
+ this.jobId = jobId;
+ this.uploadPct = uploadPct;
+ this.uploadStatus = uploadStatus;
+ this.uploadPath = fileSystemPath;
+ this.installPath = installPath;
+ }
+
+ private static String fixPath(String path){
+ if (path == null) {
+ return path;
+ }
+ if (path.startsWith(File.separator)) {
+ path=path.substring(File.separator.length());
+ }
+ if (path.endsWith(File.separator)) {
+ path=path.substring(0, path.length()-File.separator.length());
+ }
+ return path;
+ }
+
+ public void setUploadStatus(Upload.Status uploadStatus) {
+ this.uploadStatus = uploadStatus;
+ }
+
+ public String getInstallPath() {
+ return installPath;
+ }
+ public void setInstallPath(String installPath) {
+ this.installPath = fixPath(installPath);
+ }
+
+ public void setTemplateSize(long templateSize) {
+ this.templateSize = templateSize;
+ }
+
+ public Long getTemplateSize() {
+ return templateSize;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/UploadCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/UploadCommand.java b/core/src/com/cloud/agent/api/storage/UploadCommand.java
new file mode 100644
index 0000000..473bd5b
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/UploadCommand.java
@@ -0,0 +1,145 @@
+// 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.storage;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import com.cloud.agent.api.storage.DownloadCommand.PasswordAuth;
+import com.cloud.agent.api.to.TemplateTO;
+import com.cloud.storage.Upload.Type;
+import com.cloud.template.VirtualMachineTemplate;
+
+
+public class UploadCommand extends AbstractUploadCommand implements InternalIdentity {
+
+ private TemplateTO template;
+ private String url;
+ private String installPath;
+ private boolean hvm;
+ private String description;
+ private String checksum;
+ private PasswordAuth auth;
+ private long templateSizeInBytes;
+ private long id;
+ private Type type;
+
+ public UploadCommand(VirtualMachineTemplate template, String url, String installPath, long sizeInBytes) {
+
+ this.template = new TemplateTO(template);
+ this.url = url;
+ this.installPath = installPath;
+ this.checksum = template.getChecksum();
+ this.id = template.getId();
+ this.templateSizeInBytes = sizeInBytes;
+
+ }
+
+ public UploadCommand(String url, long id, long sizeInBytes, String installPath, Type type){
+ this.template = null;
+ this.url = url;
+ this.installPath = installPath;
+ this.id = id;
+ this.type = type;
+ this.templateSizeInBytes = sizeInBytes;
+ }
+
+ protected UploadCommand() {
+ }
+
+ public UploadCommand(UploadCommand that) {
+ this.template = that.template;
+ this.url = that.url;
+ this.installPath = that.installPath;
+ this.checksum = that.getChecksum();
+ this.id = that.id;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+
+ public TemplateTO getTemplate() {
+ return template;
+ }
+
+ public void setTemplate(TemplateTO template) {
+ this.template = template;
+ }
+
+ @Override
+ public String getUrl() {
+ return url;
+ }
+
+ @Override
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public boolean isHvm() {
+ return hvm;
+ }
+
+ public void setHvm(boolean hvm) {
+ this.hvm = hvm;
+ }
+
+ public PasswordAuth getAuth() {
+ return auth;
+ }
+
+ public void setAuth(PasswordAuth auth) {
+ this.auth = auth;
+ }
+
+ public Long getTemplateSizeInBytes() {
+ return templateSizeInBytes;
+ }
+
+ public void setTemplateSizeInBytes(Long templateSizeInBytes) {
+ this.templateSizeInBytes = templateSizeInBytes;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public void setInstallPath(String installPath) {
+ this.installPath = installPath;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void setChecksum(String checksum) {
+ this.checksum = checksum;
+ }
+
+ public String getInstallPath() {
+ return installPath;
+ }
+
+ public String getChecksum() {
+ return checksum;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/UploadProgressCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/UploadProgressCommand.java b/core/src/com/cloud/agent/api/storage/UploadProgressCommand.java
new file mode 100644
index 0000000..7f6d584
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/UploadProgressCommand.java
@@ -0,0 +1,48 @@
+// 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.storage;
+
+public class UploadProgressCommand extends UploadCommand {
+
+ public static enum RequestType {GET_STATUS, ABORT, RESTART, PURGE, GET_OR_RESTART}
+ private String jobId;
+ private RequestType request;
+
+ protected UploadProgressCommand() {
+ super();
+ }
+
+ public UploadProgressCommand(UploadCommand cmd, String jobId, RequestType req) {
+ super(cmd);
+
+ this.jobId = jobId;
+ this.setRequest(req);
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setRequest(RequestType request) {
+ this.request = request;
+ }
+
+ public RequestType getRequest() {
+ return request;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/api/storage/ssCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/ssCommand.java b/core/src/com/cloud/agent/api/storage/ssCommand.java
new file mode 100644
index 0000000..c218a8d
--- /dev/null
+++ b/core/src/com/cloud/agent/api/storage/ssCommand.java
@@ -0,0 +1,48 @@
+// 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.storage;
+
+import com.cloud.agent.api.Command;
+
+public abstract class ssCommand extends Command {
+ private String secUrl;
+
+
+ public ssCommand() {
+ }
+
+ protected ssCommand(ssCommand that) {
+ this.secUrl = that.secUrl;
+ }
+ public ssCommand(String secUrl) {
+ this.secUrl = secUrl;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ public String getSecUrl() {
+ return secUrl;
+ }
+
+ public void setSecUrl(String secUrl) {
+ this.secUrl = secUrl;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
index 7148e07..b9bda4d 100755
--- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
@@ -863,13 +863,16 @@ public class VirtualRoutingResource implements Manager {
}
public void assignVpcIpToRouter(final String routerIP, final boolean add, final String pubIP,
- final String nicname, final String gateway, final String netmask, final String subnet) throws InternalErrorException {
+ final String nicname, final String gateway, final String netmask, final String subnet, boolean sourceNat) throws InternalErrorException {
String args = "";
+ String snatArgs = "";
if (add) {
args += " -A ";
+ snatArgs += " -A ";
} else {
args += " -D ";
+ snatArgs += " -D ";
}
args += " -l ";
@@ -887,6 +890,16 @@ public class VirtualRoutingResource implements Manager {
if (result != null) {
throw new InternalErrorException("KVM plugin \"vpc_ipassoc\" failed:"+result);
}
+ if (sourceNat) {
+ snatArgs += " -l " + pubIP;
+ snatArgs += " -c " + nicname;
+
+ result = routerProxy("vpc_privateGateway.sh", routerIP, snatArgs);
+ if (result != null) {
+ throw new InternalErrorException("KVM plugin \"vpc_privateGateway\" failed:"+result);
+ }
+
+ }
}
private SetStaticRouteAnswer execute(SetStaticRouteCommand cmd) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/alert/AlertAdapter.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/alert/AlertAdapter.java b/core/src/com/cloud/alert/AlertAdapter.java
deleted file mode 100644
index c04776a..0000000
--- a/core/src/com/cloud/alert/AlertAdapter.java
+++ /dev/null
@@ -1,22 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.alert;
-
-import com.cloud.utils.component.Adapter;
-
-public interface AlertAdapter extends Adapter {
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c11dbad9/core/src/com/cloud/alert/AlertManager.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/alert/AlertManager.java b/core/src/com/cloud/alert/AlertManager.java
deleted file mode 100755
index b6d005a..0000000
--- a/core/src/com/cloud/alert/AlertManager.java
+++ /dev/null
@@ -1,58 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.alert;
-
-import com.cloud.capacity.CapacityVO;
-import com.cloud.utils.component.Manager;
-
-public interface AlertManager extends Manager {
- public static final short ALERT_TYPE_MEMORY = CapacityVO.CAPACITY_TYPE_MEMORY;
- public static final short ALERT_TYPE_CPU = CapacityVO.CAPACITY_TYPE_CPU;
- public static final short ALERT_TYPE_STORAGE = CapacityVO.CAPACITY_TYPE_STORAGE;
- public static final short ALERT_TYPE_STORAGE_ALLOCATED = CapacityVO.CAPACITY_TYPE_STORAGE_ALLOCATED;
- public static final short ALERT_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = CapacityVO.CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP;
- public static final short ALERT_TYPE_PRIVATE_IP = CapacityVO.CAPACITY_TYPE_PRIVATE_IP;
- public static final short ALERT_TYPE_SECONDARY_STORAGE = CapacityVO.CAPACITY_TYPE_SECONDARY_STORAGE;
- public static final short ALERT_TYPE_HOST = 7;
- public static final short ALERT_TYPE_USERVM = 8;
- public static final short ALERT_TYPE_DOMAIN_ROUTER = 9;
- public static final short ALERT_TYPE_CONSOLE_PROXY = 10;
- public static final short ALERT_TYPE_ROUTING = 11; // lost connection to default route (to the gateway)
- public static final short ALERT_TYPE_STORAGE_MISC = 12; // lost connection to default route (to the gateway)
- public static final short ALERT_TYPE_USAGE_SERVER = 13; // lost connection to default route (to the gateway)
- public static final short ALERT_TYPE_MANAGMENT_NODE = 14; // lost connection to default route (to the gateway)
- public static final short ALERT_TYPE_DOMAIN_ROUTER_MIGRATE = 15;
- public static final short ALERT_TYPE_CONSOLE_PROXY_MIGRATE = 16;
- public static final short ALERT_TYPE_USERVM_MIGRATE = 17;
- public static final short ALERT_TYPE_VLAN = 18;
- public static final short ALERT_TYPE_SSVM = 19;
- public static final short ALERT_TYPE_USAGE_SERVER_RESULT = 20; // Usage job result
- public static final short ALERT_TYPE_STORAGE_DELETE = 21;
- public static final short ALERT_TYPE_UPDATE_RESOURCE_COUNT = 22; // Generated when we fail to update the resource
- // count
- public static final short ALERT_TYPE_USAGE_SANITY_RESULT = 23;
- public static final short ALERT_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 24;
- public static final short ALERT_TYPE_LOCAL_STORAGE = 25;
- public static final short ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED = 26; // Generated when the resource limit exceeds the limit. Currently used for recurring snapshots only
-
-
- void clearAlert(short alertType, long dataCenterId, long podId);
-
- void sendAlert(short alertType, long dataCenterId, Long podId, String subject, String body);
-
- void recalculateCapacity();
-}