Make Mutual CHAP optional for VMware.

This commit is contained in:
Mike Tutkowski 2013-08-26 16:08:37 -06:00
parent 652720a411
commit bd2d875073
4 changed files with 34 additions and 8 deletions

View File

@ -4411,10 +4411,14 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
auth.setChapAuthenticationType(strAuthType);
auth.setChapName(chapName);
auth.setChapSecret(chapSecret);
auth.setMutualChapInherited(false);
auth.setMutualChapAuthenticationType(strAuthType);
auth.setMutualChapName(mutualChapName);
auth.setMutualChapSecret(mutualChapSecret);
if (StringUtils.isNotBlank(mutualChapName) &&
StringUtils.isNotBlank(mutualChapSecret)) {
auth.setMutualChapInherited(false);
auth.setMutualChapAuthenticationType(strAuthType);
auth.setMutualChapName(mutualChapName);
auth.setMutualChapSecret(mutualChapSecret);
}
target.setAuthenticationProperties(auth);

View File

@ -203,13 +203,22 @@ public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
String chapInitiatorSecret = accountDetail.getValue();
accountDetail = _accountDetailsDao.findDetail(accountId, SolidFireUtil.CHAP_TARGET_USERNAME);
StoragePoolDetailVO storagePoolDetail = _storagePoolDetailsDao.findDetail(volumeInfo.getPoolId(), SolidFireUtil.USE_MUTUAL_CHAP_FOR_VMWARE);
String chapTargetUsername = accountDetail.getValue();
boolean useMutualChapForVMware = new Boolean(storagePoolDetail.getValue());
accountDetail = _accountDetailsDao.findDetail(accountId, SolidFireUtil.CHAP_TARGET_SECRET);
String chapTargetUsername = null;
String chapTargetSecret = null;
String chapTargetSecret = accountDetail.getValue();
if (useMutualChapForVMware) {
accountDetail = _accountDetailsDao.findDetail(accountId, SolidFireUtil.CHAP_TARGET_USERNAME);
chapTargetUsername = accountDetail.getValue();
accountDetail = _accountDetailsDao.findDetail(accountId, SolidFireUtil.CHAP_TARGET_SECRET);
chapTargetSecret = accountDetail.getValue();
}
return new ChapInfoImpl(chapInitiatorUsername, chapInitiatorSecret,
chapTargetUsername, chapTargetSecret);

View File

@ -157,6 +157,17 @@ public class SolidFirePrimaryDataStoreLifeCycle implements PrimaryDataStoreLifeC
details.put(SolidFireUtil.CLUSTER_DEFAULT_MAX_IOPS, String.valueOf(lClusterDefaultMaxIops));
details.put(SolidFireUtil.CLUSTER_DEFAULT_BURST_IOPS_PERCENT_OF_MAX_IOPS, String.valueOf(fClusterDefaultBurstIopsPercentOfMaxIops));
String useMutualChapForVMware = getValue(SolidFireUtil.USE_MUTUAL_CHAP_FOR_VMWARE, url);
if (useMutualChapForVMware == null || new Boolean(useMutualChapForVMware)) {
useMutualChapForVMware = Boolean.TRUE.toString();
}
else {
useMutualChapForVMware = Boolean.FALSE.toString();
}
details.put(SolidFireUtil.USE_MUTUAL_CHAP_FOR_VMWARE, useMutualChapForVMware);
// this adds a row in the cloud.storage_pool table for this SolidFire cluster
return dataStoreHelper.createPrimaryDataStore(parameters);
}

View File

@ -75,6 +75,8 @@ public class SolidFireUtil
public static final String CHAP_TARGET_USERNAME = "chapTargetUsername";
public static final String CHAP_TARGET_SECRET = "chapTargetSecret";
public static final String USE_MUTUAL_CHAP_FOR_VMWARE = "useMutualChapForVMware";
public static long createSolidFireVolume(String strSfMvip, int iSfPort, String strSfAdmin, String strSfPassword,
String strSfVolumeName, long lSfAccountId, long lTotalSize, boolean bEnable512e,
long lMinIops, long lMaxIops, long lBurstIops)