sbcli-pre 1.1.6__zip → 1.1.8__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.1.6 → sbcli_pre-1.1.8}/PKG-INFO +1 -1
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/env_var +1 -1
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/sbcli_pre.egg-info/PKG-INFO +1 -1
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_cli/cli.py +10 -2
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/cluster_ops.py +0 -22
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/device_controller.py +12 -7
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/tasks_controller.py +34 -1
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/tasks_events.py +5 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/kv_store.py +5 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/job_schedule.py +2 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/tasks_runner_restart.py +21 -14
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/README.md +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/pyproject.toml +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/sbcli_pre.egg-info/SOURCES.txt +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/sbcli_pre.egg-info/dependency_links.txt +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/sbcli_pre.egg-info/entry_points.txt +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/sbcli_pre.egg-info/requires.txt +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/sbcli_pre.egg-info/top_level.txt +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/setup.cfg +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/setup.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_cli/main.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/__init__.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/cnode_client.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/compute_node_ops.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/constants.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/__init__.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/caching_node_controller.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/cluster_events.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/device_events.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/events_controller.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/health_controller.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/lvol_controller.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/lvol_events.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/mgmt_events.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/pool_controller.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/pool_events.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/snapshot_controller.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/snapshot_events.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/controllers/storage_events.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/distr_controller.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/mgmt_node_ops.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/__init__.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/base_model.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/caching_node.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/cluster.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/compute_node.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/events.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/global_settings.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/iface.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/lvol_model.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/mgmt_node.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/nvme_device.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/pool.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/port_stat.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/snapshot.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/stats.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/models/storage_node.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/pci_utils.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/rpc_client.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/__init__.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/alerting/alert_resources.yaml.j2 +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/alerting/alert_rules.yaml +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/clean_local_storage_deploy.sh +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/config_docker.sh +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/dashboards/cluster.json +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/dashboards/devices.json +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/dashboards/lvols.json +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/dashboards/node-exporter.json +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/dashboards/nodes.json +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/dashboards/pools.json +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/datasource.yml +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/db_config_double.sh +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/db_config_single.sh +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/deploy_stack.sh +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/docker-compose-swarm-monitoring.yml +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/docker-compose-swarm.yml +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/haproxy.cfg +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/install_deps.sh +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/prometheus.yml +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/run_ssh.sh +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/set_db_config.sh +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/stack_deploy_wait.sh +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/__init__.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/caching_node_monitor.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/cap_monitor.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/capacity_and_stats_collector.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/device_monitor.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/distr_event_collector.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/health_check_service.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/install_service.sh +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/log_agg_service.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/lvol_monitor.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/lvol_stat_collector.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/mgmt_node_monitor.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/port_stat_collector.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/remove_service.sh +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/service_template.service +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/storage_node_monitor.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/tasks_runner_migration.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/shell_utils.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/snode_client.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/storage_node_ops.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/utils.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/__init__.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/app.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/auth_middleware.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/__init__.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/caching_node_ops.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/caching_node_ops_k8s.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/node_api_basic.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/node_api_caching_docker.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/node_api_caching_ks.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/snode_ops.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/web_api_caching_node.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/web_api_cluster.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/web_api_device.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/web_api_lvol.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/web_api_mgmt_node.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/web_api_pool.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/web_api_snapshot.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/blueprints/web_api_storage_node.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/caching_node_app.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/caching_node_app_k8s.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/node_utils.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/node_webapp.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/snode_app.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/static/delete.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/static/deploy.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/static/deploy_cnode.yaml +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/static/deploy_spdk.yaml +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/static/is_up.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/static/list_deps.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/static/rpac.yaml +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/static/tst.py +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/templates/deploy_spdk.yaml.j2 +0 -0
- {sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_web/utils.py +0 -0
@@ -10,7 +10,8 @@ from simplyblock_core import compute_node_ops as compute_ops
|
|
10
10
|
from simplyblock_core import storage_node_ops as storage_ops
|
11
11
|
from simplyblock_core import mgmt_node_ops as mgmt_ops
|
12
12
|
from simplyblock_core import constants
|
13
|
-
from simplyblock_core.controllers import pool_controller, lvol_controller, snapshot_controller, device_controller
|
13
|
+
from simplyblock_core.controllers import pool_controller, lvol_controller, snapshot_controller, device_controller, \
|
14
|
+
tasks_controller
|
14
15
|
from simplyblock_core.controllers import caching_node_controller, health_controller
|
15
16
|
from simplyblock_core.models.pool import Pool
|
16
17
|
|
@@ -324,6 +325,10 @@ class CLIWrapper:
|
|
324
325
|
sub_command = self.add_sub_command(subparser, "list-tasks", 'List tasks by cluster ID')
|
325
326
|
sub_command.add_argument("cluster_id", help='UUID of the cluster')
|
326
327
|
|
328
|
+
# cancel task
|
329
|
+
sub_command = self.add_sub_command(subparser, "cancel-task", 'Cancel task by ID')
|
330
|
+
sub_command.add_argument("id", help='UUID of the Task')
|
331
|
+
|
327
332
|
# delete cluster
|
328
333
|
sub_command = self.add_sub_command(
|
329
334
|
subparser, 'delete', 'Delete Cluster',
|
@@ -846,7 +851,10 @@ class CLIWrapper:
|
|
846
851
|
ret = cluster_ops.update_cluster(args.id)
|
847
852
|
|
848
853
|
elif sub_command == "list-tasks":
|
849
|
-
ret =
|
854
|
+
ret = tasks_controller.list_tasks(args.cluster_id)
|
855
|
+
|
856
|
+
elif sub_command == "cancel-task":
|
857
|
+
ret = tasks_controller.cancel_task(args.id)
|
850
858
|
|
851
859
|
elif sub_command == "graceful-shutdown":
|
852
860
|
ret = cluster_ops.cluster_grace_shutdown(args.id)
|
@@ -588,28 +588,6 @@ def update_cluster(cl_id):
|
|
588
588
|
logger.info("Done")
|
589
589
|
return True
|
590
590
|
|
591
|
-
|
592
|
-
def list_tasks(cluster_id):
|
593
|
-
db_controller = DBController()
|
594
|
-
cluster = db_controller.get_cluster_by_id(cluster_id)
|
595
|
-
if not cluster:
|
596
|
-
logger.error("Cluster not found: %s", cluster_id)
|
597
|
-
return False
|
598
|
-
|
599
|
-
data = []
|
600
|
-
tasks = db_controller.get_job_tasks(cluster_id)
|
601
|
-
for task in tasks:
|
602
|
-
data.append({
|
603
|
-
"Task ID": task.uuid,
|
604
|
-
"Target ID": task.device_id or task.node_id,
|
605
|
-
"Function": task.function_name,
|
606
|
-
"Retry": f"{task.retry}/{constants.TASK_EXEC_RETRY_COUNT}",
|
607
|
-
"Status": task.status,
|
608
|
-
"Result": task.function_result,
|
609
|
-
"Date": time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(task.date)),
|
610
|
-
})
|
611
|
-
return utils.print_table(data)
|
612
|
-
|
613
591
|
|
614
592
|
def cluster_grace_startup(cl_id):
|
615
593
|
db_controller = DBController()
|
@@ -92,7 +92,7 @@ def get_alceml_name(alceml_id):
|
|
92
92
|
return f"alceml_{alceml_id}"
|
93
93
|
|
94
94
|
|
95
|
-
def _def_create_device_stack(device_obj, snode):
|
95
|
+
def _def_create_device_stack(device_obj, snode, force=False):
|
96
96
|
|
97
97
|
rpc_client = RPCClient(
|
98
98
|
snode.mgmt_ip, snode.rpc_port,
|
@@ -105,7 +105,8 @@ def _def_create_device_stack(device_obj, snode):
|
|
105
105
|
ret = rpc_client.bdev_passtest_create(test_name, device_obj.nvme_bdev)
|
106
106
|
if not ret:
|
107
107
|
logger.error(f"Failed to create bdev: {test_name}")
|
108
|
-
|
108
|
+
if not force:
|
109
|
+
return False
|
109
110
|
|
110
111
|
alceml_id = device_obj.get_id()
|
111
112
|
alceml_name = get_alceml_name(alceml_id)
|
@@ -114,14 +115,16 @@ def _def_create_device_stack(device_obj, snode):
|
|
114
115
|
dev_cpu_mask=snode.dev_cpu_mask)
|
115
116
|
if not ret:
|
116
117
|
logger.error(f"Failed to create alceml bdev: {alceml_name}")
|
117
|
-
|
118
|
+
if not force:
|
119
|
+
return False
|
118
120
|
|
119
121
|
# add pass through
|
120
122
|
pt_name = f"{alceml_name}_PT"
|
121
123
|
ret = rpc_client.bdev_PT_NoExcl_create(pt_name, alceml_name)
|
122
124
|
if not ret:
|
123
125
|
logger.error(f"Failed to create pt noexcl bdev: {pt_name}")
|
124
|
-
|
126
|
+
if not force:
|
127
|
+
return False
|
125
128
|
|
126
129
|
subsystem_nqn = snode.subsystem + ":dev:" + alceml_id
|
127
130
|
logger.info("Creating subsystem %s", subsystem_nqn)
|
@@ -150,7 +153,8 @@ def _def_create_device_stack(device_obj, snode):
|
|
150
153
|
dev_cpu_mask=snode.dev_cpu_mask)
|
151
154
|
if not ret:
|
152
155
|
logger.error(f"Failed to create jm bdev: {device_obj.jm_bdev}")
|
153
|
-
|
156
|
+
if not force:
|
157
|
+
return False
|
154
158
|
|
155
159
|
device_obj.testing_bdev = test_name
|
156
160
|
device_obj.alceml_bdev = alceml_name
|
@@ -186,11 +190,12 @@ def restart_device(device_id, force=False):
|
|
186
190
|
logger.info(f"Restarting device {device_id}")
|
187
191
|
device_set_unavailable(device_id)
|
188
192
|
|
189
|
-
ret = _def_create_device_stack(device_obj, snode)
|
193
|
+
ret = _def_create_device_stack(device_obj, snode, force=force)
|
190
194
|
|
191
195
|
if not ret:
|
192
196
|
logger.error("Failed to create device stack")
|
193
|
-
|
197
|
+
if not force:
|
198
|
+
return False
|
194
199
|
|
195
200
|
logger.info("Make other nodes connect to the device")
|
196
201
|
snodes = db_controller.get_storage_nodes()
|
@@ -3,7 +3,7 @@ import logging
|
|
3
3
|
import time
|
4
4
|
import uuid
|
5
5
|
|
6
|
-
from simplyblock_core import kv_store
|
6
|
+
from simplyblock_core import kv_store, constants, utils
|
7
7
|
from simplyblock_core.controllers import tasks_events
|
8
8
|
from simplyblock_core.models.job_schedule import JobSchedule
|
9
9
|
|
@@ -68,3 +68,36 @@ def add_device_to_auto_restart(device):
|
|
68
68
|
|
69
69
|
def add_node_to_auto_restart(node):
|
70
70
|
return _add_task(JobSchedule.FN_NODE_RESTART, node.cluster_id, node.get_id(), "")
|
71
|
+
|
72
|
+
|
73
|
+
def list_tasks(cluster_id):
|
74
|
+
cluster = db_controller.get_cluster_by_id(cluster_id)
|
75
|
+
if not cluster:
|
76
|
+
logger.error("Cluster not found: %s", cluster_id)
|
77
|
+
return False
|
78
|
+
|
79
|
+
data = []
|
80
|
+
tasks = db_controller.get_job_tasks(cluster_id)
|
81
|
+
for task in tasks:
|
82
|
+
data.append({
|
83
|
+
"Task ID": task.uuid,
|
84
|
+
"Target ID": task.device_id or task.node_id,
|
85
|
+
"Function": task.function_name,
|
86
|
+
"Retry": f"{task.retry}/{constants.TASK_EXEC_RETRY_COUNT}",
|
87
|
+
"Status": task.status,
|
88
|
+
"Result": task.function_result,
|
89
|
+
"Date": time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(task.date)),
|
90
|
+
})
|
91
|
+
return utils.print_table(data)
|
92
|
+
|
93
|
+
|
94
|
+
def cancel_task(task_id):
|
95
|
+
task = db_controller.get_task_by_id(task_id)
|
96
|
+
if not task:
|
97
|
+
logger.error("Task not found: %s", task_id)
|
98
|
+
return False
|
99
|
+
|
100
|
+
task.canceled = True
|
101
|
+
task.write_to_db(db_controller.kv_store)
|
102
|
+
tasks_events.task_canceled(task)
|
103
|
+
return True
|
@@ -30,3 +30,8 @@ def task_updated(task, caused_by=ec.CAUSED_BY_CLI):
|
|
30
30
|
|
31
31
|
def task_status_change(task, new_state, old_status, caused_by=ec.CAUSED_BY_CLI):
|
32
32
|
_task_event(task, f"task status changed from: {old_status} to: {new_state}", caused_by, ec.EVENT_STATUS_CHANGE)
|
33
|
+
|
34
|
+
|
35
|
+
def task_canceled(task, caused_by=ec.CAUSED_BY_CLI):
|
36
|
+
_task_event(task, f"Task canceled: {task.uuid}", caused_by, ec.EVENT_STATUS_CHANGE)
|
37
|
+
|
@@ -274,3 +274,8 @@ class DBController:
|
|
274
274
|
|
275
275
|
def get_job_tasks(self, cluster_id, reverse=True):
|
276
276
|
return JobSchedule().read_from_db(self.kv_store, id=cluster_id, reverse=reverse)
|
277
|
+
|
278
|
+
def get_task_by_id(self, task_id):
|
279
|
+
for task in self.get_job_tasks(""):
|
280
|
+
if task.uuid == task_id:
|
281
|
+
return task
|
@@ -19,6 +19,8 @@ class JobSchedule(BaseModel):
|
|
19
19
|
"device_id": {"type": str, 'default': ""},
|
20
20
|
"date": {"type": int, 'default': 0},
|
21
21
|
|
22
|
+
"canceled": {"type": bool, 'default': False},
|
23
|
+
|
22
24
|
"function_name": {"type": str, 'default': ""},
|
23
25
|
"function_params": {"type": dict, 'default': {}},
|
24
26
|
"function_result": {"type": str, 'default': ""},
|
@@ -79,6 +79,12 @@ def task_runner_device(task):
|
|
79
79
|
device_controller.device_set_unavailable(device.get_id())
|
80
80
|
return True
|
81
81
|
|
82
|
+
if task.canceled:
|
83
|
+
task.function_result = "canceled"
|
84
|
+
task.status = JobSchedule.STATUS_DONE
|
85
|
+
task.write_to_db(db_controller.kv_store)
|
86
|
+
return True
|
87
|
+
|
82
88
|
node = db_controller.get_storage_node_by_id(task.node_id)
|
83
89
|
if node.status != StorageNode.STATUS_ONLINE:
|
84
90
|
logger.error(f"Node is not online: {node.get_id()}, retry")
|
@@ -106,20 +112,15 @@ def task_runner_device(task):
|
|
106
112
|
task.write_to_db(db_controller.kv_store)
|
107
113
|
tasks_events.task_updated(task)
|
108
114
|
|
109
|
-
#
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
#
|
118
|
-
# task.write_to_db(db_controller.kv_store)
|
119
|
-
# return True
|
120
|
-
|
121
|
-
logger.info(f"Restarting device {device.get_id()}")
|
122
|
-
device_controller.restart_device(device.get_id(), force=True)
|
115
|
+
# set device online for the first 3 retries
|
116
|
+
if task.retry < 3:
|
117
|
+
logger.info(f"Set device online {device.get_id()}")
|
118
|
+
device_controller.device_set_online(device.get_id())
|
119
|
+
else:
|
120
|
+
logger.info(f"Restarting device {device.get_id()}")
|
121
|
+
device_controller.restart_device(device.get_id(), force=True)
|
122
|
+
|
123
|
+
# check device status
|
123
124
|
time.sleep(5)
|
124
125
|
device = _get_device(task)
|
125
126
|
if device.status == NVMeDevice.STATUS_ONLINE and device.io_error is False:
|
@@ -157,6 +158,12 @@ def task_runner_node(task):
|
|
157
158
|
task.write_to_db(db_controller.kv_store)
|
158
159
|
return True
|
159
160
|
|
161
|
+
if task.canceled:
|
162
|
+
task.function_result = "canceled"
|
163
|
+
task.status = JobSchedule.STATUS_DONE
|
164
|
+
task.write_to_db(db_controller.kv_store)
|
165
|
+
return True
|
166
|
+
|
160
167
|
if task.status != JobSchedule.STATUS_RUNNING:
|
161
168
|
task.status = JobSchedule.STATUS_RUNNING
|
162
169
|
task.write_to_db(db_controller.kv_store)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/alerting/alert_resources.yaml.j2
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/scripts/docker-compose-swarm-monitoring.yml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{sbcli_pre-1.1.6 → sbcli_pre-1.1.8}/simplyblock_core/services/capacity_and_stats_collector.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|