sbcli-pre 1.4.3__zip → 1.4.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.
Files changed (141) hide show
  1. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/PKG-INFO +11 -1
  2. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/env_var +1 -1
  3. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/sbcli_pre.egg-info/PKG-INFO +11 -1
  4. sbcli_pre-1.4.5/sbcli_pre.egg-info/requires.txt +18 -0
  5. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/setup.py +10 -0
  6. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_cli/cli.py +3 -3
  7. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/cnode_client.py +11 -0
  8. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/constants.py +1 -3
  9. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/caching_node_controller.py +53 -29
  10. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/storage_node.py +3 -4
  11. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/deploy_stack.sh +9 -0
  12. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/docker-compose-swarm-monitoring.yml +5 -14
  13. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/caching_node_monitor.py +2 -14
  14. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/cap_monitor.py +2 -15
  15. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/capacity_and_stats_collector.py +3 -13
  16. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/device_monitor.py +2 -14
  17. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/distr_event_collector.py +3 -14
  18. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/health_check_service.py +4 -15
  19. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/lvol_monitor.py +5 -17
  20. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/lvol_stat_collector.py +3 -15
  21. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/mgmt_node_monitor.py +2 -12
  22. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/port_stat_collector.py +3 -16
  23. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/storage_node_monitor.py +3 -17
  24. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/tasks_runner_migration.py +2 -14
  25. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/tasks_runner_restart.py +2 -15
  26. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/storage_node_ops.py +91 -87
  27. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/utils.py +15 -0
  28. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/app.py +1 -2
  29. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/caching_node_ops.py +72 -1
  30. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/caching_node_ops_k8s.py +76 -1
  31. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/snode_ops.py +42 -42
  32. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/templates/deploy_spdk.yaml.j2 +8 -3
  33. sbcli_pre-1.4.3/sbcli_pre.egg-info/requires.txt +0 -8
  34. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/README.md +0 -0
  35. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/pyproject.toml +0 -0
  36. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/sbcli_pre.egg-info/SOURCES.txt +0 -0
  37. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/sbcli_pre.egg-info/dependency_links.txt +0 -0
  38. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/sbcli_pre.egg-info/entry_points.txt +0 -0
  39. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/sbcli_pre.egg-info/top_level.txt +0 -0
  40. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/setup.cfg +0 -0
  41. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_cli/main.py +0 -0
  42. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/__init__.py +0 -0
  43. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/cluster_ops.py +0 -0
  44. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/compute_node_ops.py +0 -0
  45. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/__init__.py +0 -0
  46. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/cluster_events.py +0 -0
  47. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/device_controller.py +0 -0
  48. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/device_events.py +0 -0
  49. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/events_controller.py +0 -0
  50. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/health_controller.py +0 -0
  51. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/lvol_controller.py +0 -0
  52. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/lvol_events.py +0 -0
  53. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/mgmt_events.py +0 -0
  54. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/pool_controller.py +0 -0
  55. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/pool_events.py +0 -0
  56. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/snapshot_controller.py +0 -0
  57. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/snapshot_events.py +0 -0
  58. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/storage_events.py +0 -0
  59. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/tasks_controller.py +0 -0
  60. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/controllers/tasks_events.py +0 -0
  61. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/distr_controller.py +0 -0
  62. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/kv_store.py +0 -0
  63. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/mgmt_node_ops.py +0 -0
  64. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/__init__.py +0 -0
  65. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/base_model.py +0 -0
  66. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/caching_node.py +0 -0
  67. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/cluster.py +0 -0
  68. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/compute_node.py +0 -0
  69. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/deployer.py +0 -0
  70. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/events.py +0 -0
  71. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/global_settings.py +0 -0
  72. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/iface.py +0 -0
  73. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/job_schedule.py +0 -0
  74. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/lvol_model.py +0 -0
  75. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/mgmt_node.py +0 -0
  76. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/nvme_device.py +0 -0
  77. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/pool.py +0 -0
  78. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/port_stat.py +0 -0
  79. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/snapshot.py +0 -0
  80. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/models/stats.py +0 -0
  81. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/pci_utils.py +0 -0
  82. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/rpc_client.py +0 -0
  83. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/__init__.py +0 -0
  84. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/alerting/alert_resources.yaml.j2 +0 -0
  85. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/alerting/alert_rules.yaml +0 -0
  86. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/clean_local_storage_deploy.sh +0 -0
  87. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/config_docker.sh +0 -0
  88. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/dashboard.yml +0 -0
  89. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/dashboards/cluster.json +0 -0
  90. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/dashboards/devices.json +0 -0
  91. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/dashboards/lvols.json +0 -0
  92. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/dashboards/node-exporter.json +0 -0
  93. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/dashboards/nodes.json +0 -0
  94. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/dashboards/pools.json +0 -0
  95. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/datasource.yml +0 -0
  96. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/db_config_double.sh +0 -0
  97. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/db_config_single.sh +0 -0
  98. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/docker-compose-swarm.yml +0 -0
  99. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/haproxy.cfg +0 -0
  100. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/install_deps.sh +0 -0
  101. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/objstore.yml +0 -0
  102. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/prometheus.yml +0 -0
  103. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/run_ssh.sh +0 -0
  104. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/set_db_config.sh +0 -0
  105. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/scripts/stack_deploy_wait.sh +0 -0
  106. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/__init__.py +0 -0
  107. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/install_service.sh +0 -0
  108. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/log_agg_service.py +0 -0
  109. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/remove_service.sh +0 -0
  110. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/services/service_template.service +0 -0
  111. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/shell_utils.py +0 -0
  112. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_core/snode_client.py +0 -0
  113. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/__init__.py +0 -0
  114. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/auth_middleware.py +0 -0
  115. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/__init__.py +0 -0
  116. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/node_api_basic.py +0 -0
  117. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/node_api_caching_docker.py +0 -0
  118. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/node_api_caching_ks.py +0 -0
  119. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/web_api_caching_node.py +0 -0
  120. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/web_api_cluster.py +0 -0
  121. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/web_api_deployer.py +0 -0
  122. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/web_api_device.py +0 -0
  123. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/web_api_lvol.py +0 -0
  124. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/web_api_mgmt_node.py +0 -0
  125. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/web_api_pool.py +0 -0
  126. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/web_api_snapshot.py +0 -0
  127. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/blueprints/web_api_storage_node.py +0 -0
  128. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/caching_node_app.py +0 -0
  129. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/caching_node_app_k8s.py +0 -0
  130. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/node_utils.py +0 -0
  131. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/node_webapp.py +0 -0
  132. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/snode_app.py +0 -0
  133. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/static/delete.py +0 -0
  134. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/static/deploy.py +0 -0
  135. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/static/deploy_cnode.yaml +0 -0
  136. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/static/deploy_spdk.yaml +0 -0
  137. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/static/is_up.py +0 -0
  138. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/static/list_deps.py +0 -0
  139. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/static/rpac.yaml +0 -0
  140. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/static/tst.py +0 -0
  141. {sbcli_pre-1.4.3 → sbcli_pre-1.4.5}/simplyblock_web/utils.py +0 -0
