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 da9d3467792..b86784ed0b0 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") 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 1c938888f72..7a5b0d06020 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 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); 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 57f545323f9..357b4333678 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 getPatchFiles() { List files = new ArrayList(); - 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); diff --git a/server/src/com/cloud/resource/ResourceManager.java b/server/src/com/cloud/resource/ResourceManager.java index 266ba948afc..b0ab9269529 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 listHostsInClusterByStatus(long clusterId, Status status); public List listAllUpAndEnabledHostsInOneZoneByType(Host.Type type, long dcId); + public List listAllUpAndEnabledHostsInOneZoneByHypervisor(HypervisorType type, long dcId); public List listAllHostsInOneZoneByType(Host.Type type, long dcId); diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index 14628c1fe8d..c4713ad331d 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 listAllUpAndEnabledHostsInOneZoneByHypervisor( + HypervisorType type, long dcId) { + SearchCriteriaService 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(); + } } diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index ca21f62455a..f51079240c9 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); diff --git a/server/test/com/cloud/resource/MockResourceManagerImpl.java b/server/test/com/cloud/resource/MockResourceManagerImpl.java index 1d851a037d4..5202c317e56 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 listAllUpAndEnabledHostsInOneZoneByHypervisor( + HypervisorType type, long dcId) { + // TODO Auto-generated method stub + return null; + } + }