Skip to content

Commit bd2d875

Browse files
author
Mike Tutkowski
committed
Make Mutual CHAP optional for VMware.
1 parent 652720a commit bd2d875

4 files changed

Lines changed: 34 additions & 8 deletions

File tree

‎plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4411,10 +4411,14 @@ private ManagedObjectReference createVmfsDatastore(VmwareHypervisorHost hyperHos
44114411
auth.setChapAuthenticationType(strAuthType);
44124412
auth.setChapName(chapName);
44134413
auth.setChapSecret(chapSecret);
4414-
auth.setMutualChapInherited(false);
4415-
auth.setMutualChapAuthenticationType(strAuthType);
4416-
auth.setMutualChapName(mutualChapName);
4417-
auth.setMutualChapSecret(mutualChapSecret);
4414+
4415+
if (StringUtils.isNotBlank(mutualChapName) &&
4416+
StringUtils.isNotBlank(mutualChapSecret)) {
4417+
auth.setMutualChapInherited(false);
4418+
auth.setMutualChapAuthenticationType(strAuthType);
4419+
auth.setMutualChapName(mutualChapName);
4420+
auth.setMutualChapSecret(mutualChapSecret);
4421+
}
44184422

44194423
target.setAuthenticationProperties(auth);
44204424

‎plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,22 @@ public ChapInfo getChapInfo(VolumeInfo volumeInfo) {
203203

204204
String chapInitiatorSecret = accountDetail.getValue();
205205

206-
accountDetail = _accountDetailsDao.findDetail(accountId, SolidFireUtil.CHAP_TARGET_USERNAME);
206+
StoragePoolDetailVO storagePoolDetail = _storagePoolDetailsDao.findDetail(volumeInfo.getPoolId(), SolidFireUtil.USE_MUTUAL_CHAP_FOR_VMWARE);
207207

208-
String chapTargetUsername = accountDetail.getValue();
208+
boolean useMutualChapForVMware = new Boolean(storagePoolDetail.getValue());
209209

210-
accountDetail = _accountDetailsDao.findDetail(accountId, SolidFireUtil.CHAP_TARGET_SECRET);
210+
String chapTargetUsername = null;
211+
String chapTargetSecret = null;
211212

212-
String chapTargetSecret = accountDetail.getValue();
213+
if (useMutualChapForVMware) {
214+
accountDetail = _accountDetailsDao.findDetail(accountId, SolidFireUtil.CHAP_TARGET_USERNAME);
215+
216+
chapTargetUsername = accountDetail.getValue();
217+
218+
accountDetail = _accountDetailsDao.findDetail(accountId, SolidFireUtil.CHAP_TARGET_SECRET);
219+
220+
chapTargetSecret = accountDetail.getValue();
221+
}
213222

214223
return new ChapInfoImpl(chapInitiatorUsername, chapInitiatorSecret,
215224
chapTargetUsername, chapTargetSecret);

‎plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,17 @@ public DataStore initialize(Map<String, Object> dsInfos) {
157157
details.put(SolidFireUtil.CLUSTER_DEFAULT_MAX_IOPS, String.valueOf(lClusterDefaultMaxIops));
158158
details.put(SolidFireUtil.CLUSTER_DEFAULT_BURST_IOPS_PERCENT_OF_MAX_IOPS, String.valueOf(fClusterDefaultBurstIopsPercentOfMaxIops));
159159

160+
String useMutualChapForVMware = getValue(SolidFireUtil.USE_MUTUAL_CHAP_FOR_VMWARE, url);
161+
162+
if (useMutualChapForVMware == null || new Boolean(useMutualChapForVMware)) {
163+
useMutualChapForVMware = Boolean.TRUE.toString();
164+
}
165+
else {
166+
useMutualChapForVMware = Boolean.FALSE.toString();
167+
}
168+
169+
details.put(SolidFireUtil.USE_MUTUAL_CHAP_FOR_VMWARE, useMutualChapForVMware);
170+
160171
// this adds a row in the cloud.storage_pool table for this SolidFire cluster
161172
return dataStoreHelper.createPrimaryDataStore(parameters);
162173
}

‎plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ public class SolidFireUtil
7575
public static final String CHAP_TARGET_USERNAME = "chapTargetUsername";
7676
public static final String CHAP_TARGET_SECRET = "chapTargetSecret";
7777

78+
public static final String USE_MUTUAL_CHAP_FOR_VMWARE = "useMutualChapForVMware";
79+
7880
public static long createSolidFireVolume(String strSfMvip, int iSfPort, String strSfAdmin, String strSfPassword,
7981
String strSfVolumeName, long lSfAccountId, long lTotalSize, boolean bEnable512e,
8082
long lMinIops, long lMaxIops, long lBurstIops)

0 commit comments

Comments
 (0)