You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2012/11/27 03:46:26 UTC
[1/2] git commit: remove unused code
Updated Branches:
refs/heads/javelin 5724f1ca9 -> 487a0ac43
remove unused code
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/487a0ac4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/487a0ac4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/487a0ac4
Branch: refs/heads/javelin
Commit: 487a0ac43d4a0f3975e930fb539815fae9481cf3
Parents: 5724f1c
Author: Edison Su <su...@gmail.com>
Authored: Mon Nov 26 18:45:49 2012 -0800
Committer: Edison Su <su...@gmail.com>
Committed: Mon Nov 26 18:45:49 2012 -0800
----------------------------------------------------------------------
.../subsystem/api/storage/BackupStrategy.java | 5 -
.../engine/subsystem/api/storage/DataObject.java | 42 --
.../DataObjectBackupStorageOperationState.java | 58 ---
.../engine/subsystem/api/storage/DataStore.java | 76 ---
.../api/storage/DataStoreConfigurator.java | 16 -
.../subsystem/api/storage/DataStoreDriver.java | 35 --
.../subsystem/api/storage/DataStoreEndPoint.java | 26 -
.../api/storage/DataStoreEndPointSelector.java | 7 -
.../api/storage/DataStoreExtendedAttribute.java | 5 -
.../engine/subsystem/api/storage/FileSystem.java | 32 --
.../engine/subsystem/api/storage/Snapshot.java | 23 -
.../subsystem/api/storage/SnapshotStrategy.java | 5 -
.../subsystem/api/storage/StorageProvider.java | 20 -
.../subsystem/api/storage/TemplateStrategy.java | 13 -
.../subsystem/api/storage/VolumeStrategy.java | 16 -
.../storage/StorageOrchestratorImpl.java | 372 ---------------
.../cloudstack/storage/StorageProviderManager.java | 14 -
.../storage/StorageProviderManagerImpl.java | 54 ---
.../apache/cloudstack/storage/VolumeBackupRef.java | 66 ---
.../storage/datastore/DefaultDataStore.java | 228 ---------
.../DefaultPrimaryDatastoreProviderImpl.java | 2 -
.../storage/driver/AbstractStorageDriver.java | 73 ---
.../storage/driver/DefaultNfsSecondaryDriver.java | 90 ----
.../storage/driver/XenServerStorageDriver.java | 81 ----
.../cloudstack/storage/image/ImageManager.java | 32 --
.../cloudstack/storage/image/ImageManagerImpl.java | 165 -------
.../storage/image/ImageOrchestratorImpl.java | 78 ---
.../lifecycle/DefaultNfsSecondaryLifeCycle.java | 56 ---
.../DefaultPrimaryDataStoreLifeCycle.java | 123 -----
.../storage/manager/BackupStorageManager.java | 43 --
.../storage/manager/BackupStorageManagerImpl.java | 66 ---
.../storage/manager/PrimaryDataStoreManager.java | 43 --
.../manager/PrimaryDataStoreManagerImpl.java | 142 ------
.../storage/manager/SecondaryStorageManager.java | 37 --
.../manager/SecondaryStorageManagerImpl.java | 55 ---
.../DefaultNfsSecondaryStorageProvider.java | 130 -----
.../provider/DefaultPrimaryStorageProvider.java | 141 ------
.../storage/provider/HttpImageStoreProvider.java | 91 ----
.../provider/S3SecondaryStorageProvider.java | 91 ----
.../provider/SwiftSecondaryStorageProvider.java | 91 ----
.../storage/snapshot/SnapshotService.java | 25 -
.../storage/strategy/DefaultTemplateStratey.java | 191 --------
.../storage/strategy/DefaultVolumeStrategy.java | 95 ----
.../storage/strategy/XenBackupStrategy.java | 12 -
.../storage/strategy/XenSnapshotStrategy.java | 12 -
.../cloudstack/storage/test/AopTestAdvice.java | 2 -
.../storage/test/ChildTestConfiguration.java | 2 +-
.../storage/test/DirectAgentManagerImpl.java | 193 ++++++++
.../apache/cloudstack/storage/test/SimpleTest.java | 41 ++
49 files changed, 235 insertions(+), 3081 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/BackupStrategy.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/BackupStrategy.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/BackupStrategy.java
deleted file mode 100644
index d93a509..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/BackupStrategy.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.cloudstack.engine.subsystem.api.storage;
-
-public interface BackupStrategy {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObject.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObject.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObject.java
deleted file mode 100644
index 70aca35..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObject.java
+++ /dev/null
@@ -1,42 +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 org.apache.cloudstack.engine.subsystem.api.storage;
-
-import java.util.List;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore.DataStoreRef;
-
-/*
- * Logic entity
- */
-public interface DataObject {
- String getURI();
- String getUUID();
- DataStoreRef getStoreRef();
- long getSize();
- //volume/snapshot/template
- String getType();
- //db id
- Long getId();
- DataObject getParent();
- void setParent(DataObject obj);
- List<DataObject> getChidren();
- boolean lock();
- boolean unlock();
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObjectBackupStorageOperationState.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObjectBackupStorageOperationState.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObjectBackupStorageOperationState.java
deleted file mode 100644
index 974a400..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObjectBackupStorageOperationState.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 org.apache.cloudstack.engine.subsystem.api.storage;
-
-import com.cloud.utils.fsm.StateMachine;
-
-public enum DataObjectBackupStorageOperationState {
- Copying,
- Deleting,
- Ready,
- NonOperational;
-
- public enum Event {
- Initial("Init state machine"),
- CopyingRequested("Copy operation is requested"),
- DeleteRequested("Delete operation is requested"),
- OperationSuccess("Operation successed"),
- OperationFailed("Operation failed");
-
- private final String _msg;
-
- private Event(String msg) {
- _msg = msg;
- }
- }
-
- public DataObjectBackupStorageOperationState getNextState(Event a) {
- return s_fsm.getNextState(this, a);
- }
-
- protected static final StateMachine<DataObjectBackupStorageOperationState, Event> s_fsm = new StateMachine<DataObjectBackupStorageOperationState, Event>();
- static {
- s_fsm.addTransition(null, Event.Initial, DataObjectBackupStorageOperationState.Ready);
- s_fsm.addTransition(DataObjectBackupStorageOperationState.Ready, Event.CopyingRequested, DataObjectBackupStorageOperationState.Copying);
- s_fsm.addTransition(DataObjectBackupStorageOperationState.Copying, Event.CopyingRequested, DataObjectBackupStorageOperationState.Copying);
- s_fsm.addTransition(DataObjectBackupStorageOperationState.Copying, Event.OperationFailed, DataObjectBackupStorageOperationState.Ready);
- s_fsm.addTransition(DataObjectBackupStorageOperationState.Copying, Event.OperationSuccess, DataObjectBackupStorageOperationState.Ready);
- s_fsm.addTransition(DataObjectBackupStorageOperationState.Ready, Event.DeleteRequested, DataObjectBackupStorageOperationState.Deleting);
- s_fsm.addTransition(DataObjectBackupStorageOperationState.Deleting, Event.OperationFailed, DataObjectBackupStorageOperationState.Ready);
- s_fsm.addTransition(DataObjectBackupStorageOperationState.Deleting, Event.OperationSuccess, DataObjectBackupStorageOperationState.NonOperational);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStore.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStore.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStore.java
deleted file mode 100644
index 0658049..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStore.java
+++ /dev/null
@@ -1,76 +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 org.apache.cloudstack.engine.subsystem.api.storage;
-
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.storage.Snapshot;
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.storage.Volume;
-import com.cloud.template.VirtualMachineTemplate;
-
-public interface DataStore {
- public class DataStoreRef {
-
- }
-
- public class DataStoreDriverRef {
-
- }
-
- public enum StoreType {
- Primary,
- Image,
- Backup;
- }
- public class StoreScope {
- public long zoneId;
- private long clusterId;
- private long hostId;
- }
-
- String getURI();
- String getUUID();
- long getCluterId();
- long getPodId();
- long getZoneId();
- String getPath();
- StoreType getType();
- StoragePoolType getPoolType();
- StoreScope getScope();
- boolean isSharedStorage();
- Long getId();
- DataStoreDriver getDataStoreDriver();
- StorageProvider getProvider();
- DataStoreEndPointSelector getEndPointSelector();
- FileSystem getFileSystem();
- VolumeStrategy getVolumeStrategy();
- SnapshotStrategy getSnapshotStrategy();
- BackupStrategy getBackupStrategy();
- TemplateStrategy getTemplateStrategy();
- DataStoreLifeCycle getLifeCycle();
-
- VolumeProfile prepareVolume(Volume volume, DataStore destStore);
- SnapshotProfile prepareSnapshot(Snapshot snapshot, DataStore destStore);
- TemplateProfile prepareTemplate(long templateId, DataStore destStore);
- boolean contains(Volume volume);
- boolean contains(Snapshot snapshot);
- boolean contains(TemplateProfile template);
- TemplateProfile get(TemplateProfile template);
- StorageFilerTO getTO();
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreConfigurator.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreConfigurator.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreConfigurator.java
deleted file mode 100644
index d9fb86b..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreConfigurator.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.apache.cloudstack.engine.subsystem.api.storage;
-
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-import com.cloud.storage.StoragePool;
-
-public interface DataStoreConfigurator {
- String getProtocol();
- StoragePool getStoragePool(Map<String, String> configs);
- List<String> getConfigNames();
- Map<String, String> getConfigs(URI uri, Map<String, String> extras);
- boolean validate(Map<String, String> configs);
- DataStore getDataStore(StoragePool pool);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java
deleted file mode 100644
index 0167f48..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java
+++ /dev/null
@@ -1,35 +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 org.apache.cloudstack.engine.subsystem.api.storage;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-public interface DataStoreDriver {
- String getDriverType();
- TemplateProfile install(TemplateProfile tp, DataStoreEndPoint ep);
- TemplateProfile register(TemplateProfile tp, DataStoreEndPoint ep);
- DataObject create(DataObject obj);
- DataObject copy(DataObject src, DataStore dest);
- DataObject copy(DataObject src, DataObject dest);
- DataObject move(DataObject src, DataObject dest);
- VolumeProfile createVolumeFromTemplate(VolumeProfile vol, TemplateProfile tp, DataStoreEndPoint dp);
- Answer sendMessage(DataStoreEndPoint dsep, Command cmd);
- boolean delete(DataObject obj);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreEndPoint.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreEndPoint.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreEndPoint.java
deleted file mode 100644
index 3bdbbb5..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreEndPoint.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.apache.cloudstack.engine.subsystem.api.storage;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-public class DataStoreEndPoint {
- protected long hostId;
- protected String privIp;
-
- public DataStoreEndPoint(long host, String ip) {
- hostId = host;
- privIp = ip;
- }
-
- public long getHostId() {
- return hostId;
- }
-
- public String getPrivateIp() {
- return privIp;
- }
-
- public Answer sendCommand(Command cmd) {
- return new Answer(cmd);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreEndPointSelector.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreEndPointSelector.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreEndPointSelector.java
deleted file mode 100644
index 3328a3a..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreEndPointSelector.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.apache.cloudstack.engine.subsystem.api.storage;
-
-import java.util.List;
-
-public interface DataStoreEndPointSelector {
- List<DataStoreEndPoint> getEndPoints(StorageEvent event);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreExtendedAttribute.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreExtendedAttribute.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreExtendedAttribute.java
deleted file mode 100644
index 9f6df82..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreExtendedAttribute.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.cloudstack.engine.subsystem.api.storage;
-
-public interface DataStoreExtendedAttribute {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/FileSystem.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/FileSystem.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/FileSystem.java
deleted file mode 100644
index 734fc59..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/FileSystem.java
+++ /dev/null
@@ -1,32 +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 org.apache.cloudstack.engine.subsystem.api.storage;
-
-public interface FileSystem {
- DataObject create(DataObject obj);
- DataObject copy(DataObject Obj, DataStore destStore);
- DataObject copy(DataObject obj, DataObject destObj);
- DataObject move(DataObject srcObj, DataObject destObj);
- boolean delete(DataObject obj);
- long getStats(DataObject obj);
- String getFileType();
- boolean isWritable(DataObject obj);
- boolean contains(DataObject obj);
- DataObject ioctl(DataObject obj, Object... objects);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/Snapshot.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/Snapshot.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/Snapshot.java
deleted file mode 100644
index f8d4b59..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/Snapshot.java
+++ /dev/null
@@ -1,23 +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 org.apache.cloudstack.engine.subsystem.api.storage;
-
-public interface Snapshot extends DataObject {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java
deleted file mode 100644
index 91bebee..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.cloudstack.engine.subsystem.api.storage;
-
-public interface SnapshotStrategy {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StorageProvider.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StorageProvider.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StorageProvider.java
deleted file mode 100644
index 9d41093..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StorageProvider.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.apache.cloudstack.engine.subsystem.api.storage;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore.StoreType;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.storage.StoragePool;
-import com.cloud.utils.component.Adapter;
-
-public interface StorageProvider extends Adapter {
- List<HypervisorType> supportedHypervisors();
- String getProviderName();
- List<StoreType> supportedStoreTypes();
- void configure(Map<String, String> storeProviderInfo);
- DataStore addDataStore(StoragePool sp, String uri, Map<String, String> params);
- DataStore getDataStore(StoragePool pool);
- Map<HypervisorType, Map<String,DataStoreConfigurator>> getDataStoreConfigs();
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateStrategy.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateStrategy.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateStrategy.java
deleted file mode 100644
index b0458aa..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateStrategy.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.cloudstack.engine.subsystem.api.storage;
-
-import com.cloud.agent.api.storage.DownloadCommand.Proxy;
-
-public interface TemplateStrategy {
- TemplateProfile install(TemplateProfile tp);
- TemplateProfile get(long templateId);
- TemplateProfile register(TemplateProfile tp);
- boolean canRegister(long templateId);
- int getDownloadWait();
- long getMaxTemplateSizeInBytes();
- Proxy getHttpProxy();
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeStrategy.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeStrategy.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeStrategy.java
deleted file mode 100644
index dba0077..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeStrategy.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.apache.cloudstack.engine.subsystem.api.storage;
-
-
-import com.cloud.storage.Volume;
-
-public interface VolumeStrategy {
- Volume createVolume(Volume vol);
- Volume createDataVolume(Volume vol);
- Volume copyVolumeFromBackup(VolumeProfile srcVol, Volume destVol);
- Volume createVolumeFromSnapshot(SnapshotProfile snapshot, Volume vol);
- Volume createVolumeFromTemplate(TemplateProfile template, Volume vol);
- Volume migrateVolume(Volume srcVol, Volume destVol, DataStore destStore);
- Volume createVolumeFromBaseTemplate(Volume destVol, TemplateProfile tp);
- boolean deleteVolume(Volume vol);
- VolumeProfile get(long volumeId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/storage/src/org/apache/cloudstack/storage/StorageOrchestratorImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/StorageOrchestratorImpl.java b/engine/storage/src/org/apache/cloudstack/storage/StorageOrchestratorImpl.java
deleted file mode 100644
index d71b72a..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/StorageOrchestratorImpl.java
+++ /dev/null
@@ -1,372 +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 org.apache.cloudstack.storage;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
-import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectBackupStorageOperationState;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.StorageOrchestrator;
-import org.apache.cloudstack.engine.subsystem.api.storage.StorageProvider;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeProfile;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeStrategy;
-import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType;
-import org.apache.cloudstack.engine.subsystem.api.storage.type.BaseImage;
-import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType;
-import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
-import org.apache.cloudstack.storage.datastore.manager.PrimaryDataStoreManager;
-import org.apache.cloudstack.storage.image.ImageManager;
-import org.apache.cloudstack.storage.image.ImageService;
-import org.apache.cloudstack.storage.image.TemplateEntityImpl;
-import org.apache.cloudstack.storage.image.TemplateInfo;
-import org.apache.cloudstack.storage.image.motion.ImageMotionService;
-import org.apache.cloudstack.storage.manager.BackupStorageManager;
-import org.apache.cloudstack.storage.manager.SecondaryStorageManager;
-import org.apache.cloudstack.storage.volume.VolumeEntityImpl;
-import org.apache.cloudstack.storage.volume.VolumeManager;
-import org.apache.cloudstack.storage.volume.VolumeObject;
-import org.apache.cloudstack.storage.volume.VolumeService;
-import org.apache.log4j.Logger;
-
-import com.cloud.deploy.DeploymentPlan;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.offering.DiskOffering;
-import com.cloud.storage.DiskOfferingVO;
-import com.cloud.storage.StoragePool;
-import com.cloud.storage.Volume;
-import com.cloud.storage.VolumeVO;
-import com.cloud.storage.dao.DiskOfferingDao;
-import com.cloud.storage.dao.StoragePoolDao;
-import com.cloud.storage.dao.VMTemplateDao;
-import com.cloud.storage.dao.VolumeDao;
-import com.cloud.storage.dao.VolumeHostDao;
-import com.cloud.template.VirtualMachineTemplate;
-import com.cloud.utils.component.Inject;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.Transaction;
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.fsm.NoTransitionException;
-import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.dao.VMInstanceDao;
-
-public class StorageOrchestratorImpl implements StorageOrchestrator {
- private static final Logger s_logger = Logger.getLogger(StorageOrchestratorImpl.class);
- @Inject
- StoragePoolDao _storagePoolDao;
- @Inject
- StorageProviderManager _spManager;
- @Inject
- VolumeDao _volumeDao;
- @Inject
- VMInstanceDao _vmDao;
- @Inject
- DiskOfferingDao _diskOfferingDao;
- @Inject
- VolumeHostDao _volumeHostDao;
- @Inject
- StorageProviderManager _storageProviderMgr;
- @Inject
- VolumeManager _volumeMgr;
- @Inject
- SecondaryStorageManager _secondaryStorageMgr;
- @Inject
- ImageManager _templateMgr;
- @Inject
- VMTemplateDao _templateDao;
- @Inject
- VolumeService volumeService;
- @Inject
- ImageMotionService imageMotionService;
- @Inject
- ImageService imageService;
- @Inject
- PrimaryDataStoreManager primaryStorageMgr;
-
- @DB
- protected Volume copyVolumeFromBackupStorage(VolumeVO volume, DataStore destStore, String reservationId) throws NoTransitionException {
- DataStore ds = _secondaryStorageMgr.getStore(volume);
- if (!ds.contains(volume)) {
- throw new CloudRuntimeException("volume: " + volume + "doesn't exist on backup storage");
- }
-/*
- VolumeProfile vp = ds.prepareVolume(volume, destStore);
-
- VolumeStrategy vs = destStore.getVolumeStrategy();
-
- Transaction txn = Transaction.currentTxn();
- volume.setReservationId(reservationId);
- _volumeMgr.processEvent(volume, Volume.Event.CopyRequested);
- VolumeVO destVolume = _volumeMgr.allocateDuplicateVolume(volume);
- destVolume = _volumeMgr.processEvent(destVolume, Volume.Event.CreateRequested);
- txn.commit();
-
- vs.copyVolumeFromBackup(vp, destVolume);
-
- txn.start();
- volume = _volumeMgr.processEvent(volume, Volume.Event.OperationSucceeded);
- destVolume = _volumeMgr.processEvent(destVolume, Volume.Event.OperationSucceeded);
- txn.commit();
-
- return destVolume;
- */
- return null;
- }
-
- @DB
- protected Volume migrateVolume(VolumeVO volume, DataStore srcStore, DataStore destStore, String reservationId) throws NoTransitionException {
- Transaction txn = Transaction.currentTxn();
- txn.start();
- /*
- volume.setReservationId(reservationId);
- volume = _volumeMgr.processEvent(volume, Volume.Event.MigrationRequested);
- Volume destVolume = _volumeMgr.allocateDuplicateVolume(volume);
- destVolume = _volumeMgr.processEvent(destVolume, Volume.Event.CreateRequested);
- txn.commit();
-
- VolumeStrategy vs = srcStore.getVolumeStrategy();
- vs.migrateVolume(volume, destVolume, destStore);
-
- txn.start();
- volume = _volumeMgr.processEvent(volume, Volume.Event.OperationSucceeded);
- destVolume = _volumeMgr.processEvent(destVolume, Volume.Event.OperationSucceeded);
- txn.commit();
-
- volume = _volumeMgr.processEvent(volume, Volume.Event.DestroyRequested);
-
- vs.deleteVolume(volume);
-
- _volumeMgr.processEvent(volume, Volume.Event.OperationSucceeded);
- return destVolume;
- */
- return null;
- }
-
- @DB
- protected Volume recreateVolume(VolumeVO srcVolume, DataStore destStore, String reservationId) throws NoTransitionException {
- Transaction txn = Transaction.currentTxn();
- txn.start();
- /*
- srcVolume.setReservationId(reservationId);
- srcVolume = _volumeMgr.processEvent(srcVolume, Volume.Event.CopyRequested);
- Volume destVolume = _volumeMgr.allocateDuplicateVolume(srcVolume);
- destVolume = _volumeMgr.processEvent(destVolume, Volume.Event.CreateRequested);
- txn.commit();
-
- DataStore srcStore = _storageProviderMgr.getDataStore(srcVolume.getPoolId());
- VolumeStrategy vs = srcStore.getVolumeStrategy();
-
- vs.migrateVolume(srcVolume, destVolume, destStore);
-
- txn.start();
- srcVolume = _volumeMgr.processEvent(srcVolume, Volume.Event.OperationSucceeded);
- destVolume = _volumeMgr.processEvent(destVolume, Volume.Event.OperationSucceeded);
- txn.commit();
-
- srcVolume = _volumeMgr.processEvent(srcVolume, Volume.Event.DestroyRequested);
-
- vs.deleteVolume(srcVolume);
-
- _volumeMgr.processEvent(srcVolume, Volume.Event.OperationSucceeded);
-
- return destVolume;
- */
- return null;
- }
-
- protected Volume createVolumeOnStorage(Volume volume, DataStore destStore, String reservationId) throws NoTransitionException {
- VolumeStrategy vs = destStore.getVolumeStrategy();
- /*
- volume.setReservationId(reservationId);
- volume = _volumeMgr.processEvent(volume, Volume.Event.CreateRequested);
-
- if (volume.getTemplateId() != null) {
- DataStore ds = _secondaryStorageMgr.getImageStore(destStore);
- TemplateProfile tp = ds.prepareTemplate(volume.getTemplateId(), destStore);
- if (!destStore.contains(tp)) {
- tp = _templateMgr.AssociateTemplateStoragePool(tp, destStore);
- tp = destStore.getTemplateStrategy().install(tp);
- } else {
- tp = destStore.getTemplateStrategy().get(tp.getId());
- }
- volume = vs.createVolumeFromBaseTemplate(volume, tp);
- } else {
- volume = vs.createDataVolume(volume);
- }
-
- volume = _volumeMgr.processEvent(volume, Volume.Event.OperationSucceeded);
- return volume;
- */
- return null;
- }
-
- @DB
- protected void prepareVolumes(List<VolumeVO> vols, Long destPoolId, String reservationId) throws NoTransitionException {
- DataStore destStore = null;
- if (destPoolId != null) {
- destStore = _storageProviderMgr.getDataStore(destPoolId);
- }
-
- for (VolumeVO volume : vols) {
- if (volume.getPoolId() == null && destStore == null) {
- throw new CloudRuntimeException("Volume has no pool associate and also no storage pool assigned in DeployDestination, Unable to create.");
- }
- if (destStore == null) {
- continue;
- }
-
- DataStore srcStore = _storageProviderMgr.getDataStore(volume.getPoolId());
- boolean needToCreateVolume = false;
- boolean needToRecreateVolume = false;
- boolean needToMigrateVolume = false;
- boolean needToCopyFromSec = false;
-
- Volume.State state = volume.getState();
- if (state == Volume.State.Allocated) {
- needToCreateVolume = true;
- } else if (state == Volume.State.UploadOp) {
- needToCopyFromSec = true;
- } else if (destStore.getId() != srcStore.getId()) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Mismatch in storage pool " + destStore.getId() + " assigned by deploymentPlanner and the one associated with volume " + volume);
- }
-
- if (volume.isRecreatable()) {
- needToRecreateVolume = true;
- } else {
- if (Volume.Type.ROOT == volume.getVolumeType()) {
- needToMigrateVolume = true;
- } else {
- if (destStore.getCluterId() != srcStore.getCluterId()) {
- needToMigrateVolume = true;
- } else if (!srcStore.isSharedStorage() && srcStore.getId() != destStore.getId()) {
- needToMigrateVolume = true;
- } else {
- continue;
- }
- }
- }
- } else {
- continue;
- }
-
- if (needToCreateVolume) {
- createVolumeOnStorage(volume, destStore, reservationId);
- } else if (needToMigrateVolume) {
- migrateVolume(volume, srcStore, destStore, reservationId);
- } else if (needToCopyFromSec) {
- copyVolumeFromBackupStorage(volume, destStore, reservationId);
- } else if (needToRecreateVolume) {
- recreateVolume(volume, destStore, reservationId);
- }
- }
- }
-
- public void prepare(long vmId, DeploymentPlan plan, String reservationId) {
- VirtualMachine vm = _vmDao.findById(vmId);
-
- List<VolumeVO> vols = _volumeDao.findUsableVolumesForInstance(vm.getId());
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Prepare " + vols.size() + " volumes for " + vm.getInstanceName());
- }
-
- try {
- prepareVolumes(vols, plan.getPoolId(), reservationId);
- } catch (NoTransitionException e) {
- s_logger.debug("Failed to prepare volume: " + e.toString());
- }
- }
-
- public void release(long vmId, String reservationId) {
- // TODO Auto-generated method stub
-
- }
-
- public void destroy(List<Long> disks, String reservationId) {
- // TODO Auto-generated method stub
-
- }
-
- public void cancel(String reservationId) {
- // TODO Auto-generated method stub
-
- }
-
- public void prepareAttachDiskToVM(long diskId, long vmId, String reservationId) {
- VirtualMachine vm = _vmDao.findById(vmId);
-
- if (vm == null || vm.getState() != VirtualMachine.State.Running) {
- return;
- }
-
- VolumeVO volume = _volumeDao.findById(diskId);
- if (volume.getInstanceId() != null) {
- if (volume.getInstanceId() != vmId) {
- throw new InvalidParameterValueException("Volume " + volume + "already attached to " + volume.getInstanceId());
- } else {
- return;
- }
- }
-
- List<VolumeVO> vols = new ArrayList<VolumeVO>();
- vols.add(volume);
-
- List<VolumeVO> rootDisks = _volumeDao.findByInstanceAndType(vmId, Volume.Type.ROOT);
- VolumeVO rootDisk = rootDisks.get(0);
- try {
- prepareVolumes(vols, rootDisk.getPoolId(), reservationId);
- } catch (NoTransitionException e) {
- s_logger.debug("Failed to prepare volume: " + volume + ", due to" + e.toString());
- throw new CloudRuntimeException(e.toString());
- }
-
- volume = _volumeDao.findById(diskId);
- volume.setInstanceId(vmId);
- _volumeDao.update(volume.getId(), volume);
- }
-
- @Override
- public boolean createVolume(VolumeEntity volume, long dataStoreId, VolumeDiskType diskType) {
- VolumeEntityImpl vei = ((VolumeEntityImpl) volume);
- VolumeInfo vi = volumeService.createVolume(vei.getVolumeInfo(), dataStoreId, diskType);
- vei.setVolumeInfo(vi);
- return true;
- }
-
- @Override
- public VolumeEntity allocateVolumeInDb(long size, VolumeType type, String volName, Long templateId) {
- return volumeService.allocateVolumeInDb(size, type, volName, templateId);
- }
-
- protected VolumeInfo getVolumeInfo(VolumeEntity volume) {
- VolumeEntityImpl vei = (VolumeEntityImpl) volume;
- return vei.getVolumeInfo();
- }
-
- @Override
- public boolean createVolumeFromTemplate(VolumeEntity volume, long dataStoreId, VolumeDiskType diskType, TemplateEntity template) {
-
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManager.java b/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManager.java
deleted file mode 100644
index 4260115..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManager.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.apache.cloudstack.storage;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.StorageProvider;
-
-public interface StorageProviderManager {
- StorageProvider getProvider(String uuid);
-
- StorageProvider getProvider(long poolId);
-
- StorageProvider getBackupStorageProvider(long zoneId);
-
- DataStore getDataStore(long poolId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManagerImpl.java
deleted file mode 100644
index bbed9f4..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManagerImpl.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.cloudstack.storage;
-
-import java.util.Map;
-
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.StorageProvider;
-
-import com.cloud.utils.component.Manager;
-
-public class StorageProviderManagerImpl implements StorageProviderManager, Manager {
-
- public StorageProvider getProvider(String uuid) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean start() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean stop() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public String getName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public StorageProvider getProvider(long poolId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public StorageProvider getBackupStorageProvider(long zoneId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataStore getDataStore(long poolId) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/storage/src/org/apache/cloudstack/storage/VolumeBackupRef.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/VolumeBackupRef.java b/engine/storage/src/org/apache/cloudstack/storage/VolumeBackupRef.java
deleted file mode 100644
index 4b512ba..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/VolumeBackupRef.java
+++ /dev/null
@@ -1,66 +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 org.apache.cloudstack.storage;
-
-import java.util.Date;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectBackupStorageOperationState;
-
-import com.cloud.storage.Storage;
-import com.cloud.storage.VMTemplateStorageResourceAssoc;
-import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
-
-public interface VolumeBackupRef {
- public DataObjectBackupStorageOperationState getOperationState();
-
- public String getInstallPath();
-
- public long getHostId();
-
- public long getVolumeId();
-
- public long getZoneId();
-
- public int getDownloadPercent();
-
- public long getVolumeSize();
-
- public Storage.ImageFormat getFormat();
-
- public String getDownloadUrl();
-
- public boolean getDestroyed();
-
- public long getPhysicalSize();
-
- public long getSize();
-
- public String getLocalDownloadPath();
-
- public String getChecksum();
-
- public Status getDownloadState();
-
- public Date getLastUpdated();
-
- public Date getCreated();
-
- public long getId();
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/storage/src/org/apache/cloudstack/storage/datastore/DefaultDataStore.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/DefaultDataStore.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/DefaultDataStore.java
deleted file mode 100644
index 206f917..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/DefaultDataStore.java
+++ /dev/null
@@ -1,228 +0,0 @@
-package org.apache.cloudstack.storage.datastore;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.BackupStrategy;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreEndPointSelector;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle;
-import org.apache.cloudstack.engine.subsystem.api.storage.FileSystem;
-import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotProfile;
-import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy;
-import org.apache.cloudstack.engine.subsystem.api.storage.StorageProvider;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateStrategy;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeProfile;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeStrategy;
-
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.storage.Snapshot;
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.storage.Volume;
-
-public class DefaultDataStore implements DataStore {
- protected VolumeStrategy _volumeStrategy;
- protected SnapshotStrategy _snapshotStrategy;
- protected BackupStrategy _backupStrategy;
- protected TemplateStrategy _templateStrategy;
- protected String _uri;
- protected String _uuid;
- protected StoreType _type;
- protected StoreScope _scope;
- protected long _poolId;
- protected DataStoreDriver _driverRef;
- protected DataStoreEndPointSelector _selector;
- protected FileSystem _fs;
- protected VolumeStrategy _volumeSt;
- protected SnapshotStrategy _snapshotSt;
- protected BackupStrategy _backupSt;
- protected long _id;
- protected DataStoreLifeCycle _dslf;
-
- public DefaultDataStore() {
- }
-
- public String getURI() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void setURI(String uri) {
- this._uri = uri;
- }
-
- public String getUUID() {
- return this._uuid;
- }
-
- public void setUUID(String uuid) {
- this._uuid = uuid;
- }
-
- public StoreType getType() {
- return this._type;
- }
-
- public void setType(StoreType type) {
- this._type = type;
- }
-
- public StoreScope getScope() {
- return this._scope;
- }
-
- public void setScope(StoreScope scope) {
- this._scope = scope;
- }
-
- public Long getId() {
- return this._id;
- }
-
- public void setId(long id) {
- this._id = id;
- }
-
- public DataStoreDriver getDataStoreDriver() {
- return this._driverRef;
- }
-
- public void setDataStoreDriver(DataStoreDriver drv) {
- this._driverRef = drv;
- }
-
- public void setEndPointSelector(DataStoreEndPointSelector selector) {
- this._selector = selector;
- }
-
- public DataStoreEndPointSelector getSelector() {
- return this._selector;
- }
-
- public FileSystem getFileSystem() {
- return this._fs;
- }
-
- public void setFileSystem(FileSystem fs) {
- this._fs = fs;
- }
-
- public VolumeStrategy getVolumeStrategy() {
- return this._volumeSt;
- }
-
- public void setVolumeStrategy(VolumeStrategy vs) {
- this._volumeSt = vs;
- }
-
- public SnapshotStrategy getSnapshotStrategy() {
- return this._snapshotSt;
- }
-
- public void setSnapshotStrategy(SnapshotStrategy ss) {
- this._snapshotSt = ss;
- }
-
- public BackupStrategy getBackupStrategy() {
- return this._backupSt;
- }
-
- public void setBackupStrategy(BackupStrategy bs) {
- this._backupSt = bs;
- }
-
- public TemplateStrategy getTemplateStrategy() {
- return this._templateStrategy;
- }
-
- public void setTemplateStrategy(TemplateStrategy ts) {
- this._templateStrategy = ts;
- }
-
- public DataStoreLifeCycle getLifeCycle() {
- return this._dslf;
- }
-
- public void setLifeCycle(DataStoreLifeCycle lf) {
- this._dslf = lf;
- }
-
- public long getCluterId() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public long getPodId() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public long getZoneId() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public String getPath() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public StoragePoolType getPoolType() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean isSharedStorage() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public StorageProvider getProvider() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataStoreEndPointSelector getEndPointSelector() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public VolumeProfile prepareVolume(Volume volume, DataStore destStore) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public SnapshotProfile prepareSnapshot(Snapshot snapshot, DataStore destStore) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public TemplateProfile prepareTemplate(long templateId, DataStore destStore) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean contains(Volume volume) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean contains(Snapshot snapshot) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean contains(TemplateProfile template) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public TemplateProfile get(TemplateProfile template) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public StorageFilerTO getTO() {
- // TODO Auto-generated method stub
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
index 8437872..bd7c878 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
@@ -7,7 +7,6 @@ import javax.inject.Inject;
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
import org.apache.cloudstack.storage.datastore.DefaultPrimaryDataStoreImpl;
import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreProviderDao;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreProviderVO;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreVO;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
@@ -15,7 +14,6 @@ import org.apache.cloudstack.storage.datastore.driver.DefaultPrimaryDataStoreDri
import org.apache.cloudstack.storage.datastore.driver.PrimaryDataStoreDriver;
import org.apache.cloudstack.storage.datastore.lifecycle.DefaultPrimaryDataStoreLifeCycleImpl;
import org.apache.cloudstack.storage.datastore.lifecycle.PrimaryDataStoreLifeCycle;
-import org.apache.cloudstack.storage.lifecycle.DefaultPrimaryDataStoreLifeCycle;
import org.springframework.stereotype.Component;
import com.cloud.utils.component.ComponentInject;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/storage/src/org/apache/cloudstack/storage/driver/AbstractStorageDriver.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/driver/AbstractStorageDriver.java b/engine/storage/src/org/apache/cloudstack/storage/driver/AbstractStorageDriver.java
deleted file mode 100644
index 8b78378..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/driver/AbstractStorageDriver.java
+++ /dev/null
@@ -1,73 +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 org.apache.cloudstack.storage.driver;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreEndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateStrategy;
-
-import com.cloud.agent.api.storage.DownloadProgressCommand;
-import com.cloud.agent.api.storage.DownloadProgressCommand.RequestType;
-import com.cloud.agent.api.storage.DownloadCommand;
-import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
-import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
-
-public abstract class AbstractStorageDriver implements DataStoreDriver {
- protected DataStore _ds;
- protected TemplateStrategy _ts;
-
- public AbstractStorageDriver(DataStore ds) {
- _ds = ds;
- _ts = ds.getTemplateStrategy();
- }
-
- public TemplateProfile install(TemplateProfile tp, DataStoreEndPoint ep) {
- PrimaryStorageDownloadCommand dcmd = new PrimaryStorageDownloadCommand(tp.getName(), tp.getUrl(), tp.getFormat(), 0, _ds.getId(), _ds.getUUID(), _ts.getDownloadWait());
- dcmd.setSecondaryStorageUrl(tp.getImageStorageUri());
- dcmd.setPrimaryStorageUrl(_ds.getURI());
- PrimaryStorageDownloadAnswer asw = (PrimaryStorageDownloadAnswer) ep.sendCommand(dcmd);
-
- tp.setLocalPath(asw.getInstallPath());
- return tp;
- }
-
- public TemplateProfile register(TemplateProfile tp, DataStoreEndPoint ep, boolean freshDownload) {
-
- DownloadCommand dcmd = new DownloadCommand(_ds.getURI(), tp.getTemplate(), _ts.getMaxTemplateSizeInBytes());
- dcmd.setProxy(_ts.getHttpProxy());
- if (!freshDownload) {
- dcmd = new DownloadProgressCommand(dcmd, tp.getJobId(), RequestType.GET_OR_RESTART);
- }
-
- ep.sendCommand(dcmd);
- return tp;
- }
- /*
- * public VolumeProfile createVolumeFromTemplate(VolumeProfile volProfile,
- * TemplateProfile tp, DataStoreEndPoint ep) { CreateCommand cmd = new
- * CreateCommand(volProfile, tp.getLocalPath(), _ds.getTO()); CreateAnswer
- * ans = (CreateAnswer)ep.sendCommand(cmd); VolumeTO created =
- * ans.getVolume(); DiskProfile diskProfile = new VolumeProfile(volProfile);
- * diskProfile.setPath(created.getPath());
- * diskProfile.setSize(created.getSize()); return diskProfile; return null;
- * }
- */
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/storage/src/org/apache/cloudstack/storage/driver/DefaultNfsSecondaryDriver.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/driver/DefaultNfsSecondaryDriver.java b/engine/storage/src/org/apache/cloudstack/storage/driver/DefaultNfsSecondaryDriver.java
deleted file mode 100644
index df1e0b3..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/driver/DefaultNfsSecondaryDriver.java
+++ /dev/null
@@ -1,90 +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 org.apache.cloudstack.storage.driver;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreEndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeProfile;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.storage.TemplateProfile;
-
-public class DefaultNfsSecondaryDriver extends AbstractStorageDriver {
-
- /**
- * @param ds
- */
- public DefaultNfsSecondaryDriver(DataStore ds) {
- super(ds);
- // TODO Auto-generated constructor stub
- }
-
- public String getDriverType() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public TemplateProfile register(TemplateProfile tp, DataStoreEndPoint ep) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject create(DataObject obj) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject copy(DataObject src, DataStore dest) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject copy(DataObject src, DataObject dest) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject move(DataObject src, DataObject dest) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Answer sendMessage(DataStoreEndPoint dsep, Command cmd) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean delete(DataObject obj) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile register(org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint ep) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public VolumeProfile createVolumeFromTemplate(VolumeProfile vol, org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint dp) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/storage/src/org/apache/cloudstack/storage/driver/XenServerStorageDriver.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/driver/XenServerStorageDriver.java b/engine/storage/src/org/apache/cloudstack/storage/driver/XenServerStorageDriver.java
deleted file mode 100644
index 4b3bbe5..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/driver/XenServerStorageDriver.java
+++ /dev/null
@@ -1,81 +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 org.apache.cloudstack.storage.driver;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreEndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeProfile;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-public class XenServerStorageDriver extends AbstractStorageDriver {
- protected DataStore _ds;
-
- public XenServerStorageDriver(DataStore ds) {
- super(ds);
- _ds = ds;
- }
-
- public String getDriverType() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject create(DataObject obj) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject copy(DataObject src, DataStore dest) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject copy(DataObject src, DataObject dest) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject move(DataObject src, DataObject dest) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Answer sendMessage(DataStoreEndPoint dsep, Command cmd) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean delete(DataObject obj) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile register(org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint ep) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public VolumeProfile createVolumeFromTemplate(VolumeProfile vol, org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint dp) {
- // TODO Auto-generated method stub
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/storage/src/org/apache/cloudstack/storage/image/ImageManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/ImageManager.java b/engine/storage/src/org/apache/cloudstack/storage/image/ImageManager.java
deleted file mode 100644
index a5b4497..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/image/ImageManager.java
+++ /dev/null
@@ -1,32 +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 org.apache.cloudstack.storage.image;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile;
-
-import com.cloud.api.commands.RegisterTemplateCmd;
-
-public interface ImageManager {
- TemplateProfile AssociateTemplateStoragePool(TemplateProfile tp, DataStore ds);
-
- TemplateProfile getProfile(long templateId);
-
- TemplateProfile allocateTemplateInDB(RegisterTemplateCmd cmd);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/storage/src/org/apache/cloudstack/storage/image/ImageManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/ImageManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/ImageManagerImpl.java
deleted file mode 100644
index bcf42ce..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/image/ImageManagerImpl.java
+++ /dev/null
@@ -1,165 +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 org.apache.cloudstack.storage.image;
-
-import java.util.List;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateProfile;
-import org.apache.log4j.Logger;
-
-import com.cloud.api.commands.RegisterTemplateCmd;
-import com.cloud.dc.DataCenterVO;
-import com.cloud.dc.dao.DataCenterDao;
-import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.storage.Storage.TemplateType;
-import com.cloud.storage.VMTemplateHostVO;
-import com.cloud.storage.VMTemplateStoragePoolVO;
-import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
-import com.cloud.storage.VMTemplateVO;
-import com.cloud.storage.dao.VMTemplateDao;
-import com.cloud.storage.dao.VMTemplatePoolDao;
-import com.cloud.template.VirtualMachineTemplate;
-import com.cloud.utils.EnumUtils;
-import com.cloud.utils.component.Inject;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-public class ImageManagerImpl implements ImageManager {
- private static final Logger s_logger = Logger.getLogger(ImageManagerImpl.class);
- @Inject
- VMTemplateDao _templateDao;
- @Inject
- VMTemplatePoolDao _templatePoolDao;
- @Inject
- DataCenterDao _dcDao;
-
- public boolean contains(VirtualMachineTemplate template, DataStore ds) {
- long templateId = template.getId();
- long poolId = ds.getId();
- VMTemplateStoragePoolVO templateStoragePoolRef = null;
- templateStoragePoolRef = _templatePoolDao.findByPoolTemplate(poolId, templateId);
- return templateStoragePoolRef == null ? false : true;
- }
-
- public TemplateProfile AssociateTemplateStoragePool(TemplateProfile tp, DataStore ds) {
- long templateId = tp.getTemplateId();
- long poolId = ds.getId();
- VMTemplateStoragePoolVO templateStoragePoolRef = null;
- long templateStoragePoolRefId;
-
- templateStoragePoolRef = _templatePoolDao.findByPoolTemplate(poolId, templateId);
- if (templateStoragePoolRef != null) {
- templateStoragePoolRef.setMarkedForGC(false);
- _templatePoolDao.update(templateStoragePoolRef.getId(), templateStoragePoolRef);
-
- if (templateStoragePoolRef.getDownloadState() == Status.DOWNLOADED) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Template " + templateId + " has already been downloaded to pool " + poolId);
- }
-
- tp.setLocalPath(templateStoragePoolRef.getInstallPath());
- tp.setTemplatePoolRefId(templateStoragePoolRef.getId());
- return tp;
- }
- }
-
- if (templateStoragePoolRef == null) {
- templateStoragePoolRef = new VMTemplateStoragePoolVO(poolId, templateId);
- try {
- templateStoragePoolRef = _templatePoolDao.persist(templateStoragePoolRef);
- templateStoragePoolRefId = templateStoragePoolRef.getId();
- } catch (Exception e) {
- s_logger.debug("Assuming we're in a race condition: " + e.getMessage());
- templateStoragePoolRef = _templatePoolDao.findByPoolTemplate(poolId, templateId);
- if (templateStoragePoolRef == null) {
- throw new CloudRuntimeException("Unable to persist a reference for pool " + poolId + " and template " + templateId);
- }
- templateStoragePoolRefId = templateStoragePoolRef.getId();
- }
- } else {
- templateStoragePoolRefId = templateStoragePoolRef.getId();
- }
- tp.setTemplatePoolRefId(templateStoragePoolRefId);
- return tp;
- }
-
- public TemplateProfile getProfile(long templateId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- protected TemplateProfile persistTemplate(TemplateProfile profile) {
- Long zoneId = profile.getZoneId();
- VMTemplateVO template = new VMTemplateVO(profile.getTemplateId(), profile.getName(), profile.getFormat(), profile.getIsPublic(), profile.getFeatured(), profile.getIsExtractable(),
- TemplateType.USER, profile.getUrl(), profile.getRequiresHVM(), profile.getBits(), profile.getAccountId(), profile.getCheckSum(), profile.getDisplayText(),
- profile.getPasswordEnabled(), profile.getGuestOsId(), profile.getBootable(), profile.getHypervisorType(), profile.getTemplateTag(), profile.getDetails(), profile.getSshKeyEnabled());
-
- if (zoneId == null || zoneId.longValue() == -1) {
- List<DataCenterVO> dcs = _dcDao.listAll();
-
- if (dcs.isEmpty()) {
- throw new CloudRuntimeException("No zones are present in the system, can't add template");
- }
-
- template.setCrossZones(true);
- for (DataCenterVO dc : dcs) {
- _templateDao.addTemplateToZone(template, dc.getId());
- }
- } else {
- _templateDao.addTemplateToZone(template, zoneId);
- }
-
- return getProfile(template.getId());
- }
-
- protected boolean parameterCheck(RegisterTemplateCmd cmd) {
- Long zoneId = cmd.getZoneId();
- if (zoneId == -1) {
- zoneId = null;
- }
-
- ImageFormat imgfmt = ImageFormat.valueOf(cmd.getFormat().toUpperCase());
- if (imgfmt == null) {
- throw new IllegalArgumentException("Image format is incorrect " + cmd.getFormat() + ". Supported formats are " + EnumUtils.listValues(ImageFormat.values()));
- }
-
- // If a zoneId is specified, make sure it is valid
- if (zoneId != null) {
- DataCenterVO zone = _dcDao.findById(zoneId);
- if (zone == null) {
- throw new IllegalArgumentException("Please specify a valid zone.");
- }
- }
-
- List<VMTemplateVO> systemvmTmplts = _templateDao.listAllSystemVMTemplates();
- for (VMTemplateVO template : systemvmTmplts) {
- if (template.getName().equalsIgnoreCase(cmd.getTemplateName()) || template.getDisplayText().equalsIgnoreCase(cmd.getDisplayText())) {
- throw new IllegalArgumentException("Cannot use reserved names for templates");
- }
- }
-
- return true;
- }
-
- public TemplateProfile allocateTemplateInDB(RegisterTemplateCmd cmd) {
- parameterCheck(cmd);
- // TemplateProfile tp = new TemplateProfile(cmd);
- return persistTemplate(null);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/storage/src/org/apache/cloudstack/storage/image/ImageOrchestratorImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/ImageOrchestratorImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/ImageOrchestratorImpl.java
deleted file mode 100644
index 8da27b5..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/image/ImageOrchestratorImpl.java
+++ /dev/null
@@ -1,78 +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 org.apache.cloudstack.storage.image;
-
-import java.util.List;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotProfile;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateStrategy;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeProfile;
-import org.apache.cloudstack.storage.manager.SecondaryStorageManager;
-
-import com.cloud.storage.TemplateProfile;
-import com.cloud.storage.VMTemplateZoneVO;
-import com.cloud.storage.dao.VMTemplateZoneDao;
-import com.cloud.utils.component.Inject;
-
-public class ImageOrchestratorImpl implements ImageOrchestrator {
- @Inject
- SecondaryStorageManager _secStorageMgr;
- @Inject
- VMTemplateZoneDao _templateZoneDao;
-
- public void registerTemplate(long templateId) {
- List<VMTemplateZoneVO> tpZones = _templateZoneDao.listByTemplateId(templateId);
-
- for (VMTemplateZoneVO tpZone : tpZones) {
- DataStore imageStore = null;
- List<DataStore> imageStores = _secStorageMgr.getImageStores(tpZone.getZoneId());
- for (DataStore imgStore : imageStores) {
- TemplateStrategy ts = imgStore.getTemplateStrategy();
- if (ts.canRegister(templateId)) {
- imageStore = imgStore;
- break;
- }
- }
-
- if (imageStore == null) {
- continue;
- }
-
- TemplateStrategy ts = imageStore.getTemplateStrategy();
- ts.register(ts.get(templateId));
- }
- }
-
- public void registerSnapshot(long snapshotId) {
- // TODO Auto-generated method stub
-
- }
-
- public void registerVolume(long volumeId) {
- // TODO Auto-generated method stub
-
- }
-
- public void registerIso(long isoId) {
- // TODO Auto-generated method stub
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultNfsSecondaryLifeCycle.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultNfsSecondaryLifeCycle.java b/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultNfsSecondaryLifeCycle.java
deleted file mode 100644
index 4c71e43..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultNfsSecondaryLifeCycle.java
+++ /dev/null
@@ -1,56 +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 org.apache.cloudstack.storage.lifecycle;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle;
-
-public class DefaultNfsSecondaryLifeCycle implements DataStoreLifeCycle {
- protected DataStore _ds;
-
- public DefaultNfsSecondaryLifeCycle(DataStore ds) {
- _ds = ds;
- }
-
- public void add() {
- // TODO Auto-generated method stub
-
- }
-
- public void delete() {
- // TODO Auto-generated method stub
-
- }
-
- public void enable() {
- // TODO Auto-generated method stub
-
- }
-
- public void disable() {
- // TODO Auto-generated method stub
-
- }
-
- public void processEvent(DataStoreEvent event, Object... objs) {
- // TODO Auto-generated method stub
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/487a0ac4/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultPrimaryDataStoreLifeCycle.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultPrimaryDataStoreLifeCycle.java b/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultPrimaryDataStoreLifeCycle.java
deleted file mode 100644
index 098c56a..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultPrimaryDataStoreLifeCycle.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package org.apache.cloudstack.storage.lifecycle;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreEndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreEndPointSelector;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle;
-import org.apache.log4j.Logger;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.CreateStoragePoolCommand;
-import com.cloud.agent.api.ModifyStoragePoolAnswer;
-import com.cloud.agent.api.ModifyStoragePoolCommand;
-import com.cloud.alert.AlertManager;
-import com.cloud.exception.StorageUnavailableException;
-import com.cloud.host.HostVO;
-import com.cloud.storage.StoragePoolHostVO;
-import com.cloud.storage.StoragePoolVO;
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.storage.dao.StoragePoolDao;
-import com.cloud.storage.dao.StoragePoolHostDao;
-import com.cloud.utils.component.Inject;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-public class DefaultPrimaryDataStoreLifeCycle implements DataStoreLifeCycle {
- private static final Logger s_logger = Logger.getLogger(DataStoreLifeCycle.class);
- private DataStore _ds;
- @Inject
- StoragePoolDao _storagePoolDao;
- @Inject
- StoragePoolHostDao _poolHostDao;
-
- public DefaultPrimaryDataStoreLifeCycle(DataStore ds) {
- this._ds = ds;
- }
-
- protected boolean createStoragePool(DataStoreEndPoint ep, StoragePoolVO pool) {
- DataStoreDriver dsDriver = _ds.getDataStoreDriver();
- CreateStoragePoolCommand cmd = new CreateStoragePoolCommand(true, pool);
- final Answer answer = dsDriver.sendMessage(ep, cmd);
- if (answer != null && answer.getResult()) {
- return true;
- } else {
- throw new CloudRuntimeException(answer.getDetails());
- }
- }
-
- protected void connectHostToSharedPool(DataStoreEndPoint ep, StoragePoolVO pool) throws StorageUnavailableException {
- DataStoreDriver dsDriver = _ds.getDataStoreDriver();
- long hostId = ep.getHostId();
- ModifyStoragePoolCommand cmd = new ModifyStoragePoolCommand(true, pool);
- final Answer answer = dsDriver.sendMessage(ep, cmd);
-
- if (answer == null) {
- throw new StorageUnavailableException("Unable to get an answer to the modify storage pool command", pool.getId());
- }
-
- if (!answer.getResult()) {
- throw new StorageUnavailableException("Unable establish connection from storage head to storage pool " + pool.getId() + " due to " + answer.getDetails(), pool.getId());
- }
-
- assert (answer instanceof ModifyStoragePoolAnswer) : "Well, now why won't you actually return the ModifyStoragePoolAnswer when it's ModifyStoragePoolCommand? Pool=" + pool.getId();
- ModifyStoragePoolAnswer mspAnswer = (ModifyStoragePoolAnswer) answer;
-
- StoragePoolHostVO poolHost = _poolHostDao.findByPoolHost(pool.getId(), hostId);
- if (poolHost == null) {
- poolHost = new StoragePoolHostVO(pool.getId(), hostId, mspAnswer.getPoolInfo().getLocalPath().replaceAll("//", "/"));
- _poolHostDao.persist(poolHost);
- } else {
- poolHost.setLocalPath(mspAnswer.getPoolInfo().getLocalPath().replaceAll("//", "/"));
- }
- pool.setAvailableBytes(mspAnswer.getPoolInfo().getAvailableBytes());
- pool.setCapacityBytes(mspAnswer.getPoolInfo().getCapacityBytes());
- _storagePoolDao.update(pool.getId(), pool);
- }
-
- public void add() {
- DataStoreEndPointSelector dseps = _ds.getEndPointSelector();
- List<DataStoreEndPoint> dsep = dseps.getEndPoints(null);
- boolean success = false;
- StoragePoolVO spool = _storagePoolDao.findById(_ds.getId());
- for (DataStoreEndPoint ep : dsep) {
- success = createStoragePool(ep, spool);
- if (success) {
- break;
- }
- }
-
- List<DataStoreEndPoint> poolHosts = new ArrayList<DataStoreEndPoint>();
- for (DataStoreEndPoint ep : dsep) {
- try {
- connectHostToSharedPool(ep, spool);
- poolHosts.add(ep);
- } catch (Exception e) {
- s_logger.debug("Failed to add storage on this ep: " + ep.getHostId());
- }
- }
- }
-
- public void delete() {
- // TODO Auto-generated method stub
-
- }
-
- public void enable() {
- // TODO Auto-generated method stub
-
- }
-
- public void disable() {
- // TODO Auto-generated method stub
-
- }
-
- public void processEvent(DataStoreEvent event, Object... objs) {
- // TODO Auto-generated method stub
-
- }
-
-}