sbcli-pre 1.0.8__zip → 1.1.0__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.0.8 → sbcli_pre-1.1.0}/PKG-INFO +1 -1
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/env_var +1 -1
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/sbcli_pre.egg-info/PKG-INFO +1 -1
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/constants.py +1 -1
- sbcli_pre-1.1.0/simplyblock_core/controllers/tasks_controller.py +70 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/distr_event_collector.py +4 -4
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/tasks_runner_migration.py +1 -1
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/tasks_runner_restart.py +34 -14
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/utils.py +1 -1
- sbcli_pre-1.0.8/simplyblock_core/controllers/tasks_controller.py +0 -54
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/README.md +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/pyproject.toml +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/sbcli_pre.egg-info/SOURCES.txt +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/sbcli_pre.egg-info/dependency_links.txt +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/sbcli_pre.egg-info/entry_points.txt +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/sbcli_pre.egg-info/requires.txt +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/sbcli_pre.egg-info/top_level.txt +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/setup.cfg +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/setup.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_cli/cli.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_cli/main.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/__init__.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/cluster_ops.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/cnode_client.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/compute_node_ops.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/__init__.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/caching_node_controller.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/cluster_events.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/device_controller.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/device_events.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/events_controller.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/health_controller.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/lvol_controller.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/lvol_events.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/mgmt_events.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/pool_controller.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/pool_events.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/snapshot_controller.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/snapshot_events.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/storage_events.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/controllers/tasks_events.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/distr_controller.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/kv_store.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/mgmt_node_ops.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/__init__.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/base_model.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/caching_node.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/cluster.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/compute_node.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/events.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/global_settings.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/iface.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/job_schedule.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/lvol_model.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/mgmt_node.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/nvme_device.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/pool.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/port_stat.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/snapshot.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/stats.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/models/storage_node.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/pci_utils.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/rpc_client.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/__init__.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/alerting/alert_resources.yaml +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/alerting/alert_rules.yaml +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/clean_local_storage_deploy.sh +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/config_docker.sh +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/dashboards/cluster.json +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/dashboards/devices.json +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/dashboards/lvols.json +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/dashboards/node-exporter.json +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/dashboards/nodes.json +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/dashboards/pools.json +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/datasource.yml +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/db_config_double.sh +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/db_config_single.sh +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/deploy_stack.sh +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/docker-compose-swarm-monitoring.yml +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/docker-compose-swarm.yml +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/haproxy.cfg +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/install_deps.sh +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/prometheus.yml +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/run_ssh.sh +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/set_db_config.sh +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/scripts/stack_deploy_wait.sh +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/__init__.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/caching_node_monitor.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/cap_monitor.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/capacity_and_stats_collector.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/device_monitor.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/health_check_service.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/install_service.sh +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/log_agg_service.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/lvol_monitor.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/lvol_stat_collector.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/mgmt_node_monitor.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/port_stat_collector.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/remove_service.sh +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/service_template.service +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/services/storage_node_monitor.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/shell_utils.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/snode_client.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_core/storage_node_ops.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/__init__.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/app.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/auth_middleware.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/__init__.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/caching_node_ops.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/caching_node_ops_k8s.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/node_api_basic.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/node_api_caching_docker.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/node_api_caching_ks.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/snode_ops.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/web_api_caching_node.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/web_api_cluster.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/web_api_device.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/web_api_lvol.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/web_api_mgmt_node.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/web_api_pool.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/web_api_snapshot.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/blueprints/web_api_storage_node.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/caching_node_app.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/caching_node_app_k8s.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/node_utils.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/node_webapp.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/snode_app.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/static/delete.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/static/deploy.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/static/deploy_cnode.yaml +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/static/deploy_spdk.yaml +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/static/is_up.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/static/list_deps.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/static/rpac.yaml +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/static/tst.py +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/templates/deploy_spdk.yaml.j2 +0 -0
- {sbcli_pre-1.0.8 → sbcli_pre-1.1.0}/simplyblock_web/utils.py +0 -0
@@ -58,6 +58,6 @@ TASK_EXEC_INTERVAL_SEC = 30
|
|
58
58
|
TASK_EXEC_RETRY_COUNT = 8
|
59
59
|
|
60
60
|
SIMPLY_BLOCK_SPDK_CORE_IMAGE = "simplyblock/spdk-core:latest"
|
61
|
-
SIMPLY_BLOCK_SPDK_ULTRA_IMAGE = "simplyblock/spdk:
|
61
|
+
SIMPLY_BLOCK_SPDK_ULTRA_IMAGE = "simplyblock/spdk:prerelease-latest"
|
62
62
|
|
63
63
|
GELF_PORT = 12201
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# coding=utf-8
|
2
|
+
import logging
|
3
|
+
import time
|
4
|
+
import uuid
|
5
|
+
|
6
|
+
from simplyblock_core import kv_store
|
7
|
+
from simplyblock_core.controllers import tasks_events
|
8
|
+
from simplyblock_core.models.job_schedule import JobSchedule
|
9
|
+
|
10
|
+
logger = logging.getLogger()
|
11
|
+
db_controller = kv_store.DBController()
|
12
|
+
|
13
|
+
|
14
|
+
def _validate_new_task_node_restart(cluster_id, node_id):
|
15
|
+
tasks = db_controller.get_job_tasks(cluster_id)
|
16
|
+
for task in tasks:
|
17
|
+
if task.function_name == JobSchedule.FN_NODE_RESTART and task.node_id == node_id:
|
18
|
+
if task.status != JobSchedule.STATUS_DONE:
|
19
|
+
logger.info(f"Task found, skip adding new task: {task.get_id()}")
|
20
|
+
return False
|
21
|
+
return True
|
22
|
+
|
23
|
+
|
24
|
+
def _validate_new_task_dev_restart(cluster_id, node_id, device_id):
|
25
|
+
tasks = db_controller.get_job_tasks(cluster_id)
|
26
|
+
for task in tasks:
|
27
|
+
if task.function_name == JobSchedule.FN_DEV_RESTART and task.device_id == device_id:
|
28
|
+
if task.status != JobSchedule.STATUS_DONE:
|
29
|
+
logger.info(f"Task found, skip adding new task: {task.get_id()}")
|
30
|
+
return False
|
31
|
+
elif task.function_name == JobSchedule.FN_NODE_RESTART and task.node_id == node_id:
|
32
|
+
if task.status != JobSchedule.STATUS_DONE:
|
33
|
+
logger.info(f"Task found, skip adding new task: {task.get_id()}")
|
34
|
+
return False
|
35
|
+
return True
|
36
|
+
|
37
|
+
|
38
|
+
def _add_task(function_name, cluster_id, node_id, device_id):
|
39
|
+
|
40
|
+
if function_name in [JobSchedule.FN_DEV_RESTART, JobSchedule.FN_DEV_MIG]:
|
41
|
+
if not _validate_new_task_dev_restart(cluster_id, node_id, device_id):
|
42
|
+
return False
|
43
|
+
elif function_name == JobSchedule.FN_NODE_RESTART:
|
44
|
+
if not _validate_new_task_node_restart(cluster_id, node_id):
|
45
|
+
return False
|
46
|
+
|
47
|
+
task_obj = JobSchedule()
|
48
|
+
task_obj.uuid = str(uuid.uuid4())
|
49
|
+
task_obj.cluster_id = cluster_id
|
50
|
+
task_obj.node_id = node_id
|
51
|
+
task_obj.device_id = device_id
|
52
|
+
task_obj.date = int(time.time())
|
53
|
+
task_obj.function_name = function_name
|
54
|
+
task_obj.status = JobSchedule.STATUS_NEW
|
55
|
+
task_obj.write_to_db(db_controller.kv_store)
|
56
|
+
tasks_events.task_create(task_obj)
|
57
|
+
return task_obj.uuid
|
58
|
+
|
59
|
+
|
60
|
+
def add_device_mig_task(device_id):
|
61
|
+
device = db_controller.get_storage_devices(device_id)
|
62
|
+
return _add_task(JobSchedule.FN_DEV_MIG, device.cluster_id, device.node_id, device.get_id())
|
63
|
+
|
64
|
+
|
65
|
+
def add_device_to_auto_restart(device):
|
66
|
+
return _add_task(JobSchedule.FN_DEV_RESTART, device.cluster_id, device.node_id, device.get_id())
|
67
|
+
|
68
|
+
|
69
|
+
def add_node_to_auto_restart(node):
|
70
|
+
return _add_task(JobSchedule.FN_NODE_RESTART, node.cluster_id, node.get_id(), "")
|
@@ -144,8 +144,8 @@ while True:
|
|
144
144
|
)
|
145
145
|
num_of_events = constants.DISTR_EVENT_COLLECTOR_NUM_OF_EVENTS
|
146
146
|
try:
|
147
|
-
events = client.distr_status_events_get()
|
148
|
-
|
147
|
+
# events = client.distr_status_events_get()
|
148
|
+
events = client.distr_status_events_discard_then_get(0, num_of_events)
|
149
149
|
if not events:
|
150
150
|
logger.error("Distr events empty")
|
151
151
|
continue
|
@@ -161,8 +161,8 @@ while True:
|
|
161
161
|
logger.info(f"Processing event: {eid}")
|
162
162
|
process_event(eid)
|
163
163
|
|
164
|
-
|
165
|
-
|
164
|
+
logger.info(f"Discarding events: {num_of_events}")
|
165
|
+
events = client.distr_status_events_discard_then_get(num_of_events, 0)
|
166
166
|
|
167
167
|
except Exception as e:
|
168
168
|
logger.error("Failed to process distr events")
|
@@ -48,7 +48,7 @@ while True:
|
|
48
48
|
logger.error("No clusters found!")
|
49
49
|
else:
|
50
50
|
for cl in clusters:
|
51
|
-
tasks = db_controller.get_job_tasks(cl.get_id())
|
51
|
+
tasks = db_controller.get_job_tasks(cl.get_id(), reverse=False)
|
52
52
|
for task in tasks:
|
53
53
|
delay_seconds = constants.TASK_EXEC_INTERVAL_SEC
|
54
54
|
if task.function_name == JobSchedule.FN_DEV_MIG:
|
@@ -15,6 +15,19 @@ from graypy import GELFUDPHandler
|
|
15
15
|
from simplyblock_core.models.storage_node import StorageNode
|
16
16
|
|
17
17
|
|
18
|
+
# configure logging
|
19
|
+
logger_handler = logging.StreamHandler(stream=sys.stdout)
|
20
|
+
logger_handler.setFormatter(logging.Formatter('%(asctime)s: %(levelname)s: %(message)s'))
|
21
|
+
gelf_handler = GELFUDPHandler('0.0.0.0', constants.GELF_PORT)
|
22
|
+
logger = logging.getLogger()
|
23
|
+
logger.addHandler(gelf_handler)
|
24
|
+
logger.addHandler(logger_handler)
|
25
|
+
logger.setLevel(logging.DEBUG)
|
26
|
+
|
27
|
+
# get DB controller
|
28
|
+
db_controller = kv_store.DBController()
|
29
|
+
|
30
|
+
|
18
31
|
def _get_node_unavailable_devices_count(node_id):
|
19
32
|
node = db_controller.get_storage_node_by_id(node_id)
|
20
33
|
devices = []
|
@@ -31,6 +44,16 @@ def _get_device(task):
|
|
31
44
|
return dev
|
32
45
|
|
33
46
|
|
47
|
+
def _validate_no_task_node_restart(cluster_id, node_id):
|
48
|
+
tasks = db_controller.get_job_tasks(cluster_id)
|
49
|
+
for task in tasks:
|
50
|
+
if task.function_name == JobSchedule.FN_NODE_RESTART and task.node_id == node_id:
|
51
|
+
if task.status != JobSchedule.STATUS_DONE:
|
52
|
+
logger.info(f"Task found, skip adding new task: {task.get_id()}")
|
53
|
+
return False
|
54
|
+
return True
|
55
|
+
|
56
|
+
|
34
57
|
def task_runner(task):
|
35
58
|
if task.function_name == JobSchedule.FN_DEV_RESTART:
|
36
59
|
return task_runner_device(task)
|
@@ -49,6 +72,13 @@ def task_runner_device(task):
|
|
49
72
|
device_controller.device_set_retries_exhausted(device.get_id(), True)
|
50
73
|
return True
|
51
74
|
|
75
|
+
if not _validate_no_task_node_restart(task.cluster_id, task.node_id):
|
76
|
+
task.function_result = "canceled: node restart found"
|
77
|
+
task.status = JobSchedule.STATUS_DONE
|
78
|
+
task.write_to_db(db_controller.kv_store)
|
79
|
+
device_controller.device_set_unavailable(device.get_id())
|
80
|
+
return True
|
81
|
+
|
52
82
|
node = db_controller.get_storage_node_by_id(task.node_id)
|
53
83
|
if node.status != StorageNode.STATUS_ONLINE:
|
54
84
|
logger.error(f"Node is not online: {node.get_id()} , skipping task: {task.get_id()}")
|
@@ -113,7 +143,8 @@ def task_runner_node(task):
|
|
113
143
|
storage_node_ops.set_node_status(task.node_id, StorageNode.STATUS_UNREACHABLE)
|
114
144
|
return True
|
115
145
|
|
116
|
-
if _get_node_unavailable_devices_count(node.get_id()) == 0:
|
146
|
+
# if _get_node_unavailable_devices_count(node.get_id()) == 0:
|
147
|
+
if node.status == StorageNode.STATUS_ONLINE:
|
117
148
|
logger.info(f"Node is online: {node.get_id()}, no restart needed")
|
118
149
|
task.function_result = "skipped because node is online"
|
119
150
|
task.status = JobSchedule.STATUS_DONE
|
@@ -138,7 +169,8 @@ def task_runner_node(task):
|
|
138
169
|
if ret:
|
139
170
|
logger.info(f"Node restart succeeded")
|
140
171
|
|
141
|
-
if _get_node_unavailable_devices_count(node.get_id()) == 0:
|
172
|
+
# if _get_node_unavailable_devices_count(node.get_id()) == 0:
|
173
|
+
if node.status == StorageNode.STATUS_ONLINE:
|
142
174
|
logger.info(f"Node is online: {node.get_id()}, no restart needed")
|
143
175
|
task.function_result = "done"
|
144
176
|
task.status = JobSchedule.STATUS_DONE
|
@@ -150,18 +182,6 @@ def task_runner_node(task):
|
|
150
182
|
return False
|
151
183
|
|
152
184
|
|
153
|
-
# configure logging
|
154
|
-
logger_handler = logging.StreamHandler(stream=sys.stdout)
|
155
|
-
logger_handler.setFormatter(logging.Formatter('%(asctime)s: %(levelname)s: %(message)s'))
|
156
|
-
gelf_handler = GELFUDPHandler('0.0.0.0', constants.GELF_PORT)
|
157
|
-
logger = logging.getLogger()
|
158
|
-
logger.addHandler(gelf_handler)
|
159
|
-
logger.addHandler(logger_handler)
|
160
|
-
logger.setLevel(logging.DEBUG)
|
161
|
-
|
162
|
-
# get DB controller
|
163
|
-
db_controller = kv_store.DBController()
|
164
|
-
|
165
185
|
logger.info("Starting Tasks runner...")
|
166
186
|
while True:
|
167
187
|
time.sleep(3)
|
@@ -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 {ip} > /dev/null")
|
260
|
+
response = os.system(f"ping -c 1 -W 3 {ip} > /dev/null")
|
261
261
|
if response == 0:
|
262
262
|
logger.debug(f"{ip} is UP")
|
263
263
|
return True
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# coding=utf-8
|
2
|
-
import logging
|
3
|
-
import time
|
4
|
-
import uuid
|
5
|
-
|
6
|
-
from simplyblock_core import kv_store
|
7
|
-
from simplyblock_core.controllers import tasks_events
|
8
|
-
from simplyblock_core.models.job_schedule import JobSchedule
|
9
|
-
|
10
|
-
logger = logging.getLogger()
|
11
|
-
db_controller = kv_store.DBController()
|
12
|
-
|
13
|
-
|
14
|
-
def _add_task(function_name, cluster_id, node_id, device_id):
|
15
|
-
tasks = db_controller.get_job_tasks(cluster_id)
|
16
|
-
for task in tasks:
|
17
|
-
if task.function_name != function_name:
|
18
|
-
continue
|
19
|
-
|
20
|
-
if function_name in [JobSchedule.FN_DEV_RESTART, JobSchedule.FN_DEV_MIG]:
|
21
|
-
if task.device_id == device_id:
|
22
|
-
if task.status != JobSchedule.STATUS_DONE:
|
23
|
-
logger.info(f"Task found, skip adding new task: {task.get_id()}")
|
24
|
-
return
|
25
|
-
elif function_name == JobSchedule.FN_NODE_RESTART:
|
26
|
-
if task.node_id == node_id:
|
27
|
-
if task.status != JobSchedule.STATUS_DONE:
|
28
|
-
logger.info(f"Task found, skip adding new task: {task.get_id()}")
|
29
|
-
return
|
30
|
-
|
31
|
-
task_obj = JobSchedule()
|
32
|
-
task_obj.uuid = str(uuid.uuid4())
|
33
|
-
task_obj.cluster_id = cluster_id
|
34
|
-
task_obj.node_id = node_id
|
35
|
-
task_obj.device_id = device_id
|
36
|
-
task_obj.date = int(time.time())
|
37
|
-
task_obj.function_name = function_name
|
38
|
-
task_obj.status = JobSchedule.STATUS_NEW
|
39
|
-
task_obj.write_to_db(db_controller.kv_store)
|
40
|
-
tasks_events.task_create(task_obj)
|
41
|
-
return task_obj.uuid
|
42
|
-
|
43
|
-
|
44
|
-
def add_device_mig_task(device_id):
|
45
|
-
device = db_controller.get_storage_devices(device_id)
|
46
|
-
return _add_task(JobSchedule.FN_DEV_MIG, device.cluster_id, device.node_id, device.get_id())
|
47
|
-
|
48
|
-
|
49
|
-
def add_device_to_auto_restart(device):
|
50
|
-
return _add_task(JobSchedule.FN_DEV_RESTART, device.cluster_id, device.node_id, device.get_id())
|
51
|
-
|
52
|
-
|
53
|
-
def add_node_to_auto_restart(node):
|
54
|
-
return _add_task(JobSchedule.FN_NODE_RESTART, node.cluster_id, node.get_id, "")
|
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
|
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.0.8 → sbcli_pre-1.1.0}/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.0.8 → sbcli_pre-1.1.0}/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
|