Skip to content

Commit 5a34d93

Browse files
committed
Merge branch 'release-v2.7.0' of https://bitbucket.ngage.netapp.com/scm/sie-bb/netapp-dataops-toolkit into feature/mcp-flexcache-k8s
2 parents 7ae079a + 156e588 commit 5a34d93

9 files changed

Lines changed: 386 additions & 183 deletions

File tree

netapp_dataops_k8s/netapp_dataops/k8s/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
by applications using the import method of utilizing the toolkit.
55
"""
66

7-
__version__ = "2.5.0"
7+
__version__ = "2.6.0"
88

99
import base64
1010
from datetime import datetime

netapp_dataops_k8s/netapp_dataops/netapp_dataops_k8s_cli.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -689,16 +689,16 @@
689689
Create a new FlexCache volume.
690690
691691
Required Options/Arguments:
692-
\t-f, --flexcache-vol=\tName of flexcache volume
693-
\t-s, --source-svm=\tSource SVM name
694-
\t-v, --source-vol=\tSource volume name
695-
\t-z, --flexcache-size=\tSize of flexcache volume (Format: '1024Mi', '100Gi', '10Ti', etc.).
696-
\t-b, --backend-name=\tName of tridentbackendconfig.
692+
\t-f, --flexcache-vol=\t\tName of flexcache volume
693+
\t-s, --source-svm=\t\tSource SVM name
694+
\t-v, --source-vol=\t\tSource volume name
695+
\t-z, --flexcache-size=\t\tSize of flexcache volume (Format: '1024Mi', '100Gi', '10Ti', etc.).
696+
\t-b, --backend-name=\t\tName of tridentbackendconfig.
697697
698698
Optional Options/Arguments:
699-
\t-h, --help\t\tPrint help text.
700-
\t-c, --junction=\t\tThe junction path for the FlexCache volume.
701-
\t-n, --namespace=\tKubernetes namespace to create the new PersistentVolumeClaim (PVC) in. If not specified, the PVC will be created in the "default" namespace.
699+
\t-h, --help\t\t\tPrint help text.
700+
\t-c, --junction=\t\t\tThe junction path for the FlexCache volume.
701+
\t-n, --namespace=\t\tKubernetes namespace to create the new PersistentVolumeClaim (PVC) in. If not specified, the PVC will be created in the "default" namespace.
702702
\t-t, --trident-namespace=\tKubernetes namespace where Trident is installed. If not specified, the namespace "trident" will be used.
703703
704704
Examples:

netapp_dataops_k8s/setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ install_requires =
3737
tabulate
3838
kubernetes
3939
netapp-ontap
40+
fastmcp
4041
python_requires = >=3.8,<3.14
4142

4243
[options.packages.find]

netapp_dataops_traditional/Examples/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,3 @@ This directory contains different examples including Jupyter Notebooks, YAML fil
99

1010
In this example we demonstrate an AI workflow in a Jupyter Notebook using Keras and MLflow. This notebook's goal is to give you an understanding of how to use the DataOps Toolkit with MLFlow for dataset-to-model traceability.
1111

12-
## SageMaker Notebook Instances with FSx for NetApp ONTAP
13-
14-
[notebookInstance-FSXVolume-stack.yaml](notebookInstance-FSXVolume-stack.yaml)
15-
16-
An AWS CloudFormation template for deploying Amazon SageMaker Notebook instances with access to an Amazon FSx for NetApp ONTAP filesystem.

netapp_dataops_traditional/Examples/notebookInstance-FSXVolume-stack.yaml

Lines changed: 0 additions & 142 deletions
This file was deleted.

netapp_dataops_traditional/README.md

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ Data volume management operations:
9191
- [List all data volumes.](#cli-list-volumes)
9292
- [Mount an existing data volume locally as "read-only" or "read-write".](#cli-mount-volume)
9393
- [Unmount an existing data volume.](#cli-unmount-volume)
94+
- [Create a new flexcache volume.](#cli-create-flexcache)
9495

9596
Snapshot management operations:
9697
- [Create a new snapshot for a data volume.](#cli-create-snapshot)
@@ -400,6 +401,51 @@ Unmounting volume at '/test1'.
400401
Volume unmounted successfully.
401402
```
402403

404+
<a name="cli-create-flexcache"></a>
405+
406+
#### Create a New FlexCache Volume
407+
408+
The NetApp DataOps Toolkit can be used to create a new FlexCache volume. A FlexCache volume acts as a local cache for a remote volume, enabling faster access to frequently used data. The command for creating a new FlexCache volume is `netapp_dataops_cli.py create flexcache`.
409+
410+
The following options/arguments are required:
411+
412+
```
413+
-n, --flexcache-vol= Name of the FlexCache volume to be created.
414+
-v, --source-volume= Name of the source volume.
415+
-s, --source-svm= Name of the source SVM.
416+
```
417+
418+
The following options/arguments are optional:
419+
420+
```
421+
-t, --flexcache-svm= Name of the SVM where the FlexCache volume will reside.
422+
-u, --cluster-name= Non-default hosting cluster.
423+
-j, --junction= Custom junction path for the FlexCache volume to be exported at. If not specified, junction path will be: ("/"+FlexCache Volume Name).
424+
-z, --flexcache-size= Size of the FlexCache volume. Format: '1024MB', '100GB', '10TB', etc. (default is 10% of the origin volume size or 1GB per constituent, whichever is greater).
425+
-e, --export-policy= NFS export policy to use for the FlexCache volume (default: 'default').
426+
-m, --mountpoint= Local mountpoint to mount the FlexCache volume after creation. If not specified, the volume will not be mounted locally. On Linux hosts, must be run as root if specified.
427+
-x, --readonly= Mount the FlexCache volume as read-only if True. (default is False).
428+
-h, --help Print help text.
429+
```
430+
431+
##### Example Usage
432+
433+
Create a FlexCache volume named 'cache1' in SVM 'svm0' for the source volume 'source1' in the source SVM 'svm1'.
434+
435+
```sh
436+
netapp_dataops_cli.py create flexcache --flexcache-vol=cache1 --flexcache-svm=svm0 --source-volume=source1 --source-svm=svm1
437+
Creating FlexCache: svm1:source1 -> svm0:cache1
438+
FlexCache created successfully.
439+
```
440+
441+
Create a FlexCache volume named 'cache2' in SVM 'svm0' for the source volume 'source2' in the source SVM 'svm1', with a size of 500GB.
442+
443+
```sh
444+
netapp_dataops_cli.py create flexcache --flexcache-vol=cache2 --flexcache-svm=svm0 --source-volume=source2 --source-svm=svm1 --flexcache-size=500GB
445+
Creating FlexCache: svm1:source2 -> svm0:cache2
446+
FlexCache created successfully.
447+
```
448+
403449
### Snapshot Management Operations
404450

405451
<a name="cli-create-snapshot"></a>
@@ -943,7 +989,7 @@ Setting state to snapmirrored, action:resync
943989
The NetApp DataOps Toolkit can also be utilized as a library of functions that can be imported into any Python program or Jupyter Notebook. In this manner, data scientists and data engineers can easily incorporate data management tasks into their existing projects, programs, and workflows. This functionality is only recommended for advanced users who are proficient in Python.
944990

945991
```py
946-
from netapp_dataops.traditional import clone_volume, create_volume, delete_volume, list_volumes, mount_volume, create_snapshot, delete_snapshot, list_snapshots, restore_snapshot, list_cloud_sync_relationships, sync_cloud_sync_relationship, list_snap_mirror_relationships, sync_snap_mirror_relationship, prepopulate_flex_cache, push_directory_to_s3, push_file_to_s3, pull_bucket_from_s3, pull_object_from_s3
992+
from netapp_dataops.traditional import clone_volume, create_volume, delete_volume, list_volumes, mount_volume, create_snapshot, delete_snapshot, list_snapshots, restore_snapshot, list_cloud_sync_relationships, sync_cloud_sync_relationship, list_snap_mirror_relationships, sync_snap_mirror_relationship, create_flexcache, prepopulate_flex_cache, push_directory_to_s3, push_file_to_s3, pull_bucket_from_s3, pull_object_from_s3
947993
```
948994

949995
Note: The prerequisite steps outlined in the [Getting Started](#getting-started) section still appy when the toolkit is being utilized as an importable library of functions.
@@ -957,6 +1003,7 @@ Data volume management operations:
9571003
- [List all data volumes.](#lib-list-volumes)
9581004
- [Mount an existing data volume locally as read-only or read-write.](#lib-mount-volume)
9591005
- [Unmount an existing data volume.](#lib-unmount-volume)
1006+
- [Create a new flexcache volume.](#lib-create-flexcache)
9601007

9611008
Snapshot management operations:
9621009
- [Create a new snapshot for a data volume.](#lib-create-snapshot)
@@ -1223,6 +1270,44 @@ APIConnectionError # The storage system/service API returned an err
12231270
InvalidVolumeParameterError # An invalid parameter was specified.
12241271
```
12251272

1273+
<a name="lib-create-flexcache"></a>
1274+
1275+
#### Create a New FlexCache Volume
1276+
1277+
The NetApp DataOps Toolkit can be used to create a new FlexCache volume as part of any Python program or workflow. A FlexCache volume acts as a local cache for a remote volume, enabling faster access to frequently used data. This functionality is useful for distributed environments where data needs to be accessed quickly and efficiently.
1278+
1279+
##### Function Definition
1280+
1281+
```py
1282+
def create_flexcache(
1283+
source_vol: str, # Name of the source volume (required).
1284+
source_svm: str, # Name of the source SVM (required).
1285+
flexcache_vol: str, # Name of the FlexCache volume to be created (required).
1286+
flexcache_svm: str = None, # Name of the SVM where the FlexCache volume will reside (optional, defaults to config SVM).
1287+
cluster_name: str = None, # Non-default cluster name, same credentials as the default credentials should be used (optional).
1288+
flexcache_size: str = None, # Size of the FlexCache volume. Format: '1024MB', '100GB', '10TB', etc. (optional). Default is 10% of the source volume size or 1GB per constituent, whichever is greater.
1289+
junction: str = None, # Custom junction path for the FlexCache volume to be exported at. If not specified, junction path will be: ("/"+FlexCache Volume Name).
1290+
export_policy: str = "default", # NFS export policy to use for the FlexCache volume (default: 'default').
1291+
mountpoint: str = None, # Local mountpoint to mount the FlexCache volume after creation. If not specified, the volume will not be mounted locally. On Linux hosts, must be run as root if specified.
1292+
readonly: bool = False, # Mount the FlexCache volume as read-only if True.
1293+
print_output: bool = False # Denotes whether or not to print messages to the console during execution.
1294+
):
1295+
```
1296+
1297+
##### Return Value
1298+
1299+
None
1300+
1301+
##### Error Handling
1302+
1303+
If an error is encountered, the function will raise an exception of one of the following types. These exception types are defined in `netapp_dataops.traditional`.
1304+
1305+
```py
1306+
InvalidConfigError # Config file is missing or contains an invalid value.
1307+
APIConnectionError # The storage system/service API returned an error.
1308+
InvalidVolumeParameterError # An invalid parameter was specified.
1309+
```
1310+
12261311
### Snapshot Management Operations
12271312

12281313
<a name="lib-create-snapshot"></a>

netapp_dataops_traditional/netapp_dataops/mcp_server/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def load_credentials():
1919

2020
# If path not found, raise an error that config.json file doesn't exist
2121
if not os.path.exists(credentials_path):
22-
raise FileNotFoundError("Credentials file 'config.json' not found in the netapp_dataops directory.")
22+
raise FileNotFoundError("Credentials file 'config.json' not found in the ~/.netapp_dataops directory.")
2323

2424
# Opens the file specified, reads its contents, parses the contents as JSON, and stores the resulting data
2525
with open(credentials_path, 'r') as f:
@@ -48,4 +48,4 @@ def load_credentials():
4848
if key not in config:
4949
raise ValueError(f"Missing required key '{key}' in 'config.json' file.")
5050

51-
return config # Returns the validated configuration dictionary
51+
return config # Returns the validated configuration dictionary

0 commit comments

Comments
 (0)