Skip to content

Commit d9bef05

Browse files
FR79: Introducing storage tags on host, cluster and pods (apache#503)
The feature introduces Storage Access Groups on zone/cluster scoped storage pools and hosts/clusters/pods/zones to define the host and storage pool connections. Previously when a zone scoped storage pool is added it would connect to all the hosts in that zone, now with this feature one can define the scope of the connections of the storage to the required hosts. * API and DB changes * Added validations on vm and volume migrations wrt storage tags on host * Fix tags during startupcommand * update storagepool tags * Added responses and UI changes * Fix storage tags on cluster and pods * some more fixes * Fix storage tag deletion and tests * Fix storage tags deletion * Add & Remove PowerFlex/ScaleIO MDMs while preparing & unpreparing the storage SDC connections (instead of start & stop scini) * storage pool detail null check * Fix some tag edit scenarios * Addressed review comments * UI change for storage tags * Fix empty storage tags on hosts validation during vm migrate * Fix updating storage connection when applying tags on storage pool * Fix to populate tags to hosts when tags are removed on cluster/pod * Fix mysql queries * Fixes for host tags and storage pool tags * Add check for used volumes while updating storage pool * Fix update cluster UI for tags deletion * Fix update pod form to accept empty storage tags * Zone storage pool tags introduction * Added zone level storage tags * Add storage tags to zone UI details * Replace the usage of tags in storage pool with a new parameter for host connection * Update host and storage connections based on consideration on empty tags * Add hostId to liststoragepools API to list connected pools * Few fixes and improvements * Rename table * Fix unit tests * fix gen toc * Add configureStorageAccess API to gen doc * Change name from storagetags to storageaccessgroups * Remove storagetags from all update APIs, just to use configureStorageAccess API * Rename storage tags with storage access groups * UI changes * Add primary storage update UI * UI changes * Add proper migration checks and fix tests * Add missing UI label * Reorder mysql changes * storage pool detail null check * Add/Remove MDM IP addresses during Host connection/disconnection to/from storage pool when powerflex.connect.on.demand is false * unit test fixes * Fix storage access groups comparision * Add check if all hosts are using the tags * Fix error message * Use listeners disconnect method * Don't remove MDM IPs from SDC when any volumes mapped to SDC * Fix hostDao * Fix storage pool addition with the combined tags * Addressed Review comments mainly on renaming * Fix tests and some logic * optimise the storage access group check * Add tests for storage access group checks * Added tests for volume migration checks * Unit tests for checking all hosts using storage access groups * Add tests for volumes in use by pools which needs to be disconnected * Fix podId * Add inherited storage groups to response and UI * Fetch IDs from host object * changes after rebasing apple-base418 * Don't remove MDM IPs when other pools of same ScaleIO/PowerFlex cluster are connected * Add logs and a unit test * Action event for configureStorageAccess API * fetch eligible hosts while finding the endpoint for command executions * Update storage access groups on host after Disconnected and Downstate * Check for common accessible host for migrations * update changes, to not remove/disconnect MDMs on maintenance * Add volumes information in logging for better understanding * Fix UI double notification --------- Co-authored-by: Suresh Kumar Anaparti <suresh.anaparti@shapeblue.com> Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
1 parent 0473348 commit d9bef05

129 files changed

Lines changed: 4964 additions & 425 deletions

File tree

Some content is hidden

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

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

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -187,25 +187,19 @@ public interface ConfigurationService {
187187
/**
188188
* Creates a new pod based on the parameters specified in the command object
189189
*
190-
* @param zoneId
191-
* TODO
192-
* @param name
193-
* TODO
194-
* @param startIp
195-
* TODO
196-
* @param endIp
197-
* TODO
198-
* @param gateway
199-
* TODO
200-
* @param netmask
201-
* TODO
202-
* @param allocationState
203-
* TODO
190+
* @param zoneId TODO
191+
* @param name TODO
192+
* @param startIp TODO
193+
* @param endIp TODO
194+
* @param gateway TODO
195+
* @param netmask TODO
196+
* @param allocationState TODO
197+
* @param storageAccessGroups
204198
* @return the new pod if successful, null otherwise
205199
* @throws
206200
* @throws
207201
*/
208-
Pod createPod(long zoneId, String name, String startIp, String endIp, String gateway, String netmask, String allocationState);
202+
Pod createPod(long zoneId, String name, String startIp, String endIp, String gateway, String netmask, String allocationState, List<String> storageAccessGroups);
209203

210204
/**
211205
* 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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ public class EventTypes {
430430
public static final String EVENT_DISABLE_PRIMARY_STORAGE = "DISABLE.PS";
431431
public static final String EVENT_SYNC_STORAGE_POOL = "SYNC.STORAGE.POOL";
432432

433+
public static final String EVENT_CONFIGURE_STORAGE_ACCESS = "CONFIGURE.STORAGE.ACCESS";
434+
433435
// VPN
434436
public static final String EVENT_REMOTE_ACCESS_VPN_CREATE = "VPN.REMOTE.ACCESS.CREATE";
435437
public static final String EVENT_REMOTE_ACCESS_VPN_DESTROY = "VPN.REMOTE.ACCESS.DESTROY";

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,6 @@ public static String[] toStrings(Host.Type... types) {
209209
boolean isDisabled();
210210

211211
ResourceState getResourceState();
212+
213+
String getStorageAccessGroups();
212214
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@ public static enum ClusterType {
3838
AllocationState getAllocationState();
3939

4040
ManagedState getManagedState();
41+
42+
String getStorageAccessGroups();
4143
}

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
@@ -21,6 +21,7 @@
2121
import java.util.Map;
2222

2323
import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
24+
import org.apache.cloudstack.api.command.admin.storage.ConfigureStorageAccessCmd;
2425
import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd;
2526
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
2627
import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
@@ -85,6 +86,8 @@ public interface StorageService {
8586

8687
StoragePool updateStoragePool(UpdateStoragePoolCmd cmd) throws IllegalArgumentException;
8788

89+
boolean configureStorageAccess(ConfigureStorageAccessCmd cmd);
90+
8891
StoragePool getStoragePool(long id);
8992

9093
boolean deleteImageStore(DeleteImageStoreCmd cmd);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ public class ApiConstants {
434434
public static final String SYSTEM_VM_TYPE = "systemvmtype";
435435
public static final String TAGS = "tags";
436436
public static final String STORAGE_TAGS = "storagetags";
437+
public static final String STORAGE_ACCESS_GROUPS = "storageaccessgroups";
437438
public static final String TARGET_IQN = "targetiqn";
438439
public static final String TEMPLATE_FILTER = "templatefilter";
439440
public static final String TEMPLATE_ID = "templateid";

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
@@ -114,6 +114,12 @@ public class AddClusterCmd extends BaseCmd {
114114
private String ovm3cluster;
115115
@Parameter(name = ApiConstants.OVM3_VIP, type = CommandType.STRING, required = false, description = "Ovm3 vip to use for pool (and cluster)")
116116
private String ovm3vip;
117+
@Parameter(name = ApiConstants.STORAGE_ACCESS_GROUPS,
118+
type = CommandType.LIST, collectionType = CommandType.STRING,
119+
description = "comma separated list of storage access groups for the hosts in the cluster",
120+
since = "4.18.1")
121+
private List<String> storageAccessGroups;
122+
117123
public String getOvm3Pool() {
118124
return ovm3pool;
119125
}
@@ -188,6 +194,10 @@ public void setClusterType(String type) {
188194
this.clusterType = type;
189195
}
190196

197+
public List<String> getStorageAccessGroups() {
198+
return storageAccessGroups;
199+
}
200+
191201
@Override
192202
public long getEntityOwnerId() {
193203
return Account.ACCOUNT_ID_SYSTEM;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public void execute() {
118118
}
119119
Cluster result = _resourceService.updateCluster(this);
120120
if (result != null) {
121-
ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster, false);
121+
ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(result, false);
122122
clusterResponse.setResponseName(getCommandName());
123123
this.setResponseObject(clusterResponse);
124124
} else {

0 commit comments

Comments
 (0)