Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9b33ac8
pass secondary_stg_name during bdev_distrib_create
boddumanohar May 6, 2025
67b66f2
storage tiering
boddumanohar May 6, 2025
7875a5d
pass parameters properly
boddumanohar May 6, 2025
7d58069
create s3_dev before distrib
boddumanohar May 6, 2025
da9bf76
remove support storage tiering default
boddumanohar May 6, 2025
95d6663
fix syntax
boddumanohar May 6, 2025
d55937d
initialize rpc client
boddumanohar May 7, 2025
3bec750
pass storage_tiering param at all usages
boddumanohar May 7, 2025
322229a
use storage-tiering docker image
boddumanohar May 7, 2025
55cc5d9
use **kwargs
boddumanohar May 7, 2025
8a8b6b9
use seperate functions
boddumanohar May 7, 2025
2cdef9f
pass params explicitly
boddumanohar May 7, 2025
2a4e4ef
s3 bdev create only once per node
boddumanohar May 7, 2025
9c86971
add distrib bdev create
boddumanohar May 7, 2025
0c01946
limit to 2**16-2
boddumanohar May 7, 2025
1b66127
fix typo
boddumanohar May 7, 2025
343f3d4
remove un used imports
boddumanohar May 7, 2025
3634fc7
use sanitizer image
boddumanohar May 8, 2025
2076a53
pass bucket name from cluster object
boddumanohar May 14, 2025
ff35e7f
make cluster_sz multiple of ndcs
boddumanohar May 14, 2025
c9231f0
use vuid for storage_tiering_id
boddumanohar May 15, 2025
d08adbe
set addtional flags during lvol create & clone
boddumanohar May 16, 2025
f6ce7ab
set ghost and small to 100 and main queue to 1000
boddumanohar May 20, 2025
291da45
update endpoint
boddumanohar May 21, 2025
3fa6958
Revert "update endpoint"
boddumanohar May 21, 2025
598379b
set is_raid_base to true during storage_tiering
boddumanohar May 22, 2025
a0ffa5d
remove the usage of is_raid_base flag
boddumanohar May 24, 2025
3bd4f25
toggle disaster recovery during lvstore recover
boddumanohar May 29, 2025
36149ea
use full_page_unmap as true
boddumanohar May 29, 2025
fac55af
storage tiering
boddumanohar Jun 2, 2025
2f4a32f
storage tiering
boddumanohar Jun 3, 2025
b73bd1f
backup a snapshot
boddumanohar Jun 3, 2025
09cf2ba
snapshot backedup at
boddumanohar Jun 3, 2025
2019d76
S3 Endpoint tests
boddumanohar Jun 3, 2025
d5d15e7
set all values to zero
boddumanohar Jun 3, 2025
8affbd9
pass parameters to cluster create
boddumanohar Jun 3, 2025
a682fc7
Merge branch 'main' into manohar-storage-tiering3
boddumanohar Jun 16, 2025
f599815
take cluster params from cli
boddumanohar Jun 16, 2025
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
77 changes: 77 additions & 0 deletions simplyblock_cli/cli-reference.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,41 @@ commands:
dest: strict_node_anti_affinity
type: bool
action: store_true
- name: "--support-storage-tiering"
help: "Enable storage tiering for the cluster"
dest: storage_tiering
type: bool
default: false
- name: "--s3-endpoint"
help: "S3 endpoint for storage tiering"
dest: s3_endpoint
type: str
default: ""
- name: "--s3-bucket"
help: "S3 bucket for storage tiering"
dest: s3_bucket
type: str
default: ""
- name: "--s3-access-key"
help: "S3 access key for storage tiering"
dest: s3_access_key
type: str
default: ""
- name: "--s3-secret-key"
help: "S3 secret key for storage tiering"
dest: s3_secret_key
type: str
default: ""
- name: "--s3-workerpool-mask"
help: "S3 workerpool mask for storage tiering"
dest: s3_workerpool_mask
type:
regex: "^(0x|0X)?[a-fA-F0-9]+$"
- name: "--s3-workerpool-size"
help: "S3 workerpool size for storage tiering"
dest: s3_workerpool_size
type: int
default: 32
- name: add
help: "Adds a new cluster"
arguments:
Expand Down Expand Up @@ -1185,6 +1220,41 @@ commands:
dest: strict_node_anti_affinity
type: bool
action: store_true
- name: "--support-storage-tiering"
help: "Enable storage tiering for the cluster"
dest: storage_tiering
type: bool
default: false
- name: "--s3-endpoint"
help: "S3 endpoint for storage tiering"
dest: s3_endpoint
type: str
default: ""
- name: "--s3-bucket"
help: "S3 bucket for storage tiering"
dest: s3_bucket
type: str
default: ""
- name: "--s3-access-key"
help: "S3 access key for storage tiering"
dest: s3_access_key
type: str
default: ""
- name: "--s3-secret-key"
help: "S3 secret key for storage tiering"
dest: s3_secret_key
type: str
default: ""
- name: "--s3-workerpool-mask"
help: "S3 workerpool mask for storage tiering"
dest: s3_workerpool_mask
type:
regex: "^(0x|0X)?[a-fA-F0-9]+$"
- name: "--s3-workerpool-size"
help: "S3 workerpool size for storage tiering"
dest: s3_workerpool_size
type: int
default: 32
- name: activate
help: >
Activates a cluster.
Expand Down Expand Up @@ -1986,6 +2056,13 @@ commands:
dest: resize
type: size
default: "0"
- name: backup
help: "Backs up a snapshot to a s3 storage using storage tiering"
arguments:
- name: "snapshot_id"
help: "Snapshot id"
dest: snapshot_id
type: str
- name: "caching-node"
help: "Caching node commands"
aliases:
Expand Down
21 changes: 21 additions & 0 deletions simplyblock_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,13 @@ def init_cluster__create(self, subparser):
if self.developer_mode:
argument = subcommand.add_argument('--enable-qos', help='Enable qos bdev for storage nodes, true by default', type=bool, default=False, dest='enable_qos')
argument = subcommand.add_argument('--strict-node-anti-affinity', help='Enable strict node anti affinity for storage nodes. Never more than one chunk is placed on a node. This requires a minimum of _data-chunks-in-stripe + parity-chunks-in-stripe + 1_ nodes in the cluster.', dest='strict_node_anti_affinity', action='store_true')
argument = subcommand.add_argument('--support-storage-tiering', help='Enable storage tiering for the cluster', type=bool, default=False, dest='storage_tiering')
argument = subcommand.add_argument('--s3-endpoint', help='S3 endpoint for storage tiering', type=str, default='', dest='s3_endpoint')
argument = subcommand.add_argument('--s3-bucket', help='S3 bucket for storage tiering', type=str, default='', dest='s3_bucket')
argument = subcommand.add_argument('--s3-access-key', help='S3 access key for storage tiering', type=str, default='', dest='s3_access_key')
argument = subcommand.add_argument('--s3-secret-key', help='S3 secret key for storage tiering', type=str, default='', dest='s3_secret_key')
argument = subcommand.add_argument('--s3-workerpool-mask', help='S3 workerpool mask for storage tiering', type=regex_type(r'^(0x|0X)?[a-fA-F0-9]+$'), dest='s3_workerpool_mask')
argument = subcommand.add_argument('--s3-workerpool-size', help='S3 workerpool size for storage tiering', type=int, default=32, dest='s3_workerpool_size')

