mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-724: add zone wide storage, createstoragepoolcmd doesn't need cluster/pod any more
This commit is contained in:
parent
254275dc26
commit
cc81413931
@ -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")
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user