@@ -14,7 +14,7 @@ from flask import request
14
14
  from kubernetes.client import ApiException
15
15
  from jinja2 import Environment, FileSystemLoader
16
16
 
17
- from simplyblock_core import constants
17
+ from simplyblock_core import constants, shell_utils
18
18
 
19
19
  from simplyblock_web import utils, node_utils
20
20
 
@@ -111,6 +111,8 @@ def spdk_process_start():
111
111
  else:
112
112
  spdk_mem = 64096
113
113
 
114
+ spdk_mem_gega = int(spdk_mem / 1024)
115
+
114
116
  spdk_image = constants.SIMPLY_BLOCK_SPDK_CORE_IMAGE
115
117
  if node_utils.get_host_arch() == "aarch64":
116
118
  spdk_image = constants.SIMPLY_BLOCK_SPDK_CORE_IMAGE_ARM64
@@ -132,6 +134,7 @@ def spdk_process_start():
132
134
  'SPDK_IMAGE': spdk_image,
133
135
  'SPDK_CPU_MASK': spdk_cpu_mask,
134
136
  'SPDK_MEM': spdk_mem,
137
+ 'MEM_GEGA': spdk_mem_gega,
135
138
  'SERVER_IP': data['server_ip'],
136
139
  'RPC_PORT': data['rpc_port'],
137
140
  'RPC_USERNAME': data['rpc_username'],
@@ -277,3 +280,75 @@ def disconnect_all():
277
280
  logger.debug(out)
278
281
  logger.debug(err)
279
282
  return utils.get_response(ret_code)
