Interface DatastoreTypeProvider
- All Superinterfaces:
PluginProvider
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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceProvides an asynchronous event listener for subscribing to events that may pertain to a datastore integration.static interfaceThis facet is used to provide additional hooks for MVM/VME specific provisioning tasks for VME/HPE Hypervisor Clusters.static interfacePerform any operations necessary on the target to create a snapshot of a volume.Nested classes/interfaces inherited from interface com.morpheusdata.core.providers.PluginProvider
PluginProvider.EventSubscriberFacet<E extends Event> -
Method Summary
Modifier and TypeMethodDescriptioncloneVolume(StorageVolume volume, ComputeServer server, StorageVolume sourceVolume) Clones a volume based on a source volume object.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.createDatastore(Datastore datastore) Perform any operations necessary on the target to create and register a datastore.createVolume(StorageVolume volume, ComputeServer server) Perform any operations necessary on the target to create a volume.booleanFlags if this datastore can be created by the user.booleanFlags if the datastore created for this is editable or notdefault StringReturns the external subtype of the provider that serves to differentiate it from other providers sharing the same external type.default StringReturns the external type of the provider.default booleanFlags if this datastore is heartbeat target capable in support of automatic failover of running workloads in the event of the loss of a host.default booleanFlags if this datastore is image target capable.default booleanFlags if theDatastoreTypeis a local storage type, or a shared storage integration for cross host clustering.Provide custom configuration options when creating a newAccountIntegrationdefault booleanFlags if thisDatastoreTypeimplements its own refresh logic for refreshing volumes within the datastore type, or if this falls back to generic sync.Returns theProvisionProvidercode for linking the generatedDatastoreTypewith the appropriateProvisionTypebooleanFlags if the datastore created for this is removable or notReturns the provider code for interacting with theStorageServerinterface This is optional and can be null if there is no interaction with a storage server whatsoeverdefault List<StorageVolumeType>Provide custom list ofStorageVolumeTypefor this datastore.default ServiceResponse<Datastore>refreshDatastore(Datastore datastore) Refresh the provider with the associated data in the external system.removeDatastore(Datastore datastore) Perform any operations necessary on the target to remove a datastore.removeVolume(StorageVolume volume, ComputeServer server, boolean removeSnapshots, boolean force) Perform any operations necessary on the target to remove a volume.resizeVolume(StorageVolume volume, ComputeServer server, Long newSize) Perform any operations necessary on the target to resize a volume.default ServiceResponse<Datastore>updateDatastore(Datastore datastore) Perform any operations necessary on the target to update a datastore.default ServiceResponsevalidateDatastore(Datastore datastore) Perform any validations necessary on the target prior to create.Methods inherited from interface com.morpheusdata.core.providers.PluginProvider
getCode, getMorpheus, getName, getPlugin, isPlugin
-
Method Details
-
getProvisionTypeCode
String getProvisionTypeCode()Returns theProvisionProvidercode for linking the generatedDatastoreTypewith the appropriateProvisionType- Returns:
- the code of the relevant ProvisionProvider
-
getStorageProviderCode
String getStorageProviderCode()Returns the provider code for interacting with theStorageServerinterface 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
StorageServerTypecode)
-
getOptionTypes
List<OptionType> getOptionTypes()Provide custom configuration options when creating a newAccountIntegration- Returns:
- a List of OptionType
-
getVolumeTypes
Provide custom list ofStorageVolumeTypefor this datastore. -
getExternalType
Returns the external type of the provider.- Returns:
- the external type
-
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 theDatastoreTypeis a local storage type, or a shared storage integration for cross host clustering.- Returns:
- if the
DatastoreTypeis local
-
getPluginManagedVolumeRefresh
default boolean getPluginManagedVolumeRefresh()Flags if thisDatastoreTypeimplements its own refresh logic for refreshing volumes within the datastore type, or if this falls back to generic sync.- Returns:
- if the
DatastoreTypeimplements 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 removeserver- 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
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 createserver- 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 mostVirtualImageprovisioning 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 datastoreString 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 intoserver- 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 theMorpheusFileCopyService- Parameters:
volume- the volume we are creating and cloning intoserver- the server the volume is associated with (typically the workload/vm)virtualImage- the virtual image this volume is being cloned out ofcloudFile- 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 resizeserver- 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
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
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
Perform any operations necessary on the target to update a datastore. The default is not implemented for this behavior. IfgetEditable()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
Perform any operations necessary on the target to remove a datastore. this method should be implemented ifgetRemovable()is true. otherwise return null or an error.- Parameters:
datastore- the current datastore being removed- Returns:
- the success state of the removal
-
refreshDatastore
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
ServiceResponseobject. A ServiceResponse with a success value of 'false' will indicate the refresh process has failed and will change the datastore status to 'error'
-