/**
   * Creates a new vCenter. Discovery is initiated after the vCenter is created.
   *
   * @param createParam the parameter that has the attributes of the vCenter to be created.
   * @param validateConnection specifies if the connection to the vCenter to be validated before
   *     creating the vCenter or not. Default value is "false", so connection to the vCenter will
   *     not be validated if it is not specified.
   * @return the vCenter discovery async task.
   */
  @POST
  @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
  @CheckPermission(roles = {Role.SYSTEM_ADMIN, Role.TENANT_ADMIN})
  public TaskResourceRep createVcenter(
      VcenterCreateParam createParam,
      @QueryParam("validate_connection") @DefaultValue("false") final Boolean validateConnection) {
    validateVcenter(createParam, null, validateConnection);

    // create and persist the vcenter
    Vcenter vcenter = createNewVcenter(null, createParam);
    vcenter.setRegistrationStatus(DiscoveredDataObject.RegistrationStatus.REGISTERED.toString());
    _dbClient.createObject(vcenter);
    auditOp(OperationTypeEnum.CREATE_VCENTER, true, null, vcenter.auditParameters());

    return doDiscoverVcenter(queryObject(Vcenter.class, vcenter.getId(), true));
  }
  /**
   * Creates an instance of new storage port and associates it with the storage system.
   *
   * @param portNetworkId
   * @param transportType
   */
  private void create(String portNetworkId, String transportType) {
    logger.info(
        "Start create storage port for portNetworkId={}" + " and transportType={}",
        portNetworkId,
        transportType);

    StorageHADomain adapter = CinderUtils.getStorageAdapter(storageSystem, dbClient);

    StoragePort port = new StoragePort();
    port.setId(URIUtil.createId(StoragePort.class));
    port.setStorageDevice(storageSystem.getId());
    String portName = generatePortName();
    logger.debug("New storage port name is = {}", portName);
    String nativeGuid =
        NativeGUIDGenerator.generateNativeGuid(storageSystem, portName, NativeGUIDGenerator.PORT);
    port.setNativeGuid(nativeGuid);
    port.setPortNetworkId(portNetworkId);
    port.setStorageHADomain(adapter.getId());

    port.setRegistrationStatus(DiscoveredDataObject.RegistrationStatus.REGISTERED.toString());
    // always treat it as a frontend port
    port.setPortType(PortType.frontend.name());
    port.setOperationalStatus(OperationalStatus.OK.toString());
    port.setTransportType(transportType);
    port.setLabel(portName);
    port.setPortName(portName);
    port.setPortGroup("Cinder-PortGroup");
    port.setCompatibilityStatus(CompatibilityStatus.COMPATIBLE.name());
    port.setDiscoveryStatus(DiscoveryStatus.VISIBLE.name());
    dbClient.createObject(port);

    // Add it to the new ports list
    newStoragePortsList.add(port);

    // Add it to the local list
    allStoragePortsList.add(port);

    logger.info(
        "End create storage port for portNetworkId={}" + " and transportType={}",
        portNetworkId,
        transportType);
  }