Skip to content

Commit 2febc41

Browse files
authored
Merge pull request #54 from DataCrunch-io/add-sfs-volume-example
Feature: Added SFS type constant and example
2 parents 3f057a5 + 5cb319c commit 2febc41

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Added shared filesystem (SFS) type constant and example
13+
1014
## [1.16.0] - 2025-10-27
1115

1216
### Changed

datacrunch/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class VolumeTypes:
6161

6262
NVMe = 'NVMe'
6363
HDD = 'HDD'
64+
SFS = 'NVMe_Shared'
6465

6566
def __init__(self):
6667
return

examples/storage_volumes.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# Get some volume type constants
1313
NVMe = datacrunch.constants.volume_types.NVMe
1414
HDD = datacrunch.constants.volume_types.HDD
15+
SFS = datacrunch.constants.volume_types.SFS
1516

1617
# Example instance id
1718
INSTANCE_ID = '8705bb38-2574-454f-9967-d18b130bf5ee'
@@ -28,6 +29,9 @@
2829
# Create a 200 GB detached NVMe volume
2930
nvme_volume = datacrunch.volumes.create(type=NVMe, name='data-storage-1', size=200)
3031

32+
# Create a shared filesystem volume
33+
shared_filesystem_volume = datacrunch.volumes.create(type=SFS, name='shared-filesystem-1', size=50)
34+
3135
# Create a 500 GB HDD volume and attach it to an existing shutdown instance
3236
# Note: If the instance isn't shutdown an exception would be raised
3337
hdd_volume = datacrunch.volumes.create(
@@ -36,6 +40,7 @@
3640

3741
nvme_volume_id = nvme_volume.id
3842
hdd_volume_id = hdd_volume.id
43+
sfs_volume_id = shared_filesystem_volume.id
3944

4045
# attach the nvme volume to the instance
4146
datacrunch.volumes.attach(nvme_volume_id, INSTANCE_ID)
@@ -59,10 +64,10 @@
5964
datacrunch.volumes.clone([nvme_volume_id, hdd_volume_id])
6065

6166
# delete volumes (move to trash for 96h, not permanent)
62-
datacrunch.volumes.delete([nvme_volume_id, hdd_volume_id])
67+
datacrunch.volumes.delete([nvme_volume_id, hdd_volume_id, sfs_volume_id])
6368

6469
# get all volumes in trash
6570
volumes_in_trash = datacrunch.volumes.get_in_trash()
6671

6772
# delete volumes permanently
68-
datacrunch.volumes.delete([nvme_volume_id, hdd_volume_id], is_permanent=True)
73+
datacrunch.volumes.delete([nvme_volume_id, hdd_volume_id, sfs_volume_id], is_permanent=True)

0 commit comments

Comments
 (0)