Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0E458D9E1 for ; Tue, 15 Jan 2013 02:57:12 +0000 (UTC) Received: (qmail 39827 invoked by uid 500); 15 Jan 2013 02:57:11 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 39776 invoked by uid 500); 15 Jan 2013 02:57:11 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 39512 invoked by uid 99); 15 Jan 2013 02:57:10 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jan 2013 02:57:10 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 297B61D762; Tue, 15 Jan 2013 02:57:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: edison@apache.org To: cloudstack-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [3/7] refactor api, based on suggestion from community Message-Id: <20130115025710.297B61D762@tyr.zones.apache.org> Date: Tue, 15 Jan 2013 02:57:10 +0000 (UTC) http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmCLVMConfigurator.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmCLVMConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmCLVMConfigurator.java deleted file mode 100644 index f0b581f..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmCLVMConfigurator.java +++ /dev/null @@ -1,47 +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.datastore.configurator.kvm; - -import org.apache.cloudstack.storage.datastore.configurator.validator.CLVMProtocolTransformer; -import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -@Component -@Qualifier("defaultProvider") -public class KvmCLVMConfigurator extends AbstractKvmConfigurator { - - @Override - public String getSupportedDataStoreType() { - return "clvm"; - } - - @Override - public StorageProtocolTransformer getProtocolTransformer() { - return new CLVMProtocolTransformer(); - } - - @Override - protected boolean isLocalStorageSupported() { - // TODO Auto-generated method stub - return false; - } - - -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmNfsConfigurator.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmNfsConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmNfsConfigurator.java deleted file mode 100644 index 1c36f15..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmNfsConfigurator.java +++ /dev/null @@ -1,51 +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.datastore.configurator.kvm; - -import javax.inject.Inject; - -import org.apache.cloudstack.storage.datastore.configurator.validator.NfsProtocolTransformer; -import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer; -import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - - -@Component -@Qualifier("defaultProvider") -public class KvmNfsConfigurator extends AbstractKvmConfigurator { - @Inject - PrimaryDataStoreDao dataStoreDao; - - @Override - public String getSupportedDataStoreType() { - return "nfs"; - } - - @Override - public StorageProtocolTransformer getProtocolTransformer() { - return new NfsProtocolTransformer(dataStoreDao); - } - - @Override - protected boolean isLocalStorageSupported() { - // TODO Auto-generated method stub - return false; - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmRBDConfigurator.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmRBDConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmRBDConfigurator.java deleted file mode 100644 index a644239..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmRBDConfigurator.java +++ /dev/null @@ -1,46 +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.datastore.configurator.kvm; - -import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer; -import org.apache.cloudstack.storage.datastore.configurator.validator.RBDValidator; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -import com.cloud.storage.Storage.StoragePoolType; - -@Component -@Qualifier("defaultProvider") -public class KvmRBDConfigurator extends AbstractKvmConfigurator { - - public String getSupportedDataStoreType() { - return "rbd"; - } - - @Override - public StorageProtocolTransformer getProtocolTransformer() { - return new RBDValidator(); - } - - @Override - protected boolean isLocalStorageSupported() { - // TODO Auto-generated method stub - return false; - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/CLVMProtocolTransformer.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/CLVMProtocolTransformer.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/CLVMProtocolTransformer.java deleted file mode 100644 index 4dd19d2..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/CLVMProtocolTransformer.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.datastore.configurator.validator; - -import java.util.List; -import java.util.Map; - -import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; -import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; -import org.apache.cloudstack.storage.to.VolumeTO; - -public class CLVMProtocolTransformer implements StorageProtocolTransformer { - - @Override - public boolean normalizeUserInput(Map params) { - // TODO Auto-generated method stub - return false; - } - - @Override - public List getInputParamNames() { - // TODO Auto-generated method stub - return null; - } - - @Override - public PrimaryDataStoreTO getDataStoreTO(PrimaryDataStoreInfo dataStore) { - // TODO Auto-generated method stub - return null; - } - - @Override - public VolumeTO getVolumeTO(VolumeInfo volume) { - // TODO Auto-generated method stub - return null; - } - - -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/FileSystemValidator.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/FileSystemValidator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/FileSystemValidator.java deleted file mode 100644 index 8e1180e..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/FileSystemValidator.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.datastore.configurator.validator; - -import java.util.List; -import java.util.Map; - -import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; -import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; -import org.apache.cloudstack.storage.to.VolumeTO; - -public class FileSystemValidator implements StorageProtocolTransformer { - - @Override - public boolean normalizeUserInput(Map params) { - // TODO Auto-generated method stub - return false; - } - - @Override - public List getInputParamNames() { - // TODO Auto-generated method stub - return null; - } - - @Override - public PrimaryDataStoreTO getDataStoreTO(PrimaryDataStoreInfo dataStore) { - // TODO Auto-generated method stub - return null; - } - - @Override - public VolumeTO getVolumeTO(VolumeInfo volume) { - // TODO Auto-generated method stub - return null; - } - - -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/ISCSIProtocolTransformer.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/ISCSIProtocolTransformer.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/ISCSIProtocolTransformer.java deleted file mode 100644 index 44bdba9..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/ISCSIProtocolTransformer.java +++ /dev/null @@ -1,55 +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.datastore.configurator.validator; - -import java.util.List; -import java.util.Map; - -import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; -import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; -import org.apache.cloudstack.storage.to.VolumeTO; - -public class ISCSIProtocolTransformer implements StorageProtocolTransformer { - - @Override - public List getInputParamNames() { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean normalizeUserInput(Map params) { - // TODO Auto-generated method stub - return false; - } - - @Override - public PrimaryDataStoreTO getDataStoreTO(PrimaryDataStoreInfo dataStore) { - // TODO Auto-generated method stub - return null; - } - - @Override - public VolumeTO getVolumeTO(VolumeInfo volume) { - // TODO Auto-generated method stub - return null; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/NfsProtocolTransformer.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/NfsProtocolTransformer.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/NfsProtocolTransformer.java deleted file mode 100644 index 67ec5e8..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/NfsProtocolTransformer.java +++ /dev/null @@ -1,96 +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.datastore.configurator.validator; - -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; -import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; -import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreVO; -import org.apache.cloudstack.storage.to.NfsPrimaryDataStoreTO; -import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; -import org.apache.cloudstack.storage.to.VolumeTO; - -import com.cloud.utils.exception.CloudRuntimeException; - -public class NfsProtocolTransformer implements StorageProtocolTransformer { - private final PrimaryDataStoreDao dataStoreDao; - - public NfsProtocolTransformer(PrimaryDataStoreDao dao) { - this.dataStoreDao = dao; - } - - @Override - public boolean normalizeUserInput(Map params) { - String url = params.get("url"); - - try { - URI uri = new URI(url); - if (!"nfs".equalsIgnoreCase(uri.getScheme())) { - throw new CloudRuntimeException("invalid protocol, must starting with nfs"); - } - String storageHost = uri.getHost(); - String hostPath = uri.getPath(); - String userInfo = uri.getUserInfo(); - int port = uri.getPort(); - if (port == -1) { - port = 2049; - } - params.put("server", storageHost); - params.put("path", hostPath); - params.put("user", userInfo); - params.put("port", String.valueOf(port)); - params.put("uuid", UUID.nameUUIDFromBytes((storageHost + hostPath).getBytes()).toString()); - } catch (URISyntaxException e) { - throw new CloudRuntimeException("invalid url: " + e.toString()); - } - return true; - } - - @Override - public List getInputParamNames() { - List paramNames = new ArrayList(); - paramNames.add("server"); - paramNames.add("path"); - return paramNames; - } - - @Override - public PrimaryDataStoreTO getDataStoreTO(PrimaryDataStoreInfo dataStore) { - NfsPrimaryDataStoreTO dataStoreTO = new NfsPrimaryDataStoreTO(dataStore); - PrimaryDataStoreVO dataStoreVO = dataStoreDao.findById(dataStore.getId()); - dataStoreTO.setServer(dataStoreVO.getHostAddress()); - dataStoreTO.setPath(dataStoreVO.getPath()); - return dataStoreTO; - } - - @Override - public VolumeTO getVolumeTO(VolumeInfo volume) { - VolumeTO vol = new VolumeTO(volume); - vol.setDataStore(this.getDataStoreTO(volume.getDataStore())); - return vol; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/RBDValidator.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/RBDValidator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/RBDValidator.java deleted file mode 100644 index e18c861..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/RBDValidator.java +++ /dev/null @@ -1,55 +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.datastore.configurator.validator; - -import java.util.List; -import java.util.Map; - -import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; -import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; -import org.apache.cloudstack.storage.to.VolumeTO; - -public class RBDValidator implements StorageProtocolTransformer { - - @Override - public boolean normalizeUserInput(Map params) { - // TODO Auto-generated method stub - return false; - } - - @Override - public List getInputParamNames() { - // TODO Auto-generated method stub - return null; - } - - @Override - public PrimaryDataStoreTO getDataStoreTO(PrimaryDataStoreInfo dataStore) { - // TODO Auto-generated method stub - return null; - } - - @Override - public VolumeTO getVolumeTO(VolumeInfo volume) { - // TODO Auto-generated method stub - return null; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/StorageProtocolTransformer.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/StorageProtocolTransformer.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/StorageProtocolTransformer.java deleted file mode 100644 index ab9a613..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/StorageProtocolTransformer.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.datastore.configurator.validator; - -import java.util.List; -import java.util.Map; - -import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; -import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; -import org.apache.cloudstack.storage.to.VolumeTO; - -public interface StorageProtocolTransformer { - public boolean normalizeUserInput(Map params); - public PrimaryDataStoreTO getDataStoreTO(PrimaryDataStoreInfo dataStore); - public VolumeTO getVolumeTO(VolumeInfo volume); - public List getInputParamNames(); -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/VMFSValidator.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/VMFSValidator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/VMFSValidator.java deleted file mode 100644 index a0ae1f8..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/validator/VMFSValidator.java +++ /dev/null @@ -1,55 +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.datastore.configurator.validator; - -import java.util.List; -import java.util.Map; - -import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; -import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; -import org.apache.cloudstack.storage.to.VolumeTO; - -public class VMFSValidator implements StorageProtocolTransformer { - - @Override - public boolean normalizeUserInput(Map params) { - // TODO Auto-generated method stub - return false; - } - - @Override - public List getInputParamNames() { - // TODO Auto-generated method stub - return null; - } - - @Override - public PrimaryDataStoreTO getDataStoreTO(PrimaryDataStoreInfo dataStore) { - // TODO Auto-generated method stub - return null; - } - - @Override - public VolumeTO getVolumeTO(VolumeInfo volume) { - // TODO Auto-generated method stub - return null; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/AbstractVmwareConfigurator.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/AbstractVmwareConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/AbstractVmwareConfigurator.java deleted file mode 100644 index c688bd6..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/AbstractVmwareConfigurator.java +++ /dev/null @@ -1,49 +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.datastore.configurator.vmware; - -import javax.inject.Inject; - -import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle; -import org.apache.cloudstack.storage.datastore.configurator.AbstractPrimaryDataStoreConfigurator; -import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; -import org.apache.cloudstack.storage.datastore.driver.DefaultPrimaryDataStoreDriverImpl; -import org.apache.cloudstack.storage.datastore.driver.PrimaryDataStoreDriver; -import org.apache.cloudstack.storage.datastore.lifecycle.DefaultVmwarePrimaryDataStoreLifeCycle; -import com.cloud.hypervisor.Hypervisor.HypervisorType; - -public abstract class AbstractVmwareConfigurator extends AbstractPrimaryDataStoreConfigurator { - - @Inject - PrimaryDataStoreDao dataStoreDao; - @Override - public HypervisorType getSupportedHypervisor() { - return HypervisorType.VMware; - } - - @Override - protected PrimaryDataStoreLifeCycle getLifeCycle() { - return new DefaultVmwarePrimaryDataStoreLifeCycle(dataStoreDao); - } - - @Override - protected PrimaryDataStoreDriver getDriver() { - return new DefaultPrimaryDataStoreDriverImpl(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareIsciConfigurator.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareIsciConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareIsciConfigurator.java deleted file mode 100644 index 4e59656..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareIsciConfigurator.java +++ /dev/null @@ -1,45 +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.datastore.configurator.vmware; - -import org.apache.cloudstack.storage.datastore.configurator.validator.ISCSIProtocolTransformer; -import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -@Component -@Qualifier("defaultProvider") -public class VmwareIsciConfigurator extends AbstractVmwareConfigurator { - - public String getSupportedDataStoreType() { - return "iscsi"; - } - - @Override - public StorageProtocolTransformer getProtocolTransformer() { - return new ISCSIProtocolTransformer(); - } - - @Override - protected boolean isLocalStorageSupported() { - // TODO Auto-generated method stub - return false; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareNfsConfigurator.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareNfsConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareNfsConfigurator.java deleted file mode 100644 index afd8d21..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareNfsConfigurator.java +++ /dev/null @@ -1,49 +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.datastore.configurator.vmware; - -import javax.inject.Inject; - -import org.apache.cloudstack.storage.datastore.configurator.validator.NfsProtocolTransformer; -import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer; -import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -@Component -@Qualifier("defaultProvider") -public class VmwareNfsConfigurator extends AbstractVmwareConfigurator { - @Inject - PrimaryDataStoreDao dataStoreDao; - @Override - public String getSupportedDataStoreType() { - return "nfs"; - } - - @Override - public StorageProtocolTransformer getProtocolTransformer() { - return new NfsProtocolTransformer(dataStoreDao); - } - - @Override - protected boolean isLocalStorageSupported() { - // TODO Auto-generated method stub - return false; - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareVMFSConfigurator.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareVMFSConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareVMFSConfigurator.java deleted file mode 100644 index fc8738c..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareVMFSConfigurator.java +++ /dev/null @@ -1,47 +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.datastore.configurator.vmware; - -import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer; -import org.apache.cloudstack.storage.datastore.configurator.validator.VMFSValidator; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -import com.cloud.storage.Storage.StoragePoolType; - -@Component -@Qualifier("defaultProvider") -public class VmwareVMFSConfigurator extends AbstractVmwareConfigurator { - - @Override - public String getSupportedDataStoreType() { - return "vmfs"; - } - - @Override - public StorageProtocolTransformer getProtocolTransformer() { - return new VMFSValidator(); - } - - @Override - protected boolean isLocalStorageSupported() { - // TODO Auto-generated method stub - return false; - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/AbstractXenConfigurator.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/AbstractXenConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/AbstractXenConfigurator.java deleted file mode 100644 index 1181dea..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/AbstractXenConfigurator.java +++ /dev/null @@ -1,40 +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.datastore.configurator.xen; - -import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle; -import org.apache.cloudstack.storage.datastore.configurator.AbstractPrimaryDataStoreConfigurator; -import org.apache.cloudstack.storage.datastore.driver.DefaultPrimaryDataStoreDriverImpl; -import org.apache.cloudstack.storage.datastore.driver.PrimaryDataStoreDriver; -import org.apache.cloudstack.storage.datastore.lifecycle.DefaultXenPrimaryDataStoreLifeCycle; - -import com.cloud.hypervisor.Hypervisor.HypervisorType; - -public abstract class AbstractXenConfigurator extends AbstractPrimaryDataStoreConfigurator { - @Override - public HypervisorType getSupportedHypervisor() { - return HypervisorType.XenServer; - } - - protected PrimaryDataStoreLifeCycle getLifeCycle() { - return new DefaultXenPrimaryDataStoreLifeCycle(dataStoreDao); - } - - protected PrimaryDataStoreDriver getDriver() { - return new DefaultPrimaryDataStoreDriverImpl(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/XenIscsiConfigurator.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/XenIscsiConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/XenIscsiConfigurator.java deleted file mode 100644 index 1120ec2..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/XenIscsiConfigurator.java +++ /dev/null @@ -1,45 +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.datastore.configurator.xen; - -import org.apache.cloudstack.storage.datastore.configurator.validator.ISCSIProtocolTransformer; -import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -@Component -@Qualifier("defaultProvider") -public class XenIscsiConfigurator extends AbstractXenConfigurator { - - @Override - public String getSupportedDataStoreType() { - return "iscsi"; - } - - @Override - public StorageProtocolTransformer getProtocolTransformer() { - return new ISCSIProtocolTransformer(); - } - - protected boolean isLocalStorageSupported() { - // TODO Auto-generated method stub - return false; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/XenNfsConfigurator.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/XenNfsConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/XenNfsConfigurator.java deleted file mode 100644 index 0cb24a8..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/XenNfsConfigurator.java +++ /dev/null @@ -1,45 +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.datastore.configurator.xen; - -import org.apache.cloudstack.storage.datastore.configurator.validator.NfsProtocolTransformer; -import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer; -import org.apache.cloudstack.storage.datastore.protocol.DataStoreProtocol; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -@Component -@Qualifier("defaultProvider") -public class XenNfsConfigurator extends AbstractXenConfigurator { - @Override - public String getSupportedDataStoreType() { - return DataStoreProtocol.NFS.toString(); - } - - @Override - public StorageProtocolTransformer getProtocolTransformer() { - return new NfsProtocolTransformer(dataStoreDao); - } - - @Override - protected boolean isLocalStorageSupported() { - // TODO Auto-generated method stub - return false; - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java deleted file mode 100644 index 24a5c79..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java +++ /dev/null @@ -1,116 +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.datastore.db; - -import java.util.List; -import java.util.Map; - -import org.apache.cloudstack.storage.datastore.DataStoreStatus; - -import com.cloud.utils.db.GenericDao; - -public interface PrimaryDataStoreDao extends GenericDao { - - /** - * @param datacenterId - * -- the id of the datacenter (availability zone) - */ - List listByDataCenterId(long datacenterId); - - /** - * @param datacenterId - * -- the id of the datacenter (availability zone) - */ - List listBy(long datacenterId, long podId, Long clusterId); - - /** - * Set capacity of storage pool in bytes - * - * @param id - * pool id. - * @param capacity - * capacity in bytes - */ - void updateCapacity(long id, long capacity); - - /** - * Set available bytes of storage pool in bytes - * - * @param id - * pool id. - * @param available - * available capacity in bytes - */ - void updateAvailable(long id, long available); - - PrimaryDataStoreVO persist(PrimaryDataStoreVO pool, Map details); - - /** - * Find pool by name. - * - * @param name - * name of pool. - * @return the single StoragePoolVO - */ - List findPoolByName(String name); - - /** - * Find pools by the pod that matches the details. - * - * @param podId - * pod id to find the pools in. - * @param details - * details to match. All must match for the pool to be returned. - * @return List of StoragePoolVO - */ - List findPoolsByDetails(long dcId, long podId, Long clusterId, Map details); - - List findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared); - - /** - * Find pool by UUID. - * - * @param uuid - * uuid of pool. - * @return the single StoragePoolVO - */ - PrimaryDataStoreVO findPoolByUUID(String uuid); - - List listByStorageHost(String hostFqdnOrIp); - - PrimaryDataStoreVO findPoolByHostPath(long dcId, Long podId, String host, String path, String uuid); - - List listPoolByHostPath(String host, String path); - - void updateDetails(long poolId, Map details); - - Map getDetails(long poolId); - - List searchForStoragePoolDetails(long poolId, String value); - - List findIfDuplicatePoolsExistByUUID(String uuid); - - List listByStatus(DataStoreStatus status); - - long countPoolsByStatus(DataStoreStatus... statuses); - - List listByStatusInZone(long dcId, DataStoreStatus status); - - List listPoolsByCluster(long clusterId); -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java deleted file mode 100644 index ef42208..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java +++ /dev/null @@ -1,360 +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.datastore.db; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.inject.Inject; -import javax.naming.ConfigurationException; - -import org.apache.cloudstack.storage.datastore.DataStoreStatus; -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.DB; -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.GenericSearchBuilder; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; -import com.cloud.utils.db.SearchCriteria.Func; -import com.cloud.utils.db.SearchCriteria.Op; -import com.cloud.utils.db.Transaction; -import com.cloud.utils.exception.CloudRuntimeException; - -@Component -public class PrimaryDataStoreDaoImpl extends GenericDaoBase implements PrimaryDataStoreDao { - protected final SearchBuilder AllFieldSearch; - protected final SearchBuilder DcPodSearch; - protected final SearchBuilder DcPodAnyClusterSearch; - protected final SearchBuilder DeleteLvmSearch; - protected final GenericSearchBuilder StatusCountSearch; - - @Inject protected PrimaryDataStoreDetailsDao _detailsDao; - - private final String DetailsSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_details ON storage_pool.id = storage_pool_details.pool_id WHERE storage_pool.removed is null and storage_pool.data_center_id = ? and (storage_pool.pod_id = ? or storage_pool.pod_id is null) and ("; - private final String DetailsSqlSuffix = ") GROUP BY storage_pool_details.pool_id HAVING COUNT(storage_pool_details.name) >= ?"; - private final String FindPoolTagDetails = "SELECT storage_pool_details.name FROM storage_pool_details WHERE pool_id = ? and value = ?"; - - public PrimaryDataStoreDaoImpl() { - AllFieldSearch = createSearchBuilder(); - AllFieldSearch.and("name", AllFieldSearch.entity().getName(), SearchCriteria.Op.EQ); - AllFieldSearch.and("uuid", AllFieldSearch.entity().getUuid(), SearchCriteria.Op.EQ); - AllFieldSearch.and("datacenterId", AllFieldSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); - AllFieldSearch.and("hostAddress", AllFieldSearch.entity().getHostAddress(), SearchCriteria.Op.EQ); - AllFieldSearch.and("status", AllFieldSearch.entity().getStatus(), SearchCriteria.Op.EQ); - AllFieldSearch.and("path", AllFieldSearch.entity().getPath(), SearchCriteria.Op.EQ); - AllFieldSearch.and("podId", AllFieldSearch.entity().getPodId(), Op.EQ); - AllFieldSearch.and("clusterId", AllFieldSearch.entity().getClusterId(), Op.EQ); - AllFieldSearch.done(); - - DcPodSearch = createSearchBuilder(); - DcPodSearch.and("datacenterId", DcPodSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); - DcPodSearch.and().op("nullpod", DcPodSearch.entity().getPodId(), SearchCriteria.Op.NULL); - DcPodSearch.or("podId", DcPodSearch.entity().getPodId(), SearchCriteria.Op.EQ); - DcPodSearch.cp(); - DcPodSearch.and().op("nullcluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.NULL); - DcPodSearch.or("cluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.EQ); - DcPodSearch.cp(); - DcPodSearch.done(); - - DcPodAnyClusterSearch = createSearchBuilder(); - DcPodAnyClusterSearch.and("datacenterId", DcPodAnyClusterSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); - DcPodAnyClusterSearch.and().op("nullpod", DcPodAnyClusterSearch.entity().getPodId(), SearchCriteria.Op.NULL); - DcPodAnyClusterSearch.or("podId", DcPodAnyClusterSearch.entity().getPodId(), SearchCriteria.Op.EQ); - DcPodAnyClusterSearch.cp(); - DcPodAnyClusterSearch.done(); - - DeleteLvmSearch = createSearchBuilder(); - DeleteLvmSearch.and("ids", DeleteLvmSearch.entity().getId(), SearchCriteria.Op.IN); - DeleteLvmSearch.and().op("LVM", DeleteLvmSearch.entity().getPoolType(), SearchCriteria.Op.EQ); - DeleteLvmSearch.or("Filesystem", DeleteLvmSearch.entity().getPoolType(), SearchCriteria.Op.EQ); - DeleteLvmSearch.cp(); - DeleteLvmSearch.done(); - - StatusCountSearch = createSearchBuilder(Long.class); - StatusCountSearch.and("status", StatusCountSearch.entity().getStatus(), SearchCriteria.Op.IN); - StatusCountSearch.select(null, Func.COUNT, null); - StatusCountSearch.done(); - } - - @Override - public List findPoolByName(String name) { - SearchCriteria sc = AllFieldSearch.create(); - sc.setParameters("name", name); - return listIncludingRemovedBy(sc); - } - - @Override - public PrimaryDataStoreVO findPoolByUUID(String uuid) { - SearchCriteria sc = AllFieldSearch.create(); - sc.setParameters("uuid", uuid); - return findOneIncludingRemovedBy(sc); - } - - @Override - public List findIfDuplicatePoolsExistByUUID(String uuid) { - SearchCriteria sc = AllFieldSearch.create(); - sc.setParameters("uuid", uuid); - return listBy(sc); - } - - @Override - public List listByDataCenterId(long datacenterId) { - SearchCriteria sc = AllFieldSearch.create(); - sc.setParameters("datacenterId", datacenterId); - return listBy(sc); - } - - @Override - public void updateAvailable(long id, long available) { - PrimaryDataStoreVO pool = createForUpdate(id); - pool.setAvailableBytes(available); - update(id, pool); - } - - @Override - public void updateCapacity(long id, long capacity) { - PrimaryDataStoreVO pool = createForUpdate(id); - pool.setCapacityBytes(capacity); - update(id, pool); - - } - - @Override - public List listByStorageHost(String hostFqdnOrIp) { - SearchCriteria sc = AllFieldSearch.create(); - sc.setParameters("hostAddress", hostFqdnOrIp); - return listIncludingRemovedBy(sc); - } - - @Override - public List listByStatus(DataStoreStatus status) { - SearchCriteria sc = AllFieldSearch.create(); - sc.setParameters("status", status); - return listBy(sc); - } - - @Override - public List listByStatusInZone(long dcId, DataStoreStatus status) { - SearchCriteria sc = AllFieldSearch.create(); - sc.setParameters("status", status); - sc.setParameters("datacenterId", dcId); - return listBy(sc); - } - - @Override - public PrimaryDataStoreVO findPoolByHostPath(long datacenterId, Long podId, String host, String path, String uuid) { - SearchCriteria sc = AllFieldSearch.create(); - sc.setParameters("hostAddress", host); - sc.setParameters("path", path); - sc.setParameters("datacenterId", datacenterId); - sc.setParameters("podId", podId); - sc.setParameters("uuid", uuid); - - return findOneBy(sc); - } - - @Override - public List listBy(long datacenterId, long podId, Long clusterId) { - if (clusterId != null) { - SearchCriteria sc = DcPodSearch.create(); - sc.setParameters("datacenterId", datacenterId); - sc.setParameters("podId", podId); - - sc.setParameters("cluster", clusterId); - return listBy(sc); - } else { - SearchCriteria sc = DcPodAnyClusterSearch.create(); - sc.setParameters("datacenterId", datacenterId); - sc.setParameters("podId", podId); - return listBy(sc); - } - } - - @Override - public List listPoolByHostPath(String host, String path) { - SearchCriteria sc = AllFieldSearch.create(); - sc.setParameters("hostAddress", host); - sc.setParameters("path", path); - - return listBy(sc); - } - - public PrimaryDataStoreVO listById(Integer id) { - SearchCriteria sc = AllFieldSearch.create(); - sc.setParameters("id", id); - - return findOneIncludingRemovedBy(sc); - } - - @Override - @DB - public PrimaryDataStoreVO persist(PrimaryDataStoreVO pool, Map details) { - Transaction txn = Transaction.currentTxn(); - txn.start(); - pool = super.persist(pool); - if (details != null) { - for (Map.Entry detail : details.entrySet()) { - PrimaryDataStoreDetailVO vo = new PrimaryDataStoreDetailVO(pool.getId(), detail.getKey(), detail.getValue()); - _detailsDao.persist(vo); - } - } - txn.commit(); - return pool; - } - - @DB - @Override - public List findPoolsByDetails(long dcId, long podId, Long clusterId, Map details) { - StringBuilder sql = new StringBuilder(DetailsSqlPrefix); - if (clusterId != null) { - sql.append("storage_pool.cluster_id = ? OR storage_pool.cluster_id IS NULL) AND ("); - } - for (Map.Entry detail : details.entrySet()) { - sql.append("((storage_pool_details.name='").append(detail.getKey()).append("') AND (storage_pool_details.value='").append(detail.getValue()).append("')) OR "); - } - sql.delete(sql.length() - 4, sql.length()); - sql.append(DetailsSqlSuffix); - Transaction txn = Transaction.currentTxn(); - PreparedStatement pstmt = null; - try { - pstmt = txn.prepareAutoCloseStatement(sql.toString()); - int i = 1; - pstmt.setLong(i++, dcId); - pstmt.setLong(i++, podId); - if (clusterId != null) { - pstmt.setLong(i++, clusterId); - } - pstmt.setInt(i++, details.size()); - ResultSet rs = pstmt.executeQuery(); - List pools = new ArrayList(); - while (rs.next()) { - pools.add(toEntityBean(rs, false)); - } - return pools; - } catch (SQLException e) { - throw new CloudRuntimeException("Unable to execute " + pstmt, e); - } - } - - protected Map tagsToDetails(String[] tags) { - Map details = new HashMap(tags.length); - for (String tag : tags) { - details.put(tag, "true"); - } - return details; - } - - @Override - public List findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared) { - List storagePools = null; - if (tags == null || tags.length == 0) { - storagePools = listBy(dcId, podId, clusterId); - } else { - Map details = tagsToDetails(tags); - storagePools = findPoolsByDetails(dcId, podId, clusterId, details); - } - - if (shared == null) { - return storagePools; - } else { - List filteredStoragePools = new ArrayList(storagePools); - for (PrimaryDataStoreVO pool : storagePools) { - /* - * if (shared != pool.isShared()) { - * filteredStoragePools.remove(pool); } - */ - } - - return filteredStoragePools; - } - } - - @Override - @DB - public List searchForStoragePoolDetails(long poolId, String value) { - - StringBuilder sql = new StringBuilder(FindPoolTagDetails); - - Transaction txn = Transaction.currentTxn(); - PreparedStatement pstmt = null; - try { - pstmt = txn.prepareAutoCloseStatement(sql.toString()); - pstmt.setLong(1, poolId); - pstmt.setString(2, value); - - ResultSet rs = pstmt.executeQuery(); - List tags = new ArrayList(); - - while (rs.next()) { - tags.add(rs.getString("name")); - } - return tags; - } catch (SQLException e) { - throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e); - } - - } - - @Override - public void updateDetails(long poolId, Map details) { - if (details != null) { - _detailsDao.update(poolId, details); - } - } - - @Override - public Map getDetails(long poolId) { - return _detailsDao.getDetails(poolId); - } - - @Override - public boolean configure(String name, Map params) throws ConfigurationException { - super.configure(name, params); - _detailsDao.configure("DetailsDao", params); - return true; - } - - @Override - public long countPoolsByStatus(DataStoreStatus... statuses) { - SearchCriteria sc = StatusCountSearch.create(); - - sc.setParameters("status", (Object[]) statuses); - - List rs = customSearchIncludingRemoved(sc, null); - if (rs.size() == 0) { - return 0; - } - - return rs.get(0); - } - - @Override - public List listPoolsByCluster(long clusterId) { - SearchCriteria sc = AllFieldSearch.create(); - sc.setParameters("clusterId", clusterId); - - return listBy(sc); - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java deleted file mode 100644 index d1f802d..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java +++ /dev/null @@ -1,79 +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.datastore.db; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name="storage_pool_details") -public class PrimaryDataStoreDetailVO { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - long id; - - @Column(name="pool_id") - long poolId; - - @Column(name="name") - String name; - - @Column(name="value") - String value; - - public PrimaryDataStoreDetailVO(long poolId, String name, String value) { - this.poolId = poolId; - this.name = name; - this.value = value; - } - - public long getId() { - return id; - } - - public long getPoolId() { - return poolId; - } - - public void setPoolId(long poolId) { - this.poolId = poolId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - protected PrimaryDataStoreDetailVO() { - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java deleted file mode 100644 index 906742b..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java +++ /dev/null @@ -1,28 +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.datastore.db; - -import java.util.Map; - -import com.cloud.storage.StoragePoolDetailVO; -import com.cloud.utils.db.GenericDao; - -public interface PrimaryDataStoreDetailsDao extends GenericDao { - - void update(long poolId, Map details); - Map getDetails(long poolId); -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java deleted file mode 100644 index 59c488c..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java +++ /dev/null @@ -1,71 +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.datastore.db; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; -import com.cloud.utils.db.Transaction; - -@Component -public class PrimaryDataStoreDetailsDaoImpl extends GenericDaoBase implements PrimaryDataStoreDetailsDao { - - protected final SearchBuilder PoolSearch = null; - - protected PrimaryDataStoreDetailsDaoImpl() { - /* - super(); - PoolSearch = createSearchBuilder(); - PoolSearch.and("pool", PoolSearch.entity().getPoolId(), SearchCriteria.Op.EQ); - PoolSearch.done(); - */ - } - - @Override - public void update(long poolId, Map details) { - Transaction txn = Transaction.currentTxn(); - SearchCriteria sc = PoolSearch.create(); - sc.setParameters("pool", poolId); - - txn.start(); - expunge(sc); - for (Map.Entry entry : details.entrySet()) { - PrimaryDataStoreDetailVO detail = new PrimaryDataStoreDetailVO(poolId, entry.getKey(), entry.getValue()); - persist(detail); - } - txn.commit(); - } - - @Override - public Map getDetails(long poolId) { - SearchCriteria sc = PoolSearch.create(); - sc.setParameters("pool", poolId); - - List details = listBy(sc); - Map detailsMap = new HashMap(); - for (PrimaryDataStoreDetailVO detail : details) { - detailsMap.put(detail.getName(), detail.getValue()); - } - - return detailsMap; - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java deleted file mode 100644 index ebba01c..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.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.datastore.db; - -import com.cloud.utils.db.GenericDao; - -public interface PrimaryDataStoreProviderDao extends GenericDao { - public PrimaryDataStoreProviderVO findByName(String name); -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java deleted file mode 100644 index 0050c2f..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java +++ /dev/null @@ -1,38 +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.datastore.db; - -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchCriteria2; -import com.cloud.utils.db.SearchCriteriaService; -import com.cloud.utils.db.SearchCriteria.Op; - -@Component -class PrimaryDataStoreProviderDaoImpl extends GenericDaoBase implements PrimaryDataStoreProviderDao { - - @Override - public PrimaryDataStoreProviderVO findByName(String name) { - SearchCriteriaService sc = SearchCriteria2.create(PrimaryDataStoreProviderVO.class); - sc.addAnd(sc.getEntity().getName(), Op.EQ, name); - return sc.find(); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java deleted file mode 100644 index 7e31d9c..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java +++ /dev/null @@ -1,49 +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.datastore.db; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.TableGenerator; - -@Entity -@Table(name = "primary_data_store_provider") -public class PrimaryDataStoreProviderVO { - @Id - @TableGenerator(name = "data_store_provider_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "data_store_provider_seq", allocationSize = 1) - @Column(name = "id", updatable = false, nullable = false) - private long id; - - @Column(name = "name", nullable = false) - private String name; - - public long getId() { - return id; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } -} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8af85b04/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreVO.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreVO.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreVO.java deleted file mode 100644 index c8265c7..0000000 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreVO.java +++ /dev/null @@ -1,265 +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.datastore.db; - -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.TableGenerator; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; - -import org.apache.cloudstack.api.Identity; -import org.apache.cloudstack.storage.datastore.DataStoreStatus; - -import com.cloud.utils.db.GenericDao; - -@Entity -@Table(name = "storage_pool") -public class PrimaryDataStoreVO implements Identity { - @Id - @TableGenerator(name = "storage_pool_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "storage_pool_seq", allocationSize = 1) - @Column(name = "id", updatable = false, nullable = false) - private long id; - - @Column(name = "name", updatable = false, nullable = false, length = 255) - private String name = null; - - @Column(name = "uuid", length = 255) - private String uuid = null; - - @Column(name = "pool_type", updatable = false, nullable = false, length = 32) - private String poolType; - - @Column(name = GenericDao.CREATED_COLUMN) - Date created; - - @Column(name = GenericDao.REMOVED_COLUMN) - private Date removed; - - @Column(name = "update_time", updatable = true) - @Temporal(value = TemporalType.TIMESTAMP) - private Date updateTime; - - @Column(name = "data_center_id", updatable = true, nullable = false) - private long dataCenterId; - - @Column(name = "pod_id", updatable = true) - private Long podId; - - @Column(name = "available_bytes", updatable = true, nullable = true) - private long availableBytes; - - @Column(name = "capacity_bytes", updatable = true, nullable = true) - private long capacityBytes; - - @Column(name = "status", updatable = true, nullable = false) - @Enumerated(value = EnumType.STRING) - private DataStoreStatus status; - - @Column(name = "storage_provider_id", updatable = true, nullable = false) - private Long storageProviderId; - - @Column(name = "host_address") - private String hostAddress; - - @Column(name = "path") - private String path; - - @Column(name = "port") - private int port; - - @Column(name = "user_info") - private String userInfo; - - @Column(name = "cluster_id") - private Long clusterId; - - @Column(name = "configurator_key") - private String key; - - public long getId() { - return id; - } - - public DataStoreStatus getStatus() { - return status; - } - - public PrimaryDataStoreVO() { - this.status = DataStoreStatus.Initial; - } - - public String getName() { - return name; - } - - @Override - public String getUuid() { - return uuid; - } - - public String getPoolType() { - return poolType; - } - - public void setPoolType(String protocol) { - this.poolType = protocol; - } - - public Date getCreated() { - return created; - } - - public Date getRemoved() { - return removed; - } - - public Date getUpdateTime() { - return updateTime; - } - - public long getDataCenterId() { - return dataCenterId; - } - - public long getAvailableBytes() { - return availableBytes; - } - - public Long getStorageProviderId() { - return storageProviderId; - } - - public void setStorageProviderId(Long provider) { - storageProviderId = provider; - } - - public long getCapacityBytes() { - return capacityBytes; - } - - public void setAvailableBytes(long available) { - availableBytes = available; - } - - public void setCapacityBytes(long capacity) { - capacityBytes = capacity; - } - - public Long getClusterId() { - return clusterId; - } - - public void setClusterId(Long clusterId) { - this.clusterId = clusterId; - } - - public String getHostAddress() { - return hostAddress; - } - - public void setHostAddress(String host) { - this.hostAddress = host; - } - - public String getPath() { - return path; - } - - public String getUserInfo() { - return userInfo; - } - - public void setStatus(DataStoreStatus status) { - this.status = status; - } - - public void setId(long id) { - this.id = id; - } - - public void setDataCenterId(long dcId) { - this.dataCenterId = dcId; - } - - public void setPodId(Long podId) { - this.podId = podId; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public void setPath(String path) { - this.path = path; - } - - public void setUserInfo(String userInfo) { - this.userInfo = userInfo; - } - - public int getPort() { - return port; - } - - public void setPort(int port) { - this.port = port; - } - - public Long getPodId() { - return podId; - } - - public void setName(String name) { - this.name = name; - } - - public void setKey(String key) { - this.key = key; - } - - public String getKey() { - return this.key; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof PrimaryDataStoreVO) || obj == null) { - return false; - } - PrimaryDataStoreVO that = (PrimaryDataStoreVO) obj; - return this.id == that.id; - } - - @Override - public int hashCode() { - return new Long(id).hashCode(); - } - - @Override - public String toString() { - return new StringBuilder("Pool[").append(id).append("|").append(poolType).append("]").toString(); - } -} \ No newline at end of file