Name the SolidFire Volume Access Group after the UUID of the CloudStack cluster it serves

This commit is contained in:
Mike Tutkowski 2014-08-28 23:57:52 -06:00
parent de6a3112b6
commit 08995b68e6
3 changed files with 11 additions and 5 deletions

View File

@ -43,9 +43,11 @@ import com.cloud.agent.api.to.DataObjectType;
import com.cloud.agent.api.to.DataStoreTO;
import com.cloud.agent.api.to.DataTO;
import com.cloud.capacity.CapacityManager;
import com.cloud.dc.ClusterVO;
import com.cloud.dc.ClusterDetailsVO;
import com.cloud.dc.ClusterDetailsDao;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.dc.dao.ClusterDao;
import com.cloud.host.Host;
import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDao;
@ -65,6 +67,7 @@ public class SolidFirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
@Inject private AccountDao _accountDao;
@Inject private AccountDetailsDao _accountDetailsDao;
@Inject private CapacityManager _capacityMgr;
@Inject private ClusterDao _clusterDao;
@Inject private ClusterDetailsDao _clusterDetailsDao;
@Inject private DataCenterDao _zoneDao;
@Inject private HostDao _hostDao;
@ -135,7 +138,9 @@ public class SolidFirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
SolidFireUtil.modifySolidFireVag(sfConnection, sfVag.getId(), hostIqns, volumeIds);
}
else {
SolidFireUtil.placeVolumeInVolumeAccessGroup(sfConnection, sfVolumeId, storagePoolId, hosts, _clusterDetailsDao);
ClusterVO cluster = _clusterDao.findById(clusterId);
SolidFireUtil.placeVolumeInVolumeAccessGroup(sfConnection, sfVolumeId, storagePoolId, cluster.getUuid(), hosts, _clusterDetailsDao);
}
return true;

View File

@ -255,8 +255,9 @@ public class SolidFireSharedPrimaryDataStoreLifeCycle implements PrimaryDataStor
// place the newly created volume in the Volume Access Group
try {
List<HostVO> hosts = _hostDao.findByClusterId(clusterId);
ClusterVO cluster = _clusterDao.findById(clusterId);
SolidFireUtil.placeVolumeInVolumeAccessGroup(sfConnection, sfVolume.getId(), dataStore.getId(), hosts, _clusterDetailsDao);
SolidFireUtil.placeVolumeInVolumeAccessGroup(sfConnection, sfVolume.getId(), dataStore.getId(), cluster.getUuid(), hosts, _clusterDetailsDao);
SolidFireUtil.SolidFireAccount sfAccount = sfCreateVolume.getAccount();
Account csAccount = CallContext.current().getCallingAccount();

View File

@ -229,8 +229,8 @@ public class SolidFireUtil {
}
}
public static long placeVolumeInVolumeAccessGroup(SolidFireConnection sfConnection, long sfVolumeId, long storagePoolId, List<HostVO> hosts,
ClusterDetailsDao clusterDetailsDao) {
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.");
}
@ -238,7 +238,7 @@ public class SolidFireUtil {
long lVagId;
try {
lVagId = SolidFireUtil.createSolidFireVag(sfConnection, "CloudStack-" + UUID.randomUUID().toString(),
lVagId = SolidFireUtil.createSolidFireVag(sfConnection, "CloudStack-" + vagUuid,
SolidFireUtil.getIqnsFromHosts(hosts), new long[] { sfVolumeId });
}
catch (Exception ex) {