283
+
284
+
285
+
286
+
287
+ @bp.route('/make_gpt_partitions', methods=['POST'])
288
+ def make_gpt_partitions_for_nbd():
289
+ nbd_device = '/dev/nbd0'
290
+ jm_percent = 10
291
+
292
+ try:
293
+ data = request.get_json()
294
+ nbd_device = data['nbd_device']
295
+ jm_percent = data['jm_percent']
296
+ except:
297
+ pass
298
+
299
+ cmd_list = [
300
+ f"parted -fs {nbd_device} mklabel gpt",
301
+ f"parted -f {nbd_device} mkpart journal \"0%\" \"{jm_percent}%\""
302
+ ]
303
+ sg_cmd_list = [
304
+ f"sgdisk -t 1:6527994e-2c5a-4eec-9613-8f5944074e8b {nbd_device}",
305
+ ]
306
+
307
+ for cmd in cmd_list+sg_cmd_list:
308
+ logger.debug(cmd)
309
+ out, err, ret_code = shell_utils.run_command(cmd)
310
+ logger.debug(out)
311
+ logger.debug(ret_code)
312
+ if ret_code != 0:
313
+ logger.error(err)
314
+ return utils.get_response(False, f"Error running cmd: {cmd}, returncode: {ret_code}, output: {out}, err: {err}")
315
+ time.sleep(1)
316
+
317
+ return utils.get_response(True)
318
+
319
+
320
+
321
+ @bp.route('/delete_dev_gpt_partitions', methods=['POST'])
322
+ def delete_gpt_partitions_for_dev():
323
+
324
+ data = request.get_json()
325
+
326
+ if "device_pci" not in data:
327
+ return utils.get_response(False, "Required parameter is missing: device_pci")
328
+
329
+ device_pci = data['device_pci']
330
+
331
+ cmd_list = [
332
+ f"echo -n \"{device_pci}\" > /sys/bus/pci/drivers/uio_pci_generic/unbind",
333
+ f"echo -n \"{device_pci}\" > /sys/bus/pci/drivers/nvme/bind",
334
+ ]
335
+
336
+ for cmd in cmd_list:
337
+ logger.debug(cmd)
338
+ ret = os.popen(cmd).read().strip()
339
+ logger.debug(ret)
340
+ time.sleep(1)
341
+
342
+ device_name = os.popen(f"ls /sys/devices/pci0000:00/{device_pci}/nvme/nvme*/ | grep nvme").read().strip()
343
+ cmd_list = [
344
+ f"parted -fs /dev/{device_name} mklabel gpt",
345
+ f"echo -n \"{device_pci}\" > /sys/bus/pci/drivers/nvme/unbind",
346
+ ]
347
+
348
+ for cmd in cmd_list:
349
+ logger.debug(cmd)
350
+ ret = os.popen(cmd).read().strip()
351
+ logger.debug(ret)
352
+ time.sleep(1)
353
+
354
+ return utils.get_response(True)
@@ -8,6 +8,7 @@ import time
8
8
 
9
9
  import cpuinfo
10
10
  import docker
11
+ import requests
11
12
  from docker.types import LogConfig
12
13
  from flask import Blueprint
13
14
  from flask import request
@@ -15,7 +16,6 @@ from flask import request
15
16
  from simplyblock_web import utils, node_utils
16
17
 
17
18
  from simplyblock_core import scripts, constants, shell_utils
18
- from ec2_metadata import ec2_metadata
19
19
 
20
20
  logger = logging.getLogger(__name__)
21
21
  logger.setLevel(logging.DEBUG)
@@ -23,26 +23,36 @@ bp = Blueprint("snode", __name__, url_prefix="/snode")
23
23
 
24
24
  cluster_id_file = "/etc/foundationdb/sbcli_cluster_id"
25
25
 
26
- CPU_INFO = cpuinfo.get_cpu_info()
27
- HOSTNAME, _, _ = node_utils.run_command("hostname -s")
28
- SYSTEM_ID = ""
29
- EC2_PUBLIC_IP = ""
30
- EC2_MD = ""
31
26
 
32
- try:
33
- SYSTEM_ID = ec2_metadata.instance_id
34
- except:
35
- SYSTEM_ID, _, _ = node_utils.run_command("dmidecode -s system-uuid")
27
+ def get_google_cloud_info():
28
+ try:
29
+ headers = {'Metadata-Flavor': 'Google'}
30
+ response = requests.get("http://169.254.169.254/computeMetadata/v1/instance/?recursive=true", headers=headers)
31
+ data = response.json()
32
+ return {
33
+ "id": str(data["id"]),
34
+ "type": data["machineType"].split("/")[-1],
35
+ "cloud": "google",
36
+ "ip": data["networkInterfaces"][0]["ip"],
37
+ "public_ip": data["networkInterfaces"][0]["accessConfigs"][0]["externalIp"],
38
+ }
39
+ except:
40
+ pass
36
41
 