def init_cluster__add(self, subparser):
subcommand = self.add_sub_command(subparser, 'add', 'Adds a new cluster')
Expand All @@ -465,6 +472,13 @@ def init_cluster__add(self, subparser):
if self.developer_mode:
argument = subcommand.add_argument('--enable-qos', help='Enable qos bdev for storage nodes, default: true', type=bool, default=False, dest='enable_qos')
argument = subcommand.add_argument('--strict-node-anti-affinity', help='Enable strict node anti affinity for storage nodes. Never more than one chunk is placed on a node. This requires a minimum of _data-chunks-in-stripe + parity-chunks-in-stripe + 1_ nodes in the cluster."', dest='strict_node_anti_affinity', action='store_true')
argument = subcommand.add_argument('--support-storage-tiering', help='Enable storage tiering for the cluster', type=bool, default=False, dest='storage_tiering')
argument = subcommand.add_argument('--s3-endpoint', help='S3 endpoint for storage tiering', type=str, default='', dest='s3_endpoint')
argument = subcommand.add_argument('--s3-bucket', help='S3 bucket for storage tiering', type=str, default='', dest='s3_bucket')
argument = subcommand.add_argument('--s3-access-key', help='S3 access key for storage tiering', type=str, default='', dest='s3_access_key')
argument = subcommand.add_argument('--s3-secret-key', help='S3 secret key for storage tiering', type=str, default='', dest='s3_secret_key')
argument = subcommand.add_argument('--s3-workerpool-mask', help='S3 workerpool mask for storage tiering', type=regex_type(r'^(0x|0X)?[a-fA-F0-9]+$'), dest='s3_workerpool_mask')
argument = subcommand.add_argument('--s3-workerpool-size', help='S3 workerpool size for storage tiering', type=int, default=32, dest='s3_workerpool_size')

