rafaelweingartner commented on a change in pull request #2503: Support multiple
volume access groups per compute cluster
URL: https://github.com/apache/cloudstack/pull/2503#discussion_r178037872
##########
File path:
plugins/storage/volume/solidfire/src/main/java/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java
##########
@@ -397,65 +508,290 @@ public static void hostAddedToOrRemovedFromCluster(long
hostId, long clusterId,
}
}
- public static long placeVolumeInVolumeAccessGroup(SolidFireConnection
sfConnection, long sfVolumeId, long storagePoolId,
- String vagUuid,
List<HostVO> hosts, ClusterDetailsDao clusterDetailsDao) {
- if (hosts == null || hosts.isEmpty()) {
- throw new CloudRuntimeException("There must be at least one host
in the cluster.");
+ // Put the host in an existing VAG or create a new one (only create a new
one if all existing VAGs are full (i.e. 64 hosts max per VAG) and if
+ // creating a new VAG won't exceed 4 VAGs for the computer cluster).
+ // If none of the hosts in the cluster are in a VAG, then leave this host
out of a VAG.
+ // Place applicable volume IDs in VAG, if need be (account of volume
starts with SF_CS_ACCOUNT_PREFIX).
+ private static void handleVagForHost(SolidFireUtil.SolidFireConnection
sfConnection, List<SolidFireUtil.SolidFireVag> sfVags, Host host, HostDao
hostDao) {
+ List<HostVO> hostVOs = hostDao.findByClusterId(host.getClusterId());
+
+ if (hostVOs != null) {
+ int numVags = 0;
+
+ Collections.shuffle(hostVOs, RANDOM);
+
+ for (HostVO hostVO : hostVOs) {
+ if (hostVO.getId() != host.getId()) {
+ SolidFireVag sfVag =
getVolumeAccessGroup(hostVO.getStorageUrl(), sfVags);
+
+ if (sfVag != null) {
+ numVags++;
+
+ // A volume should be visible to all hosts that are in
the same compute cluster. That being the case, you
+ // can use MAX_NUM_VAGS_PER_VOLUME here. This is to
limit the number of VAGs being used in a compute cluster
+ // to MAX_NUM_VAGS_PER_VOLUME.
+ if (numVags > MAX_NUM_VAGS_PER_VOLUME) {
+ throw new CloudRuntimeException("Can support at
most four volume access groups per compute cluster (>)");
+ }
+
+ if (sfVag.getInitiators().length <
MAX_NUM_INITIATORS_PER_VAG) {
+ if (!hostSupports_iScsi(host)) {
+ String errMsg = "Host with ID " + host.getId()
+ " does not support iSCSI.";
+
+ LOGGER.warn(errMsg);
+
+ throw new CloudRuntimeException(errMsg);
+ }
+
+ addInitiatorsToSolidFireVag(sfConnection,
sfVag.getId(), new String[] { host.getStorageUrl() });
+
+ return;
+ }
+ }
+ }
+ }
+
+ if (numVags == MAX_NUM_VAGS_PER_VOLUME) {
+ throw new CloudRuntimeException("Can support at most four
volume access groups per compute cluster (==)");
+ }
+
+ if (numVags > 0) {
+ if (!hostSupports_iScsi(host)) {
+ String errMsg = "Host with ID " + host.getId() + " does
not support iSCSI.";
+
+ LOGGER.warn(errMsg);
+
+ throw new CloudRuntimeException(errMsg);
+ }
+
+ SolidFireUtil.createVag(sfConnection, "CloudStack-" +
UUID.randomUUID().toString(),
+ new String[]{host.getStorageUrl()},
getVolumeIds(sfConnection, sfVags, host, hostDao));
+ }
}
+ }
- long lVagId;
+ // Make use of the volume access group (VAG) of a random host in the
cluster. With this VAG, collect all of its volume IDs that are for
+ // volumes that are in SolidFire accounts that are for CloudStack.
+ private static long[] getVolumeIds(SolidFireUtil.SolidFireConnection
sfConnection, List<SolidFireUtil.SolidFireVag> sfVags,
Review comment:
The same here regarding Java docs
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services