incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject [12/50] [abbrv] git commit: refs/heads/affinity_groups - CLOUDSTACK-724: add zone wide storage, createstoragepoolcmd doesn't need cluster/pod any more
Date Thu, 14 Mar 2013 22:35:17 GMT
CLOUDSTACK-724: add zone wide storage, createstoragepoolcmd doesn't need cluster/pod any more


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/4e01cde1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/4e01cde1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/4e01cde1

Branch: refs/heads/affinity_groups
Commit: 4e01cde1ee23d66a72fa97c9dafe3466fdbc55fb
Parents: 6f17426
Author: Edison Su <edison.su@citrix.com>
Authored: Tue Feb 26 23:16:06 2013 -0800
Committer: Prachi Damle <prachi@cloud.com>
Committed: Thu Mar 14 15:12:26 2013 -0700

----------------------------------------------------------------------
 .../admin/storage/CreateStoragePoolCmd.java        |    4 +-
 .../AncientPrimaryDataStoreLifeCycleImpl.java      |   18 ++++++++++----
 .../hypervisor/xen/resource/XcpOssResource.java    |    2 +-
 server/src/com/cloud/resource/ResourceManager.java |    1 +
 .../com/cloud/resource/ResourceManagerImpl.java    |   13 ++++++++++
 .../src/com/cloud/storage/StorageManagerImpl.java  |    2 +-
 .../cloud/resource/MockResourceManagerImpl.java    |    7 +++++
 7 files changed, 38 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4e01cde1/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
index da9d346..b86784e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
@@ -49,7 +49,7 @@ public class CreateStoragePoolCmd extends BaseCmd {
     /////////////////////////////////////////////////////
 
     @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType = ClusterResponse.class,
-            required=true, description="the cluster ID for the storage pool")
+            description="the cluster ID for the storage pool")
     private Long clusterId;
 
     @Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details
for the storage pool")
@@ -59,7 +59,7 @@ public class CreateStoragePoolCmd extends BaseCmd {
     private String storagePoolName;
 
     @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType = PodResponse.class,
-            required=true, description="the Pod ID for the storage pool")
+            description="the Pod ID for the storage pool")
     private Long podId;
 
     @Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="the tags for
the storage pool")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4e01cde1/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/AncientPrimaryDataStoreLifeCycleImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/AncientPrimaryDataStoreLifeCycleImpl.java
b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/AncientPrimaryDataStoreLifeCycleImpl.java
index 1c93888..7a5b0d0 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/AncientPrimaryDataStoreLifeCycleImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/AncientPrimaryDataStoreLifeCycleImpl.java
@@ -56,6 +56,7 @@ import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.host.Host;
 import com.cloud.host.HostVO;
 import com.cloud.host.Status;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.resource.ResourceManager;
 import com.cloud.server.ManagementServer;
 import com.cloud.storage.OCFS2Manager;
@@ -220,10 +221,6 @@ public class AncientPrimaryDataStoreLifeCycleImpl implements
             }
             pool = new StoragePoolVO(StoragePoolType.NetworkFilesystem,
                     storageHost, port, hostPath);
-            if (clusterId == null) {
-                throw new IllegalArgumentException(
-                        "NFS need to have clusters specified for XenServers");
-            }
         } else if (scheme.equalsIgnoreCase("file")) {
             if (port == -1) {
                 port = 0;
@@ -463,7 +460,18 @@ public class AncientPrimaryDataStoreLifeCycleImpl implements
 
     @Override
     public boolean attachZone(DataStore dataStore, ZoneScope scope) {
-        StoragePoolVO pool = this.primaryDataStoreDao.findById(dataStore.getId());
+    	List<HostVO> hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(HypervisorType.KVM,
scope.getScopeId());
+    	for (HostVO host : hosts) {
+    		try {
+    			this.storageMgr.connectHostToSharedPool(host.getId(),
+    					dataStore.getId());
+    		} catch (Exception e) {
+    			s_logger.warn("Unable to establish a connection between " + host
+    					+ " and " + dataStore, e);
+    		}
+    	}
+    	StoragePoolVO pool = this.primaryDataStoreDao.findById(dataStore.getId());
+        
         pool.setScope(ScopeType.ZONE);
         pool.setStatus(StoragePoolStatus.Up);
         this.primaryDataStoreDao.update(pool.getId(), pool);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4e01cde1/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java
index 57f5453..357b433 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java
@@ -57,7 +57,7 @@ public class XcpOssResource extends CitrixResourceBase {
     @Override
     protected List<File> getPatchFiles() {
         List<File> files = new ArrayList<File>();
-        String patch = "patch";
+        String patch = "scripts/vm/hypervisor/xenserver/xcposs/patch";
         String patchfilePath = Script.findScript("", patch);
         if (patchfilePath == null) {
             throw new CloudRuntimeException("Unable to find patch file " + patch);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4e01cde1/server/src/com/cloud/resource/ResourceManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManager.java b/server/src/com/cloud/resource/ResourceManager.java
index 266ba94..b0ab926 100755
--- a/server/src/com/cloud/resource/ResourceManager.java
+++ b/server/src/com/cloud/resource/ResourceManager.java
@@ -100,6 +100,7 @@ public interface ResourceManager extends ResourceService{
     public List<HostVO> listHostsInClusterByStatus(long clusterId, Status status);
     
     public List<HostVO> listAllUpAndEnabledHostsInOneZoneByType(Host.Type type, long
dcId);
+    public List<HostVO> listAllUpAndEnabledHostsInOneZoneByHypervisor(HypervisorType
type, long dcId);
     
     public List<HostVO> listAllHostsInOneZoneByType(Host.Type type, long dcId);
     

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4e01cde1/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index 14628c1..c4713ad 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -2822,4 +2822,17 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
         }
         return pcs;
     }
+
+	@Override
+	public List<HostVO> listAllUpAndEnabledHostsInOneZoneByHypervisor(
+			HypervisorType type, long dcId) {
+		SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2
+				.create(HostVO.class);
+        sc.addAnd(sc.getEntity().getHypervisorType(), Op.EQ, type);
+        sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dcId);
+        sc.addAnd(sc.getEntity().getStatus(), Op.EQ, Status.Up);
+		sc.addAnd(sc.getEntity().getResourceState(), Op.EQ,
+				ResourceState.Enabled);
+        return sc.list();
+	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4e01cde1/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index ca21f62..f510792 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -768,7 +768,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager,
C
         String scope = cmd.getScope();
         if (scope != null) {
             try {
-                scopeType = Enum.valueOf(ScopeType.class, scope);
+                scopeType = Enum.valueOf(ScopeType.class, scope.toUpperCase());
             } catch (Exception e) {
                 throw new InvalidParameterValueException("invalid scope"
                         + scope);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4e01cde1/server/test/com/cloud/resource/MockResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/resource/MockResourceManagerImpl.java b/server/test/com/cloud/resource/MockResourceManagerImpl.java
index 1d851a0..5202c31 100644
--- a/server/test/com/cloud/resource/MockResourceManagerImpl.java
+++ b/server/test/com/cloud/resource/MockResourceManagerImpl.java
@@ -601,4 +601,11 @@ public class MockResourceManagerImpl extends ManagerBase implements ResourceMana
         return "MockResourceManagerImpl";
     }
 
+	@Override
+	public List<HostVO> listAllUpAndEnabledHostsInOneZoneByHypervisor(
+			HypervisorType type, long dcId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
 }


Mime
View raw message