You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2012/11/05 18:23:43 UTC
[16/18] Moved platform to engine
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/format/OVA.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/format/OVA.java b/platform/storage/src/org/apache/cloudstack/storage/image/format/OVA.java
deleted file mode 100644
index 46f77a0..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/format/OVA.java
+++ /dev/null
@@ -1,31 +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.format;
-
-import org.apache.cloudstack.storage.BaseType;
-import org.springframework.stereotype.Component;
-
-@Component
-public class OVA extends BaseType implements ImageFormat {
- private final String type = "OVA";
- @Override
- public String toString() {
- return type;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/format/QCOW2.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/format/QCOW2.java b/platform/storage/src/org/apache/cloudstack/storage/image/format/QCOW2.java
deleted file mode 100644
index 9e13ebb..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/format/QCOW2.java
+++ /dev/null
@@ -1,31 +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.format;
-
-import org.apache.cloudstack.storage.BaseType;
-import org.springframework.stereotype.Component;
-
-@Component("imageformat_qcow2")
-public class QCOW2 extends BaseType implements ImageFormat {
- private final String type = "QCOW2";
- @Override
- public String toString() {
- return type;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/format/Unknown.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/format/Unknown.java b/platform/storage/src/org/apache/cloudstack/storage/image/format/Unknown.java
deleted file mode 100644
index 341be64..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/format/Unknown.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.format;
-
-import org.apache.cloudstack.storage.BaseType;
-import org.springframework.stereotype.Component;
-
-@Component
-public class Unknown extends BaseType implements ImageFormat {
- private final String type = "Unknown";
-
- @Override
- public String toString() {
- return type;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/format/VHD.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/format/VHD.java b/platform/storage/src/org/apache/cloudstack/storage/image/format/VHD.java
deleted file mode 100644
index 4a02e5f..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/format/VHD.java
+++ /dev/null
@@ -1,29 +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.format;
-
-import org.apache.cloudstack.storage.BaseType;
-
-public class VHD extends BaseType implements ImageFormat {
- private final String type = "VHD";
- @Override
- public String toString() {
- return type;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManager.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManager.java b/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManager.java
deleted file mode 100644
index 878e394..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManager.java
+++ /dev/null
@@ -1,25 +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.manager;
-
-import org.apache.cloudstack.storage.image.store.ImageDataStore;
-
-public interface ImageDataStoreManager {
- ImageDataStore getImageDataStore(long dataStoreId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java b/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java
deleted file mode 100644
index 3b09fcb..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java
+++ /dev/null
@@ -1,41 +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.manager;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.storage.datastore.db.DataStoreVO;
-import org.apache.cloudstack.storage.image.db.ImageDaoStoreDao;
-import org.apache.cloudstack.storage.image.db.ImageDataDao;
-import org.apache.cloudstack.storage.image.db.ImageDataStoreVO;
-import org.apache.cloudstack.storage.image.store.ImageDataStore;
-
-public class ImageDataStoreManagerImpl implements ImageDataStoreManager {
- @Inject
- ImageDaoStoreDao dataStoreDao;
- @Inject
- ImageDataDao imageDataDao;
- @Override
- public ImageDataStore getImageDataStore(long dataStoreId) {
- ImageDataStoreVO dataStore = dataStoreDao.findById(dataStoreId);
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProvider.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProvider.java b/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProvider.java
deleted file mode 100644
index 42933f4..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProvider.java
+++ /dev/null
@@ -1,25 +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.provider;
-
-import org.apache.cloudstack.storage.image.store.ImageDataStore;
-
-public interface ImageDataStoreProvider {
- ImageDataStore getImageDataStore(long imageStoreId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManager.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManager.java b/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManager.java
deleted file mode 100644
index 1f9c956..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManager.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.storage.image.provider;
-
-public interface ImageDataStoreProviderManager {
- public ImageDataStoreProvider getProvider(long providerId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManagerImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManagerImpl.java b/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManagerImpl.java
deleted file mode 100644
index 0325311..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManagerImpl.java
+++ /dev/null
@@ -1,37 +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.provider;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.storage.image.db.ImageDataStoreProviderDao;
-
-
-public class ImageDataStoreProviderManagerImpl implements ImageDataStoreProviderManager {
-
- @Inject
- ImageDataStoreProviderDao providerDao;
- @Override
- public ImageDataStoreProvider getProvider(long providerId) {
-
- return null;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java b/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java
deleted file mode 100644
index 60d1e84..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java
+++ /dev/null
@@ -1,31 +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.store;
-
-import org.apache.cloudstack.storage.image.Template;
-import org.apache.cloudstack.storage.image.downloader.ImageDownloader;
-
-public interface ImageDataStore {
- Template registerTemplate(long templateId);
- String grantAccess(long templateId, long endPointId);
- boolean revokeAccess(long templateId, long endPointId);
- boolean deleteTemplate(long templateId);
- boolean needDownloadToCacheStorage();
- ImageDownloader getImageDownloader();
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java b/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java
deleted file mode 100644
index 925e152..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java
+++ /dev/null
@@ -1,83 +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.store;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.storage.image.Template;
-import org.apache.cloudstack.storage.image.db.ImageDataDao;
-import org.apache.cloudstack.storage.image.db.ImageDataVO;
-import org.apache.cloudstack.storage.image.downloader.ImageDownloader;
-import org.apache.cloudstack.storage.image.driver.ImageDataStoreDriver;
-
-public class ImageDataStoreImpl implements ImageDataStore {
- @Inject
- ImageDataDao imageDao;
- ImageDataStoreDriver driver;
- ImageDownloader downloader;
- boolean needDownloadToCacheStorage = false;
-
-
- public ImageDataStoreImpl(ImageDataStoreDriver driver, boolean needDownloadToCacheStorage, ImageDownloader downloader) {
- this.driver = driver;
- this.needDownloadToCacheStorage = needDownloadToCacheStorage;
- this.downloader = downloader;
- }
-
- @Override
- public Template registerTemplate(long templateId) {
- ImageDataVO idv = imageDao.findById(templateId);
- Template template = new Template(this, idv);
- if (driver.registerTemplate(template)) {
- return template;
- } else {
- return null;
- }
- }
-
- @Override
- public String grantAccess(long templateId, long endPointId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean revokeAccess(long templateId, long endPointId) {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean deleteTemplate(long templateId) {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean needDownloadToCacheStorage() {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public ImageDownloader getImageDownloader() {
- return this.downloader;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultNfsSecondaryLifeCycle.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultNfsSecondaryLifeCycle.java b/platform/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultNfsSecondaryLifeCycle.java
deleted file mode 100644
index d31935e..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultNfsSecondaryLifeCycle.java
+++ /dev/null
@@ -1,54 +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.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.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/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultPrimaryDataStoreLifeCycle.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultPrimaryDataStoreLifeCycle.java b/platform/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultPrimaryDataStoreLifeCycle.java
deleted file mode 100644
index dbf8589..0000000
--- a/platform/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.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreDriver;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreEndPoint;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreEndPointSelector;
-import org.apache.cloudstack.platform.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
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManager.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManager.java b/platform/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManager.java
deleted file mode 100644
index f8388c9..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManager.java
+++ /dev/null
@@ -1,39 +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.manager;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataObjectBackupStorageOperationState;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-
-import com.cloud.storage.Snapshot;
-import com.cloud.storage.Volume;
-import com.cloud.template.VirtualMachineTemplate;
-import com.cloud.utils.fsm.NoTransitionException;
-
-public interface BackupStorageManager {
- boolean contains(Volume vol);
- boolean contains(Snapshot snapshot);
- boolean contains(VirtualMachineTemplate template);
-
- DataStore getBackupDataStore(Volume vol);
- DataStore getBackupDataStore(Snapshot snapshot);
- DataStore getBackupDataStore(VirtualMachineTemplate template);
-
- boolean updateOperationState(Volume vol, DataObjectBackupStorageOperationState.Event event) throws NoTransitionException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManagerImpl.java b/platform/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManagerImpl.java
deleted file mode 100644
index 500763c..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManagerImpl.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.manager;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataObjectBackupStorageOperationState.Event;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-
-import com.cloud.storage.Snapshot;
-import com.cloud.storage.Volume;
-import com.cloud.template.VirtualMachineTemplate;
-import com.cloud.utils.fsm.NoTransitionException;
-
-public class BackupStorageManagerImpl implements BackupStorageManager {
-
- public boolean contains(Volume vol) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean contains(Snapshot snapshot) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean contains(VirtualMachineTemplate template) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public DataStore getBackupDataStore(Volume vol) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataStore getBackupDataStore(Snapshot snapshot) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataStore getBackupDataStore(VirtualMachineTemplate template) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean updateOperationState(Volume vol, Event event) throws NoTransitionException {
- // TODO Auto-generated method stub
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManager.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManager.java b/platform/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManager.java
deleted file mode 100644
index 6292ab8..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManager.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.storage.manager;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.storage.StoragePool;
-
-public interface PrimaryDataStoreManager {
- PrimaryDataStore addDataStore(long zoneId, long podId, long clusterId, long hostId,
- String URI,
- String storageType,
- String poolName,
- String storageProviderName,
- Map<String, String> params);
- void deleteStoragePool(long poolId);
- void enableStoragePool(long poolId);
- void disableStoragePool(long poolId);
- Map<String, List<String>> getSupportedPrimaryStorages(long zoneId, HypervisorType hypervisor);
- Map<String, List<String>> getSupportedSecondaryStorages(long zoneId);
- PrimaryDataStore getDataStore(String id);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManagerImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManagerImpl.java b/platform/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManagerImpl.java
deleted file mode 100644
index 2cae6a8..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManagerImpl.java
+++ /dev/null
@@ -1,142 +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.manager;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore.StoreType;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreLifeCycle;
-import org.apache.cloudstack.platform.subsystem.api.storage.StorageProvider;
-import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
-
-import com.cloud.dc.ClusterVO;
-import com.cloud.dc.DataCenterVO;
-import com.cloud.dc.dao.ClusterDao;
-import com.cloud.dc.dao.DataCenterDao;
-import com.cloud.dc.dao.HostPodDao;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.storage.StoragePool;
-import com.cloud.storage.StoragePoolStatus;
-import com.cloud.storage.StoragePoolVO;
-import com.cloud.storage.dao.StoragePoolDao;
-import com.cloud.utils.component.Adapters;
-import com.cloud.utils.component.Inject;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-public class PrimaryDataStoreManagerImpl implements PrimaryDataStoreManager {
- @Inject(adapter = StorageProvider.class)
- protected Adapters<StorageProvider> _storageProviders;
- @Inject
- protected DataCenterDao _dcDao;
- @Inject
- protected HostPodDao _podDao;
- @Inject
- protected ClusterDao _clusterDao;
- @Inject
- protected StoragePoolDao _storagePoolDao;
-
- public void deleteStoragePool(long poolId) {
- StoragePool spool = _storagePoolDao.findById(poolId);
- StorageProvider sp = findStorageProvider(spool.getStorageProvider());
- DataStore ds = sp.getDataStore(spool);
- DataStoreLifeCycle dslc = ds.getLifeCycle();
- dslc.delete();
- }
-
- public void enableStoragePool(long poolId) {
- // TODO Auto-generated method stub
-
- }
-
- public void disableStoragePool(long poolId) {
- // TODO Auto-generated method stub
-
- }
-
- public Map<String, List<String>> getSupportedPrimaryStorages(long zoneId, HypervisorType hypervisor) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Map<String, List<String>> getSupportedSecondaryStorages(long zoneId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- protected StorageProvider findStorageProvider(String name) {
- Iterator<StorageProvider> spIter = _storageProviders.iterator();
- StorageProvider sp = null;
- while (spIter.hasNext()) {
- sp = spIter.next();
- if (sp.getProviderName().equalsIgnoreCase(name)) {
- break;
- }
- }
-
- return sp;
- }
-
- public StoragePool addStoragePool(long zoneId, long podId, long clusterId, long hostId, String URI, String storageType, String poolName, String storageProviderName, Map<String, String> params) {
- StoragePoolVO spool = new StoragePoolVO();
- long poolId = _storagePoolDao.getNextInSequence(Long.class, "id");
- spool.setId(poolId);
- spool.setDataCenterId(zoneId);
- spool.setPodId(podId);
- spool.setName(poolName);
- spool.setClusterId(clusterId);
- spool.setStorageProvider(storageProviderName);
- spool.setStorageType(storageType);
- spool.setStatus(StoragePoolStatus.Creating);
- spool = _storagePoolDao.persist(spool);
-
- StorageProvider sp = findStorageProvider(storageProviderName);
- DataStore ds = sp.addDataStore((StoragePool)spool, URI, params);
-
- DataStoreLifeCycle dslc = ds.getLifeCycle();
- try {
- dslc.add();
- } catch (CloudRuntimeException e) {
- _storagePoolDao.remove(spool.getId());
- throw e;
- }
-
- spool.setPath(ds.getURI());
- spool.setUuid(ds.getUUID());
- spool.setStatus(StoragePoolStatus.Up);
- _storagePoolDao.update(spool.getId(), spool);
- spool = _storagePoolDao.findById(spool.getId());
- return spool;
- }
-
- @Override
- public PrimaryDataStore addDataStore(long zoneId, long podId, long clusterId, long hostId, String URI, String storageType, String poolName, String storageProviderName, Map<String, String> params) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public PrimaryDataStore getDataStore(String id) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManager.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManager.java b/platform/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManager.java
deleted file mode 100644
index cc9136e..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManager.java
+++ /dev/null
@@ -1,34 +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.manager;
-
-import java.util.List;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-
-import com.cloud.storage.Snapshot;
-import com.cloud.storage.Volume;
-import com.cloud.template.VirtualMachineTemplate;
-
-public interface SecondaryStorageManager {
- DataStore getStore(Volume volume);
- DataStore getImageStore(DataStore destStore);
- List<DataStore> getImageStores(long zoneId);
- DataStore getStore(Snapshot snapshot);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManagerImpl.java b/platform/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManagerImpl.java
deleted file mode 100644
index dd4ed68..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManagerImpl.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.manager;
-
-import java.util.List;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-
-import com.cloud.storage.Snapshot;
-import com.cloud.storage.Volume;
-import com.cloud.storage.dao.VMTemplateZoneDao;
-import com.cloud.utils.component.Inject;
-
-public class SecondaryStorageManagerImpl implements SecondaryStorageManager {
- public DataStore getStore(Volume volume) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataStore getImageStore(DataStore destStore) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<DataStore> getImageStores() {
-
- return null;
- }
-
- public DataStore getStore(Snapshot snapshot) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<DataStore> getImageStores(long zoneId) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/provider/DefaultNfsSecondaryStorageProvider.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/provider/DefaultNfsSecondaryStorageProvider.java b/platform/storage/src/org/apache/cloudstack/storage/provider/DefaultNfsSecondaryStorageProvider.java
deleted file mode 100644
index 484b485..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/provider/DefaultNfsSecondaryStorageProvider.java
+++ /dev/null
@@ -1,131 +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.provider;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreConfigurator;
-import org.apache.cloudstack.platform.subsystem.api.storage.StorageProvider;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore.StoreType;
-import org.apache.cloudstack.storage.datastoreconfigurator.NfsSecondaryStorageConfigurator;
-import org.apache.cloudstack.storage.datastoreconfigurator.XenNfsDataStoreConfigurator;
-
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.hypervisor.Hypervisor;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.storage.StoragePool;
-
-public class DefaultNfsSecondaryStorageProvider implements StorageProvider {
- private String _name = DefaultPrimaryStorageProvider.class.toString();
- protected Map<HypervisorType, Map<String, DataStoreConfigurator>> _supportedProtocols;
- public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
- Map<String, DataStoreConfigurator> dscs = new HashMap<String, DataStoreConfigurator>();
- DataStoreConfigurator nfsdc = new NfsSecondaryStorageConfigurator();
- dscs.put(nfsdc.getProtocol(), nfsdc);
-
- _supportedProtocols.put(HypervisorType.XenServer, dscs);
- _supportedProtocols.put(HypervisorType.KVM, dscs);
- _supportedProtocols.put(HypervisorType.VMware, dscs);
- _supportedProtocols.put(HypervisorType.Ovm, dscs);
- return true;
- }
-
- public String getName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean start() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean stop() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public List<HypervisorType> supportedHypervisors() {
- List<HypervisorType> hypervisors = new ArrayList<HypervisorType>();
- Set<HypervisorType> hyps = _supportedProtocols.keySet();
-
- for (HypervisorType hy : hyps) {
- hypervisors.add(hy);
- }
-
- return hypervisors;
- }
-
- public String getProviderName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void configure(Map<String, String> storeProviderInfo) {
- // TODO Auto-generated method stub
-
- }
-
- public DataStore addDataStore(StoragePool sp, String url, Map<String, String> params) {
- URI uri;
- try {
- uri = new URI(url);
- } catch (URISyntaxException e) {
- throw new InvalidParameterValueException("invalide url" + url);
- }
-
- String protocol = uri.getScheme();
- if (protocol == null) {
- throw new InvalidParameterValueException("the protocol can't be null");
- }
-
- DataStoreConfigurator dscf = _supportedProtocols.get(HypervisorType.XenServer).get(protocol);
- Map<String, String> configs = dscf.getConfigs(uri, params);
- dscf.validate(configs);
- DataStore ds = dscf.getDataStore(sp);
- return ds;
- }
-
- public DataStore getDataStore(StoragePool pool) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Map<HypervisorType, Map<String, DataStoreConfigurator>> getDataStoreConfigs() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<StoreType> supportedStoreTypes() {
- List<StoreType> types = new ArrayList<StoreType>();
- types.add(StoreType.Image);
- types.add(StoreType.Backup);
- return types;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/provider/DefaultPrimaryStorageProvider.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/provider/DefaultPrimaryStorageProvider.java b/platform/storage/src/org/apache/cloudstack/storage/provider/DefaultPrimaryStorageProvider.java
deleted file mode 100644
index a5579d0..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/provider/DefaultPrimaryStorageProvider.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package org.apache.cloudstack.storage.provider;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreConfigurator;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreLifeCycle;
-import org.apache.cloudstack.platform.subsystem.api.storage.StorageProvider;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore.StoreType;
-import org.apache.cloudstack.storage.datastoreconfigurator.NfsDataStoreConfigurator;
-import org.apache.cloudstack.storage.datastoreconfigurator.XenNfsDataStoreConfigurator;
-
-import com.cloud.dc.ClusterVO;
-import com.cloud.dc.DataCenterVO;
-import com.cloud.dc.HostPodVO;
-import com.cloud.dc.dao.ClusterDao;
-import com.cloud.dc.dao.DataCenterDao;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.hypervisor.Hypervisor;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.storage.StoragePool;
-import com.cloud.storage.StoragePoolStatus;
-import com.cloud.storage.StoragePoolVO;
-import com.cloud.storage.dao.StoragePoolDao;
-import com.cloud.utils.component.Inject;
-
-public class DefaultPrimaryStorageProvider implements StorageProvider {
- private String _name = DefaultPrimaryStorageProvider.class.toString();
- static Map<HypervisorType, Map<String, DataStoreConfigurator>> _supportedProtocols;
- @Inject
- protected ClusterDao _clusterDao;
-
- public List<HypervisorType> supportedHypervisors() {
- List<HypervisorType> hypervisors = new ArrayList<HypervisorType>();
- hypervisors.add(Hypervisor.HypervisorType.XenServer);
- return hypervisors;
- }
-
- public DefaultPrimaryStorageProvider() {
- Map<String, DataStoreConfigurator> dscs = new HashMap<String, DataStoreConfigurator>();
- DataStoreConfigurator nfsdc = new XenNfsDataStoreConfigurator();
- dscs.put(nfsdc.getProtocol(), nfsdc);
-
- _supportedProtocols.put(HypervisorType.XenServer, dscs);
- }
-
- public List<StoreType> supportedStoreType() {
- List<StoreType> type = new ArrayList<StoreType>();
- type.add(StoreType.Primary);
- return type;
- }
-
- public void configure(Map<String, String> storeProviderInfo) {
- // TODO Auto-generated method stub
-
- }
-
- public Map<HypervisorType, Map<String,DataStoreConfigurator>> getDataStoreConfigs() {
- return _supportedProtocols;
- }
-
- public String getProviderName() {
- return _name;
- }
-
- public DataStore createDataStore(HypervisorType hypervisor,
- DataStoreConfigurator dsc) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataStore getDataStore(StoragePool pool) {
- ClusterVO clu = _clusterDao.findById(pool.getClusterId());
- HypervisorType hy = clu.getHypervisorType();
- Map<String, DataStoreConfigurator> dscs = _supportedProtocols.get(hy);
- DataStoreConfigurator dsc = dscs.get(pool.getPoolType().toString());
- return dsc.getDataStore(pool);
- }
-
- public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
- // TODO Auto-generated method stub
- return false;
- }
-
- public String getName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean start() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean stop() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public DataStore addDataStore(StoragePool spool, String url, Map<String, String> params) {
- URI uri;
- try {
- uri = new URI(url);
- } catch (URISyntaxException e) {
- throw new InvalidParameterValueException("invalide url" + url);
- }
-
- String protocol = uri.getScheme();
- if (protocol == null) {
- throw new InvalidParameterValueException("the protocol can't be null");
- }
-
- ClusterVO cluster = _clusterDao.findById(spool.getClusterId());
-
- Map<String, DataStoreConfigurator> dscs = _supportedProtocols.get(cluster.getHypervisorType());
- if (dscs.isEmpty()) {
- throw new InvalidParameterValueException("Doesn't support this hypervisor");
- }
-
- DataStoreConfigurator dsc = dscs.get(protocol);
- if (dsc == null) {
- throw new InvalidParameterValueException("Doesn't support this protocol");
- }
-
- Map<String, String> configs = dsc.getConfigs(uri, params);
- dsc.validate(configs);
- DataStore ds = dsc.getDataStore(spool);
-
- return ds;
- }
-
- public List<StoreType> supportedStoreTypes() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/provider/HttpImageStoreProvider.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/provider/HttpImageStoreProvider.java b/platform/storage/src/org/apache/cloudstack/storage/provider/HttpImageStoreProvider.java
deleted file mode 100644
index c98320b..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/provider/HttpImageStoreProvider.java
+++ /dev/null
@@ -1,91 +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.provider;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreConfigurator;
-import org.apache.cloudstack.platform.subsystem.api.storage.StorageProvider;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore.StoreType;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.storage.StoragePool;
-
-public class HttpImageStoreProvider implements StorageProvider {
-
- public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
- // TODO Auto-generated method stub
- return false;
- }
-
- public String getName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean start() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean stop() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public List<HypervisorType> supportedHypervisors() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getProviderName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<StoreType> supportedStoreTypes() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void configure(Map<String, String> storeProviderInfo) {
- // TODO Auto-generated method stub
-
- }
-
- public DataStore addDataStore(StoragePool sp, String uri, Map<String, String> params) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataStore getDataStore(StoragePool pool) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Map<HypervisorType, Map<String, DataStoreConfigurator>> getDataStoreConfigs() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/provider/S3SecondaryStorageProvider.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/provider/S3SecondaryStorageProvider.java b/platform/storage/src/org/apache/cloudstack/storage/provider/S3SecondaryStorageProvider.java
deleted file mode 100644
index d5c15b3..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/provider/S3SecondaryStorageProvider.java
+++ /dev/null
@@ -1,91 +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.provider;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreConfigurator;
-import org.apache.cloudstack.platform.subsystem.api.storage.StorageProvider;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore.StoreType;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.storage.StoragePool;
-
-public class S3SecondaryStorageProvider implements StorageProvider {
-
- public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
- // TODO Auto-generated method stub
- return false;
- }
-
- public String getName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean start() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean stop() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public List<HypervisorType> supportedHypervisors() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getProviderName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<StoreType> supportedStoreTypes() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void configure(Map<String, String> storeProviderInfo) {
- // TODO Auto-generated method stub
-
- }
-
- public DataStore addDataStore(StoragePool sp, String uri, Map<String, String> params) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataStore getDataStore(StoragePool pool) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Map<HypervisorType, Map<String, DataStoreConfigurator>> getDataStoreConfigs() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/provider/SwiftSecondaryStorageProvider.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/provider/SwiftSecondaryStorageProvider.java b/platform/storage/src/org/apache/cloudstack/storage/provider/SwiftSecondaryStorageProvider.java
deleted file mode 100644
index 75bf74c..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/provider/SwiftSecondaryStorageProvider.java
+++ /dev/null
@@ -1,91 +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.provider;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreConfigurator;
-import org.apache.cloudstack.platform.subsystem.api.storage.StorageProvider;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore.StoreType;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.storage.StoragePool;
-
-public class SwiftSecondaryStorageProvider implements StorageProvider {
-
- public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
- // TODO Auto-generated method stub
- return false;
- }
-
- public String getName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean start() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean stop() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public List<HypervisorType> supportedHypervisors() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getProviderName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<StoreType> supportedStoreTypes() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void configure(Map<String, String> storeProviderInfo) {
- // TODO Auto-generated method stub
-
- }
-
- public DataStore addDataStore(StoragePool sp, String uri, Map<String, String> params) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataStore getDataStore(StoragePool pool) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Map<HypervisorType, Map<String, DataStoreConfigurator>> getDataStoreConfigs() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java b/platform/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java
deleted file mode 100644
index 6adab00..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java
+++ /dev/null
@@ -1,24 +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.snapshot;
-
-public interface SnapshotService {
- long takeSnapshot(long volumeId);
- boolean deleteSnapshot(long snapshotId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/strategy/DefaultTemplateStratey.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/strategy/DefaultTemplateStratey.java b/platform/storage/src/org/apache/cloudstack/storage/strategy/DefaultTemplateStratey.java
deleted file mode 100644
index 2c6eaa3..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/strategy/DefaultTemplateStratey.java
+++ /dev/null
@@ -1,191 +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.strategy;
-
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreDriver;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreEndPoint;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreEndPointSelector;
-import org.apache.cloudstack.platform.subsystem.api.storage.StorageEvent;
-import org.apache.cloudstack.platform.subsystem.api.storage.StorageProvider;
-import org.apache.cloudstack.platform.subsystem.api.storage.TemplateProfile;
-import org.apache.cloudstack.platform.subsystem.api.storage.TemplateStrategy;
-import org.apache.cloudstack.storage.image.ImageManager;
-import org.apache.log4j.Logger;
-
-import com.cloud.agent.api.storage.DownloadCommand.Proxy;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.storage.VMTemplateHostVO;
-import com.cloud.storage.VMTemplateStoragePoolVO;
-import com.cloud.storage.VMTemplateStorageResourceAssoc;
-import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
-import com.cloud.storage.dao.VMTemplateHostDao;
-import com.cloud.storage.dao.VMTemplatePoolDao;
-import com.cloud.utils.component.Inject;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-public class DefaultTemplateStratey implements TemplateStrategy {
- private static final Logger s_logger = Logger.getLogger(DefaultTemplateStratey.class);
- protected DataStore _ds;
- protected DataStoreDriver _driver;
- protected int _primaryStorageDownloadWait;
- protected int _installTries = 3;
- protected int _storagePoolMaxWaitSeconds = 3600;
- @Inject
- VMTemplatePoolDao _templatePoolDao;
- @Inject
- VMTemplateHostDao _templateImageStoreDao;
- @Inject
- ImageManager _templateMgr;
-
- public DefaultTemplateStratey(DataStore ds) {
- _ds = ds;
- }
-
- public TemplateProfile get(long templateId) {
- return _templateMgr.getProfile(templateId);
- }
-
- public TemplateProfile install(TemplateProfile tp) {
- DataStoreEndPointSelector dseps = _ds.getEndPointSelector();
- List<DataStoreEndPoint> eps = dseps.getEndPoints(StorageEvent.DownloadTemplateToPrimary);
- int tries = Math.min(eps.size(), _installTries);
-
- VMTemplateStoragePoolVO templateStoragePoolRef = _templatePoolDao.acquireInLockTable(tp.getTemplatePoolRefId(), _storagePoolMaxWaitSeconds);
- if (templateStoragePoolRef == null) {
- throw new CloudRuntimeException("Unable to acquire lock on VMTemplateStoragePool: " + tp.getTemplatePoolRefId());
- }
-
- try {
- for (int retry = 0; retry < tries; retry++) {
- Collections.shuffle(eps);
- DataStoreEndPoint ep = eps.get(0);
- try {
- tp = _driver.install(tp, ep);
- templateStoragePoolRef.setDownloadPercent(100);
- templateStoragePoolRef.setDownloadState(Status.DOWNLOADED);
- templateStoragePoolRef.setLocalDownloadPath(tp.getLocalPath());
- templateStoragePoolRef.setInstallPath(tp.getLocalPath());
- templateStoragePoolRef.setTemplateSize(tp.getSize());
- _templatePoolDao.update(templateStoragePoolRef.getId(), templateStoragePoolRef);
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Template " + tp.getTemplateId() + " is installed via " + ep.getHostId());
- }
- return get(tp.getTemplateId());
- } catch (CloudRuntimeException e) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Template " + tp.getTemplateId() + " download to pool " + _ds.getId() + " failed due to " + e.toString());
- }
- }
- }
- } finally {
- _templatePoolDao.releaseFromLockTable(tp.getTemplatePoolRefId());
- }
-
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Template " + tp.getTemplateId() + " is not found on and can not be downloaded to pool " + _ds.getId());
- }
- return null;
- }
-
- public TemplateProfile register(TemplateProfile tp) {
-
- VMTemplateHostVO vmTemplateHost = _templateImageStoreDao.findByHostTemplate(_ds.getId(), tp.getTemplateId());
- if (vmTemplateHost == null) {
- vmTemplateHost = new VMTemplateHostVO(_ds.getId(), tp.getTemplateId(), new Date(), 0, VMTemplateStorageResourceAssoc.Status.NOT_DOWNLOADED, null, null, "jobid0000", null, tp.getUrl());
- _templateImageStoreDao.persist(vmTemplateHost);
- }
-
- DataStoreEndPointSelector dseps = _ds.getEndPointSelector();
- List<DataStoreEndPoint> eps = dseps.getEndPoints(StorageEvent.RegisterTemplate);
-
- Collections.shuffle(eps);
- DataStoreEndPoint ep = eps.get(0);
- _driver.register(tp, ep);
-
- return null;
- }
-
- protected boolean checkHypervisor(HypervisorType hypervisor) {
- StorageProvider sp = _ds.getProvider();
- List<HypervisorType> spHys = sp.supportedHypervisors();
- boolean checkHypervisor = false;
- for (HypervisorType hy : spHys) {
- if (hy == hypervisor) {
- checkHypervisor = true;
- }
- }
- return checkHypervisor;
- }
-
- protected boolean checkFormat(String url, String format) {
- if ((!url.toLowerCase().endsWith("vhd")) && (!url.toLowerCase().endsWith("vhd.zip")) && (!url.toLowerCase().endsWith("vhd.bz2")) && (!url.toLowerCase().endsWith("vhd.gz"))
- && (!url.toLowerCase().endsWith("qcow2")) && (!url.toLowerCase().endsWith("qcow2.zip")) && (!url.toLowerCase().endsWith("qcow2.bz2")) && (!url.toLowerCase().endsWith("qcow2.gz"))
- && (!url.toLowerCase().endsWith("ova")) && (!url.toLowerCase().endsWith("ova.zip")) && (!url.toLowerCase().endsWith("ova.bz2")) && (!url.toLowerCase().endsWith("ova.gz"))
- && (!url.toLowerCase().endsWith("img")) && (!url.toLowerCase().endsWith("raw"))) {
- throw new InvalidParameterValueException("Please specify a valid " + format.toLowerCase());
- }
-
- if ((format.equalsIgnoreCase("vhd") && (!url.toLowerCase().endsWith("vhd") && !url.toLowerCase().endsWith("vhd.zip") && !url.toLowerCase().endsWith("vhd.bz2") && !url.toLowerCase().endsWith(
- "vhd.gz")))
- || (format.equalsIgnoreCase("qcow2") && (!url.toLowerCase().endsWith("qcow2") && !url.toLowerCase().endsWith("qcow2.zip") && !url.toLowerCase().endsWith("qcow2.bz2") && !url
- .toLowerCase().endsWith("qcow2.gz")))
- || (format.equalsIgnoreCase("ova") && (!url.toLowerCase().endsWith("ova") && !url.toLowerCase().endsWith("ova.zip") && !url.toLowerCase().endsWith("ova.bz2") && !url.toLowerCase()
- .endsWith("ova.gz"))) || (format.equalsIgnoreCase("raw") && (!url.toLowerCase().endsWith("img") && !url.toLowerCase().endsWith("raw")))) {
- throw new InvalidParameterValueException("Please specify a valid URL. URL:" + url + " is an invalid for the format " + format.toLowerCase());
- }
- return true;
- }
-
- public boolean canRegister(long templateId) {
- TemplateProfile tp = get(templateId);
-
- if (!checkHypervisor(tp.getHypervisorType())) {
- return false;
- }
-
- if (!checkFormat(tp.getUrl(), tp.getFormat().toString())) {
- return false;
- }
-
- return true;
- }
-
- public int getDownloadWait() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public long getMaxTemplateSizeInBytes() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public Proxy getHttpProxy() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/strategy/DefaultVolumeStrategy.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/strategy/DefaultVolumeStrategy.java b/platform/storage/src/org/apache/cloudstack/storage/strategy/DefaultVolumeStrategy.java
deleted file mode 100644
index 35e284f..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/strategy/DefaultVolumeStrategy.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.apache.cloudstack.storage.strategy;
-
-import java.util.List;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreDriver;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreEndPoint;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreEndPointSelector;
-import org.apache.cloudstack.platform.subsystem.api.storage.SnapshotProfile;
-import org.apache.cloudstack.platform.subsystem.api.storage.StorageEvent;
-import org.apache.cloudstack.platform.subsystem.api.storage.TemplateProfile;
-import org.apache.cloudstack.platform.subsystem.api.storage.VolumeProfile;
-import org.apache.cloudstack.platform.subsystem.api.storage.VolumeStrategy;
-import org.apache.cloudstack.storage.volume.VolumeManager;
-
-import org.apache.log4j.Logger;
-
-
-import com.cloud.storage.Volume;
-import com.cloud.storage.VolumeVO;
-import com.cloud.utils.component.Inject;
-
-
-public class DefaultVolumeStrategy implements VolumeStrategy {
- private static final Logger s_logger = Logger.getLogger(DefaultVolumeStrategy.class);
- protected DataStore _ds;
- protected DataStoreDriver _driver;
- @Inject
- VolumeManager _volumeMgr;
-
- public VolumeProfile get(long volumeId) {
- return _volumeMgr.getProfile(volumeId);
- }
-
- public DefaultVolumeStrategy(DataStore ds) {
- _ds = ds;
- }
- public Volume createVolume(Volume vol) {
- // TODO Auto-generated method stub
- return null;
- }
- public Volume createDataVolume(Volume vol) {
- // TODO Auto-generated method stub
- return null;
- }
- public Volume copyVolumeFromBackup(VolumeProfile srcVol, Volume destVol) {
- // TODO Auto-generated method stub
- return null;
- }
- public Volume createVolumeFromSnapshot(SnapshotProfile snapshot, Volume vol) {
- // TODO Auto-generated method stub
- return null;
- }
- public Volume createVolumeFromTemplate(TemplateProfile template, Volume vol) {
- // TODO Auto-generated method stub
- return null;
- }
- public Volume migrateVolume(Volume srcVol, Volume destVol, DataStore destStore) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Volume createVolumeFromBaseTemplate(Volume volume, TemplateProfile tp) {
- DataStoreEndPointSelector dsep = _ds.getEndPointSelector();
- List<DataStoreEndPoint> dseps = dsep.getEndPoints(StorageEvent.CreateVolumeFromTemplate);
- DataStoreEndPoint dp = dseps.get(0);
-
- VolumeProfile vp = _driver.createVolumeFromTemplate(get(volume.getId()), tp, dp);
-
- VolumeVO vlvo = _volumeMgr.getVolume(volume.getId());
-
- vlvo.setFolder(_ds.getPath());
- vlvo.setPath(vp.getPath());
- vlvo.setSize(vp.getSize());
- vlvo.setPoolType(_ds.getPoolType());
- vlvo.setPoolId(_ds.getId());
- vlvo.setPodId(_ds.getPodId());
-
- return _volumeMgr.updateVolume(vlvo);
- }
- public boolean deleteVolume(Volume vol) {
- // TODO Auto-generated method stub
- return false;
- }
-
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/strategy/XenBackupStrategy.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/strategy/XenBackupStrategy.java b/platform/storage/src/org/apache/cloudstack/storage/strategy/XenBackupStrategy.java
deleted file mode 100644
index 5ac839d..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/strategy/XenBackupStrategy.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.apache.cloudstack.storage.strategy;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.BackupStrategy;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-
-public class XenBackupStrategy implements BackupStrategy {
- protected DataStore _ds;
- public XenBackupStrategy(DataStore ds) {
- _ds = ds;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/strategy/XenSnapshotStrategy.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/strategy/XenSnapshotStrategy.java b/platform/storage/src/org/apache/cloudstack/storage/strategy/XenSnapshotStrategy.java
deleted file mode 100644
index 1b93880..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/strategy/XenSnapshotStrategy.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.apache.cloudstack.storage.strategy;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.SnapshotStrategy;
-
-public class XenSnapshotStrategy implements SnapshotStrategy {
- protected DataStore _ds;
- public XenSnapshotStrategy(DataStore ds) {
- _ds = ds;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/volume/Volume.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/volume/Volume.java b/platform/storage/src/org/apache/cloudstack/storage/volume/Volume.java
deleted file mode 100644
index 35eaa3b..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/volume/Volume.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.apache.cloudstack.storage.volume;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
-import org.apache.cloudstack.storage.datastore.PrimaryDataStoreInfo;
-import org.apache.cloudstack.storage.volume.db.VolumeDao;
-import org.apache.cloudstack.storage.volume.db.VolumeVO;
-import org.apache.cloudstack.storage.volume.disktype.VolumeDiskType;
-import org.apache.cloudstack.storage.volume.disktype.VolumeDiskTypeHelper;
-import org.apache.cloudstack.storage.volume.type.VolumeType;
-import org.apache.cloudstack.storage.volume.type.VolumeTypeHelper;
-import org.apache.log4j.Logger;
-
-import com.cloud.utils.fsm.NoTransitionException;
-import com.cloud.utils.fsm.StateMachine2;
-
-public class Volume {
- private static final Logger s_logger = Logger.getLogger(Volume.class);
- protected VolumeVO volumeVO;
- private StateMachine2<VolumeState, VolumeEvent, VolumeVO> _volStateMachine;
- protected PrimaryDataStore dataStore;
- @Inject
- VolumeDiskTypeHelper diskTypeHelper;
- @Inject
- VolumeTypeHelper volumeTypeHelper;
- @Inject
- VolumeDao volumeDao;
-
- public Volume(PrimaryDataStore dataStore, VolumeVO volumeVO) {
- this.volumeVO = volumeVO;
- this.dataStore = dataStore;
- }
-
- public String getUuid() {
- return volumeVO.getUuid();
- }
-
- public void setUuid(String uuid) {
- volumeVO.setUuid(uuid);
- }
-
- public String getPath() {
- return volumeVO.getPath();
- }
-
- public String getTemplateUuid() {
- return null;
- }
-
- public String getTemplatePath() {
- return null;
- }
-
- public PrimaryDataStoreInfo getDataStoreInfo() {
- return dataStore.getDataStoreInfo();
- }
-
- public VolumeState getState() {
- return volumeVO.getState();
- }
-
- public PrimaryDataStore getDataStore() {
- return dataStore;
- }
-
- public long getSize() {
- return volumeVO.getSize();
- }
-
- public VolumeDiskType getDiskType() {
- return diskTypeHelper.getDiskType(volumeVO.getDiskType());
- }
-
- public VolumeType getType() {
- return volumeTypeHelper.getType(volumeVO.getVolumeType());
- }
-
- public long getVolumeId() {
- return volumeVO.getId();
- }
-
- public void setVolumeDiskType(VolumeDiskType type) {
- volumeVO.setDiskType(type.toString());
- }
-
- public boolean stateTransit(VolumeEvent event) {
- boolean result = false;
- try {
- result = _volStateMachine.transitTo(volumeVO, event, null, volumeDao);
- } catch (NoTransitionException e) {
- s_logger.debug("Failed to transit volume: " + this.getVolumeId() + ", due to: " + e.toString());
- }
- return result;
- }
-
- public void update() {
- volumeDao.update(volumeVO.getId(), volumeVO);
- volumeVO = volumeDao.findById(volumeVO.getId());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/volume/VolumeEvent.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/volume/VolumeEvent.java b/platform/storage/src/org/apache/cloudstack/storage/volume/VolumeEvent.java
deleted file mode 100644
index 33d1261..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/volume/VolumeEvent.java
+++ /dev/null
@@ -1,34 +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.volume;
-
-public enum VolumeEvent {
- CreateRequested,
- CopyRequested,
- CopySucceeded,
- CopyFailed,
- OperationFailed,
- OperationSucceeded,
- OperationRetry,
- UploadRequested,
- MigrationRequested,
- SnapshotRequested,
- DestroyRequested,
- ExpungingRequested;
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/volume/VolumeInfo.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/volume/VolumeInfo.java b/platform/storage/src/org/apache/cloudstack/storage/volume/VolumeInfo.java
deleted file mode 100644
index 0c6981a..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/volume/VolumeInfo.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.storage.volume;
-
-import org.apache.cloudstack.storage.datastore.PrimaryDataStoreInfo;
-import org.apache.cloudstack.storage.volume.disktype.VolumeDiskType;
-import org.apache.cloudstack.storage.volume.type.VolumeType;
-
-public class VolumeInfo {
- private long size;
- private String uuid;
- private String path;
- private PrimaryDataStoreInfo dataStoreInfo;
- private String baseTemplateUuid;
- private String baseTemplatePath;
- private VolumeType type;
- private VolumeDiskType diskType;
-
- public VolumeInfo(Volume volume) {
- this.size = volume.getSize();
- this.uuid = volume.getUuid();
- this.baseTemplatePath = volume.getTemplatePath();
- this.baseTemplateUuid = volume.getTemplateUuid();
- this.dataStoreInfo = volume.getDataStoreInfo();
- this.diskType = volume.getDiskType();
- this.type = volume.getType();
- }
-
- public long getSize() {
- return this.size;
- }
-
- public String getUuid() {
- return this.uuid;
- }
-
- public String getPath() {
- return this.path;
- }
-
- public PrimaryDataStoreInfo getDataStore() {
- return this.dataStoreInfo;
- }
-
- public String getTemplateUuid() {
- return this.baseTemplateUuid;
- }
-
- public String getTemplatePath() {
- return this.baseTemplatePath;
- }
-
- public VolumeType getType() {
- return this.type;
- }
-
- public VolumeDiskType getDiskType() {
- return this.diskType;
- }
-}