Not everyone wants to use Mutual CHAP with VMware - make it optional. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/13a415fe Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/13a415fe Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/13a415fe
Branch: refs/heads/4.2 Commit: 13a415fe8a3917a49dae5a1f3998f5ae78a61da3 Parents: 38d8a84 Author: Mike Tutkowski <[email protected]> Authored: Mon Aug 26 15:33:39 2013 -0600 Committer: Mike Tutkowski <[email protected]> Committed: Mon Aug 26 15:33:39 2013 -0600 ---------------------------------------------------------------------- .../hypervisor/vmware/resource/VmwareResource.java | 12 ++++++++---- .../driver/SolidfirePrimaryDataStoreDriver.java | 17 +++++++++++++---- .../SolidFirePrimaryDataStoreLifeCycle.java | 11 +++++++++++ .../storage/datastore/util/SolidFireUtil.java | 2 ++ 4 files changed, 34 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/13a415fe/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java index e883433..87e2e93 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -4513,10 +4513,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); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/13a415fe/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java ---------------------------------------------------------------------- diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java index 8c00b8e..c73e409 100644 --- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java +++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java @@ -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); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/13a415fe/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java ---------------------------------------------------------------------- diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java index ab3ef61..f1ac3b3 100644 --- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java +++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java @@ -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); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/13a415fe/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java ---------------------------------------------------------------------- diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java index e7ac042..ac11272 100644 --- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java +++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java @@ -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)