def init_cluster__activate(self, subparser):
subcommand = self.add_sub_command(subparser, 'activate', 'Activates a cluster.')
Expand Down Expand Up @@ -785,6 +799,7 @@ def init_snapshot(self):
self.init_snapshot__list(subparser)
self.init_snapshot__delete(subparser)
self.init_snapshot__clone(subparser)
self.init_snapshot__backup(subparser)


def init_snapshot__add(self, subparser):
Expand All @@ -807,6 +822,10 @@ def init_snapshot__clone(self, subparser):
subcommand.add_argument('lvol_name', help='Logical volume name', type=str)
argument = subcommand.add_argument('--resize', help='New logical volume size: 10M, 10G, 10(bytes). Can only increase.', type=size_type(), default='0', dest='resize')

def init_snapshot__backup(self, subparser):
subcommand = self.add_sub_command(subparser, 'backup', 'Backs up a snapshot to a s3 storage using storage tiering')
subcommand.add_argument('snapshot_id', help='Snapshot id', type=str)


def init_caching_node(self):
subparser = self.add_command('caching-node', 'Caching node commands', aliases=['cn',])
Expand Down Expand Up @@ -1214,6 +1233,8 @@ def run(self):
ret = self.snapshot__delete(sub_command, args)
elif sub_command in ['clone']:
ret = self.snapshot__clone(sub_command, args)
elif sub_command in ['backup']:
ret = self.snapshot__backup(sub_command, args)
else:
self.parser.print_help()

Expand Down
24 changes: 22 additions & 2 deletions simplyblock_cli/clibase.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,10 @@ def snapshot__clone(self, sub_command, args):
success, details = snapshot_controller.clone(args.snapshot_id, args.lvol_name, new_size)
return details

def snapshot__backup(self, sub_command, args):
snapshot_id = args.snapshot_id
return snapshot_controller.backup(snapshot_id)

def caching_node__deploy(self, sub_command, args):
return caching_node_controller.deploy(args.ifname)

Expand Down Expand Up @@ -688,18 +692,26 @@ def cluster_add(self, args):
distr_bs = args.distr_bs
distr_chunk_bs = args.distr_chunk_bs
ha_type = args.ha_type

enable_node_affinity = args.enable_node_affinity
qpair_count = args.qpair_count
max_queue_size = args.max_queue_size
inflight_io_threshold = args.inflight_io_threshold
enable_qos = args.enable_qos
strict_node_anti_affinity = args.strict_node_anti_affinity
storage_tiering = args.storage_tiering
s3_endpoint = args.s3_endpoint
s3_bucket = args.s3_bucket
s3_access_key = args.s3_access_key
s3_secret_key = args.s3_secret_key
s3_workerpool_mask = args.s3_workerpool_mask
s3_workerpool_size = args.s3_workerpool_size

return cluster_ops.add_cluster(
blk_size, page_size_in_blocks, cap_warn, cap_crit, prov_cap_warn, prov_cap_crit,
distr_ndcs, distr_npcs, distr_bs, distr_chunk_bs, ha_type, enable_node_affinity,
qpair_count, max_queue_size, inflight_io_threshold, enable_qos, strict_node_anti_affinity)
qpair_count, max_queue_size, inflight_io_threshold, enable_qos, strict_node_anti_affinity,
storage_tiering, s3_endpoint, s3_bucket, s3_access_key, s3_secret_key, s3_workerpool_mask,
s3_workerpool_size)

def cluster_deploy(self, args):
grafana_endpoint = ""
Expand Down Expand Up @@ -819,6 +831,14 @@ def cluster_create(self, args):
enable_qos = args.enable_qos
strict_node_anti_affinity = args.strict_node_anti_affinity

# storage_tiering = args.storage_tiering
# s3_endpoint = args.s3_endpoint
# s3_bucket = args.s3_bucket
# s3_access_key = args.s3_access_key
# s3_secret_key = args.s3_secret_key
# s3_workerpool_mask = args.s3_workerpool_mask
# s3_workerpool_size = args.s3_workerpool_size

