@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);
  }
  private long getDefaultMaxIops(long storagePoolId) {
    StoragePoolDetailVO storagePoolDetail =
        _storagePoolDetailsDao.findDetail(storagePoolId, SolidFireUtil.CLUSTER_DEFAULT_MAX_IOPS);

    String clusterDefaultMaxIops = storagePoolDetail.getValue();

    return Long.parseLong(clusterDefaultMaxIops);
  }
  private long getDefaultBurstIops(long storagePoolId, long maxIops) {
    StoragePoolDetailVO storagePoolDetail =
        _storagePoolDetailsDao.findDetail(
            storagePoolId, SolidFireUtil.CLUSTER_DEFAULT_BURST_IOPS_PERCENT_OF_MAX_IOPS);

    String clusterDefaultBurstIopsPercentOfMaxIops = storagePoolDetail.getValue();

    float fClusterDefaultBurstIopsPercentOfMaxIops =
        Float.parseFloat(clusterDefaultBurstIopsPercentOfMaxIops);

    return (long) (maxIops * fClusterDefaultBurstIopsPercentOfMaxIops);
  }
  private SolidFireConnection getSolidFireConnection(long storagePoolId) {
    StoragePoolDetailVO storagePoolDetail =
        _storagePoolDetailsDao.findDetail(storagePoolId, SolidFireUtil.MANAGEMENT_VIP);

    String mVip = storagePoolDetail.getValue();

    storagePoolDetail =
        _storagePoolDetailsDao.findDetail(storagePoolId, SolidFireUtil.MANAGEMENT_PORT);

    int mPort = Integer.parseInt(storagePoolDetail.getValue());

    storagePoolDetail =
        _storagePoolDetailsDao.findDetail(storagePoolId, SolidFireUtil.CLUSTER_ADMIN_USERNAME);

    String clusterAdminUsername = storagePoolDetail.getValue();

    storagePoolDetail =
        _storagePoolDetailsDao.findDetail(storagePoolId, SolidFireUtil.CLUSTER_ADMIN_PASSWORD);

    String clusterAdminPassword = storagePoolDetail.getValue();

    return new SolidFireConnection(mVip, mPort, clusterAdminUsername, clusterAdminPassword);
  }
  @Test
  public void testClusterAllocatorWithTags() {
    try {
      createDb();
      StoragePoolDetailVO detailVO = new StoragePoolDetailVO(this.storagePoolId, "high", "true");
      poolDetailsDao.persist(detailVO);
      DiskOfferingVO diskOff = this.diskOfferingDao.findById(diskOffering.getId());
      List<String> tags = new ArrayList<String>();
      tags.add("high");
      diskOff.setTagsArray(tags);
      diskOfferingDao.update(diskOff.getId(), diskOff);

      DiskProfile profile = new DiskProfile(volume, diskOff, HypervisorType.XenServer);
      VirtualMachineProfile vmProfile = Mockito.mock(VirtualMachineProfile.class);
      Mockito.when(
              storageMgr.storagePoolHasEnoughSpace(
                  Mockito.anyListOf(Volume.class), Mockito.any(StoragePool.class)))
          .thenReturn(true);
      DeploymentPlan plan = new DataCenterDeployment(dcId, podId, clusterId, null, null, null);
      int foundAcct = 0;
      for (StoragePoolAllocator allocator : allocators) {
        List<StoragePool> pools =
            allocator.allocateToPool(profile, vmProfile, plan, new ExcludeList(), 1);
        if (!pools.isEmpty()) {
          Assert.assertEquals(pools.get(0).getId(), storage.getId());
          foundAcct++;
        }
      }

      if (foundAcct > 1 || foundAcct == 0) {
        Assert.fail();
      }
    } catch (Exception e) {
      cleanDb();
      Assert.fail();
    }
  }