37
- try:
38
- EC2_PUBLIC_IP = ec2_metadata.public_ipv4
39
- except:
40
- pass
41
42
 
42
- try:
43
- EC2_MD = ec2_metadata.instance_identity_document
44
- except:
45
- pass
43
+ def get_amazon_cloud_info():
44
+ try:
45
+ from ec2_metadata import ec2_metadata
46
+ data = ec2_metadata.instance_identity_document
47
+ return {
48
+ "id": data["instanceId"],
49
+ "type": data["instanceType"],
50
+ "cloud": "amazon",
51
+ "ip": data["privateIp"],
52
+ "public_ip": ec2_metadata.public_ipv4 or "",
53
+ }
54
+ except:
55
+ pass
46
56
 
47
57
 
48
58
  def get_docker_client():
@@ -203,27 +213,6 @@ def delete_cluster_id():
203
213
  return out
204
214
 
205
215
 
206
- def get_ec2_meta():
207
- stream = os.popen('curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 1"')
208
- token = stream.read()
209
- stream = os.popen(f"curl -H \"X-aws-ec2-metadata-token: {token}\" http://169.254.169.254/latest/dynamic/instance-identity/document")
210
- out = stream.read()
211
- try:
212
- data = json.loads(out)
213
- return data
214
- except:
215
- return {}
216
-
217
-
218
- def get_ec2_public_ip():
219
- stream = os.popen('curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 1"')
220
- token = stream.read()
221
- stream = os.popen(f"curl -H \"X-aws-ec2-metadata-token: {token}\" http://169.254.169.254/latest/meta-data/public-ipv4")
222
- response = stream.read()
223
- out = response if "404" not in response else None
224
- return out
225
-
226
-
227
216
  @bp.route('/info', methods=['GET'])
228
217
  def get_info():
229
218
 
@@ -248,9 +237,7 @@ def get_info():
248
237
 
249
238
  "network_interface": node_utils.get_nics_data(),
250
239
 
251
- "ec2_metadata": EC2_MD,
252
-
253
- "ec2_public_ip": EC2_PUBLIC_IP,
240
+ "cloud_instance": CLOUD_INFO,
254
241
  }
255
242
  return utils.get_response(out)
256
243
 
@@ -381,3 +368,16 @@ def delete_gpt_partitions_for_dev():
381
368
  time.sleep(1)
382
369
 
383
370
  return utils.get_response(True)
371
+
372
+
373
+ CPU_INFO = cpuinfo.get_cpu_info()
374
+ HOSTNAME, _, _ = node_utils.run_command("hostname -s")
375
+ SYSTEM_ID = ""
376
+ CLOUD_INFO = get_amazon_cloud_info()
377
+ if not CLOUD_INFO:
378
+ CLOUD_INFO = get_google_cloud_info()
379
+
380
+ if CLOUD_INFO:
381
+ SYSTEM_ID = CLOUD_INFO["id"]
382
+ else:
383
+ SYSTEM_ID, _, _ = node_utils.run_command("dmidecode -s system-uuid")
@@ -37,6 +37,11 @@ spec:
37
37
  - name: script-config
38
38
  configMap:
39
39
  name: caching-node-restart-script-cm
40
+ tolerations:
41
+ - effect: NoSchedule
42
+ key: dedicated
43
+ operator: Equal
44
+ value: simplyblock-cache
40
45
  initContainers:
41
46
  - name: copy-script
42
47
  image: busybox
@@ -81,10 +86,10 @@ spec:
81
86
  mountPath: /script
82
87
  resources:
83
88
  limits:
84
- hugepages-2Mi: 2Gi
85
- memory: 1024Mi
89
+ hugepages-2Mi: {{ MEM_GEGA }}Gi
90
+ memory: 4096Mi
86
91
  requests:
87
- memory: 1024Mi
92
+ memory: 4096Mi
88
93
 
89
94
  - name: spdk-proxy-container
90
95
  image: {{ SPDK_IMAGE }}
@@ -1,8 +0,0 @@
1
- foundationdb
2
- requests
3
- typing
4
- prettytable
5
- docker
6
- psutil
7
- py-cpuinfo
8
- graypy
File without changes
File without changes
File without changes