return cluster_ops.create_cluster(
blk_size, page_size_in_blocks,
CLI_PASS, cap_warn, cap_crit, prov_cap_warn, prov_cap_crit,
Expand Down
11 changes: 10 additions & 1 deletion simplyblock_core/cluster_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ def deploy_cluster(storage_nodes,test,ha_type,distr_ndcs,distr_npcs,enable_qos,i

def add_cluster(blk_size, page_size_in_blocks, cap_warn, cap_crit, prov_cap_warn, prov_cap_crit,
distr_ndcs, distr_npcs, distr_bs, distr_chunk_bs, ha_type, enable_node_affinity, qpair_count,
max_queue_size, inflight_io_threshold, enable_qos, strict_node_anti_affinity) -> str:
max_queue_size, inflight_io_threshold, enable_qos, strict_node_anti_affinity, storage_tiering,
s3_endpoint, s3_bucket, s3_access_key, s3_secret_key, s3_workerpool_mask, s3_workerpool_size) -> str:
db_controller = DBController()
clusters = db_controller.get_clusters()
if not clusters:
Expand Down Expand Up @@ -493,6 +494,14 @@ def add_cluster(blk_size, page_size_in_blocks, cap_warn, cap_crit, prov_cap_warn
cluster.max_queue_size = max_queue_size
cluster.inflight_io_threshold = inflight_io_threshold
cluster.enable_qos = enable_qos
cluster.storage_tiering = storage_tiering
cluster.s3_endpoint = s3_endpoint
cluster.s3_bucket = s3_bucket
cluster.s3_access_key = s3_access_key
cluster.s3_secret_key = s3_secret_key
cluster.s3_workerpool_mask = s3_workerpool_mask
cluster.s3_workerpool_size = s3_workerpool_size

if cap_warn and cap_warn > 0:
cluster.cap_warn = cap_warn
if cap_crit and cap_crit > 0:
Expand Down
34 changes: 34 additions & 0 deletions simplyblock_core/controllers/snapshot_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging as lg
import time
import uuid
import datetime

from simplyblock_core.controllers import lvol_controller, snapshot_events, pool_controller

Expand Down Expand Up @@ -227,6 +228,39 @@ def list(all=False):
return utils.print_table(data)


def backup(snapshot_uuid):
snap = db_controller.get_snapshot_by_id(snapshot_uuid)
if not snap:
msg = f"Snapshot not found: {snapshot_uuid}"
logger.error(msg)
return False, msg

snode = db_controller.get_storage_node_by_id(snap.lvol.node_id)
if not snode:
msg = f"Storage node not found: {snap.lvol.node_id}"
logger.error(msg)
return False, msg

rpc_client = RPCClient(snode.mgmt_ip, snode.rpc_port, snode.rpc_username, snode.rpc_password)
ret = rpc_client.bdev_lvol_backup_snapshot(snap.snap_uuid, timeout_us=1000000, dev_page_size=2 * 1024 * 1024, nmax_retries=4, nmax_flush_jobs=4)
if not ret:
msg = f"Failed to backup snapshot: {snap.snap_bdev}"
logger.error(msg)
return False, msg

times = 5
while times > 0:
resp = rpc_client.bdev_lvol_get_snapshot_backup_status(lvol_name=snap.snap_uuid)
time.sleep(3)
times = times - 1
if resp == "SUCCEEDED":
snap.backedup_at = str(datetime.datetime.now(datetime.timezone.utc))
snap.write_to_db(db_controller.kv_store)
logger.info("Done")
return True, ""

return False, f"Failed to backup snapshot: {snap.snap_bdev}, status: {resp}"

def delete(snapshot_uuid, force_delete=False):
snap = db_controller.get_snapshot_by_id(snapshot_uuid)
if not snap:
Expand Down
5 changes: 2 additions & 3 deletions simplyblock_core/env_var
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
SIMPLY_BLOCK_COMMAND_NAME=sbcli-dev
SIMPLY_BLOCK_VERSION=18.0.90


SIMPLY_BLOCK_DOCKER_IMAGE=simplyblock/simplyblock:main
SIMPLY_BLOCK_SPDK_ULTRA_IMAGE=simplyblock/spdk:main-latest
SIMPLY_BLOCK_DOCKER_IMAGE=public.ecr.aws/simply-block/simplyblock:manohar-storage-tiering3
SIMPLY_BLOCK_SPDK_ULTRA_IMAGE=simplyblock/spdk:storage-tiering-ha-tested-sanitizer
7 changes: 7 additions & 0 deletions simplyblock_core/models/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ class Cluster(BaseModel):
strict_node_anti_affinity: bool = False
tls: bool = False
is_re_balancing: bool = False
storage_tiering: bool = True
s3_access_key: str = "foobar"
s3_secret_key: str = "barfoobarfoo"
s3_endpoint: str = "http://192.168.10.146:9000"
s3_bucket: str = "mybucket"
s3_workerpool_mask: str = "0x00000000"
s3_workerpool_size: int = 32
full_page_unmap: bool = True

def get_status_code(self):
Expand Down
1 change: 1 addition & 0 deletions simplyblock_core/models/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ class SnapShot(BaseModel):
snap_ref_id: str = ""
snap_uuid: str = ""
vuid: int = 0
backedup_at: str = ""
Loading
Loading