コード例 #1
0
  @Override
  public ChapInfo getChapInfo(VolumeInfo volumeInfo) {
    long accountId = volumeInfo.getAccountId();

    AccountDetailVO accountDetail =
        _accountDetailsDao.findDetail(accountId, SolidFireUtil.CHAP_INITIATOR_USERNAME);

    String chapInitiatorUsername = accountDetail.getValue();

    accountDetail = _accountDetailsDao.findDetail(accountId, SolidFireUtil.CHAP_INITIATOR_SECRET);

    String chapInitiatorSecret = accountDetail.getValue();

    StoragePoolDetailVO storagePoolDetail =
        _storagePoolDetailsDao.findDetail(
            volumeInfo.getPoolId(), SolidFireUtil.USE_MUTUAL_CHAP_FOR_VMWARE);

    boolean useMutualChapForVMware = new Boolean(storagePoolDetail.getValue());

    String chapTargetUsername = null;
    String chapTargetSecret = null;

    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);
  }
コード例 #2
0
  private void deleteSolidFireVolume(VolumeInfo volumeInfo, SolidFireConnection sfConnection) {
    Long storagePoolId = volumeInfo.getPoolId();

    if (storagePoolId == null) {
      return; // this volume was never assigned to a storage pool, so no SAN volume should exist for
              // it
    }

    String mVip = sfConnection.getManagementVip();
    int mPort = sfConnection.getManagementPort();
    String clusterAdminUsername = sfConnection.getClusterAdminUsername();
    String clusterAdminPassword = sfConnection.getClusterAdminPassword();

    long sfVolumeId = Long.parseLong(volumeInfo.getFolder());

    SolidFireUtil.deleteSolidFireVolume(
        mVip, mPort, clusterAdminUsername, clusterAdminPassword, sfVolumeId);
  }