Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,12 @@ public interface ConfigurationService {
* TODO
* @param allocationState
* TODO
* @param storageAccessGroups
* @return the new pod if successful, null otherwise
* @throws
* @throws
*/
Pod createPod(long zoneId, String name, String startIp, String endIp, String gateway, String netmask, String allocationState);
Pod createPod(long zoneId, String name, String startIp, String endIp, String gateway, String netmask, String allocationState, List<String> storageAccessGroups);

/**
* Creates a mutual exclusive IP range in the pod with same gateway, netmask.
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/com/cloud/dc/Pod.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ public interface Pod extends InfrastructureEntity, Grouping, Identity, InternalI
AllocationState getAllocationState();

boolean getExternalDhcp();

String getStorageAccessGroups();
}
1 change: 1 addition & 0 deletions api/src/main/java/com/cloud/event/EventTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ public class EventTypes {
public static final String EVENT_ENABLE_PRIMARY_STORAGE = "ENABLE.PS";
public static final String EVENT_DISABLE_PRIMARY_STORAGE = "DISABLE.PS";
public static final String EVENT_SYNC_STORAGE_POOL = "SYNC.STORAGE.POOL";
public static final String EVENT_CONFIGURE_STORAGE_ACCESS = "CONFIGURE.STORAGE.ACCESS";
public static final String EVENT_CHANGE_STORAGE_POOL_SCOPE = "CHANGE.STORAGE.POOL.SCOPE";

// VPN
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/com/cloud/host/Host.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,6 @@ public static String[] toStrings(Host.Type... types) {
ResourceState getResourceState();

CPU.CPUArch getArch();

String getStorageAccessGroups();
}
2 changes: 2 additions & 0 deletions api/src/main/java/com/cloud/org/Cluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ public static enum ClusterType {
ManagedState getManagedState();

CPU.CPUArch getArch();

String getStorageAccessGroups();
}
7 changes: 7 additions & 0 deletions api/src/main/java/com/cloud/resource/ResourceService.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,11 @@ public interface ResourceService {

boolean releaseHostReservation(Long hostId);

void updatePodStorageAccessGroups(long podId, List<String> newStorageAccessGroups);

void updateZoneStorageAccessGroups(long zoneId, List<String> newStorageAccessGroups);

void updateClusterStorageAccessGroups(Long clusterId, List<String> newStorageAccessGroups);

void updateHostStorageAccessGroups(Long hostId, List<String> newStorageAccessGroups);
}
3 changes: 3 additions & 0 deletions api/src/main/java/com/cloud/storage/StorageService.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
import org.apache.cloudstack.api.command.admin.storage.ChangeStoragePoolScopeCmd;
import org.apache.cloudstack.api.command.admin.storage.ConfigureStorageAccessCmd;
import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
Expand Down Expand Up @@ -99,6 +100,8 @@ public interface StorageService {

StoragePool disablePrimaryStoragePool(Long id);

boolean configureStorageAccess(ConfigureStorageAccessCmd cmd);

StoragePool getStoragePool(long id);

boolean deleteImageStore(DeleteImageStoreCmd cmd);
Expand Down
5 changes: 5 additions & 0 deletions api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,11 @@ public class ApiConstants {
public static final String SYSTEM_VM_TYPE = "systemvmtype";
public static final String TAGS = "tags";
public static final String STORAGE_TAGS = "storagetags";
public static final String STORAGE_ACCESS_GROUPS = "storageaccessgroups";
public static final String STORAGE_ACCESS_GROUP = "storageaccessgroup";
public static final String CLUSTER_STORAGE_ACCESS_GROUPS = "clusterstorageaccessgroups";
public static final String POD_STORAGE_ACCESS_GROUPS = "podstorageaccessgroups";
public static final String ZONE_STORAGE_ACCESS_GROUPS = "zonestorageaccessgroups";
public static final String SUCCESS = "success";
public static final String SUITABLE_FOR_VM = "suitableforvirtualmachine";
public static final String SUPPORTS_STORAGE_SNAPSHOT = "supportsstoragesnapshot";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ public interface ResponseGenerator {

PodResponse createPodResponse(Pod pod, Boolean showCapacities);

PodResponse createMinimalPodResponse(Pod pod);

ZoneResponse createZoneResponse(ResponseView view, DataCenter dataCenter, Boolean showCapacities, Boolean showResourceIcon);

DataCenterGuestIpv6PrefixResponse createDataCenterGuestIpv6PrefixResponse(DataCenterGuestIpv6Prefix prefix);
Expand All @@ -324,6 +326,8 @@ public interface ResponseGenerator {

ClusterResponse createClusterResponse(Cluster cluster, Boolean showCapacities);

ClusterResponse createMinimalClusterResponse(Cluster cluster);

FirewallRuleResponse createPortForwardingRuleResponse(PortForwardingRule fwRule);

IpForwardingRuleResponse createIpForwardingRuleResponse(StaticNatRule fwRule);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ public class AddClusterCmd extends BaseCmd {
private String ovm3cluster;
@Parameter(name = ApiConstants.OVM3_VIP, type = CommandType.STRING, required = false, description = "Ovm3 vip to use for pool (and cluster)")
private String ovm3vip;
@Parameter(name = ApiConstants.STORAGE_ACCESS_GROUPS,
type = CommandType.LIST, collectionType = CommandType.STRING,
description = "comma separated list of storage access groups for the hosts in the cluster",
since = "4.21.0")
private List<String> storageAccessGroups;

public String getOvm3Pool() {
return ovm3pool;
}
Expand Down Expand Up @@ -192,6 +198,10 @@ public void setClusterType(String type) {
this.clusterType = type;
}

public List<String> getStorageAccessGroups() {
return storageAccessGroups;
}

@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ public class ListClustersCmd extends BaseListCmd {
since = "4.20.1")
private String arch;

@Parameter(name = ApiConstants.STORAGE_ACCESS_GROUP, type = CommandType.STRING,
description = "the name of the storage access group",
since = "4.21.0")
private String storageAccessGroup;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -122,6 +127,18 @@ public CPU.CPUArch getArch() {
return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch);
}

public String getStorageAccessGroup() {
return storageAccessGroup;
}

public ListClustersCmd() {

}

public ListClustersCmd(String storageAccessGroup) {
this.storageAccessGroup = storageAccessGroup;
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void execute() {
}
Cluster result = _resourceService.updateCluster(this);
if (result != null) {
ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster, false);
ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(result, false);
clusterResponse.setResponseName(getCommandName());
this.setResponseObject(clusterResponse);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ public class AddHostCmd extends BaseCmd {
@Parameter(name = ApiConstants.HOST_TAGS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "list of tags to be added to the host")
private List<String> hostTags;

@Parameter(name = ApiConstants.STORAGE_ACCESS_GROUPS,
type = CommandType.LIST, collectionType = CommandType.STRING,
description = "comma separated list of storage access groups for the host",
since = "4.21.0")
private List<String> storageAccessGroups;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -115,6 +121,10 @@ public List<String> getHostTags() {
return hostTags;
}

public List<String> getStorageAccessGroups() {
return storageAccessGroups;
}

public String getAllocationState() {
return allocationState;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ public class ListHostsCmd extends BaseListCmd {
@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, description = "CPU Arch of the host", since = "4.20.1")
private String arch;

@Parameter(name = ApiConstants.STORAGE_ACCESS_GROUP, type = CommandType.STRING,
description = "the name of the storage access group",
since = "4.21.0")
private String storageAccessGroup;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -205,6 +210,18 @@ public CPU.CPUArch getArch() {
return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch);
}

public String getStorageAccessGroup() {
return storageAccessGroup;
}

public ListHostsCmd() {

}

public ListHostsCmd(String storageAccessGroup) {
this.storageAccessGroup = storageAccessGroup;
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import com.cloud.dc.Pod;
import com.cloud.user.Account;

import java.util.List;

@APICommand(name = "createPod", description = "Creates a new Pod.", responseObject = PodResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreatePodCmd extends BaseCmd {
Expand Down Expand Up @@ -63,6 +65,12 @@ public class CreatePodCmd extends BaseCmd {
@Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "Allocation state of this Pod for allocation of new resources")
private String allocationState;

@Parameter(name = ApiConstants.STORAGE_ACCESS_GROUPS,
type = CommandType.LIST, collectionType = CommandType.STRING,
description = "comma separated list of storage access groups for the hosts in the pod",
since = "4.21.0")
private List<String> storageAccessGroups;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -95,6 +103,10 @@ public String getAllocationState() {
return allocationState;
}

public List<String> getStorageAccessGroups() {
return storageAccessGroups;
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand All @@ -111,7 +123,7 @@ public ApiCommandResourceType getApiResourceType() {

@Override
public void execute() {
Pod result = _configService.createPod(getZoneId(), getPodName(), getStartIp(), getEndIp(), getGateway(), getNetmask(), getAllocationState());
Pod result = _configService.createPod(getZoneId(), getPodName(), getStartIp(), getEndIp(), getGateway(), getNetmask(), getAllocationState(), getStorageAccessGroups());
if (result != null) {
PodResponse response = _responseGenerator.createPodResponse(result, false);
response.setResponseName(getCommandName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public class ListPodsByCmd extends BaseListCmd {
@Parameter(name = ApiConstants.SHOW_CAPACITIES, type = CommandType.BOOLEAN, description = "flag to display the capacity of the pods")
private Boolean showCapacities;

@Parameter(name = ApiConstants.STORAGE_ACCESS_GROUP, type = CommandType.STRING,
description = "the name of the storage access group",
since = "4.21.0")
private String storageAccessGroup;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand All @@ -79,6 +84,18 @@ public Boolean getShowCapacities() {
return showCapacities;
}

public String getStorageAccessGroup() {
return storageAccessGroup;
}

public ListPodsByCmd() {

}

public ListPodsByCmd(String storageAccessGroup) {
this.storageAccessGroup = storageAccessGroup;
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand Down
Loading