Add pool PGs count modification
Allows an administrator to adjust the PG count of a given pool. This can be used to increase the PGs (for example after adding more OSDs) or decrease it (to remove OSDs, reduce CPU load, etc.).
This commit is contained in:
@ -708,7 +708,7 @@ def ceph_pool_info(config, pool):
|
||||
|
||||
def ceph_pool_list(config, limit):
|
||||
"""
|
||||
Get list information about Ceph OSDs (limited by {limit})
|
||||
Get list information about Ceph pools (limited by {limit})
|
||||
|
||||
API endpoint: GET /api/v1/storage/ceph/pool
|
||||
API arguments: limit={limit}
|
||||
@ -728,7 +728,7 @@ def ceph_pool_list(config, limit):
|
||||
|
||||
def ceph_pool_add(config, pool, pgs, replcfg, tier):
|
||||
"""
|
||||
Add new Ceph OSD
|
||||
Add new Ceph pool
|
||||
|
||||
API endpoint: POST /api/v1/storage/ceph/pool
|
||||
API arguments: pool={pool}, pgs={pgs}, replcfg={replcfg}, tier={tier}
|
||||
@ -747,7 +747,7 @@ def ceph_pool_add(config, pool, pgs, replcfg, tier):
|
||||
|
||||
def ceph_pool_remove(config, pool):
|
||||
"""
|
||||
Remove Ceph OSD
|
||||
Remove Ceph pool
|
||||
|
||||
API endpoint: DELETE /api/v1/storage/ceph/pool/{pool}
|
||||
API arguments:
|
||||
@ -766,6 +766,27 @@ def ceph_pool_remove(config, pool):
|
||||
return retstatus, response.json().get("message", "")
|
||||
|
||||
|
||||
def ceph_pool_set_pgs(config, pool, pgs):
|
||||
"""
|
||||
Set the PGs of a Ceph pool
|
||||
|
||||
API endpoint: PUT /api/v1/storage/ceph/pool/{pool}
|
||||
API arguments: {"pgs": "{pgs}"}
|
||||
API schema: {"message":"{data}"}
|
||||
"""
|
||||
params = {"pgs": pgs}
|
||||
response = call_api(
|
||||
config, "put", "/storage/ceph/pool/{pool}".format(pool=pool), params=params
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
retstatus = True
|
||||
else:
|
||||
retstatus = False
|
||||
|
||||
return retstatus, response.json().get("message", "")
|
||||
|
||||
|
||||
def format_list_pool(pool_list):
|
||||
# Handle empty list
|
||||
if not pool_list:
|
||||
|
@ -3532,6 +3532,8 @@ def ceph_pool():
|
||||
def ceph_pool_add(name, pgs, tier, replcfg):
|
||||
"""
|
||||
Add a new Ceph RBD pool with name NAME and PGS placement groups.
|
||||
|
||||
The placement group count must be a non-zero power of 2.
|
||||
"""
|
||||
|
||||
retcode, retmsg = pvc_ceph.ceph_pool_add(config, name, pgs, replcfg, tier)
|
||||
@ -3570,6 +3572,26 @@ def ceph_pool_remove(name, confirm_flag):
|
||||
cleanup(retcode, retmsg)
|
||||
|
||||
|
||||
###############################################################################
|
||||
# pvc storage pool set-pgs
|
||||
###############################################################################
|
||||
@click.command(name="set-pgs", short_help="Set PGs of an RBD pool.")
|
||||
@click.argument("name")
|
||||
@click.argument("pgs")
|
||||
@cluster_req
|
||||
def ceph_pool_set_pgs(name, pgs):
|
||||
"""
|
||||
Set the placement groups (PGs) count for the pool NAME to PGS.
|
||||
|
||||
The placement group count must be a non-zero power of 2.
|
||||
|
||||
Placement group counts may be increased or decreased as required though frequent alteration is not recommended.
|
||||
"""
|
||||
|
||||
retcode, retmsg = pvc_ceph.ceph_pool_set_pgs(config, name, pgs)
|
||||
cleanup(retcode, retmsg)
|
||||
|
||||
|
||||
###############################################################################
|
||||
# pvc storage pool list
|
||||
###############################################################################
|
||||
@ -5844,6 +5866,7 @@ ceph_osd.add_command(ceph_osd_list)
|
||||
|
||||
ceph_pool.add_command(ceph_pool_add)
|
||||
ceph_pool.add_command(ceph_pool_remove)
|
||||
ceph_pool.add_command(ceph_pool_set_pgs)
|
||||
ceph_pool.add_command(ceph_pool_list)
|
||||
|
||||
ceph_volume.add_command(ceph_volume_add)
|
||||
|
Reference in New Issue
Block a user