diff --git a/core/orchestrator_core.go b/core/orchestrator_core.go index 378d92fd4..2d17434a2 100644 --- a/core/orchestrator_core.go +++ b/core/orchestrator_core.go @@ -41,6 +41,17 @@ const ( // recordTiming is used to record in Prometheus the total time taken for an operation as follows: // defer recordTiming("backend_add")() // see also: https://play.golang.org/p/6xRXlhFdqBd +// It returns an error if the backend update is invalid. +// Parameters: +// operation - the name of the operation +// err - the error if there is any +// Returns: +// error - the error if the update is invalid, nil if the update is valid +// Example: +// err := o.recordTiming("backend_add", err) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 10725abd4157c24fed404e7638b0fc0c -- func recordTiming(operation string, err *error) func() { startTime := time.Now() return func() { @@ -54,6 +65,14 @@ func recordTiming(operation string, err *error) func() { } } +// recordTransactionTiming records the timing of a volume transaction. +// Parameters: +// txn - the volume transaction +// err - the error if there is any +// Example: +// recordTransactionTiming(txn, err) +// +// -- Doc autogenerated on 2022-06-21. Function hash: d39f7d63300a6cea90e7402ac7280126 -- func recordTransactionTiming(txn *storage.VolumeTransaction, err *error) { if txn == nil || txn.VolumeCreatingConfig == nil { // for unit tests, there will be no txn to record @@ -92,6 +111,15 @@ type TridentOrchestrator struct { } // NewTridentOrchestrator returns a storage orchestrator instance +// It returns a new storage orchestrator instance +// Parameters: +// client - the persistent store client +// Returns: +// *TridentOrchestrator - the new storage orchestrator instance +// Example: +// orchestrator := NewTridentOrchestrator(client) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 191889dd8a79b6ce0f352ad6106b0f84 -- func NewTridentOrchestrator(client persistentstore.Client) *TridentOrchestrator { return &TridentOrchestrator{ backends: make(map[string]storage.Backend), // key is UUID, not name @@ -108,6 +136,17 @@ func NewTridentOrchestrator(client persistentstore.Client) *TridentOrchestrator } } +// transformPersistentState transforms the persistent store to the current Trident API version. +// It returns an error if the transformation fails. +// Parameters: +// ctx - context for logging +// Returns: +// error - the error if the transformation fails, nil if the transformation succeeds +// Example: +// err := o.transformPersistentState(ctx) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: c9019c1c63e1407926e156160bcba2b4 -- func (o *TridentOrchestrator) transformPersistentState(ctx context.Context) error { version, err := o.storeClient.GetVersion(ctx) if err != nil && persistentstore.MatchKeyNotFoundErr(err) { @@ -141,6 +180,16 @@ func (o *TridentOrchestrator) transformPersistentState(ctx context.Context) erro return nil } +// Bootstrap initializes the orchestrator. It reads persistent state from the +// database and initializes the in-memory state. It also initializes the +// backend storage drivers. +// It returns an error if the initialization fails. +// Returns: +// error - the error if there is any +// Example: +// err := o.Bootstrap(ctx) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 04dcb5d2d9ba6669a7ec6f5734590b4e -- func (o *TridentOrchestrator) Bootstrap() error { ctx := GenerateRequestContext(context.Background(), "", ContextSourceInternal) var err error @@ -170,6 +219,16 @@ func (o *TridentOrchestrator) Bootstrap() error { return nil } +// bootstrapBackends initializes the backends that were persisted in the store. +// It returns an error if there is any. +// Parameters: +// ctx - context for logging +// Returns: +// error - the error if there is any +// Example: +// err := o.bootstrapBackends(ctx) +// +// -- Doc autogenerated on 2022-06-21. Function hash: ace19e963152e034bd3e2ad4e44efd2a -- func (o *TridentOrchestrator) bootstrapBackends(ctx context.Context) error { persistentBackends, err := o.storeClient.GetBackends(ctx) if err != nil { @@ -261,6 +320,16 @@ func (o *TridentOrchestrator) bootstrapBackends(ctx context.Context) error { return nil } +// bootstrapStorageClasses initializes the storage class cache from the backend store. +// It returns an error if the initialization fails. +// Parameters: +// ctx - context for logging +// Returns: +// error - error if there is any +// Example: +// err := o.bootstrapStorageClasses(ctx) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 21a98ba2c9aed0a70ca745011194074a -- func (o *TridentOrchestrator) bootstrapStorageClasses(ctx context.Context) error { persistentStorageClasses, err := o.storeClient.GetStorageClasses(ctx) if err != nil { @@ -281,8 +350,18 @@ func (o *TridentOrchestrator) bootstrapStorageClasses(ctx context.Context) error return nil } -// Updates the o.volumes cache with the latest backend data. This function should only edit o.volumes in place to avoid +// bootstrapVolumes updates the o.volumes cache with the latest backend data. This function should only edit o.volumes in place to avoid // briefly losing track of volumes that do exist. +// It returns an error if there is any. +// Parameters: +// ctx - context for logging +// Returns: +// error - the error if there is any +// Example: +// err := o.bootstrapVolumes(ctx) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 713a6e9aafc3998ba2508038c533087d -- func (o *TridentOrchestrator) bootstrapVolumes(ctx context.Context) error { volumes, err := o.storeClient.GetVolumes(ctx) if err != nil { @@ -335,6 +414,17 @@ func (o *TridentOrchestrator) bootstrapVolumes(ctx context.Context) error { return nil } +// bootstrapSnapshots initializes the snapshots map with snapshots that already exist in the backend. +// It returns an error if the initialization fails. +// Parameters: +// ctx - context for logging +// Returns: +// error - the error if the initialization is invalid, nil if the initialization is valid +// Example: +// err := o.bootstrapSnapshots(ctx) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 7cc86ef066af5a6d4d4cccf2aaacc362 -- func (o *TridentOrchestrator) bootstrapSnapshots(ctx context.Context) error { snapshots, err := o.storeClient.GetSnapshots(ctx) if err != nil { @@ -369,6 +459,16 @@ func (o *TridentOrchestrator) bootstrapSnapshots(ctx context.Context) error { return nil } +// bootstrapVolTxns initializes the volume transaction logs from the persistent store. +// It returns an error if the initialization fails. +// Parameters: +// ctx - context for logging +// Returns: +// error - the error if there is any +// Example: +// err := o.bootstrapVolTxns(ctx) +// +// -- Doc autogenerated on 2022-06-21. Function hash: e33c0ea45aaa4a9d8262fd4f04ac4667 -- func (o *TridentOrchestrator) bootstrapVolTxns(ctx context.Context) error { volTxns, err := o.storeClient.GetVolumeTransactions(ctx) if err != nil && !persistentstore.MatchKeyNotFoundErr(err) { @@ -385,6 +485,17 @@ func (o *TridentOrchestrator) bootstrapVolTxns(ctx context.Context) error { return nil } +// bootstrapNodes initializes the nodes in the store. +// It returns an error if the initialization fails. +// Parameters: +// ctx - context for logging +// Returns: +// error - the error if there is any +// Example: +// err := o.bootstrapNodes(ctx) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 7cfe94c5ecbb68533b741378eaa5ee46 -- func (o *TridentOrchestrator) bootstrapNodes(ctx context.Context) error { // Don't bootstrap nodes if we're not CSI if config.CurrentDriverContext != config.ContextCSI { @@ -409,6 +520,17 @@ func (o *TridentOrchestrator) bootstrapNodes(ctx context.Context) error { return nil } +// bootstrapVolumePublications initializes the volume publications cache with any publications that already exist in the store. +// It returns an error if the initialization fails. +// Parameters: +// ctx - context for logging +// Returns: +// error - the error if there is any +// Example: +// err := o.bootstrapVolumePublications(ctx) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: feea1b84b5d4a911d16860d0c211b775 -- func (o *TridentOrchestrator) bootstrapVolumePublications(ctx context.Context) error { // Don't bootstrap volume publications if we're not CSI if config.CurrentDriverContext != config.ContextCSI { @@ -430,6 +552,14 @@ func (o *TridentOrchestrator) bootstrapVolumePublications(ctx context.Context) e return nil } +// addVolumePublicationToCache adds a volume publication to the cache. +// Parameters: +// vp - the volume publication +// Example: +// o.addVolumePublicationToCache(vp) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 6831b1fc734710c782e9132682016e51 -- func (o *TridentOrchestrator) addVolumePublicationToCache(vp *utils.VolumePublication) { // If the volume has no entry we need to initialize the inner map if o.volumePublications[vp.VolumeName] == nil { @@ -438,6 +568,17 @@ func (o *TridentOrchestrator) addVolumePublicationToCache(vp *utils.VolumePublic o.volumePublications[vp.VolumeName][vp.NodeName] = vp } +// bootstrap initializes the orchestrator by fetching all of the backends, storage classes, volumes, snapshots, +// volumetxns, nodes, and volume publications from the store. It also initializes the core metrics. +// It returns an error if any of the fetches fail. +// Parameters: +// ctx - context for logging +// Returns: +// error - error if there is any +// Example: +// err := o.bootstrap(ctx) +// +// -- Doc autogenerated on 2022-06-21. Function hash: bcd99e963177e37d4f93a0ee26ad9890 -- func (o *TridentOrchestrator) bootstrap(ctx context.Context) error { // Fetching backend information @@ -485,6 +626,11 @@ func (o *TridentOrchestrator) bootstrap(ctx context.Context) error { } // Stop stops the orchestrator core. +// Example: +// orchestrator.Stop() +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 3a67a0fe542b11aed94153d8aabdd3cc -- func (o *TridentOrchestrator) Stop() { // Stop the node access reconciliation background task if o.stopNodeAccessLoop != nil { @@ -497,6 +643,11 @@ func (o *TridentOrchestrator) Stop() { // updateMetrics updates the metrics that track the core objects. // The caller should hold the orchestrator lock. +// Example: +// o.updateMetrics() +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: ab104a423eb8f8557aa63ebaff87a6bf -- func (o *TridentOrchestrator) updateMetrics() { tridentBuildInfo.WithLabelValues(config.BuildHash, config.OrchestratorVersion.ShortString(), @@ -548,6 +699,18 @@ func (o *TridentOrchestrator) updateMetrics() { } } +// handleFailedTransaction handles the failed transaction. +// It returns an error if the transaction is invalid. +// Parameters: +// ctx - context for logging +// v - the volume transaction +// Returns: +// error - the error if there is any +// Example: +// err := o.handleFailedTransaction(ctx, v) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 39541d951f05903909338f9e59963947 -- func (o *TridentOrchestrator) handleFailedTransaction(ctx context.Context, v *storage.VolumeTransaction) error { switch v.Op { case storage.AddVolume, storage.DeleteVolume, @@ -785,6 +948,17 @@ func (o *TridentOrchestrator) handleFailedTransaction(ctx context.Context, v *st return nil } +// resetImportedVolumeName resets the name of an imported volume to its original name. +// It returns an error if the volume cannot be renamed. +// Parameters: +// ctx - context for logging +// volume - the volume to reset +// Returns: +// error - the error if the reset failed, nil if the reset succeeded +// Example: +// err := o.resetImportedVolumeName(ctx, volume) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 1033950f7f2014fd8a87dbfb93781f51 -- func (o *TridentOrchestrator) resetImportedVolumeName(ctx context.Context, volume *storage.VolumeConfig) error { // The volume could be renamed (notManaged = false) without being persisted. // If the volume wasn't added to the persistent store, we attempt to rename @@ -801,6 +975,13 @@ func (o *TridentOrchestrator) resetImportedVolumeName(ctx context.Context, volum return nil } +// AddFrontend adds a new frontend to the orchestrator. +// Parameters: +// f - the frontend plugin +// Example: +// orchestrator.AddFrontend(frontend1) +// +// -- Doc autogenerated on 2022-06-21. Function hash: be80e16a539796ac4231803c9351df2d -- func (o *TridentOrchestrator) AddFrontend(f frontend.Plugin) { name := f.GetName() if _, ok := o.frontends[name]; ok { @@ -811,6 +992,18 @@ func (o *TridentOrchestrator) AddFrontend(f frontend.Plugin) { o.frontends[name] = f } +// GetFrontend returns a frontend by name +// It returns an error if the frontend does not exist +// Parameters: +// ctx - context for logging +// name - the name of the frontend +// Returns: +// frontend.Plugin - the frontend +// error - error if there is any +// Example: +// fe, err := orchestrator.GetFrontend(ctx, "frontend1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 68c5aa2cdd27528e7d82eb37fe73b601 -- func (o *TridentOrchestrator) GetFrontend(ctx context.Context, name string) (frontend.Plugin, error) { if fe, ok := o.frontends[name]; !ok { err := fmt.Errorf("requested frontend %s does not exist", name) @@ -821,6 +1014,17 @@ func (o *TridentOrchestrator) GetFrontend(ctx context.Context, name string) (fro } } +// validateBackendUpdate validates that the backend update is valid. +// It returns an error if the backend update is invalid. +// Parameters: +// oldBackend - the old backend +// newBackend - the new backend +// Returns: +// error - the error if the update is invalid, nil if the update is valid +// Example: +// err := o.validateBackendUpdate(oldBackend, newBackend) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 80555ddd7f23803234d84705cd8e72e3 -- func (o *TridentOrchestrator) validateBackendUpdate(oldBackend, newBackend storage.Backend) error { // Validate that backend type isn't being changed as backend type has // implications for the internal volume names. @@ -833,11 +1037,35 @@ func (o *TridentOrchestrator) validateBackendUpdate(oldBackend, newBackend stora return nil } +// GetVersion returns the version of the orchestrator. +// It returns an error if the orchestrator is not yet initialized. +// Parameters: +// ctx - context for logging +// Returns: +// string - the version of the orchestrator +// error - the error if there is any +// Example: +// version, err := o.GetVersion(ctx) +// +// -- Doc autogenerated on 2022-06-21. Function hash: b3ff28ff24fcdaca9fca3da6aa509290 -- func (o *TridentOrchestrator) GetVersion(context.Context) (string, error) { return config.OrchestratorVersion.String(), o.bootstrapError } // AddBackend handles creation of a new storage backend +// It returns an error if the backend cannot be added. +// Parameters: +// ctx - context for logging +// configJSON - the JSON configuration for the backend +// configRef - the reference to the backend configuration +// Returns: +// storage.BackendExternal - the backend external representation +// error - the error if the backend cannot be added, nil if the backend is added successfully +// Example: +// backendExternal, err := o.AddBackend(ctx, configJSON, configRef) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 34be8d97dce7cb93c1f08707afc3fa62 -- func (o *TridentOrchestrator) AddBackend( ctx context.Context, configJSON, configRef string, ) (backendExternal *storage.BackendExternal, err error) { @@ -870,6 +1098,20 @@ func (o *TridentOrchestrator) AddBackend( // addBackend creates a new storage backend. It assumes the mutex lock is // already held or not required (e.g., during bootstrapping). +// It returns an error if the backend cannot be added. +// Parameters: +// ctx - context for logging +// configJSON - the JSON configuration for the backend +// backendUUID - the UUID of the backend +// configRef - the configRef for the backend +// Returns: +// storage.BackendExternal - the backend external representation +// error - the error if the backend cannot be added, nil if the backend is added +// Example: +// backendExternal, err := o.addBackend(ctx, configJSON, backendUUID, configRef) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 1844d31bca8826ed9ced9036eb98c934 -- func (o *TridentOrchestrator) addBackend( ctx context.Context, configJSON, backendUUID, configRef string, ) (backendExternal *storage.BackendExternal, err error) { @@ -972,6 +1214,19 @@ func (o *TridentOrchestrator) addBackend( } // validateAndCreateBackendFromConfig validates config and creates backend based on Config +// It returns an error if the backend update is invalid. +// Parameters: +// ctx - context for logging +// configJSON - the config JSON +// configRef - the config reference +// backendUUID - the backend UUID +// Returns: +// storage.Backend - the backend +// error - the error if the update is invalid, nil if the update is valid +// Example: +// err := o.validateAndCreateBackendFromConfig(ctx, configJSON, configRef, backendUUID) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 2fefe24643f68e5970070168da26f2d9 -- func (o *TridentOrchestrator) validateAndCreateBackendFromConfig( ctx context.Context, configJSON, configRef, backendUUID string, ) (backendExternal storage.Backend, err error) { @@ -1009,6 +1264,20 @@ func (o *TridentOrchestrator) validateAndCreateBackendFromConfig( } // UpdateBackend updates an existing backend. +// It returns an error if the backend update is invalid. +// Parameters: +// ctx - context for logging +// backendName - the name of the backend +// configJSON - the JSON configuration for the backend +// configRef - the reference to the backend configuration +// Returns: +// storage.BackendExternal - the backend +// error - the error if the update is invalid, nil if the update is valid +// Example: +// backend, err := o.UpdateBackend(ctx, "backend1", configJSON, configRef) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: ac16cef94ad15602c48bdc8ddaac8f09 -- func (o *TridentOrchestrator) UpdateBackend( ctx context.Context, backendName, configJSON, configRef string, ) (backendExternal *storage.BackendExternal, err error) { @@ -1042,6 +1311,19 @@ func (o *TridentOrchestrator) UpdateBackend( } // updateBackend updates an existing backend. It assumes the mutex lock is already held. +// It returns an error if the backend update is invalid. +// Parameters: +// ctx - context for logging +// backendName - the name of the backend +// configJSON - JSON string representation of the backend config +// configRef - configuration reference for this orchestrator (e.g. a configmap) +// Returns: +// storage.BackendExternal - the backend external +// error - the error if the update is invalid, nil if the update is valid +// Example: +// backendExternal, err := orchestrator.updateBackend("backend1", "configJSON", "backendUUID", "configRef") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 77a2adc15ab73dcb06f28116870daedc -- func (o *TridentOrchestrator) updateBackend( ctx context.Context, backendName, configJSON, configRef string, ) (backendExternal *storage.BackendExternal, err error) { @@ -1055,6 +1337,21 @@ func (o *TridentOrchestrator) updateBackend( } // UpdateBackendByBackendUUID updates an existing backend. +// It returns an error if the backend update is invalid. +// Parameters: +// ctx - context for logging +// backendName - the name of the backend +// configJSON - the JSON configuration for the backend +// backendUUID - the UUID of the backend +// configRef - the config reference for the backend +// Returns: +// storage.BackendExternal - the backend +// error - the error if the update is invalid, nil if the update is valid +// Example: +// backend, err := orchestrator.UpdateBackendByBackendUUID(ctx, "backend1", configJSON, backendUUID, configRef) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 44aa8fb20d8dabe1ff9780954d172644 -- func (o *TridentOrchestrator) UpdateBackendByBackendUUID( ctx context.Context, backendName, configJSON, backendUUID, configRef string, ) (backend *storage.BackendExternal, err error) { @@ -1087,8 +1384,21 @@ func (o *TridentOrchestrator) UpdateBackendByBackendUUID( return backend, nil } -// TODO combine this one and the one above // updateBackendByBackendUUID updates an existing backend. It assumes the mutex lock is already held. +// It returns an error if the backend update is invalid. +// Parameters: +// ctx - context for logging +// backendName - the name of the backend +// configJSON - the JSON configuration for the backend +// backendUUID - the UUID of the backend +// callingConfigRef - the UUID of the TridentBackendConfig CR that initiated this update +// Returns: +// storage.BackendExternal - the backend external representation +// error - error if there is any +// Example: +// backendExternal, err := orchestrator.updateBackendByBackendUUID(ctx, "backend1", configJSON, "uuid1", "uuid2") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 8026625a6962d3055aaee3801d241d07 -- func (o *TridentOrchestrator) updateBackendByBackendUUID( ctx context.Context, backendName, configJSON, backendUUID, callingConfigRef string, ) (backendExternal *storage.BackendExternal, err error) { @@ -1311,6 +1621,19 @@ func (o *TridentOrchestrator) updateBackendByBackendUUID( } // UpdateBackendState updates an existing backend's state. +// It returns an error if the backend update is invalid. +// Parameters: +// ctx - context for logging +// backendName - the name of the backend +// backendState - the new state of the backend +// Returns: +// storage.BackendExternal - the backend +// error - error if there is any +// Example: +// backend, err := orchestrator.UpdateBackendState(ctx, "backend1", "up") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 98c9ddbad561e4fd433f44fac8ab4e78 -- func (o *TridentOrchestrator) UpdateBackendState( ctx context.Context, backendName, backendState string, ) (backendExternal *storage.BackendExternal, err error) { @@ -1328,6 +1651,18 @@ func (o *TridentOrchestrator) UpdateBackendState( } // updateBackendState updates an existing backend's state. It assumes the mutex lock is already held. +// It returns an error if the backend update is invalid. +// Parameters: +// ctx - context for logging +// backendName - the name of the backend +// backendState - the new state of the backend +// Returns: +// storage.BackendExternal - the backend +// error - the error if the update is invalid, nil if the update is valid +// Example: +// backend, err := orchestrator.updateBackendState(ctx, "backend1", "Failed") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 2a4b31771a2b11c73b1d43bc4fa94d33 -- func (o *TridentOrchestrator) updateBackendState( ctx context.Context, backendName, backendState string, ) (backendExternal *storage.BackendExternal, err error) { @@ -1363,6 +1698,17 @@ func (o *TridentOrchestrator) updateBackendState( return backend.ConstructExternal(ctx), o.storeClient.UpdateBackend(ctx, backend) } +// getBackendUUIDByBackendName returns a backend UUID by name +// It returns an error if the backend UUID is not found. +// Parameters: +// backendName - the name of the backend +// Returns: +// string - the UUID of the backend +// error - error if there is any +// Example: +// backendUUID, err := orchestrator.getBackendUUIDByBackendName("backend1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 3432223f3c321828475a38387539f630 -- func (o *TridentOrchestrator) getBackendUUIDByBackendName(backendName string) (string, error) { backendUUID := "" for _, b := range o.backends { @@ -1374,6 +1720,17 @@ func (o *TridentOrchestrator) getBackendUUIDByBackendName(backendName string) (s return "", utils.NotFoundError(fmt.Sprintf("backend %v was not found", backendName)) } +// getBackendByBackendName returns a backend by name +// It returns an error if the backend is not found +// Parameters: +// backendName - the name of the backend +// Returns: +// storage.Backend - the backend +// error - error if there is any +// Example: +// backend, err := orchestrator.getBackendByBackendName("backend1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 5359cbb6a4e1cb6e05469580d3214563 -- func (o *TridentOrchestrator) getBackendByBackendName(backendName string) (storage.Backend, error) { for _, b := range o.backends { if b.Name() == backendName { @@ -1383,6 +1740,17 @@ func (o *TridentOrchestrator) getBackendByBackendName(backendName string) (stora return nil, utils.NotFoundError(fmt.Sprintf("backend %v was not found", backendName)) } +// getBackendByConfigRef returns a backend by configRef +// It returns an error if the backend is not found. +// Parameters: +// configRef - the configRef of the backend +// Returns: +// storage.Backend - the backend +// error - error if there is any +// Example: +// backend, err := orchestrator.getBackendByConfigRef("configRef1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 37e7727af627a51a35149814c5e420af -- func (o *TridentOrchestrator) getBackendByConfigRef(configRef string) (storage.Backend, error) { for _, b := range o.backends { if b.ConfigRef() == configRef { @@ -1392,6 +1760,17 @@ func (o *TridentOrchestrator) getBackendByConfigRef(configRef string) (storage.B return nil, utils.NotFoundError(fmt.Sprintf("backend based on configRef '%v' was not found", configRef)) } +// getBackendByBackendUUID returns a backend by UUID +// It returns an error if the backend UUID is not found. +// Parameters: +// backendUUID - the UUID of the backend +// Returns: +// storage.Backend - the backend +// error - error if there is any +// Example: +// backend, err := orchestrator.getBackendByBackendUUID("backend1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 5b6c42a570cd7be7efb047a76057cbdd -- func (o *TridentOrchestrator) getBackendByBackendUUID(backendUUID string) (storage.Backend, error) { backend := o.backends[backendUUID] if backend != nil { @@ -1400,6 +1779,18 @@ func (o *TridentOrchestrator) getBackendByBackendUUID(backendUUID string) (stora return nil, utils.NotFoundError(fmt.Sprintf("backend uuid %v was not found", backendUUID)) } +// GetBackend returns a backend by name +// It returns an error if the backend is not found +// Parameters: +// ctx - context for logging +// backendName - the name of the backend +// Returns: +// storage.BackendExternal - the backend +// error - error if there is any +// Example: +// backend, err := orchestrator.GetBackend(ctx, "backend1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 97ea7edf0258bdf4ee62e165318ef219 -- func (o *TridentOrchestrator) GetBackend( ctx context.Context, backendName string, ) (backendExternal *storage.BackendExternal, err error) { @@ -1431,6 +1822,19 @@ func (o *TridentOrchestrator) GetBackend( return backendExternal, nil } +// GetBackendByBackendUUID returns a backend by UUID +// It returns an error if the backend UUID is invalid. +// Parameters: +// ctx - context for logging +// backendUUID - the UUID of the backend +// Returns: +// storage.BackendExternal - the backend +// error - error if there is any +// Example: +// backend, err := orchestrator.GetBackendByBackendUUID(ctx, "backend1") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 81d8fa64dc1b3803acd28fbacf4b0287 -- func (o *TridentOrchestrator) GetBackendByBackendUUID( ctx context.Context, backendUUID string, ) (backendExternal *storage.BackendExternal, err error) { @@ -1459,6 +1863,18 @@ func (o *TridentOrchestrator) GetBackendByBackendUUID( return backendExternal, nil } +// ListBackends lists all the backends that are currently configured. +// It returns an error if there is any. +// Parameters: +// ctx - context for logging +// Returns: +// []*storage.BackendExternal - the list of backends +// error - the error if there is any +// Example: +// backendExternals, err := o.ListBackends(ctx) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 2d98525f51bd5d6b7df26ff8693141e9 -- func (o *TridentOrchestrator) ListBackends( ctx context.Context, ) (backendExternals []*storage.BackendExternal, err error) { @@ -1482,6 +1898,18 @@ func (o *TridentOrchestrator) ListBackends( return backends, nil } +// DeleteBackend deletes a backend. +// It returns an error if the backend doesn't exist or if the backend is in use. +// Parameters: +// ctx - context for logging +// backendName - the name of the backend to delete +// Returns: +// error - the error if the backend could not be deleted, nil if the backend was deleted +// Example: +// err := o.DeleteBackend(ctx, "backend1") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: dac0943d6e46a81a0f9787f5f6ef64f3 -- func (o *TridentOrchestrator) DeleteBackend(ctx context.Context, backendName string) (err error) { if o.bootstrapError != nil { Logc(ctx).WithFields(log.Fields{ @@ -1503,6 +1931,19 @@ func (o *TridentOrchestrator) DeleteBackend(ctx context.Context, backendName str return o.deleteBackendByBackendUUID(ctx, backendName, backendUUID) } +// DeleteBackendByBackendUUID deletes a backend by UUID. +// It returns an error if the backend doesn't exist. +// Parameters: +// ctx - context for logging +// backendName - the name of the backend +// backendUUID - the UUID of the backend +// Returns: +// error - the error if the delete failed, nil if the delete succeeded +// Example: +// err := o.DeleteBackendByBackendUUID(ctx, "backend1", "12345") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: ade56985c915048a2ff8350f698c0690 -- func (o *TridentOrchestrator) DeleteBackendByBackendUUID( ctx context.Context, backendName, backendUUID string, ) (err error) { @@ -1522,6 +1963,19 @@ func (o *TridentOrchestrator) DeleteBackendByBackendUUID( return o.deleteBackendByBackendUUID(ctx, backendName, backendUUID) } +// deleteBackendByBackendUUID deletes a backend by name +// It returns an error if the backend doesn't exist or if the backend has volumes. +// Parameters: +// ctx - context for logging +// backendName - the name of the backend +// backendUUID - the UUID of the backend +// Returns: +// error - the error if the backend could not be deleted, nil if the backend was deleted +// Example: +// err := o.deleteBackendByBackendUUID(ctx, "backend1", "12345") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 2568753d63d7e3305bdc4b1ea5d422de -- func (o *TridentOrchestrator) deleteBackendByBackendUUID(ctx context.Context, backendName, backendUUID string) error { Logc(ctx).WithFields(log.Fields{ "backendName": backendName, @@ -1576,6 +2030,17 @@ func (o *TridentOrchestrator) deleteBackendByBackendUUID(ctx context.Context, ba } // RemoveBackendConfigRef sets backend configRef to empty and updates it. +// It returns an error if the backend update is invalid. +// Parameters: +// ctx - context for logging +// backendUUID - the UUID of the backend +// configRef - the configRef of the backend +// Returns: +// error - the error if the update is invalid, nil if the update is valid +// Example: +// err := o.RemoveBackendConfigRef(ctx, backendUUID, configRef) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 331e58f467a6cdb46f9fe1e3df756370 -- func (o *TridentOrchestrator) RemoveBackendConfigRef(ctx context.Context, backendUUID, configRef string) (err error) { defer recordTiming("backend_update", &err)() @@ -1600,6 +2065,19 @@ func (o *TridentOrchestrator) RemoveBackendConfigRef(ctx context.Context, backen return o.storeClient.UpdateBackend(ctx, b) } +// AddVolume creates a new volume. +// It returns an error if the volume already exists or if the backend does not exist. +// Parameters: +// ctx - context for logging +// volumeConfig - the volume config +// Returns: +// storage.VolumeExternal - the new volume +// error - error if there is any +// Example: +// externalVol, err := orchestrator.AddVolume(ctx, volumeConfig) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 6b3abc4db9d4558bf39248381f6e73e6 -- func (o *TridentOrchestrator) AddVolume( ctx context.Context, volumeConfig *storage.VolumeConfig, ) (externalVol *storage.VolumeExternal, err error) { @@ -1634,6 +2112,18 @@ func (o *TridentOrchestrator) AddVolume( // addVolumeInitial continues the volume creation operation. // This method should only be called from AddVolume, as it does not take locks or otherwise do much validation // of the volume config. +// It returns an error if the volume creation is invalid. +// Parameters: +// ctx - context for logging +// volumeConfig - the volume config +// Returns: +// externalVol - the external volume +// error - the error if the creation is invalid, nil if the creation is valid +// Example: +// externalVol, err := o.addVolumeInitial(ctx, volumeConfig) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: b5ae8d6da66bca2cf182c5d0013b1c02 -- func (o *TridentOrchestrator) addVolumeInitial( ctx context.Context, volumeConfig *storage.VolumeConfig, ) (externalVol *storage.VolumeExternal, err error) { @@ -1761,6 +2251,17 @@ func (o *TridentOrchestrator) addVolumeInitial( // addVolumeRetry continues a volume creation operation that previously failed with a VolumeCreatingError. // This method should only be called from AddVolume, as it does not take locks or otherwise do much validation // of the volume config. +// It returns an error if the volume creation operation fails. +// Parameters: +// ctx - context for logging +// txn - the volume transaction +// Returns: +// externalVol - the external volume +// error - the error if the volume creation operation fails, nil if it succeeds +// Example: +// externalVol, err := o.addVolumeRetry(ctx, txn) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 1ef65ba5121b49ef47f655224be95398 -- func (o *TridentOrchestrator) addVolumeRetry( ctx context.Context, txn *storage.VolumeTransaction, ) (externalVol *storage.VolumeExternal, err error) { @@ -1825,6 +2326,20 @@ func (o *TridentOrchestrator) addVolumeRetry( // addVolumeFinish is called after successful completion of a volume create/clone operation // to save the volume in the persistent store as well as Trident's in-memory cache. +// It returns an error if there is any. +// Parameters: +// ctx - context for logging +// txn - the volume transaction +// vol - the volume +// backend - the backend +// pool - the pool +// Returns: +// storage.VolumeExternal - the external volume +// error - the error if there is any +// Example: +// externalVol, err := o.addVolumeFinish(ctx, txn, vol, backend, pool) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 550c1e0b637b8b5a2f43afa834fd1758 -- func (o *TridentOrchestrator) addVolumeFinish( ctx context.Context, txn *storage.VolumeTransaction, vol *storage.Volume, backend storage.Backend, pool storage.Pool, @@ -1853,6 +2368,19 @@ func (o *TridentOrchestrator) addVolumeFinish( return externalVol, nil } +// CloneVolume creates a new volume by cloning an existing volume. +// It returns an error if the new volume cannot be created. +// Parameters: +// ctx - context for logging +// volumeConfig - the configuration for the new volume +// Returns: +// storage.VolumeExternal - the new volume +// error - the error if any +// Example: +// externalVol, err := o.CloneVolume(ctx, volumeConfig) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 3b05245cf8d531e1b7e704f1d7673887 -- func (o *TridentOrchestrator) CloneVolume( ctx context.Context, volumeConfig *storage.VolumeConfig, ) (externalVol *storage.VolumeExternal, err error) { @@ -1884,6 +2412,19 @@ func (o *TridentOrchestrator) CloneVolume( return o.cloneVolumeInitial(ctx, volumeConfig) } +// cloneVolumeInitial creates a new volume by cloning an existing volume. +// It returns an error if the new volume cannot be created. +// Parameters: +// ctx - context for logging +// volumeConfig - the volume config +// Returns: +// storage.VolumeExternal - the new volume +// error - error if there is any +// Example: +// externalVol, err := orchestrator.cloneVolumeInitial(ctx, volumeConfig) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 3f83112418a823bdafb4b150c3214f8e -- func (o *TridentOrchestrator) cloneVolumeInitial( ctx context.Context, volumeConfig *storage.VolumeConfig, ) (externalVol *storage.VolumeExternal, err error) { @@ -2025,6 +2566,18 @@ func (o *TridentOrchestrator) cloneVolumeInitial( return o.addVolumeFinish(ctx, txn, vol, backend, pool) } +// cloneVolumeRetry validates that the backend update is valid. +// It returns an error if the backend update is invalid. +// Parameters: +// ctx - context for logging +// txn - the volume transaction +// Returns: +// externalVol - the external volume +// error - the error if the update is invalid, nil if the update is valid +// Example: +// err := o.cloneVolumeRetry(ctx, txn) +// +// -- Doc autogenerated on 2022-06-21. Function hash: d3195084da6ca49594299f21956d774c -- func (o *TridentOrchestrator) cloneVolumeRetry( ctx context.Context, txn *storage.VolumeTransaction, ) (externalVol *storage.VolumeExternal, err error) { @@ -2103,6 +2656,18 @@ func (o *TridentOrchestrator) cloneVolumeRetry( // GetVolumeExternal is used by volume import so it doesn't check core's o.volumes to see if the // volume exists or not. Instead it asks the driver if the volume exists before requesting // the volume size. Returns the VolumeExternal representation of the volume. +// It returns an error if the volume doesn't exist. +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// backendName - the name of the backend +// Returns: +// volExternal - the VolumeExternal representation of the volume +// error - the error if the volume doesn't exist, nil if the volume exists +// Example: +// volExternal, err := o.GetVolumeExternal(ctx, "volume1", "backend1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 6d7df3139b77d4e7f3b0c5a1f0401aed -- func (o *TridentOrchestrator) GetVolumeExternal( ctx context.Context, volumeName, backendName string, ) (volExternal *storage.VolumeExternal, err error) { @@ -2138,6 +2703,20 @@ func (o *TridentOrchestrator) GetVolumeExternal( } // GetVolumeByInternalName returns a volume by the given internal name +// It returns the volume name and error if any +// Parameters: +// volumeInternal - the internal name of the volume +// context - context for logging +// Returns: +// string - the volume name +// error - error if any +// Example: +// volume, err := orchestrator.GetVolumeByInternalName("volume1", nil) +// +// GetVolumeExternal queries a backend driver for a given volume identified by the +// internal name. If the volume doesn't exist, an error is returned. +// +// -- Doc autogenerated on 2022-06-21. Function hash: e81135d85cf26e9b05d143d437569df4 -- func (o *TridentOrchestrator) GetVolumeByInternalName( volumeInternal string, _ context.Context, ) (volume string, err error) { @@ -2154,6 +2733,18 @@ func (o *TridentOrchestrator) GetVolumeByInternalName( return "", utils.NotFoundError(fmt.Sprintf("volume %s not found", volumeInternal)) } +// validateImportVolume validates that the volume import is valid. +// It returns an error if the volume import is invalid. +// Parameters: +// ctx - context for logging +// volumeConfig - the volume config +// Returns: +// error - the error if the import is invalid, nil if the import is valid +// Example: +// err := o.validateImportVolume(ctx, volumeConfig) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 0b239a8ef621ed2e08adbc4c80a11281 -- func (o *TridentOrchestrator) validateImportVolume(ctx context.Context, volumeConfig *storage.VolumeConfig) error { backend, err := o.getBackendByBackendUUID(volumeConfig.ImportBackendUUID) if err != nil { @@ -2215,6 +2806,21 @@ func (o *TridentOrchestrator) validateImportVolume(ctx context.Context, volumeCo return nil } +// LegacyImportVolume imports a volume from an external storage backend. +// It returns an error if the volume cannot be imported. +// Parameters: +// ctx - context for logging +// volumeConfig - the volume config +// backendName - the name of the backend +// notManaged - if true, the volume will not be persisted in the store +// createPVandPVC - the callback function to create PV and PVC for the volume +// Returns: +// storage.VolumeExternal - the volume external +// error - error if there is any +// Example: +// volExternal, err := o.LegacyImportVolume(ctx, volumeConfig, backendName, notManaged, createPVandPVC) +// +// -- Doc autogenerated on 2022-06-21. Function hash: f8c072d23374263c1a818a13bc96fac1 -- func (o *TridentOrchestrator) LegacyImportVolume( ctx context.Context, volumeConfig *storage.VolumeConfig, backendName string, notManaged bool, createPVandPVC VolumeCallback, @@ -2305,6 +2911,19 @@ func (o *TridentOrchestrator) LegacyImportVolume( return volExternal, nil } +// ImportVolume imports a volume into Trident. The volume must already exist on the specified backend. +// It returns an error if the volume cannot be imported. +// Parameters: +// ctx - context for logging +// volumeConfig - the volume config +// Returns: +// storage.VolumeExternal - the external volume +// error - the error if there is any +// Example: +// volExternal, err := orchestrator.ImportVolume(ctx, volumeConfig) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: caf9bc105080edc2f7b86c15a43a3f1e -- func (o *TridentOrchestrator) ImportVolume( ctx context.Context, volumeConfig *storage.VolumeConfig, ) (externalVol *storage.VolumeExternal, err error) { @@ -2393,6 +3012,16 @@ func (o *TridentOrchestrator) ImportVolume( // AddVolumeTransaction is called from the volume create, clone, and resize // methods to save a record of the operation in case it fails and must be // cleaned up later. +// It returns an error if the transaction could not be added. +// Parameters: +// ctx - context for logging +// volTxn - the volume transaction +// Returns: +// error - the error if the transaction could not be added, nil if the transaction was added +// Example: +// err := o.AddVolumeTransaction(ctx, volTxn) +// +// -- Doc autogenerated on 2022-06-21. Function hash: e26d3c9af53a81028676844f37108220 -- func (o *TridentOrchestrator) AddVolumeTransaction(ctx context.Context, volTxn *storage.VolumeTransaction) error { // Check if a transaction already exists for this volume. This condition // can occur if we failed to clean up the transaction object during the @@ -2435,6 +3064,18 @@ func (o *TridentOrchestrator) AddVolumeTransaction(ctx context.Context, volTxn * return o.storeClient.AddVolumeTransaction(ctx, volTxn) } +// GetVolumeCreatingTransaction returns a volume transaction that is currently creating a volume. +// It returns an error if the volume transaction cannot be retrieved. +// Parameters: +// ctx - context for logging +// config - the volume config +// Returns: +// storage.VolumeTransaction - the volume transaction +// error - error if there is any +// Example: +// txn, err := orchestrator.GetVolumeCreatingTransaction(ctx, config) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 4025deb561dc0aba9e0fa596740664b8 -- func (o *TridentOrchestrator) GetVolumeCreatingTransaction( ctx context.Context, config *storage.VolumeConfig, ) (*storage.VolumeTransaction, error) { @@ -2454,6 +3095,18 @@ func (o *TridentOrchestrator) GetVolumeCreatingTransaction( } } +// GetVolumeTransaction returns a volume transaction by name +// It returns an error if the volume transaction is not found +// Parameters: +// ctx - context for logging +// volTxn - the volume transaction +// Returns: +// storage.VolumeTransaction - the volume transaction +// error - error if there is any +// Example: +// volTxn, err := orchestrator.GetVolumeTransaction(ctx, "volTxn1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: d8a638429c4b2c3043bb0281d5c34490 -- func (o *TridentOrchestrator) GetVolumeTransaction( ctx context.Context, volTxn *storage.VolumeTransaction, ) (*storage.VolumeTransaction, error) { @@ -2462,12 +3115,37 @@ func (o *TridentOrchestrator) GetVolumeTransaction( // DeleteVolumeTransaction deletes a volume transaction created by // addVolumeTransaction. +// It returns an error if the volume transaction could not be deleted. +// Parameters: +// ctx - context for logging +// volTxn - the volume transaction to delete +// Returns: +// error - the error if the volume transaction could not be deleted, nil if the volume transaction was deleted +// Example: +// err := o.DeleteVolumeTransaction(ctx, volTxn) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 795e32bfe4a5dd11a92ae36c8c1c3e07 -- func (o *TridentOrchestrator) DeleteVolumeTransaction(ctx context.Context, volTxn *storage.VolumeTransaction) error { return o.storeClient.DeleteVolumeTransaction(ctx, volTxn) } // addVolumeCleanup is used as a deferred method from the volume create/clone methods // to clean up in case anything goes wrong during the operation. +// It returns an error if the cleanup is unsuccessful. +// Parameters: +// ctx - context for logging +// err - the error that occurred during the operation +// backend - the backend where the volume was created +// vol - the volume that was created +// volTxn - the volume transaction associated with the operation +// volumeConfig - the volume config associated with the operation +// Returns: +// error - the error if the cleanup is unsuccessful, nil if the cleanup is successful +// Example: +// err := o.addVolumeCleanup(ctx, err, backend, vol, volTxn, volumeConfig) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 10707fd80e961ea473b9d9d8b57018aa -- func (o *TridentOrchestrator) addVolumeCleanup( ctx context.Context, err error, backend storage.Backend, vol *storage.Volume, volTxn *storage.VolumeTransaction, volumeConfig *storage.VolumeConfig, @@ -2527,6 +3205,20 @@ func (o *TridentOrchestrator) addVolumeCleanup( // addVolumeRetryCleanup is used as a deferred method from the volume create/clone methods // to handles the case where a volume creation took too long, is still ongoing, and must be // preserved in a transaction. +// It returns an error if the volume creation is still ongoing. +// Parameters: +// ctx - context for logging +// err - the error if the volume creation is still ongoing +// backend - the backend +// pool - the pool +// volTxn - the volume transaction +// volumeConfig - the volume config +// Returns: +// error - the error if the volume creation is still ongoing, nil if the volume creation is successful +// Example: +// err := o.addVolumeRetryCleanup(ctx, err, backend, pool, volTxn, volumeConfig) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 012cba4286b63bb807e231a47dcbae05 -- func (o *TridentOrchestrator) addVolumeRetryCleanup( ctx context.Context, err error, backend storage.Backend, pool storage.Pool, volTxn *storage.VolumeTransaction, volumeConfig *storage.VolumeConfig, @@ -2578,6 +3270,21 @@ func (o *TridentOrchestrator) addVolumeRetryCleanup( return err } +// importVolumeCleanup is a helper function that cleans up after a failed volume import. +// +// It returns an error if it was unable to clean up all artifacts of the volume import. +// +// Parameters: +// ctx - context for logging +// err - the error that occurred during the import, if any +// volumeConfig - the volume config object for the volume being imported +// volTxn - the volume transaction object for the volume being imported +// Returns: +// error - the error if it was unable to clean up all artifacts of the volume import, nil if it was successful +// Example: +// err := o.importVolumeCleanup(ctx, err, volumeConfig, volTxn) +// +// -- Doc autogenerated on 2022-06-21. Function hash: f5e220ffc92fbb12521834e8dbc438aa -- func (o *TridentOrchestrator) importVolumeCleanup( ctx context.Context, err error, volumeConfig *storage.VolumeConfig, volTxn *storage.VolumeTransaction, ) error { @@ -2632,6 +3339,19 @@ func (o *TridentOrchestrator) importVolumeCleanup( return err } +// GetVolume returns a volume by name +// It returns an error if the volume does not exist +// Parameters: +// ctx - context for logging +// volume - the name of the volume +// Returns: +// storage.VolumeExternal - the volume +// error - error if there is any +// Example: +// vol, err := orchestrator.GetVolume(ctx, "volume1") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 7b809028c4c2d34e481ebd4d9ceadcdf -- func (o *TridentOrchestrator) GetVolume( ctx context.Context, volume string, ) (volExternal *storage.VolumeExternal, err error) { @@ -2647,6 +3367,18 @@ func (o *TridentOrchestrator) GetVolume( return o.getVolume(ctx, volume) } +// getVolume returns a volume by name +// It returns an error if the volume is not found +// Parameters: +// ctx - context for logging +// volume - the name of the volume +// Returns: +// storage.VolumeExternal - the volume +// error - error if there is any +// Example: +// vol, err := orchestrator.getVolume(ctx, "volume1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: a3180f3812fb8b86173ca5c119bc52db -- func (o *TridentOrchestrator) getVolume( _ context.Context, volume string, ) (volExternal *storage.VolumeExternal, err error) { @@ -2657,6 +3389,19 @@ func (o *TridentOrchestrator) getVolume( return vol.ConstructExternal(), nil } +// GetDriverTypeForVolume returns the driver type for the specified volume. +// It returns an error if the volume does not exist. +// Parameters: +// ctx - context for logging +// vol - the volume +// Returns: +// string - the driver type +// error - the error if there is any +// Example: +// driverType, err := o.GetDriverTypeForVolume(ctx, vol) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: fa6bc896c59ce9a936c5679fd5c658b9 -- func (o *TridentOrchestrator) GetDriverTypeForVolume(_ context.Context, vol *storage.VolumeExternal) (string, error) { if o.bootstrapError != nil { return config.UnknownDriver, o.bootstrapError @@ -2672,6 +3417,16 @@ func (o *TridentOrchestrator) GetDriverTypeForVolume(_ context.Context, vol *sto // not construct a transaction, nor does it take locks; it assumes that the // caller will take care of both of these. It also assumes that the backend // exists in memory. +// It returns the driver type and error if there is any. +// Parameters: +// backendUUID - the UUID of the backend +// Returns: +// string - the driver type +// error - error if there is any +// Example: +// driverType, err := orchestrator.getDriverTypeForVolume("backend1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 36984fba5929c8a289f6429d6e12a212 -- func (o *TridentOrchestrator) getDriverTypeForVolume(backendUUID string) (string, error) { if b, ok := o.backends[backendUUID]; ok { return b.Driver().Name(), nil @@ -2679,6 +3434,18 @@ func (o *TridentOrchestrator) getDriverTypeForVolume(backendUUID string) (string return config.UnknownDriver, nil } +// GetVolumeType returns the volume type of the specified volume. +// It returns an error if the volume type could not be determined. +// Parameters: +// ctx - context for logging +// vol - the volume +// Returns: +// volumeType - the volume type +// error - the error if there is any +// Example: +// volumeType, err := orchestrator.GetVolumeType(ctx, vol) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 38bae4a9a9ca7f54bb863b2c10a6fe6e -- func (o *TridentOrchestrator) GetVolumeType( _ context.Context, vol *storage.VolumeExternal, ) (volumeType config.VolumeType, err error) { @@ -2712,6 +3479,18 @@ func (o *TridentOrchestrator) GetVolumeType( return } +// ListVolumes returns a list of all volumes in the system. +// It returns an error if there is any. +// Parameters: +// ctx - context for logging +// Returns: +// volumes - a list of all volumes in the system +// error - error if there is any +// Example: +// volumes, err := orchestrator.ListVolumes(ctx) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 85d4a8042740926b2d85a28566cb3403 -- func (o *TridentOrchestrator) ListVolumes(context.Context) (volumes []*storage.VolumeExternal, err error) { if o.bootstrapError != nil { return nil, o.bootstrapError @@ -2733,6 +3512,16 @@ func (o *TridentOrchestrator) ListVolumes(context.Context) (volumes []*storage.V } // volumeSnapshots returns any Snapshots for the specified volume +// It returns a slice of snapshots and an error if there is any +// Parameters: +// volumeName - the name of the volume +// Returns: +// []*storage.Snapshot - a slice of snapshots +// error - error if there is any +// Example: +// snapshots, err := orchestrator.volumeSnapshots("volume1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 24b97a5ce641e2652b0a580c3bd0f00f -- func (o *TridentOrchestrator) volumeSnapshots(volumeName string) ([]*storage.Snapshot, error) { volume, volumeFound := o.volumes[volumeName] if !volumeFound { @@ -2752,6 +3541,16 @@ func (o *TridentOrchestrator) volumeSnapshots(volumeName string) ([]*storage.Sna // not construct a transaction, nor does it take locks; it assumes that the // caller will take care of both of these. It also assumes that the volume // exists in memory. +// It returns an error if the volume cannot be deleted. +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume to delete +// Returns: +// error - the error if the volume cannot be deleted, nil if the volume is deleted +// Example: +// err := o.deleteVolume(ctx, "volume1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 47503a83b9223c8109913559c890d916 -- func (o *TridentOrchestrator) deleteVolume(ctx context.Context, volumeName string) error { volume := o.volumes[volumeName] volumeBackend := o.backends[volume.BackendUUID] @@ -2829,6 +3628,18 @@ func (o *TridentOrchestrator) deleteVolume(ctx context.Context, volumeName strin return nil } +// deleteVolumeFromPersistentStoreIgnoreError deletes a volume from the persistent store. +// It ignores errors if the volume is not found in the store. +// It returns an error if the volume is found in the store but cannot be deleted. +// Parameters: +// ctx - context for logging +// volume - the volume to delete +// Returns: +// error - the error if the delete failed, nil if the delete succeeded +// Example: +// err := o.deleteVolumeFromPersistentStoreIgnoreError(ctx, volume) +// +// -- Doc autogenerated on 2022-06-21. Function hash: c2bcad7a430c67f70288fd3b95d63886 -- func (o *TridentOrchestrator) deleteVolumeFromPersistentStoreIgnoreError( ctx context.Context, volume *storage.Volume, ) error { @@ -2848,6 +3659,17 @@ func (o *TridentOrchestrator) deleteVolumeFromPersistentStoreIgnoreError( // DeleteVolume does the necessary set up to delete a volume during the course // of normal operation, verifying that the volume is present in Trident and // creating a transaction to ensure that the delete eventually completes. +// It returns an error if the volume is not present in Trident. +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume to delete +// Returns: +// error - the error if the volume is not present in Trident, nil if the volume is present in Trident +// Example: +// err := o.DeleteVolume(ctx, "volume1") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: c39825c5fd380766f73ef5c7d8653ca6 -- func (o *TridentOrchestrator) DeleteVolume(ctx context.Context, volumeName string) (err error) { if o.bootstrapError != nil { return o.bootstrapError @@ -2902,6 +3724,18 @@ func (o *TridentOrchestrator) DeleteVolume(ctx context.Context, volumeName strin return o.deleteVolume(ctx, volumeName) } +// ListVolumesByPlugin returns a list of volumes by plugin name +// It returns an error if the plugin name is invalid. +// Parameters: +// ctx - context for logging +// pluginName - the name of the plugin +// Returns: +// volumes - a list of volumes +// error - error if there is any +// Example: +// volumes, err := orchestrator.ListVolumesByPlugin(ctx, "plugin1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 60b8076f3180c5e202ffbeeef30d97b0 -- func (o *TridentOrchestrator) ListVolumesByPlugin( _ context.Context, pluginName string, ) (volumes []*storage.VolumeExternal, err error) { @@ -2926,6 +3760,19 @@ func (o *TridentOrchestrator) ListVolumesByPlugin( return volumes, nil } +// PublishVolume publishes a volume to a node. +// It returns an error if the volume cannot be published. +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// publishInfo - the publish info +// Returns: +// error - the error if there is any +// Example: +// err := o.PublishVolume(ctx, "volume1", publishInfo) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: b7313803948e3a02c08b72fd07dd08d0 -- func (o *TridentOrchestrator) PublishVolume( ctx context.Context, volumeName string, publishInfo *utils.VolumePublishInfo, ) (err error) { @@ -2977,6 +3824,19 @@ func (o *TridentOrchestrator) PublishVolume( return nil } +// UnpublishVolume unpublishes a volume from a node. +// It returns an error if the volume is not found or if the volume is not published to the node. +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// nodeName - the name of the node +// Returns: +// error - the error if the unpublish failed, nil if the unpublish succeeded +// Example: +// err := o.UnpublishVolume(ctx, "volume1", "node1") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 8051f44dc4b6fa47e354a66dd188ad29 -- func (o *TridentOrchestrator) UnpublishVolume(ctx context.Context, volumeName, nodeName string) (err error) { if o.bootstrapError != nil { return o.bootstrapError @@ -3048,6 +3908,18 @@ func (o *TridentOrchestrator) UnpublishVolume(ctx context.Context, volumeName, n // and it should be able to accomplish its task using only the data passed in; it should not need to // use the storage controller API. It may be assumed that this method always runs on the host to // which the volume will be attached. +// It returns an error if the volume is not found or if the volume is already mounted. +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// mountpoint - the mount point +// publishInfo - the volume publish info +// Returns: +// error - the error if the volume is not found or if the volume is already mounted +// Example: +// err := o.AttachVolume(ctx, "volume1", "/mnt/volume1", &utils.VolumePublishInfo{}) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 08cc29fac1ea53ca467a8405912d1e51 -- func (o *TridentOrchestrator) AttachVolume( ctx context.Context, volumeName, mountpoint string, publishInfo *utils.VolumePublishInfo, ) (err error) { @@ -3136,6 +4008,17 @@ func (o *TridentOrchestrator) AttachVolume( // use the storage controller API. It may be assumed that this method always runs on the host to // which the volume will be attached. It ensures the volume is already mounted, and it attempts to // delete the mount point. +// It returns an error if the volume is not found, the volume is deleting, or the unmount fails. +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// mountpoint - the mount point of the volume +// Returns: +// error - the error if the unmount fails, nil if the unmount succeeds +// Example: +// err := o.DetachVolume(ctx, "volume1", "/mnt/volume1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 3ab9993f2717bc59f0937d19e862392c -- func (o *TridentOrchestrator) DetachVolume(ctx context.Context, volumeName, mountpoint string) (err error) { if o.bootstrapError != nil { return o.bootstrapError @@ -3174,6 +4057,17 @@ func (o *TridentOrchestrator) DetachVolume(ctx context.Context, volumeName, moun } // SetVolumeState sets the state of a volume to a given value +// It returns an error if the volume state is invalid. +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// state - the state of the volume +// Returns: +// error - the error if the volume state is invalid, nil if the volume state is valid +// Example: +// err := o.SetVolumeState(ctx, "volume1", storage.VolumeStateOnline) +// +// -- Doc autogenerated on 2022-06-21. Function hash: caf19abab665ec64cd4d73b4922701d6 -- func (o *TridentOrchestrator) SetVolumeState( ctx context.Context, volumeName string, state storage.VolumeState, ) (err error) { @@ -3206,6 +4100,18 @@ func (o *TridentOrchestrator) SetVolumeState( } // CreateSnapshot creates a snapshot of the given volume +// It returns an error if the snapshot cannot be created. +// Parameters: +// ctx - context for logging +// snapshotConfig - the snapshot config +// Returns: +// storage.SnapshotExternal - the snapshot external +// error - the error if the snapshot cannot be created, nil if the snapshot is created +// Example: +// snapshotExternal, err := o.CreateSnapshot(ctx, snapshotConfig) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 9dd9e1ca67aaa0c73abe28dd52f15f10 -- func (o *TridentOrchestrator) CreateSnapshot( ctx context.Context, snapshotConfig *storage.SnapshotConfig, ) (externalSnapshot *storage.SnapshotExternal, err error) { @@ -3293,6 +4199,20 @@ func (o *TridentOrchestrator) CreateSnapshot( // addSnapshotCleanup is used as a deferred method from the snapshot create method // to clean up in case anything goes wrong during the operation. +// It returns an error if the cleanup fails. +// Parameters: +// ctx - context for logging +// err - the error that occurred during the operation +// backend - the backend +// snapshot - the snapshot +// volTxn - the volume transaction +// snapConfig - the snapshot config +// Returns: +// error - the error if the cleanup fails, nil if it succeeds +// Example: +// err := o.addSnapshotCleanup(ctx, err, backend, snapshot, volTxn, snapConfig) +// +// -- Doc autogenerated on 2022-06-21. Function hash: e813878e10d5a25a278213aa427ec219 -- func (o *TridentOrchestrator) addSnapshotCleanup( ctx context.Context, err error, backend storage.Backend, snapshot *storage.Snapshot, volTxn *storage.VolumeTransaction, snapConfig *storage.SnapshotConfig, @@ -3341,6 +4261,19 @@ func (o *TridentOrchestrator) addSnapshotCleanup( return err } +// GetSnapshot returns a snapshot by name +// It returns an error if the snapshot is not found. +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// snapshotName - the name of the snapshot +// Returns: +// storage.SnapshotExternal - the snapshot +// error - error if there is any +// Example: +// snapshot, err := orchestrator.GetSnapshot(ctx, "volume1", "snapshot1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: e989ccf35cebc85380ef65b188fb3054 -- func (o *TridentOrchestrator) GetSnapshot( ctx context.Context, volumeName, snapshotName string, ) (snapshotExternal *storage.SnapshotExternal, err error) { @@ -3356,6 +4289,19 @@ func (o *TridentOrchestrator) GetSnapshot( return o.getSnapshot(ctx, volumeName, snapshotName) } +// getSnapshot returns a snapshot by name +// It returns an error if the snapshot is not found +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// snapshotName - the name of the snapshot +// Returns: +// storage.SnapshotExternal - the snapshot +// error - error if there is any +// Example: +// snapshot, err := orchestrator.getSnapshot(ctx, "volume1", "snapshot1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: b64251745b9e500e060496470970c425 -- func (o *TridentOrchestrator) getSnapshot( ctx context.Context, volumeName, snapshotName string, ) (*storage.SnapshotExternal, error) { @@ -3374,6 +4320,18 @@ func (o *TridentOrchestrator) getSnapshot( } } +// updateSnapshot updates the snapshot in the orchestrator's internal state and in the persistent store. +// It returns the updated snapshot and an error if there is any. +// Parameters: +// ctx - context for logging +// snapshot - the snapshot to update +// Returns: +// storage.Snapshot - the updated snapshot +// error - error if there is any +// Example: +// snapshot, err := orchestrator.updateSnapshot(ctx, snapshot) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 325d46cbf1273d5ada4aee5aad9d18fc -- func (o *TridentOrchestrator) updateSnapshot( ctx context.Context, snapshot *storage.Snapshot, ) (*storage.Snapshot, error) { @@ -3418,6 +4376,16 @@ func (o *TridentOrchestrator) updateSnapshot( // deleteSnapshot does the necessary work to delete a snapshot entirely. It does // not construct a transaction, nor does it take locks; it assumes that the caller will // take care of both of these. +// It returns an error if the snapshot could not be deleted. +// Parameters: +// ctx - context for logging +// snapshotConfig - the snapshot config +// Returns: +// error - the error if the snapshot could not be deleted, nil if the snapshot was deleted +// Example: +// err := o.deleteSnapshot(ctx, snapshotConfig) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 97f2ac0088209154223e59b734eefc83 -- func (o *TridentOrchestrator) deleteSnapshot(ctx context.Context, snapshotConfig *storage.SnapshotConfig) error { snapshotID := snapshotConfig.ID() snapshot, ok := o.snapshots[snapshotID] @@ -3471,6 +4439,18 @@ func (o *TridentOrchestrator) deleteSnapshot(ctx context.Context, snapshotConfig return nil } +// deleteSnapshotFromPersistentStoreIgnoreError deletes a snapshot from the persistent store. +// It returns an error if the snapshot cannot be deleted. +// Parameters: +// ctx - context for logging +// snapshot - the snapshot to delete +// Returns: +// error - the error if the delete failed, nil if the delete succeeded +// Example: +// err := o.deleteSnapshotFromPersistentStoreIgnoreError(ctx, snapshot) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 3d9299843d219334e59de17ceccabde9 -- func (o *TridentOrchestrator) deleteSnapshotFromPersistentStoreIgnoreError( ctx context.Context, snapshot *storage.Snapshot, ) error { @@ -3489,6 +4469,17 @@ func (o *TridentOrchestrator) deleteSnapshotFromPersistentStoreIgnoreError( } // DeleteSnapshot deletes a snapshot of the given volume +// It returns an error if the snapshot is not found or if the snapshot cannot be deleted +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// snapshotName - the name of the snapshot +// Returns: +// error - the error if the snapshot cannot be deleted, nil if the snapshot is deleted +// Example: +// err := o.DeleteSnapshot(ctx, "volume1", "snapshot1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 5c4f78ff92e95a7708153394e239bac0 -- func (o *TridentOrchestrator) DeleteSnapshot(ctx context.Context, volumeName, snapshotName string) (err error) { if o.bootstrapError != nil { return o.bootstrapError @@ -3587,6 +4578,18 @@ func (o *TridentOrchestrator) DeleteSnapshot(ctx context.Context, volumeName, sn return o.deleteSnapshot(ctx, snapshot.Config) } +// ListSnapshots lists all snapshots in the system. +// It returns a slice of snapshots and an error if there is any. +// Parameters: +// ctx - context for logging +// Returns: +// snapshots - a slice of snapshots +// error - error if there is any +// Example: +// snapshots, err := o.ListSnapshots(ctx) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: d08dffcc2af9a6d1f09139abdd3c8e33 -- func (o *TridentOrchestrator) ListSnapshots(context.Context) (snapshots []*storage.SnapshotExternal, err error) { if o.bootstrapError != nil { return nil, o.bootstrapError @@ -3605,6 +4608,18 @@ func (o *TridentOrchestrator) ListSnapshots(context.Context) (snapshots []*stora return snapshots, nil } +// ListSnapshotsByName returns a list of snapshots by name +// It returns an error if the snapshot name is invalid. +// Parameters: +// ctx - context for logging +// snapshotName - the name of the snapshot +// Returns: +// snapshots - the list of snapshots +// error - error if there is any +// Example: +// snapshots, err := orchestrator.ListSnapshotsByName(ctx, "snapshot1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 053cf2d47c2f1434c21a089a0fbeb072 -- func (o *TridentOrchestrator) ListSnapshotsByName( _ context.Context, snapshotName string, ) (snapshots []*storage.SnapshotExternal, err error) { @@ -3627,6 +4642,18 @@ func (o *TridentOrchestrator) ListSnapshotsByName( return snapshots, nil } +// ListSnapshotsForVolume returns a list of snapshots for a volume. +// It returns an error if the volume does not exist. +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// Returns: +// snapshots - the list of snapshots +// error - error if there is any +// Example: +// snapshots, err := orchestrator.ListSnapshotsForVolume(ctx, "volume1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 623db3c5dd57eabbdc24f51e0e61b3a0 -- func (o *TridentOrchestrator) ListSnapshotsForVolume( _ context.Context, volumeName string, ) (snapshots []*storage.SnapshotExternal, err error) { @@ -3653,6 +4680,18 @@ func (o *TridentOrchestrator) ListSnapshotsForVolume( return snapshots, nil } +// ReadSnapshotsForVolume returns a list of snapshots for a volume. +// It returns an error if the volume does not exist. +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// Returns: +// externalSnapshots - a list of snapshots for the volume +// error - the error if there is any +// Example: +// snapshots, err := orchestrator.ReadSnapshotsForVolume(ctx, "volume1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: ccd4d329e169484695ad148c14dfbf12 -- func (o *TridentOrchestrator) ReadSnapshotsForVolume( ctx context.Context, volumeName string, ) (externalSnapshots []*storage.SnapshotExternal, err error) { @@ -3680,6 +4719,16 @@ func (o *TridentOrchestrator) ReadSnapshotsForVolume( return externalSnapshots, nil } +// ReloadVolumes reloads the volumes from the backend storage systems. +// It returns an error if the reload fails. +// Parameters: +// ctx - context for logging +// Returns: +// error - error if there is any +// Example: +// err := o.ReloadVolumes(ctx) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 5f5aebb4e5d30c072efd3c62cb1564b0 -- func (o *TridentOrchestrator) ReloadVolumes(ctx context.Context) (err error) { if o.bootstrapError != nil { return o.bootstrapError @@ -3722,6 +4771,17 @@ func (o *TridentOrchestrator) ReloadVolumes(ctx context.Context) (err error) { } // ResizeVolume resizes a volume to the new size. +// It returns an error if the volume doesn't exist or is being deleted. +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// newSize - the new size of the volume +// Returns: +// error - the error if the resize fails, nil if the resize succeeds +// Example: +// err := o.ResizeVolume(ctx, "volume1", "10G") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 25114e8d10b21d57c34efa66960065f9 -- func (o *TridentOrchestrator) ResizeVolume(ctx context.Context, volumeName, newSize string) (err error) { if o.bootstrapError != nil { return o.bootstrapError @@ -3778,6 +4838,17 @@ func (o *TridentOrchestrator) ResizeVolume(ctx context.Context, volumeName, newS // construct a transaction, nor does it take locks; it assumes that the // caller will take care of both of these. It also assumes that the volume // exists in memory. +// It returns an error if the resize is unsuccessful. +// Parameters: +// ctx - context for logging +// volume - the volume to resize +// newSize - the new size of the volume +// Returns: +// error - the error if the resize is unsuccessful, nil if the resize is successful +// Example: +// err := o.resizeVolume(ctx, volume, newSize) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 11b6c3fdc1fc037db20316277d5938ee -- func (o *TridentOrchestrator) resizeVolume(ctx context.Context, volume *storage.Volume, newSize string) error { volumeBackend, found := o.backends[volume.BackendUUID] if !found { @@ -3817,6 +4888,18 @@ func (o *TridentOrchestrator) resizeVolume(ctx context.Context, volume *storage. // resizeVolumeCleanup is used to clean up artifacts of volume resize in case // anything goes wrong during the operation. +// It returns an error if the cleanup fails. +// Parameters: +// ctx - context for logging +// err - the error if there is any +// vol - the volume +// volTxn - the volume transaction +// Returns: +// error - the error if the cleanup fails, nil if the cleanup succeeds +// Example: +// err := o.resizeVolumeCleanup(ctx, err, vol, volTxn) +// +// -- Doc autogenerated on 2022-06-21. Function hash: a1efa3082b3524d75fbefb8f828baae8 -- func (o *TridentOrchestrator) resizeVolumeCleanup( ctx context.Context, err error, vol *storage.Volume, volTxn *storage.VolumeTransaction, ) error { @@ -3858,6 +4941,19 @@ func (o *TridentOrchestrator) resizeVolumeCleanup( // NOTE: 1. DO NOT ALLOW ROX and RWX for block on file // 2. 'BlockOnFile' protocol set via the PVC annotation with multi-node access mode // 3. We do not support raw block volumes with block on file or NFS protocol. +// It returns an error if the backend update is invalid. +// Parameters: +// ctx - context for logging +// volumeMode - the volume mode +// accessMode - the access mode +// protocol - the protocol +// Returns: +// config.Protocol - the protocol +// error - the error if the update is invalid, nil if the update is valid +// Example: +// protocol, err := o.getProtocol(ctx, volumeMode, accessMode, protocol) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 995d04ac2f2247c573571a1b586e3638 -- func (o *TridentOrchestrator) getProtocol( ctx context.Context, volumeMode config.VolumeMode, accessMode config.AccessMode, protocol config.Protocol, ) (config.Protocol, error) { @@ -3938,6 +5034,19 @@ func (o *TridentOrchestrator) getProtocol( return res.protocol, res.err } +// AddStorageClass adds a new storage class to the orchestrator. +// It returns an error if the storage class already exists or if there is any other problem. +// Parameters: +// ctx - context for logging +// scConfig - the storage class config +// Returns: +// scExternal - the storage class external +// error - the error if there is any +// Example: +// scExternal, err := o.AddStorageClass(ctx, scConfig) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 7dd9fefe2646ed78b243a4d6e24b7079 -- func (o *TridentOrchestrator) AddStorageClass( ctx context.Context, scConfig *storageclass.Config, ) (scExternal *storageclass.External, err error) { @@ -3976,6 +5085,19 @@ func (o *TridentOrchestrator) AddStorageClass( return sc.ConstructExternal(ctx), nil } +// GetStorageClass returns a storage class by name +// It returns an error if the storage class is not found +// Parameters: +// ctx - context for logging +// scName - the name of the storage class +// Returns: +// storageclass.External - the storage class +// error - error if there is any +// Example: +// sc, err := orchestrator.GetStorageClass(ctx, "sc1") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 8ea7a3398086c800c66845416db5fef0 -- func (o *TridentOrchestrator) GetStorageClass( ctx context.Context, scName string, ) (scExternal *storageclass.External, err error) { @@ -3997,6 +5119,18 @@ func (o *TridentOrchestrator) GetStorageClass( return sc.ConstructExternal(ctx), nil } +// ListStorageClasses lists all storage classes. +// It returns an error if there is any. +// Parameters: +// ctx - context for logging +// Returns: +// scExternals - a slice of storage class externals +// error - the error if there is any +// Example: +// scExternals, err := o.ListStorageClasses(ctx) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 1d060e4f98ef90c4e6fd57ca995cef7d -- func (o *TridentOrchestrator) ListStorageClasses(ctx context.Context) ( scExternals []*storageclass.External, err error, ) { @@ -4016,6 +5150,18 @@ func (o *TridentOrchestrator) ListStorageClasses(ctx context.Context) ( return storageClasses, nil } +// DeleteStorageClass deletes a storage class. +// It returns an error if the storage class does not exist. +// Parameters: +// ctx - context for logging +// scName - the name of the storage class +// Returns: +// error - the error if the storage class could not be deleted, nil if the storage class was deleted +// Example: +// err := o.DeleteStorageClass(ctx, "storageclass1") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 7a09523cfb169968ae4a2c6a92941083 -- func (o *TridentOrchestrator) DeleteStorageClass(ctx context.Context, scName string) (err error) { if o.bootstrapError != nil { return o.bootstrapError @@ -4047,6 +5193,16 @@ func (o *TridentOrchestrator) DeleteStorageClass(ctx context.Context, scName str return nil } +// reconcileNodeAccessOnAllBackends reconciles node access on all backends. +// It returns an error if there is any. +// Parameters: +// ctx - context for logging +// Returns: +// error - the error if there is any +// Example: +// err := o.reconcileNodeAccessOnAllBackends(ctx) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 05c9e184edcad2ea38d16deda4378f81 -- func (o *TridentOrchestrator) reconcileNodeAccessOnAllBackends(ctx context.Context) error { if config.CurrentDriverContext != config.ContextCSI { return nil @@ -4067,6 +5223,17 @@ func (o *TridentOrchestrator) reconcileNodeAccessOnAllBackends(ctx context.Conte return nil } +// reconcileNodeAccessOnBackend updates the node access on the backend. +// It returns an error if the update fails. +// Parameters: +// ctx - context for logging +// b - the backend +// Returns: +// error - the error if the update fails, nil if the update succeeds +// Example: +// err := o.reconcileNodeAccessOnBackend(ctx, backend) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 32894d9e525f95bbcc5fd8c4512369cf -- func (o *TridentOrchestrator) reconcileNodeAccessOnBackend(ctx context.Context, b storage.Backend) error { if config.CurrentDriverContext != config.ContextCSI { return nil @@ -4083,6 +5250,17 @@ func (o *TridentOrchestrator) reconcileNodeAccessOnBackend(ctx context.Context, // safeReconcileNodeAccessOnBackend wraps reconcileNodeAccessOnBackend in a mutex lock for use in functions that aren't // already locked +// It returns an error if the reconcileNodeAccessOnBackend is invalid. +// Parameters: +// ctx - context for logging +// b - the backend +// Returns: +// error - the error if the reconcileNodeAccessOnBackend is invalid, nil if the reconcileNodeAccessOnBackend is valid +// Example: +// err := o.safeReconcileNodeAccessOnBackend(ctx, b) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: bdb28af6609b6ba01797424052aa73e7 -- func (o *TridentOrchestrator) safeReconcileNodeAccessOnBackend(ctx context.Context, b storage.Backend) error { o.mutex.Lock() defer o.mutex.Unlock() @@ -4091,6 +5269,11 @@ func (o *TridentOrchestrator) safeReconcileNodeAccessOnBackend(ctx context.Conte // PeriodicallyReconcileNodeAccessOnBackends is intended to be run as a goroutine and will periodically run // safeReconcileNodeAccessOnBackend for each backend in the orchestrator +// Example: +// o.PeriodicallyReconcileNodeAccessOnBackends() +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: df6e25b990a456580f2a0f5d0d3cf3ff -- func (o *TridentOrchestrator) PeriodicallyReconcileNodeAccessOnBackends() { o.stopNodeAccessLoop = make(chan bool) ctx := GenerateRequestContext(context.Background(), "", ContextSourcePeriodic) @@ -4124,6 +5307,19 @@ func (o *TridentOrchestrator) PeriodicallyReconcileNodeAccessOnBackends() { } } +// AddNode adds a new node to the orchestrator. +// It returns an error if the node cannot be added. +// Parameters: +// ctx - context for logging +// node - the node to add +// nodeEventCallback - the callback to invoke when node events occur +// Returns: +// error - the error if the node could not be added, nil if the node was added successfully +// Example: +// err := o.AddNode(ctx, node, nodeEventCallback) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: cd542a37d4abbbf6ed9a5b48b6c67621 -- func (o *TridentOrchestrator) AddNode( ctx context.Context, node *utils.Node, nodeEventCallback NodeEventCallback, ) (err error) { @@ -4166,12 +5362,29 @@ func (o *TridentOrchestrator) AddNode( return nil } +// invalidateAllBackendNodeAccess invalidates all backend node access. +// This function is called when a node is removed from the cluster. +// Example: +// o.invalidateAllBackendNodeAccess() +// +// -- Doc autogenerated on 2022-06-21. Function hash: 217366d8152ca1accdb52538ef405299 -- func (o *TridentOrchestrator) invalidateAllBackendNodeAccess() { for _, backend := range o.backends { backend.InvalidateNodeAccess() } } +// handleUpdatedNodePrep validates that the backend update is valid. +// It returns an error if the backend update is invalid. +// Parameters: +// ctx - context for logging +// protocol - the protocol for the backend +// node - the node to update +// nodeEventCallback - the callback for node events +// Example: +// err := o.handleUpdatedNodePrep(ctx, "NFS", node, nodeEventCallback) +// +// -- Doc autogenerated on 2022-06-21. Function hash: a834161b9eb4a27bfbb289d967a44a23 -- func (o *TridentOrchestrator) handleUpdatedNodePrep( ctx context.Context, protocol string, node *utils.Node, nodeEventCallback NodeEventCallback, ) { @@ -4213,6 +5426,18 @@ func (o *TridentOrchestrator) handleUpdatedNodePrep( } } +// GetNode returns a node by name +// It returns an error if the node is not found +// Parameters: +// ctx - context for logging +// nName - the name of the node +// Returns: +// utils.Node - the node +// error - error if there is any +// Example: +// node, err := orchestrator.GetNode(ctx, "node1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 8adb5cc590b1e328ec136e1d38883212 -- func (o *TridentOrchestrator) GetNode(ctx context.Context, nName string) (node *utils.Node, err error) { if o.bootstrapError != nil { return nil, o.bootstrapError @@ -4233,6 +5458,17 @@ func (o *TridentOrchestrator) GetNode(ctx context.Context, nName string) (node * return node, nil } +// ListNodes returns a list of all nodes in the cluster. +// It returns an error if there is any. +// Parameters: +// ctx - context for logging +// Returns: +// nodes - a list of all nodes in the cluster +// error - the error if there is any +// Example: +// nodes, err := o.ListNodes(ctx) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 9bdd3a6d45b81df549bbe35f26aeeb85 -- func (o *TridentOrchestrator) ListNodes(context.Context) (nodes []*utils.Node, err error) { if o.bootstrapError != nil { return nil, o.bootstrapError @@ -4250,6 +5486,18 @@ func (o *TridentOrchestrator) ListNodes(context.Context) (nodes []*utils.Node, e return nodes, nil } +// DeleteNode deletes a node from the orchestrator. +// It returns an error if the node cannot be deleted. +// Parameters: +// ctx - context for logging +// nodeName - the name of the node to delete +// Returns: +// error - the error if the node cannot be deleted, nil if the node is deleted +// Example: +// err := o.DeleteNode(ctx, "node1") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: f40063d78d89136a99089e4c9c2b95a7 -- func (o *TridentOrchestrator) DeleteNode(ctx context.Context, nodeName string) (err error) { if o.bootstrapError != nil { return o.bootstrapError @@ -4294,6 +5542,18 @@ func (o *TridentOrchestrator) DeleteNode(ctx context.Context, nodeName string) ( return nil } +// deleteNode deletes a node from the backend. +// It returns an error if the node cannot be deleted. +// Parameters: +// ctx - context for logging +// nodeName - the name of the node to delete +// Returns: +// error - the error if the node could not be deleted, nil if the node was deleted +// Example: +// err := o.deleteNode(ctx, "node1") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 06e53486e08860cbb879e4101d6a9c68 -- func (o *TridentOrchestrator) deleteNode(ctx context.Context, nodeName string) (err error) { node, found := o.nodes[nodeName] if !found { @@ -4309,6 +5569,17 @@ func (o *TridentOrchestrator) deleteNode(ctx context.Context, nodeName string) ( } // AddVolumePublication records the volume publication for a given volume/node pair +// It returns an error if the volume publication is invalid. +// Parameters: +// ctx - context for logging +// publication - the volume publication +// Returns: +// error - the error if the volume publication is invalid, nil if the volume publication is valid +// Example: +// err := o.AddVolumePublication(ctx, publication) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: b1668caeb5dc278a0b31431c551b5138 -- func (o *TridentOrchestrator) AddVolumePublication( ctx context.Context, publication *utils.VolumePublication, ) (err error) { @@ -4332,6 +5603,19 @@ func (o *TridentOrchestrator) AddVolumePublication( } // GetVolumePublication returns the volume publication for a given volume/node pair +// It returns an error if the volume publication is not found +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// nodeName - the name of the node +// Returns: +// *utils.VolumePublication - the volume publication +// error - error if there is any +// Example: +// publication, err := orchestrator.GetVolumePublication(ctx, "volume1", "node1") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: b1fc2e7f685a7a38388d3fccd1ae996c -- func (o *TridentOrchestrator) GetVolumePublication( _ context.Context, volumeName, nodeName string, ) (publication *utils.VolumePublication, err error) { @@ -4353,6 +5637,16 @@ func (o *TridentOrchestrator) GetVolumePublication( } // ListVolumePublications returns a list of all volume publications +// It returns a list of all volume publications +// Parameters: +// context.Context - the context for the request +// Returns: +// publications []*utils.VolumePublication - the list of all volume publications +// err error - error if there is any +// Example: +// publications, err := orchestrator.ListVolumePublications(context.Context) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 35b0c9f7716835376b83e5b08e5d914b -- func (o *TridentOrchestrator) ListVolumePublications( context.Context, ) (publications []*utils.VolumePublication, err error) { @@ -4375,6 +5669,18 @@ func (o *TridentOrchestrator) ListVolumePublications( } // ListVolumePublicationsForVolume returns a list of all volume publications for a given volume +// It returns an error if the volume doesn't exist +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// Returns: +// publications - a list of volume publications +// error - the error if there is any +// Example: +// publications, err := orchestrator.ListVolumePublicationsForVolume(ctx, "volume1") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: c53b2c66667305b38b8683919d86e898 -- func (o *TridentOrchestrator) ListVolumePublicationsForVolume( ctx context.Context, volumeName string, ) (publications []*utils.VolumePublication, err error) { @@ -4391,6 +5697,18 @@ func (o *TridentOrchestrator) ListVolumePublicationsForVolume( return } +// listVolumePublicationsForVolume returns a list of VolumePublications for a volume +// It returns an error if the volume doesn't exist +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// Returns: +// []*utils.VolumePublication - the list of VolumePublications +// error - error if there is any +// Example: +// publications, err := orchestrator.listVolumePublicationsForVolume(ctx, "volume1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 44ca89b928a2986ee3de364f14767cb3 -- func (o *TridentOrchestrator) listVolumePublicationsForVolume( _ context.Context, volumeName string, ) (publications []*utils.VolumePublication) { @@ -4402,6 +5720,18 @@ func (o *TridentOrchestrator) listVolumePublicationsForVolume( } // ListVolumePublicationsForNode returns a list of all volume publications for a given node +// It returns a list of all volume publications for a given node +// Parameters: +// ctx - context for logging +// nodeName - the name of the node +// Returns: +// publications - the list of volume publications +// error - error if there is any +// Example: +// publications, err := orchestrator.ListVolumePublicationsForNode(ctx, "node1") +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 9f0a1519a0a5c2c573b3fe8bd06586ab -- func (o *TridentOrchestrator) ListVolumePublicationsForNode( ctx context.Context, nodeName string, ) (publications []*utils.VolumePublication, err error) { @@ -4418,6 +5748,18 @@ func (o *TridentOrchestrator) ListVolumePublicationsForNode( return } +// listVolumePublicationsForNode returns a list of volume publications for a node. +// It returns an error if the node name is invalid. +// Parameters: +// ctx - context for logging +// nodeName - the name of the node +// Returns: +// publications - the list of volume publications +// error - error if there is any +// Example: +// publications, err := orchestrator.listVolumePublicationsForNode(ctx, "node1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 8341522491607108df10aca16d8bc332 -- func (o *TridentOrchestrator) listVolumePublicationsForNode( _ context.Context, nodeName string, ) (publications []*utils.VolumePublication) { @@ -4431,6 +5773,17 @@ func (o *TridentOrchestrator) listVolumePublicationsForNode( } // DeleteVolumePublication deletes the record of the volume publication for a given volume/node pair +// It returns an error if the volume publication is not found. +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// nodeName - the name of the node +// Returns: +// error - the error if there is any +// Example: +// err := o.DeleteVolumePublication(ctx, volumeName, nodeName) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 91456af5ab89a609eb84c7bcf52644ce -- func (o *TridentOrchestrator) DeleteVolumePublication(ctx context.Context, volumeName, nodeName string) (err error) { if o.bootstrapError != nil { return o.bootstrapError @@ -4456,6 +5809,14 @@ func (o *TridentOrchestrator) DeleteVolumePublication(ctx context.Context, volum return nil } +// removeVolumePublicationFromCache removes a volume publication from the cache. +// Parameters: +// volumeID - the ID of the volume +// nodeID - the ID of the node +// Example: +// o.removeVolumePublicationFromCache(volumeID, nodeID) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 0edde50e382bbe37edba87d678249a5a -- func (o *TridentOrchestrator) removeVolumePublicationFromCache(volumeID, nodeID string) { delete(o.volumePublications[volumeID], nodeID) // If there are no more nodes for this volume, remove the volume's entry @@ -4464,6 +5825,18 @@ func (o *TridentOrchestrator) removeVolumePublicationFromCache(volumeID, nodeID } } +// updateBackendOnPersistentStore updates the backend information on the persistent store +// It returns an error if the backend update is invalid. +// Parameters: +// ctx - context for logging +// backend - the backend to update +// newBackend - true if this is a new backend, false if this is an update to an existing backend +// Returns: +// error - the error if there is any +// Example: +// err := o.updateBackendOnPersistentStore(ctx, backend, true) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 0b8bff03ea76c0c057f27c6fad87a4db -- func (o *TridentOrchestrator) updateBackendOnPersistentStore( ctx context.Context, backend storage.Backend, newBackend bool, ) error { @@ -4487,6 +5860,18 @@ func (o *TridentOrchestrator) updateBackendOnPersistentStore( return nil } +// updateVolumeOnPersistentStore updates the volume information in persistent store +// It returns an error if the update fails. +// Parameters: +// ctx - context for logging +// vol - the volume to update +// Returns: +// error - the error if there is any +// Example: +// err := o.updateVolumeOnPersistentStore(ctx, vol) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: c4edd3c8428fe8edb94d43e360c1775a -- func (o *TridentOrchestrator) updateVolumeOnPersistentStore(ctx context.Context, vol *storage.Volume) error { // Update the volume information in persistent store Logc(ctx).WithFields(log.Fields{ @@ -4498,6 +5883,18 @@ func (o *TridentOrchestrator) updateVolumeOnPersistentStore(ctx context.Context, return o.storeClient.UpdateVolume(ctx, vol) } +// replaceBackendAndUpdateVolumesOnPersistentStore updates the backend and volume information in persistent store +// It returns an error if the backend update is invalid. +// Parameters: +// ctx - context for logging +// origBackend - the original backend +// newBackend - the new backend +// Returns: +// error - the error if there is any +// Example: +// err := o.replaceBackendAndUpdateVolumesOnPersistentStore(ctx, oldBackend, newBackend) +// +// -- Doc autogenerated on 2022-06-21. Function hash: a493110fffae19fac507baac4b3502e7 -- func (o *TridentOrchestrator) replaceBackendAndUpdateVolumesOnPersistentStore( ctx context.Context, origBackend, newBackend storage.Backend, ) error { @@ -4509,12 +5906,34 @@ func (o *TridentOrchestrator) replaceBackendAndUpdateVolumesOnPersistentStore( return o.storeClient.ReplaceBackendAndUpdateVolumes(ctx, origBackend, newBackend) } +// isCRDContext returns true if the context is from a CRD request, false otherwise. +// It returns an error if the context is nil. +// Parameters: +// ctx - context for logging +// Returns: +// bool - true if the context is from a CRD request, false otherwise +// Example: +// crdContext := o.isCRDContext(ctx) +// +// -- Doc autogenerated on 2022-06-21. Function hash: fac4a506fe93e8407310464685f2985d -- func (o *TridentOrchestrator) isCRDContext(ctx context.Context) bool { ctxSource := ctx.Value(ContextKeyRequestSource) return ctxSource != nil && ctxSource == ContextSourceCRD } // EstablishMirror creates a net-new replication mirror relationship between 2 volumes on a backend +// It returns an error if the backend does not support mirroring or if there is any other issue +// Parameters: +// ctx - context for logging +// backendUUID - the UUID of the backend +// localVolumeHandle - the handle of the local volume +// remoteVolumeHandle - the handle of the remote volume +// Returns: +// error - the error if there is any +// Example: +// err := o.EstablishMirror(ctx, backendUUID, localVolumeHandle, remoteVolumeHandle) +// +// -- Doc autogenerated on 2022-06-21. Function hash: c1b765518fd5a2d8aba3fd70a859cc19 -- func (o *TridentOrchestrator) EstablishMirror( ctx context.Context, backendUUID, localVolumeHandle, remoteVolumeHandle string, ) (err error) { @@ -4538,6 +5957,18 @@ func (o *TridentOrchestrator) EstablishMirror( } // ReestablishMirror recreates a previously existing replication mirror relationship between 2 volumes on a backend +// It returns an error if the backend does not support mirroring or if the mirror relationship could not be reestablished +// Parameters: +// ctx - context for logging +// backendUUID - the UUID of the backend +// localVolumeHandle - the handle of the local volume +// remoteVolumeHandle - the handle of the remote volume +// Returns: +// error - the error if the mirror relationship could not be reestablished, nil if the mirror relationship was reestablished +// Example: +// err := o.ReestablishMirror(ctx, backendUUID, localVolumeHandle, remoteVolumeHandle) +// +// -- Doc autogenerated on 2022-06-21. Function hash: 40c0b94acb3698f346989583106795e9 -- func (o *TridentOrchestrator) ReestablishMirror( ctx context.Context, backendUUID, localVolumeHandle, remoteVolumeHandle string, ) (err error) { @@ -4561,6 +5992,21 @@ func (o *TridentOrchestrator) ReestablishMirror( } // PromoteMirror makes the local volume the primary +// It returns a boolean indicating if the operation is waiting for a snapshot to be created +// Parameters: +// ctx - context for logging +// backendUUID - the UUID of the backend +// localVolumeHandle - the handle of the local volume +// remoteVolumeHandle - the handle of the remote volume +// snapshotHandle - the handle of the snapshot +// Returns: +// waitingForSnapshot - a boolean indicating if the operation is waiting for a snapshot to be created +// error - error if there is any +// Example: +// waitingForSnapshot, err := orchestrator.PromoteMirror(ctx, backendUUID, localVolumeHandle, remoteVolumeHandle, snapshotHandle) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 8230ace2dfda41f272c4cbd62ca3e0d2 -- func (o *TridentOrchestrator) PromoteMirror( ctx context.Context, backendUUID, localVolumeHandle, remoteVolumeHandle, snapshotHandle string, ) (waitingForSnapshot bool, err error) { @@ -4584,6 +6030,19 @@ func (o *TridentOrchestrator) PromoteMirror( } // GetMirrorStatus returns the current status of the mirror relationship +// It returns the status of the mirror relationship +// Parameters: +// ctx - context for logging +// backendUUID - the UUID of the backend +// localVolumeHandle - the handle of the local volume +// remoteVolumeHandle - the handle of the remote volume +// Returns: +// status - the status of the mirror relationship +// error - error if there is any +// Example: +// status, err := orchestrator.GetMirrorStatus(ctx, backendUUID, localVolumeHandle, remoteVolumeHandle) +// +// -- Doc autogenerated on 2022-06-21. Function hash: ed60295af3f0c04c70f60e57d5548a49 -- func (o *TridentOrchestrator) GetMirrorStatus( ctx context.Context, backendUUID, localVolumeHandle, remoteVolumeHandle string, ) (status string, err error) { @@ -4606,6 +6065,18 @@ func (o *TridentOrchestrator) GetMirrorStatus( return mirrorBackend.GetMirrorStatus(ctx, localVolumeHandle, remoteVolumeHandle) } +// CanBackendMirror returns a boolean indicating whether the backend is capable of mirroring. +// It returns an error if the backend does not exist. +// Parameters: +// ctx - context for logging +// backendUUID - the UUID of the backend +// Returns: +// capable - boolean indicating whether the backend is capable of mirroring +// error - error if there is any +// Example: +// capable, err := orchestrator.CanBackendMirror(ctx, backendUUID) +// +// -- Doc autogenerated on 2022-06-21. Function hash: bc1b19ddd30247a2154212e70860764d -- func (o *TridentOrchestrator) CanBackendMirror(_ context.Context, backendUUID string) (capable bool, err error) { if o.bootstrapError != nil { return false, o.bootstrapError @@ -4623,6 +6094,18 @@ func (o *TridentOrchestrator) CanBackendMirror(_ context.Context, backendUUID st } // ReleaseMirror removes snapmirror relationship infromation and snapshots for a source volume in ONTAP +// It returns an error if the release is unsuccessful. +// Parameters: +// ctx - context for logging +// backendUUID - the UUID of the backend +// localVolumeHandle - the handle of the source volume +// Returns: +// error - the error if the release is unsuccessful, nil if the release is successful +// Example: +// err := o.ReleaseMirror(ctx, backendUUID, localVolumeHandle) +// +// +// -- Doc autogenerated on 2022-06-21. Function hash: 84e545395def660448d10aaebe86988c -- func (o *TridentOrchestrator) ReleaseMirror( ctx context.Context, backendUUID, localVolumeHandle string, ) (err error) { @@ -4645,6 +6128,19 @@ func (o *TridentOrchestrator) ReleaseMirror( return mirrorBackend.ReleaseMirror(ctx, localVolumeHandle) } +// GetCHAP returns the CHAP information for a volume. +// It returns an error if the volume does not exist. +// Parameters: +// ctx - context for logging +// volumeName - the name of the volume +// nodeName - the name of the node +// Returns: +// chapInfo - the CHAP information +// error - the error if there is any +// Example: +// chapInfo, err := orchestrator.GetCHAP(ctx, "volume1", "node1") +// +// -- Doc autogenerated on 2022-06-21. Function hash: 235deca5df832ab0568e48718d1e814c -- func (o *TridentOrchestrator) GetCHAP( ctx context.Context, volumeName, nodeName string, ) (chapInfo *utils.IscsiChapInfo, err error) {