Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Added shared filesystem (SFS) type constant and example

## [1.16.0] - 2025-10-27

### Changed
Expand Down
1 change: 1 addition & 0 deletions datacrunch/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class VolumeTypes:

NVMe = 'NVMe'
HDD = 'HDD'
SFS = 'NVMe_Shared'

def __init__(self):
return
Expand Down
9 changes: 7 additions & 2 deletions examples/storage_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# Get some volume type constants
NVMe = datacrunch.constants.volume_types.NVMe
HDD = datacrunch.constants.volume_types.HDD
SFS = datacrunch.constants.volume_types.SFS

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

# Create a shared filesystem volume
shared_filesystem_volume = datacrunch.volumes.create(type=SFS, name='shared-filesystem-1', size=50)

# Create a 500 GB HDD volume and attach it to an existing shutdown instance
# Note: If the instance isn't shutdown an exception would be raised
hdd_volume = datacrunch.volumes.create(
Expand All @@ -36,6 +40,7 @@

nvme_volume_id = nvme_volume.id
hdd_volume_id = hdd_volume.id
sfs_volume_id = shared_filesystem_volume.id

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

# delete volumes (move to trash for 96h, not permanent)
datacrunch.volumes.delete([nvme_volume_id, hdd_volume_id])
datacrunch.volumes.delete([nvme_volume_id, hdd_volume_id, sfs_volume_id])

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

# delete volumes permanently
datacrunch.volumes.delete([nvme_volume_id, hdd_volume_id], is_permanent=True)
datacrunch.volumes.delete([nvme_volume_id, hdd_volume_id, sfs_volume_id], is_permanent=True)