Skip to content
Open
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
1 change: 0 additions & 1 deletion scripts/aws_capacity_namespace_churn_soak.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
import shlex
import signal
import subprocess
import sys
import threading
import time
from collections import defaultdict
Expand Down
38 changes: 1 addition & 37 deletions simplyblock_cli/cli-reference.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2041,27 +2041,6 @@ commands:
dest: lvol_max
type: size
default: "0"
- name: "--max-rw-iops"
help: "Maximum Read Write IO Per Second."
dest: max_rw_iops
type: int
- name: "--max-rw-mbytes"
help: "Maximum Read Write Megabytes Per Second."
dest: max_rw_mbytes
type: int
- name: "--max-r-mbytes"
help: "Maximum Read Megabytes Per Second."
dest: max_r_mbytes
type: int
- name: "--max-w-mbytes"
help: "Maximum Write Megabytes Per Second."
dest: max_w_mbytes
type: int
- name: "--qos-host"
help: "The node id for QoS pool."
dest: qos_host
type: str
required: false
- name: "--dhchap"
help: "Enable DH-HMAC-CHAP authentication for all volumes in the pool."
dest: dhchap
Expand All @@ -2083,22 +2062,7 @@ commands:
help: "Logical volume maximum size: 20M, 20G."
dest: lvol_max
type: size
- name: "--max-rw-iops"
help: "Maximum Read Write IO Per Second."
dest: max_rw_iops
type: int
- name: "--max-rw-mbytes"
help: "Maximum Read Write Megabytes Per Second."
dest: max_rw_mbytes
type: int
- name: "--max-r-mbytes"
help: "Maximum Read Megabytes Per Second."
dest: max_r_mbytes
type: int
- name: "--max-w-mbytes"
help: "Maximum Write Megabytes Per Second."
dest: max_w_mbytes
type: int

- name: list
help: "Lists all storage pools."
arguments:
Expand Down
9 changes: 0 additions & 9 deletions simplyblock_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,22 +815,13 @@ def init_storage_pool__add(self, subparser):
subcommand.add_argument('cluster_id', help='The cluster id.', type=str)
argument = subcommand.add_argument('--pool-max', help='Pool maximum size: 20M, 20G, 0. Default: `0`.', type=size_type(), default='0', dest='pool_max')
argument = subcommand.add_argument('--lvol-max', help='Logical volume maximum size: 20M, 20G, 0. Default: `0`.', type=size_type(), default='0', dest='lvol_max')
argument = subcommand.add_argument('--max-rw-iops', help='Maximum Read Write IO Per Second.', type=int, dest='max_rw_iops')
argument = subcommand.add_argument('--max-rw-mbytes', help='Maximum Read Write Megabytes Per Second.', type=int, dest='max_rw_mbytes')
argument = subcommand.add_argument('--max-r-mbytes', help='Maximum Read Megabytes Per Second.', type=int, dest='max_r_mbytes')
argument = subcommand.add_argument('--max-w-mbytes', help='Maximum Write Megabytes Per Second.', type=int, dest='max_w_mbytes')
argument = subcommand.add_argument('--qos-host', help='The node id for QoS pool.', type=str, dest='qos_host', required=False)
argument = subcommand.add_argument('--dhchap', help='Enable DH-HMAC-CHAP authentication for all volumes in the pool.', default=False, dest='dhchap', action='store_true')

def init_storage_pool__set(self, subparser):
subcommand = self.add_sub_command(subparser, 'set', 'Sets a storage pool\'s attributes.')
subcommand.add_argument('pool_id', help='The storage pool id.', type=str)
argument = subcommand.add_argument('--pool-max', help='Pool maximum size: 20M, 20G.', type=size_type(), dest='pool_max')
argument = subcommand.add_argument('--lvol-max', help='Logical volume maximum size: 20M, 20G.', type=size_type(), dest='lvol_max')
argument = subcommand.add_argument('--max-rw-iops', help='Maximum Read Write IO Per Second.', type=int, dest='max_rw_iops')
argument = subcommand.add_argument('--max-rw-mbytes', help='Maximum Read Write Megabytes Per Second.', type=int, dest='max_rw_mbytes')
argument = subcommand.add_argument('--max-r-mbytes', help='Maximum Read Megabytes Per Second.', type=int, dest='max_r_mbytes')
argument = subcommand.add_argument('--max-w-mbytes', help='Maximum Write Megabytes Per Second.', type=int, dest='max_w_mbytes')

def init_storage_pool__list(self, subparser):
subcommand = self.add_sub_command(subparser, 'list', 'Lists all storage pools.')
Expand Down
23 changes: 4 additions & 19 deletions simplyblock_cli/clibase.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,29 +719,14 @@ def control_plane__remove(self, sub_command, args):
def storage_pool__add(self, sub_command, args):
return pool_controller.add_pool(
args.name,
args.pool_max,
args.lvol_max,
args.max_rw_iops,
args.max_rw_mbytes,
args.max_r_mbytes,
args.max_w_mbytes,
args.cluster_id,
args.qos_host,
pool_max=args.pool_max,
lvol_max=args.lvol_max,
cluster_id=args.cluster_id,
dhchap=args.dhchap,
)

def storage_pool__set(self, sub_command, args):
pool_max = args.pool_max
lvol_max = args.lvol_max

ret, err = pool_controller.set_pool(
args.pool_id,
pool_max,
lvol_max,
args.max_rw_iops,
args.max_rw_mbytes,
args.max_r_mbytes,
args.max_w_mbytes)
ret, err = pool_controller.set_pool(args.pool_id, args.pool_max, args.lvol_max)
return ret

