private GlusterVolumeEntity getNewVolume() {
    GlusterVolumeEntity volume = new GlusterVolumeEntity();
    volume.setName(NEW_VOL_NAME);
    volume.setClusterId(CLUSTER_ID);
    volume.setId(NEW_VOL_ID);
    volume.setVolumeType(GlusterVolumeType.DISTRIBUTE);
    volume.addTransportType(TransportType.TCP);
    volume.setReplicaCount(0);
    volume.setStripeCount(0);
    volume.setStatus(GlusterStatus.UP);
    volume.setOption("auth.allow", "*");
    volume.addAccessProtocol(AccessProtocol.GLUSTER);
    volume.addAccessProtocol(AccessProtocol.NFS);

    GlusterBrickEntity brick = new GlusterBrickEntity();
    brick.setVolumeId(NEW_VOL_ID);
    brick.setServerId(existingServer1.getId());
    brick.setServerName(existingServer1.getHostName());
    brick.setBrickDirectory("/export/testvol1");
    brick.setStatus(GlusterStatus.UP);
    brick.setBrickOrder(0);
    volume.addBrick(brick);

    return volume;
  }
 private GlusterVolumeEntity getVolume(Guid id) {
   GlusterVolumeEntity volumeEntity = new GlusterVolumeEntity();
   volumeEntity.setId(id);
   volumeEntity.setName("test-vol");
   volumeEntity.addAccessProtocol(AccessProtocol.GLUSTER);
   volumeEntity.addTransportType(TransportType.TCP);
   return volumeEntity;
 }
  /*
   * (non-Javadoc)
   *
   * @see org.ovirt.engine.core.bll.CommandBase#executeCommand()
   */
  @Override
  protected void executeCommand() {
    // set the gluster volume name for audit purpose
    setGlusterVolumeName(volume.getName());

    if (volume.getTransportTypes() == null || volume.getTransportTypes().isEmpty()) {
      volume.addTransportType(TransportType.TCP);
    }

    // GLUSTER access protocol is enabled by default
    volume.addAccessProtocol(AccessProtocol.GLUSTER);
    if (!volume.getAccessProtocols().contains(AccessProtocol.NFS)) {
      volume.disableNFS();
    }

    VDSReturnValue returnValue =
        runVdsCommand(
            VDSCommandType.CreateGlusterVolume,
            new CreateGlusterVolumeVDSParameters(upServer.getId(), volume));
    setSucceeded(returnValue.getSucceeded());

    if (!getSucceeded()) {
      handleVdsError(
          AuditLogType.GLUSTER_VOLUME_CREATE_FAILED, returnValue.getVdsError().getMessage());
      return;
    }

    // Volume created successfully. Insert it to database.
    GlusterVolumeEntity createdVolume = (GlusterVolumeEntity) returnValue.getReturnValue();
    setVolumeType(createdVolume);
    setBrickOrder(createdVolume.getBricks());
    addVolumeToDb(createdVolume);

    // set all options of the volume
    setVolumeOptions(createdVolume);

    getReturnValue().setActionReturnValue(createdVolume.getId());
  }