Interface DatastoreTypeProvider

All Superinterfaces:
PluginProvider

public interface DatastoreTypeProvider extends PluginProvider
Represents a DatastoreType and how a StorageServer interacts with various provisioners There are several Facets related to this particular storage provider that grant certain abilities and use cases. The DatastoreTypeProvider.SnapshotFacet allows for the creation and deletion of snapshots The DatastoreTypeProvider.MvmProvisionFacet allows for MVM specific provisioning tasks for MVM/HPE Hypervisor Clusters In order to use this with an external integration, it is best to first register a StorageProvider plugin, then ensure the code used for that provider is set on the getStorageProviderCode() method. Often times, it will be necessary to orchestrate behaviors on the host/hypervisor itself when provisioning a volume. This can be done with the context MorpheusContext.executeCommandOnServer(com.morpheusdata.model.ComputeServer, java.lang.String) method.

ComputeServer host = server.parentServer //this is the host ServiceResponse response = morpheusContext.executeCommandOnServer(host, "virsh pool-refresh mypool")

Since:
1.1.18
  • Method Details

    • getProvisionTypeCode

      String getProvisionTypeCode()
      Returns the ProvisionProvider code for linking the generated DatastoreType with the appropriate ProvisionType
      Returns:
      the code of the relevant ProvisionProvider
    • getStorageProviderCode

      String getStorageProviderCode()
      Returns the provider code for interacting with the StorageServer interface This is optional and can be null if there is no interaction with a storage server whatsoever
      Returns:
      the code for the storage provider (also matches the StorageServerType code)
    • getOptionTypes

      List<OptionType> getOptionTypes()
      Provide custom configuration options when creating a new AccountIntegration
      Returns:
      a List of OptionType
    • getVolumeTypes

      default List<StorageVolumeType> getVolumeTypes()
      Provide custom list of StorageVolumeType for this datastore.
    • getExternalType

      default String getExternalType()
      Returns the external type of the provider.
      Returns:
      the external type
    • getExternalSubType

      default String getExternalSubType()
      Returns the external subtype of the provider that serves to differentiate it from other providers sharing the same external type.
      Returns:
      the external subtype
    • getHeartbeatTargetCapable

      default boolean getHeartbeatTargetCapable()
      Flags if this datastore is heartbeat target capable in support of automatic failover of running workloads in the event of the loss of a host. If true, the option to designate as a heartbeat target will be available.
      Returns:
      whether, or not this datastore is heartbeat target capable
    • getImageTargetCapable

      default boolean getImageTargetCapable()
      Flags if this datastore is image target capable. If true, the option to designate as an image target will be available.
      Returns:
      whether, or not this datastore is image target capable
    • getCreatable

      boolean getCreatable()
      Flags if this datastore can be created by the user. Some datastores are system injected and cannot be created by the user
      Returns:
      whether, or not this datastore can be created by the user
    • getEditable

      boolean getEditable()
      Flags if the datastore created for this is editable or not
      Returns:
      whether, or not this datastore can be edited once added
    • getRemovable

      boolean getRemovable()
      Flags if the datastore created for this is removable or not
      Returns:
      whether, or not this datastore can be removed once added
    • getLocalStorage

      default boolean getLocalStorage()
      Flags if the DatastoreType is a local storage type, or a shared storage integration for cross host clustering.
      Returns:
      if the DatastoreType is local
    • getPluginManagedVolumeRefresh

      default boolean getPluginManagedVolumeRefresh()
      Flags if this DatastoreType implements its own refresh logic for refreshing volumes within the datastore type, or if this falls back to generic sync.
      Returns:
      if the DatastoreType implements its own refresh logic
    • removeVolume

      ServiceResponse removeVolume(StorageVolume volume, ComputeServer server, boolean removeSnapshots, boolean force)
      Perform any operations necessary on the target to remove a volume. This is used to remove a volume on a storage server It is typically called as part of server teardown.
      Parameters:
      volume - the current volume to remove
      server - the server the volume is being removed from (may contain information such as parentServer (hypervisor) or cluster)
      removeSnapshots - whether to remove snapshots associated with the volume. In some implementations this is mandatory and not separate.
      force - whether to force the removal of the volume. This is typically used to force the removal of a volume that is in use.
      Returns:
      the success state of the removal
    • createVolume

      ServiceResponse<StorageVolume> createVolume(StorageVolume volume, ComputeServer server)
      Perform any operations necessary on the target to create a volume. This is used to create a volume on a storage server It is typically called as part of server provisioning.
      Parameters:
      volume - the current volume to create
      server - the server the volume is being created on (may contain information such as parentServer (hypervisor) or cluster)
      Returns:
      the success state and a copy of the volume
    • cloneVolume

      ServiceResponse<StorageVolume> cloneVolume(StorageVolume volume, ComputeServer server, StorageVolume sourceVolume)
      Clones a volume based on a source volume object. This is one of the most important methods for provisioning as most VirtualImage provisioning objects are cloned from a local image cache of source volumes. This is where the QCOW2 may reside Often times you can infer this from the combination of the sourceVolume object as well as its datastore

      String sourceVolumePath = sourceVolume.datastore.externalPath + '/' + sourceVolume.externalId //this is the QCOW2 path typically used for clone operations String command = "sudo mkdir -p \"${volume.datastore.externalPath}/${server.externalId ?: server.name}\" ; sudo ionice -c 3 cp -f \"${sourceVolume.datastore.externalPath}/${sourceVolume.externalId}\" \"${volume.datastore.externalPath}/${server.externalId ?: server.name}/${volume.volumeName}\"" morpheusContext.executeCommandOnServer(server, command)

      Parameters:
      volume - the volume we are creating and cloning into
      server - the server the volume is associated with (typically the workload/vm)
      sourceVolume - the source volume we are cloning from
      Returns:
      the success state and a copy of the volume
    • cloneVolume

      ServiceResponse<StorageVolume> cloneVolume(StorageVolume volume, ComputeServer server, VirtualImage virtualImage, com.bertramlabs.plugins.karman.CloudFileInterface cloudFile)
      Clones a volume based on a source being the reference to the actual File in the Virtual Image. This can be called in the event there is no image cache or we need to directly stream to an image target. Remember, this code runs in the manager or morpheus appliance and not on the host itself. In order to stream contents directly to the target , we need to create a link we can fetch using the MorpheusFileCopyService
      Parameters:
      volume - the volume we are creating and cloning into
      server - the server the volume is associated with (typically the workload/vm)
      virtualImage - the virtual image this volume is being cloned out of
      cloudFile - the specific disk file (Karman abstraction) that is being cloned
      Returns:
      the success state and a copy of the volume
      See Also:
    • resizeVolume

      ServiceResponse<StorageVolume> resizeVolume(StorageVolume volume, ComputeServer server, Long newSize)
      Perform any operations necessary on the target to resize a volume. This is used to resize a volume on a storage server
      Parameters:
      volume - the current volume to resize
      server - the server the volume is being resized on (may contain information such as parentServer (hypervisor) or cluster)
      newSize - the new size of the volume... TODO: this exists on the volume record already, is newSize needed?
      Returns:
      the success state and a copy of the volume
    • validateDatastore

      default ServiceResponse validateDatastore(Datastore datastore)
      Perform any validations necessary on the target prior to create. The default returns success.
      Parameters:
      datastore - the current datastore being created
      Returns:
      the service response containing success state or any errors upon failure
    • createDatastore

      ServiceResponse<Datastore> createDatastore(Datastore datastore)
      Perform any operations necessary on the target to create and register a datastore. Most implementations iterate over the servers on the server group (hypervisors) and register a storage pool
      Parameters:
      datastore - the current datastore being created
      Returns:
      the service response containing success state or any errors upon failure
    • updateDatastore

      default ServiceResponse<Datastore> updateDatastore(Datastore datastore)
      Perform any operations necessary on the target to update a datastore. The default is not implemented for this behavior. If getEditable() is true, this method should be implemented
      Parameters:
      datastore - the current datastore being updated
      Returns:
      the success state and a copy of the datastore
    • removeDatastore

      ServiceResponse removeDatastore(Datastore datastore)
      Perform any operations necessary on the target to remove a datastore. this method should be implemented if getRemovable() is true. otherwise return null or an error.
      Parameters:
      datastore - the current datastore being removed
      Returns:
      the success state of the removal
    • refreshDatastore

      default ServiceResponse<Datastore> refreshDatastore(Datastore datastore)
      Refresh the provider with the associated data in the external system.
      Parameters:
      datastore - The Datastore object contains all the saved information regarding configuration of the Datastore.
      Returns:
      a ServiceResponse object. A ServiceResponse with a success value of 'false' will indicate the refresh process has failed and will change the datastore status to 'error'