def storage_pool__list(self, sub_command, args):
Expand Down
4 changes: 2 additions & 2 deletions simplyblock_core/controllers/pool_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def _generate_string(length):
string.ascii_letters + string.digits) for _ in range(length))


def add_pool(name, pool_max, lvol_max, max_rw_iops, max_rw_mbytes, max_r_mbytes, max_w_mbytes, cluster_id,
cr_name=None, cr_namespace=None, cr_plural=None, qos_host=None, sec_options=None, dhchap=False):
def add_pool(name, pool_max=0, lvol_max=0, max_rw_iops=0, max_rw_mbytes=0, max_r_mbytes=0, max_w_mbytes=0,
cluster_id=None, cr_name=None, cr_namespace=None, cr_plural=None, qos_host=None, sec_options=None, dhchap=False):
db_controller = DBController()
if not name:
logger.error("Pool name is empty!")
Expand Down
31 changes: 7 additions & 24 deletions simplyblock_web/api/v1/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ def add_pool():
| cluster_id (required) | Cluster uuid
| pool_max | Pool maximum size: 10M, 10G, 10(bytes)
| lvol_max | LVol maximum size: 10M, 10G, 10(bytes)
| max_rw_iops | Maximum Read Write IO Per Second
| max_rw_mbytes | Maximum Read Write Mega Bytes Per Second
| max_r_mbytes | Maximum Read Mega Bytes Per Second
| max_w_mbytes | Maximum Write Mega Bytes Per Second
| dhchap | Enable DHCHAP authentication for this pool's lvols. Default false.
"""
pool_data = request.get_json()
if 'name' not in pool_data:
Expand All @@ -75,17 +72,15 @@ def add_pool():
if 'lvol_max' in pool_data:
lvol_max_size = core_utils.parse_size(pool_data['lvol_max'])

max_rw_iops = utils.get_int_value_or_default(pool_data, "max_rw_iops", 0)
max_rw_mbytes = utils.get_int_value_or_default(pool_data, "max_rw_mbytes", 0)
max_r_mbytes_per_sec = utils.get_int_value_or_default(pool_data, "max_r_mbytes", 0)
max_w_mbytes_per_sec = utils.get_int_value_or_default(pool_data, "max_w_mbytes", 0)

dhchap = bool(pool_data.get('dhchap', False))

ret = pool_controller.add_pool(
name, pool_max_size, lvol_max_size, max_rw_iops, max_rw_mbytes,
max_r_mbytes_per_sec, max_w_mbytes_per_sec, cluster_id,
dhchap=dhchap)
name,
pool_max=pool_max_size,
lvol_max=lvol_max_size,
cluster_id=cluster_id,
dhchap=dhchap
)

return utils.get_response(ret)

Expand Down Expand Up @@ -135,18 +130,6 @@ def update_pool(uuid):
if 'lvol_max' in pool_data:
fn_params['lvol_max'] = core_utils.parse_size(pool_data['lvol_max'])

if 'max_rw_iops' in pool_data:
fn_params['max_rw_iops'] = core_utils.parse_size(pool_data['max_rw_iops'])

if 'max_rw_mbytes' in pool_data:
fn_params['max_rw_mbytes'] = core_utils.parse_size(pool_data['max_rw_mbytes'])

if 'max_r_mbytes' in pool_data:
fn_params['max_r_mbytes'] = core_utils.parse_size(pool_data['max_r_mbytes'])

if 'max_w_mbytes' in pool_data:
fn_params['max_w_mbytes'] = core_utils.parse_size(pool_data['max_w_mbytes'])

ret, err = pool_controller.set_pool(**fn_params)

return utils.get_response(ret, err)
Expand Down
20 changes: 8 additions & 12 deletions simplyblock_web/api/v2/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ class StoragePoolParams(BaseModel):
name: str
pool_max: util.Unsigned = 0
volume_max_size: util.Unsigned = 0
max_rw_iops: util.Unsigned = 0
max_rw_mbytes: util.Unsigned = 0
max_r_mbytes: util.Unsigned = 0
max_w_mbytes: util.Unsigned = 0
dhchap: bool = False
cr_name: str = ""
cr_namespace: str = ""
Expand All @@ -48,11 +44,15 @@ def add(request: Request, cluster: Cluster, parameters: StoragePoolParams) -> Re
if pool.pool_name == parameters.name:
raise HTTPException(409, f'Pool {parameters.name} already exists')

id_or_false = pool_controller.add_pool(
parameters.name, parameters.pool_max, parameters.volume_max_size, parameters.max_rw_iops, parameters.max_rw_mbytes,
parameters.max_r_mbytes, parameters.max_w_mbytes, cluster.get_id(),
parameters.cr_name, parameters.cr_namespace, parameters.cr_plural,
id_or_false = pool_controller.add_pool(
parameters.name,
pool_max=parameters.pool_max,
lvol_max=parameters.volume_max_size,
cluster_id=cluster.get_id(),
dhchap=parameters.dhchap,
cr_name=parameters.cr_name,
cr_namespace=parameters.cr_namespace,
cr_plural=parameters.cr_plural,
)

if not id_or_false:
Expand Down Expand Up @@ -99,10 +99,6 @@ class UpdatableStoragePoolParams(BaseModel):
name: Optional[str] = None
max_size: Optional[util.Unsigned] = None
volume_max_size: Optional[util.Unsigned] = None
max_rw_iops: Optional[util.Unsigned] = None
max_rw_mbytes: Optional[util.Unsigned] = None
max_r_mbytes: Optional[util.Unsigned] = None
max_w_mbytes: Optional[util.Unsigned] = None
lvols_cr_name: Optional[str] = None
lvols_cr_namespace: Optional[str] = None
lvols_cr_plural: Optional[str] = None
Expand Down
Loading