Skip to content

Commit cfed6f8

Browse files
harikrishna-patnaladhslove
authored andcommitted
Introducing Storage Access Groups for better management for host and storage connections (apache#10381)
* Introducing Storage Access Groups to define the host and storage pool connections In CloudStack, when a primary storage is added at the Zone or Cluster scope, it is by default connected to all hosts within that scope. This default behavior can be refined using storage access groups, which allow operators to control and limit which hosts can access specific storage pools. Storage access groups can be assigned to hosts, clusters, pods, zones, and primary storage pools. When a storage access group is set on a cluster/pod/zone, all hosts within that scope inherit the group. Connectivity between a host and a storage pool is then governed by whether they share the same storage access group. A storage pool with a storage access group will connect only to hosts that have the same storage access group. A storage pool without a storage access group will connect to all hosts, including those with or without a storage access group.
1 parent 0b36a6d commit cfed6f8

File tree

127 files changed

+5675
-357
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+5675
-357
lines changed

api/src/main/java/com/cloud/configuration/ConfigurationService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,12 @@ public interface ConfigurationService {
201201
* TODO
202202
* @param allocationState
203203
* TODO
204+
* @param storageAccessGroups
204205
* @return the new pod if successful, null otherwise
205206
* @throws
206207
* @throws
207208
*/
208-
Pod createPod(long zoneId, String name, String startIp, String endIp, String gateway, String netmask, String allocationState);
209+
Pod createPod(long zoneId, String name, String startIp, String endIp, String gateway, String netmask, String allocationState, List<String> storageAccessGroups);
209210

210211
/**
211212
* Creates a mutual exclusive IP range in the pod with same gateway, netmask.

api/src/main/java/com/cloud/dc/Pod.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,6 @@ public interface Pod extends InfrastructureEntity, Grouping, Identity, InternalI
4343
AllocationState getAllocationState();
4444

4545
boolean getExternalDhcp();
46+
47+
String getStorageAccessGroups();
4648
}

api/src/main/java/com/cloud/event/EventTypes.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ public class EventTypes {
470470
public static final String EVENT_ENABLE_PRIMARY_STORAGE = "ENABLE.PS";
471471
public static final String EVENT_DISABLE_PRIMARY_STORAGE = "DISABLE.PS";
472472
public static final String EVENT_SYNC_STORAGE_POOL = "SYNC.STORAGE.POOL";
473+
public static final String EVENT_CONFIGURE_STORAGE_ACCESS = "CONFIGURE.STORAGE.ACCESS";
473474
public static final String EVENT_CHANGE_STORAGE_POOL_SCOPE = "CHANGE.STORAGE.POOL.SCOPE";
474475

475476
// VPN

api/src/main/java/com/cloud/host/Host.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,6 @@ public static String[] toStrings(Host.Type... types) {
215215
ResourceState getResourceState();
216216

217217
CPU.CPUArch getArch();
218+
219+
String getStorageAccessGroups();
218220
}

api/src/main/java/com/cloud/org/Cluster.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ public static enum ClusterType {
4141
ManagedState getManagedState();
4242

4343
CPU.CPUArch getArch();
44+
45+
String getStorageAccessGroups();
4446
}

api/src/main/java/com/cloud/resource/ResourceService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,11 @@ public interface ResourceService {
9595

9696
boolean releaseHostReservation(Long hostId);
9797

98+
void updatePodStorageAccessGroups(long podId, List<String> newStorageAccessGroups);
99+
100+
void updateZoneStorageAccessGroups(long zoneId, List<String> newStorageAccessGroups);
101+
102+
void updateClusterStorageAccessGroups(Long clusterId, List<String> newStorageAccessGroups);
103+
104+
void updateHostStorageAccessGroups(Long hostId, List<String> newStorageAccessGroups);
98105
}

api/src/main/java/com/cloud/storage/StorageService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
2424
import org.apache.cloudstack.api.command.admin.storage.ChangeStoragePoolScopeCmd;
25+
import org.apache.cloudstack.api.command.admin.storage.ConfigureStorageAccessCmd;
2526
import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd;
2627
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
2728
import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
@@ -99,6 +100,8 @@ public interface StorageService {
99100

100101
StoragePool disablePrimaryStoragePool(Long id);
101102

103+
boolean configureStorageAccess(ConfigureStorageAccessCmd cmd);
104+
102105
StoragePool getStoragePool(long id);
103106

104107
boolean deleteImageStore(DeleteImageStoreCmd cmd);

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,11 @@ public class ApiConstants {
504504
public static final String SYSTEM_VM_TYPE = "systemvmtype";
505505
public static final String TAGS = "tags";
506506
public static final String STORAGE_TAGS = "storagetags";
507+
public static final String STORAGE_ACCESS_GROUPS = "storageaccessgroups";
508+
public static final String STORAGE_ACCESS_GROUP = "storageaccessgroup";
509+
public static final String CLUSTER_STORAGE_ACCESS_GROUPS = "clusterstorageaccessgroups";
510+
public static final String POD_STORAGE_ACCESS_GROUPS = "podstorageaccessgroups";
511+
public static final String ZONE_STORAGE_ACCESS_GROUPS = "zonestorageaccessgroups";
507512
public static final String SUCCESS = "success";
508513
public static final String SUITABLE_FOR_VM = "suitableforvirtualmachine";
509514
public static final String TARGET_IQN = "targetiqn";

api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ public interface ResponseGenerator {
313313

314314
PodResponse createPodResponse(Pod pod, Boolean showCapacities);
315315

316+
PodResponse createMinimalPodResponse(Pod pod);
317+
316318
ZoneResponse createZoneResponse(ResponseView view, DataCenter dataCenter, Boolean showCapacities, Boolean showResourceIcon);
317319

318320
DataCenterGuestIpv6PrefixResponse createDataCenterGuestIpv6PrefixResponse(DataCenterGuestIpv6Prefix prefix);
@@ -327,6 +329,8 @@ public interface ResponseGenerator {
327329

328330
ClusterResponse createClusterResponse(Cluster cluster, Boolean showCapacities);
329331

332+
ClusterResponse createMinimalClusterResponse(Cluster cluster);
333+
330334
FirewallRuleResponse createPortForwardingRuleResponse(PortForwardingRule fwRule);
331335

332336
IpForwardingRuleResponse createIpForwardingRuleResponse(StaticNatRule fwRule);

api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ public class AddClusterCmd extends BaseCmd {
118118
private String ovm3cluster;
119119
@Parameter(name = ApiConstants.OVM3_VIP, type = CommandType.STRING, required = false, description = "Ovm3 vip to use for pool (and cluster)")
120120
private String ovm3vip;
121+
@Parameter(name = ApiConstants.STORAGE_ACCESS_GROUPS,
122+
type = CommandType.LIST, collectionType = CommandType.STRING,
123+
description = "comma separated list of storage access groups for the hosts in the cluster",
124+
since = "4.21.0")
125+
private List<String> storageAccessGroups;
126+
121127
public String getOvm3Pool() {
122128
return ovm3pool;
123129
}
@@ -192,6 +198,10 @@ public void setClusterType(String type) {
192198
this.clusterType = type;
193199
}
194200

201+
public List<String> getStorageAccessGroups() {
202+
return storageAccessGroups;
203+
}
204+
195205
@Override
196206
public long getEntityOwnerId() {
197207
return Account.ACCOUNT_ID_SYSTEM;

0 commit comments

Comments
 (0)