abh1sar commented on code in PR #8875:
URL: https://github.com/apache/cloudstack/pull/8875#discussion_r1575988321


##########
engine/storage/volume/src/main/java/org/apache/cloudstack/storage/datastore/lifecycle/AbstractPrimaryDataStoreLifeCycleImpl.java:
##########
@@ -0,0 +1,125 @@
+// 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.lifecycle;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.storage.volume.datastore.PrimaryDataStoreHelper;
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.DeleteStoragePoolCommand;
+import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.resource.ResourceManager;
+import com.cloud.storage.StorageManager;
+import com.cloud.storage.StoragePool;
+import com.cloud.storage.StoragePoolHostVO;
+import com.cloud.storage.dao.StoragePoolHostDao;
+import com.cloud.utils.Pair;
+
+public class AbstractPrimaryDataStoreLifeCycleImpl {
+    private static final Logger s_logger = 
Logger.getLogger(AbstractPrimaryDataStoreLifeCycleImpl.class);
+    @Inject
+    AgentManager agentMgr;
+    @Inject
+    protected ResourceManager resourceMgr;
+    @Inject
+    StorageManager storageMgr;
+    @Inject
+    PrimaryDataStoreHelper dataStoreHelper;
+    @Inject
+    protected HostDao hostDao;
+    @Inject
+    protected StoragePoolHostDao storagePoolHostDao;
+
+    private HypervisorType getHypervisorType(long hostId) {
+        HostVO host = hostDao.findById(hostId);
+        if (host != null)
+            return host.getHypervisorType();
+        return HypervisorType.None;
+    }
+
+    private List<HostVO> getPoolHostsList(ClusterScope clusterScope, 
HypervisorType hypervisorType) {
+
+        List<HostVO> hosts = new ArrayList<HostVO>();
+
+        if (hypervisorType != null) {
+             hosts = resourceMgr
+                    
.listAllHostsInOneZoneNotInClusterByHypervisor(hypervisorType, 
clusterScope.getZoneId(), clusterScope.getScopeId());
+        } else {
+            List<HostVO> xenServerHosts = resourceMgr
+                    
.listAllHostsInOneZoneNotInClusterByHypervisor(HypervisorType.XenServer, 
clusterScope.getZoneId(), clusterScope.getScopeId());
+            List<HostVO> vmWareServerHosts = resourceMgr
+                    
.listAllHostsInOneZoneNotInClusterByHypervisor(HypervisorType.VMware, 
clusterScope.getZoneId(), clusterScope.getScopeId());
+            List<HostVO> kvmHosts = resourceMgr.
+                    
listAllHostsInOneZoneNotInClusterByHypervisor(HypervisorType.KVM, 
clusterScope.getZoneId(), clusterScope.getScopeId());

Review Comment:
   Added new method



##########
plugins/storage/volume/sample/src/main/java/org/apache/cloudstack/storage/datastore/lifecycle/SamplePrimaryDataStoreLifeCycleImpl.java:
##########
@@ -146,4 +146,14 @@ public void enableStoragePool(DataStore store) {
     @Override
     public void disableStoragePool(DataStore store) {
     }
+
+    @Override
+    public void changeStoragePoolScopeToZone(DataStore store, ClusterScope 
clusterScope, HypervisorType hypervisorType) {
+        return;

Review Comment:
   removed the return statement



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to