sbcli-pre 1.2.3__zip → 1.2.5__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/PKG-INFO +20 -5
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/README.md +19 -4
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/env_var +1 -1
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/sbcli_pre.egg-info/PKG-INFO +20 -5
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/sbcli_pre.egg-info/SOURCES.txt +5 -5
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_cli/cli.py +115 -113
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/cluster_ops.py +238 -141
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/constants.py +7 -5
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/caching_node_controller.py +6 -8
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/cluster_events.py +0 -9
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/device_controller.py +63 -56
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/events_controller.py +3 -5
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/health_controller.py +40 -30
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/lvol_controller.py +36 -42
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/pool_controller.py +4 -8
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/snapshot_controller.py +3 -9
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/distr_controller.py +9 -13
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/kv_store.py +29 -47
- sbcli_pre-1.2.5/simplyblock_core/mgmt_node_ops.py +80 -0
- sbcli_pre-1.2.5/simplyblock_core/models/deployer.py +62 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/events.py +1 -9
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/job_schedule.py +0 -6
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/nvme_device.py +4 -42
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/storage_node.py +1 -9
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/rpc_client.py +10 -55
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/__init__.py +4 -0
- sbcli_pre-1.2.3/simplyblock_core/scripts/alerting/alert_resources.yaml.j2 → sbcli_pre-1.2.5/simplyblock_core/scripts/alerting/alert_resources.yaml +5 -54
- sbcli_pre-1.2.5/simplyblock_core/scripts/apply_dashboard.sh +22 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/dashboards/cluster.json +1 -1
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/deploy_stack.sh +0 -2
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/docker-compose-swarm-monitoring.yml +13 -22
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/docker-compose-swarm.yml +2 -17
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/haproxy.cfg +0 -15
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/install_deps.sh +0 -1
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/capacity_and_stats_collector.py +1 -1
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/device_monitor.py +44 -3
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/distr_event_collector.py +11 -10
- sbcli_pre-1.2.5/simplyblock_core/services/health_check_service.py +136 -0
- sbcli_pre-1.2.3/simplyblock_core/services/tasks_runner_restart.py → sbcli_pre-1.2.5/simplyblock_core/services/job_tasks.py +46 -93
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/lvol_monitor.py +1 -1
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/lvol_stat_collector.py +1 -1
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/port_stat_collector.py +1 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/storage_node_monitor.py +44 -49
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/snode_client.py +0 -12
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/storage_node_ops.py +336 -525
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/utils.py +1 -46
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/app.py +2 -1
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/snode_ops.py +25 -103
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/web_api_cluster.py +43 -20
- sbcli_pre-1.2.5/simplyblock_web/blueprints/web_api_deployer.py +394 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/web_api_device.py +7 -10
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/web_api_lvol.py +5 -9
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/web_api_pool.py +5 -14
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/web_api_storage_node.py +10 -3
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/node_utils.py +2 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/utils.py +0 -8
- sbcli_pre-1.2.3/simplyblock_core/controllers/tasks_controller.py +0 -103
- sbcli_pre-1.2.3/simplyblock_core/controllers/tasks_events.py +0 -37
- sbcli_pre-1.2.3/simplyblock_core/mgmt_node_ops.py +0 -205
- sbcli_pre-1.2.3/simplyblock_core/services/health_check_service.py +0 -134
- sbcli_pre-1.2.3/simplyblock_core/services/tasks_runner_migration.py +0 -61
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/pyproject.toml +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/sbcli_pre.egg-info/dependency_links.txt +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/sbcli_pre.egg-info/entry_points.txt +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/sbcli_pre.egg-info/requires.txt +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/sbcli_pre.egg-info/top_level.txt +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/setup.cfg +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/setup.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_cli/main.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/__init__.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/cnode_client.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/compute_node_ops.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/__init__.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/device_events.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/lvol_events.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/mgmt_events.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/pool_events.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/snapshot_events.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/controllers/storage_events.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/__init__.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/base_model.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/caching_node.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/cluster.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/compute_node.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/global_settings.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/iface.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/lvol_model.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/mgmt_node.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/pool.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/port_stat.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/snapshot.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/models/stats.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/pci_utils.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/alerting/alert_rules.yaml +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/clean_local_storage_deploy.sh +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/config_docker.sh +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/dashboards/devices.json +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/dashboards/lvols.json +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/dashboards/node-exporter.json +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/dashboards/nodes.json +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/dashboards/pools.json +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/datasource.yml +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/db_config_double.sh +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/db_config_single.sh +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/prometheus.yml +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/run_ssh.sh +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/set_db_config.sh +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/scripts/stack_deploy_wait.sh +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/__init__.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/caching_node_monitor.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/cap_monitor.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/install_service.sh +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/log_agg_service.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/mgmt_node_monitor.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/remove_service.sh +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/services/service_template.service +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_core/shell_utils.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/__init__.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/auth_middleware.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/__init__.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/caching_node_ops.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/caching_node_ops_k8s.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/node_api_basic.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/node_api_caching_docker.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/node_api_caching_ks.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/web_api_caching_node.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/web_api_mgmt_node.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/blueprints/web_api_snapshot.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/caching_node_app.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/caching_node_app_k8s.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/node_webapp.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/snode_app.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/static/delete.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/static/deploy.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/static/deploy_cnode.yaml +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/static/deploy_spdk.yaml +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/static/is_up.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/static/list_deps.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/static/rpac.yaml +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/static/tst.py +0 -0
- {sbcli_pre-1.2.3 → sbcli_pre-1.2.5}/simplyblock_web/templates/deploy_spdk.yaml.j2 +0 -0
@@ -257,7 +257,7 @@ def process_records(records, records_count):
|
|
257
257
|
|
258
258
|
def ping_host(ip):
|
259
259
|
logger.debug(f"Pinging ip ... {ip}")
|
260
|
-
response = os.system(f"ping -c 1
|
260
|
+
response = os.system(f"ping -c 1 {ip} > /dev/null")
|
261
261
|
if response == 0:
|
262
262
|
logger.debug(f"{ip} is UP")
|
263
263
|
return True
|
@@ -280,48 +280,3 @@ def sum_records(records):
|
|
280
280
|
|
281
281
|
def get_random_vuid():
|
282
282
|
return 1 + int(random.random() * 10000)
|
283
|
-
|
284
|
-
|
285
|
-
def calculate_core_allocation(cpu_count):
|
286
|
-
'''
|
287
|
-
If number of cpu cores >= 8, tune cpu core mask
|
288
|
-
1. Never use core 0 for spdk.
|
289
|
-
2. For every 8 cores, leave one core to the operating system
|
290
|
-
3. Do not use more than 15% of remaining available cores for nvme pollers
|
291
|
-
4. Use one dedicated core for app_thread
|
292
|
-
5. distribute distrib bdevs and alceml bdevs to all other cores
|
293
|
-
JIRA ticket link/s
|
294
|
-
https://simplyblock.atlassian.net/browse/SFAM-885
|
295
|
-
'''
|
296
|
-
|
297
|
-
all_cores = list(range(0, cpu_count))
|
298
|
-
# Calculate the number of cores to exclude for the OS
|
299
|
-
if cpu_count == 8:
|
300
|
-
os_cores_count = 1
|
301
|
-
else:
|
302
|
-
os_cores_count = 1 + (cpu_count // 8)
|
303
|
-
|
304
|
-
# Calculate os cores
|
305
|
-
os_cores = all_cores[0:os_cores_count]
|
306
|
-
|
307
|
-
# Calculate available cores
|
308
|
-
available_cores_count = cpu_count - os_cores_count
|
309
|
-
|
310
|
-
# Calculate NVMe pollers
|
311
|
-
nvme_pollers_count = int(available_cores_count * 0.15)
|
312
|
-
nvme_pollers_cores = all_cores[os_cores_count:os_cores_count + nvme_pollers_count]
|
313
|
-
|
314
|
-
# Allocate core for app_thread
|
315
|
-
app_thread_core = all_cores[os_cores_count + nvme_pollers_count:os_cores_count + nvme_pollers_count + 1]
|
316
|
-
|
317
|
-
# Calculate bdb_lcpu cores
|
318
|
-
bdb_lcpu_cores = all_cores[os_cores_count + nvme_pollers_count + 1:]
|
319
|
-
|
320
|
-
return os_cores, nvme_pollers_cores, app_thread_core, bdb_lcpu_cores
|
321
|
-
|
322
|
-
|
323
|
-
def generate_mask(cores):
|
324
|
-
mask = 0
|
325
|
-
for core in cores:
|
326
|
-
mask |= (1 << core)
|
327
|
-
return f'0x{mask:X}'
|
@@ -7,7 +7,7 @@ from flask import Flask
|
|
7
7
|
|
8
8
|
import utils
|
9
9
|
from blueprints import web_api_cluster, web_api_mgmt_node, web_api_device, \
|
10
|
-
web_api_lvol, web_api_storage_node, web_api_pool, web_api_caching_node, web_api_snapshot
|
10
|
+
web_api_lvol, web_api_storage_node, web_api_pool, web_api_caching_node, web_api_snapshot, web_api_deployer
|
11
11
|
from auth_middleware import token_required
|
12
12
|
from simplyblock_core import constants
|
13
13
|
|
@@ -31,6 +31,7 @@ app.register_blueprint(web_api_snapshot.bp)
|
|
31
31
|
app.register_blueprint(web_api_storage_node.bp)
|
32
32
|
app.register_blueprint(web_api_pool.bp)
|
33
33
|
app.register_blueprint(web_api_caching_node.bp)
|
34
|
+
app.register_blueprint(web_api_deployer.bp)
|
34
35
|
|
35
36
|
|
36
37
|
@app.before_request
|
@@ -14,8 +14,7 @@ from flask import request
|
|
14
14
|
|
15
15
|
from simplyblock_web import utils, node_utils
|
16
16
|
|
17
|
-
from simplyblock_core import scripts, constants
|
18
|
-
from ec2_metadata import ec2_metadata
|
17
|
+
from simplyblock_core import scripts, constants
|
19
18
|
|
20
19
|
logger = logging.getLogger(__name__)
|
21
20
|
logger.setLevel(logging.DEBUG)
|
@@ -23,24 +22,11 @@ bp = Blueprint("snode", __name__, url_prefix="/snode")
|
|
23
22
|
|
24
23
|
cluster_id_file = "/etc/foundationdb/sbcli_cluster_id"
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
EC2_PUBLIC_IP = ""
|
30
|
-
EC2_MD = ""
|
31
|
-
|
25
|
+
cpu_info = cpuinfo.get_cpu_info()
|
26
|
+
hostname, _, _ = node_utils.run_command("hostname -s")
|
27
|
+
system_id = ""
|
32
28
|
try:
|
33
|
-
|
34
|
-
except:
|
35
|
-
SYSTEM_ID, _, _ = node_utils.run_command("dmidecode -s system-uuid")
|
36
|
-
|
37
|
-
try:
|
38
|
-
EC2_PUBLIC_IP = ec2_metadata.public_ipv4
|
39
|
-
except:
|
40
|
-
pass
|
41
|
-
|
42
|
-
try:
|
43
|
-
EC2_MD = ec2_metadata.instance_identity_document
|
29
|
+
system_id, _, _ = node_utils.run_command("dmidecode -s system-uuid")
|
44
30
|
except:
|
45
31
|
pass
|
46
32
|
|
@@ -81,10 +67,23 @@ def spdk_process_start():
|
|
81
67
|
spdk_cpu_mask = None
|
82
68
|
if 'spdk_cpu_mask' in data:
|
83
69
|
spdk_cpu_mask = data['spdk_cpu_mask']
|
84
|
-
|
85
70
|
spdk_mem = None
|
86
71
|
if 'spdk_mem' in data:
|
87
72
|
spdk_mem = data['spdk_mem']
|
73
|
+
node_cpu_count = os.cpu_count()
|
74
|
+
|
75
|
+
if spdk_cpu_mask:
|
76
|
+
try:
|
77
|
+
requested_cpu_count = len(format(int(spdk_cpu_mask, 16), 'b'))
|
78
|
+
if requested_cpu_count > node_cpu_count:
|
79
|
+
return utils.get_response(
|
80
|
+
False,
|
81
|
+
f"The requested cpu count: {requested_cpu_count} "
|
82
|
+
f"is larger than the node's cpu count: {node_cpu_count}")
|
83
|
+
except:
|
84
|
+
spdk_cpu_mask = hex(int(math.pow(2, node_cpu_count)) - 1)
|
85
|
+
else:
|
86
|
+
spdk_cpu_mask = hex(int(math.pow(2, node_cpu_count)) - 1)
|
88
87
|
|
89
88
|
if spdk_mem:
|
90
89
|
spdk_mem = int(utils.parse_size(spdk_mem) / (1000 * 1000))
|
@@ -230,11 +229,11 @@ def get_info():
|
|
230
229
|
out = {
|
231
230
|
"cluster_id": get_cluster_id(),
|
232
231
|
|
233
|
-
"hostname":
|
234
|
-
"system_id":
|
232
|
+
"hostname": hostname,
|
233
|
+
"system_id": system_id,
|
235
234
|
|
236
|
-
"cpu_count":
|
237
|
-
"cpu_hz":
|
235
|
+
"cpu_count": cpu_info['count'],
|
236
|
+
"cpu_hz": cpu_info['hz_advertised'][0],
|
238
237
|
|
239
238
|
"memory": node_utils.get_memory(),
|
240
239
|
"hugepages": node_utils.get_huge_memory(),
|
@@ -248,9 +247,9 @@ def get_info():
|
|
248
247
|
|
249
248
|
"network_interface": node_utils.get_nics_data(),
|
250
249
|
|
251
|
-
"ec2_metadata":
|
250
|
+
"ec2_metadata": get_ec2_meta(),
|
252
251
|
|
253
|
-
"ec2_public_ip":
|
252
|
+
"ec2_public_ip": get_ec2_public_ip(),
|
254
253
|
}
|
255
254
|
return utils.get_response(out)
|
256
255
|
|
@@ -304,80 +303,3 @@ def leave_swarm():
|
|
304
303
|
except:
|
305
304
|
pass
|
306
305
|
return utils.get_response(True)
|
307
|
-
|
308
|
-
|
309
|
-
@bp.route('/make_gpt_partitions', methods=['POST'])
|
310
|
-
def make_gpt_partitions_for_nbd():
|
311
|
-
nbd_device = '/dev/nbd0'
|
312
|
-
jm_percent = '3'
|
313
|
-
num_partitions = 1
|
314
|
-
|
315
|
-
try:
|
316
|
-
data = request.get_json()
|
317
|
-
nbd_device = data['nbd_device']
|
318
|
-
jm_percent = data['jm_percent']
|
319
|
-
num_partitions = data['num_partitions']
|
320
|
-
except:
|
321
|
-
pass
|
322
|
-
|
323
|
-
cmd_list = [
|
324
|
-
f"parted -fs {nbd_device} mklabel gpt",
|
325
|
-
f"parted -f {nbd_device} mkpart journal \"0%\" \"{jm_percent}%\""
|
326
|
-
]
|
327
|
-
sg_cmd_list = [
|
328
|
-
f"sgdisk -t 1:6527994e-2c5a-4eec-9613-8f5944074e8b {nbd_device}",
|
329
|
-
]
|
330
|
-
perc_per_partition = int((100 - jm_percent) / num_partitions)
|
331
|
-
for i in range(num_partitions):
|
332
|
-
st = jm_percent + (i * perc_per_partition)
|
333
|
-
en = st + perc_per_partition
|
334
|
-
cmd_list.append(f"parted -f {nbd_device} mkpart part{(i+1)} \"{st}%\" \"{en}%\"")
|
335
|
-
sg_cmd_list.append(f"sgdisk -t {(i+2)}:6527994e-2c5a-4eec-9613-8f5944074e8b {nbd_device}")
|
336
|
-
|
337
|
-
for cmd in cmd_list+sg_cmd_list:
|
338
|
-
logger.debug(cmd)
|
339
|
-
out, err, ret_code = shell_utils.run_command(cmd)
|
340
|
-
logger.debug(out)
|
341
|
-
logger.debug(ret_code)
|
342
|
-
if ret_code != 0:
|
343
|
-
logger.error(err)
|
344
|
-
return utils.get_response(False, f"Error running cmd: {cmd}, returncode: {ret_code}, output: {out}, err: {err}")
|
345
|
-
time.sleep(1)
|
346
|
-
|
347
|
-
return utils.get_response(True)
|
348
|
-
|
349
|
-
|
350
|
-
@bp.route('/delete_dev_gpt_partitions', methods=['POST'])
|
351
|
-
def delete_gpt_partitions_for_dev():
|
352
|
-
|
353
|
-
data = request.get_json()
|
354
|
-
|
355
|
-
if "device_pci" not in data:
|
356
|
-
return utils.get_response(False, "Required parameter is missing: device_pci")
|
357
|
-
|
358
|
-
device_pci = data['device_pci']
|
359
|
-
|
360
|
-
cmd_list = [
|
361
|
-
f"echo -n \"{device_pci}\" > /sys/bus/pci/drivers/uio_pci_generic/unbind",
|
362
|
-
f"echo -n \"{device_pci}\" > /sys/bus/pci/drivers/nvme/bind",
|
363
|
-
]
|
364
|
-
|
365
|
-
for cmd in cmd_list:
|
366
|
-
logger.debug(cmd)
|
367
|
-
ret = os.popen(cmd).read().strip()
|
368
|
-
logger.debug(ret)
|
369
|
-
time.sleep(1)
|
370
|
-
|
371
|
-
device_name = os.popen(f"ls /sys/devices/pci0000:00/{device_pci}/nvme/nvme*/ | grep nvme").read().strip()
|
372
|
-
cmd_list = [
|
373
|
-
f"parted -fs /dev/{device_name} mklabel gpt",
|
374
|
-
f"echo -n \"{device_pci}\" > /sys/bus/pci/drivers/nvme/unbind",
|
375
|
-
]
|
376
|
-
|
377
|
-
for cmd in cmd_list:
|
378
|
-
logger.debug(cmd)
|
379
|
-
ret = os.popen(cmd).read().strip()
|
380
|
-
logger.debug(ret)
|
381
|
-
time.sleep(1)
|
382
|
-
|
383
|
-
return utils.get_response(True)
|
@@ -22,27 +22,50 @@ db_controller = kv_store.DBController()
|
|
22
22
|
|
23
23
|
@bp.route('/cluster', methods=['POST'])
|
24
24
|
def add_cluster():
|
25
|
-
|
26
|
-
blk_size = 512
|
27
|
-
page_size_in_blocks = 2097152
|
28
|
-
cap_warn = 0
|
29
|
-
cap_crit = 0
|
30
|
-
prov_cap_warn = 0
|
31
|
-
prov_cap_crit = 0
|
32
|
-
|
33
25
|
cl_data = request.get_json()
|
34
|
-
if 'blk_size' in cl_data:
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
if '
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
26
|
+
if 'blk_size' not in cl_data:
|
27
|
+
return utils.get_response_error("missing required param: blk_size", 400)
|
28
|
+
if 'page_size_in_blocks' not in cl_data:
|
29
|
+
return utils.get_response_error("missing required param: page_size_in_blocks", 400)
|
30
|
+
if 'model_ids' not in cl_data:
|
31
|
+
return utils.get_response_error("missing required param: model_ids", 400)
|
32
|
+
if 'ha_type' not in cl_data:
|
33
|
+
return utils.get_response_error("missing required param: ha_type", 400)
|
34
|
+
if 'tls' not in cl_data:
|
35
|
+
return utils.get_response_error("missing required param: tls", 400)
|
36
|
+
if 'auth-hosts-only' not in cl_data:
|
37
|
+
return utils.get_response_error("missing required param: auth-hosts-only", 400)
|
38
|
+
if 'dhchap' not in cl_data:
|
39
|
+
return utils.get_response_error("missing required param: dhchap", 400)
|
40
|
+
if 'NQN' not in cl_data:
|
41
|
+
return utils.get_response_error("missing required param: NQN", 400)
|
42
|
+
|
43
|
+
c = Cluster()
|
44
|
+
c.uuid = str(uuid.uuid4())
|
45
|
+
|
46
|
+
if cl_data['blk_size'] not in [512, 4096]:
|
47
|
+
return utils.get_response_error("blk_size can be 512 or 4096", 400)
|
48
|
+
|
49
|
+
if cl_data['ha_type'] not in ["single", "ha"]:
|
50
|
+
return utils.get_response_error("ha_type can be single or ha", 400)
|
51
|
+
|
52
|
+
if cl_data['dhchap'] not in ["off", "one-way", "bi-direct"]:
|
53
|
+
return utils.get_response_error("dhchap can be off, one-way or bi-direct", 400)
|
54
|
+
|
55
|
+
c.blk_size = cl_data['blk_size']
|
56
|
+
c.page_size_in_blocks = cl_data['page_size_in_blocks']
|
57
|
+
c.model_ids = cl_data['model_ids']
|
58
|
+
c.ha_type = cl_data['ha_type']
|
59
|
+
c.tls = cl_data['tls']
|
60
|
+
c.auth_hosts_only = cl_data['auth-hosts-only']
|
61
|
+
c.nqn = cl_data['nqn']
|
62
|
+
c.iscsi = cl_data['iscsi'] or False
|
63
|
+
c.dhchap = cl_data['dhchap']
|
64
|
+
c.cluster_status = Cluster.STATUS_ACTIVE
|
65
|
+
c.updated_at = int(time.time())
|
66
|
+
c.write_to_db(db_controller.kv_store)
|
67
|
+
|
68
|
+
return utils.get_response(c.to_dict()), 201
|
46
69
|
|
47
70
|
|
48
71
|
@bp.route('/cluster', methods=['GET'], defaults={'uuid': None})
|