hybrid_platforms_conductor 32.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/check-node +24 -0
- data/bin/deploy +12 -0
- data/bin/dump_nodes_json +12 -0
- data/bin/free_ips +23 -0
- data/bin/free_veids +17 -0
- data/bin/get_impacted_nodes +43 -0
- data/bin/last_deploys +56 -0
- data/bin/nodes_to_deploy +104 -0
- data/bin/report +10 -0
- data/bin/run +39 -0
- data/bin/setup +11 -0
- data/bin/ssh_config +14 -0
- data/bin/test +13 -0
- data/bin/topograph +54 -0
- data/lib/hybrid_platforms_conductor/action.rb +82 -0
- data/lib/hybrid_platforms_conductor/actions_executor.rb +307 -0
- data/lib/hybrid_platforms_conductor/bitbucket.rb +123 -0
- data/lib/hybrid_platforms_conductor/cmd_runner.rb +188 -0
- data/lib/hybrid_platforms_conductor/cmdb.rb +34 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +78 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +43 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +110 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +38 -0
- data/lib/hybrid_platforms_conductor/config.rb +263 -0
- data/lib/hybrid_platforms_conductor/confluence.rb +119 -0
- data/lib/hybrid_platforms_conductor/connector.rb +84 -0
- data/lib/hybrid_platforms_conductor/credentials.rb +127 -0
- data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +42 -0
- data/lib/hybrid_platforms_conductor/deployer.rb +598 -0
- data/lib/hybrid_platforms_conductor/executable.rb +145 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/bash.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/interactive.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/my_action.rb.sample +79 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/remote_bash.rb +63 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/ruby.rb +69 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb +61 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +78 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +104 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +114 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/my_cmdb.rb.sample +129 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +66 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/my_connector.rb.sample +156 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +702 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample +292 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +148 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/my_provisioner.rb.sample +103 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +125 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +522 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +707 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +122 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +69 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +164 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/my_report_plugin.rb.sample +88 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +61 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/templates/confluence_inventory.html.erb +33 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +137 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/can_be_checked.rb +21 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +112 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_from_scratch.rb +35 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/connection.rb +28 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_from_scratch.rb +36 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +49 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +25 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +45 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +45 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +25 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +77 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +56 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +54 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +47 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +82 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +120 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/my_test_plugin.rb.sample +143 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +74 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +85 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre-meltdown-checker.sh +1930 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +56 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +31 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +159 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +122 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/my_test_report.rb.sample +48 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +120 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_errors_status.html.erb +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_gauge.html.erb +49 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/confluence.html.erb +242 -0
- data/lib/hybrid_platforms_conductor/io_router.rb +70 -0
- data/lib/hybrid_platforms_conductor/json_dumper.rb +88 -0
- data/lib/hybrid_platforms_conductor/logger_helpers.rb +319 -0
- data/lib/hybrid_platforms_conductor/mutex_dir +76 -0
- data/lib/hybrid_platforms_conductor/nodes_handler.rb +597 -0
- data/lib/hybrid_platforms_conductor/parallel_threads.rb +97 -0
- data/lib/hybrid_platforms_conductor/platform_handler.rb +188 -0
- data/lib/hybrid_platforms_conductor/platforms_handler.rb +118 -0
- data/lib/hybrid_platforms_conductor/plugin.rb +53 -0
- data/lib/hybrid_platforms_conductor/plugins.rb +101 -0
- data/lib/hybrid_platforms_conductor/provisioner.rb +181 -0
- data/lib/hybrid_platforms_conductor/report.rb +31 -0
- data/lib/hybrid_platforms_conductor/reports_handler.rb +84 -0
- data/lib/hybrid_platforms_conductor/services_handler.rb +274 -0
- data/lib/hybrid_platforms_conductor/test.rb +141 -0
- data/lib/hybrid_platforms_conductor/test_by_service.rb +22 -0
- data/lib/hybrid_platforms_conductor/test_report.rb +282 -0
- data/lib/hybrid_platforms_conductor/tests_runner.rb +590 -0
- data/lib/hybrid_platforms_conductor/thycotic.rb +92 -0
- data/lib/hybrid_platforms_conductor/topographer.rb +859 -0
- data/lib/hybrid_platforms_conductor/topographer/plugin.rb +20 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +127 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +72 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/my_topographer_output_plugin.rb.sample +37 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/svg.rb +30 -0
- data/lib/hybrid_platforms_conductor/version.rb +5 -0
- data/spec/hybrid_platforms_conductor_test.rb +159 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +43 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +18 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +102 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +108 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +79 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +199 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +212 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +125 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +448 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +313 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +32 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +134 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +256 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +338 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +101 -0
- data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +165 -0
- data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +238 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +9 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +243 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +104 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +131 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker/Dockerfile +10 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker_spec.rb +123 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +211 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +126 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +290 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +43 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/proxmox.json +3 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +82 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +786 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +112 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +190 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +200 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +67 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +79 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +41 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +33 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +64 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +133 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +19 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +446 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +127 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +318 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +132 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +58 -0
- data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +97 -0
- data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +104 -0
- data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +243 -0
- data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +44 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +121 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +142 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +101 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +388 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +274 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +264 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +194 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +37 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +194 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +137 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +257 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +110 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +367 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +111 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +29 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +166 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb2.rb +93 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others2.rb +58 -0
- data/spec/hybrid_platforms_conductor_test/executables/check-node_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +158 -0
- data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +173 -0
- data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +283 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +67 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +251 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +111 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +71 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +54 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +139 -0
- data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +173 -0
- data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +41 -0
- data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +98 -0
- data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +92 -0
- data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +37 -0
- data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +130 -0
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +149 -0
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +812 -0
- data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +96 -0
- data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/platform_handler_helpers.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +127 -0
- data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +48 -0
- data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +789 -0
- data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +29 -0
- data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +38 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id1.rb +22 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id2.rb +22 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/test_plugin_id3.rb +26 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type2/test_plugin_id4.rb +26 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +225 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test2.rb +11 -0
- data/spec/hybrid_platforms_conductor_test/report_plugin.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/test_action.rb +66 -0
- data/spec/hybrid_platforms_conductor_test/test_connector.rb +151 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +30 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +53 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +47 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_ssh.rb +42 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/test_provisioner.rb +95 -0
- data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +49 -0
- data/spec/spec_helper.rb +111 -0
- metadata +566 -0
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
|
2
|
+
|
3
|
+
describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
4
|
+
|
5
|
+
context 'checking the reserve_proxmox_container sync tool' do
|
6
|
+
|
7
|
+
context 'checking how IPs are being assigned to containers' do
|
8
|
+
|
9
|
+
it 'makes sure to not use an IP already assigned to another container' do
|
10
|
+
with_sync_node do
|
11
|
+
mock_proxmox(mocked_pve_nodes: {
|
12
|
+
'pve_node_name' => {
|
13
|
+
lxc_containers: {
|
14
|
+
1050 => { ip: '192.168.0.100' },
|
15
|
+
1051 => { ip: '192.168.0.101' }
|
16
|
+
}
|
17
|
+
}
|
18
|
+
})
|
19
|
+
expect(call_reserve_proxmox_container(2, 1024, 1, config: {
|
20
|
+
vm_ips_list: %w[
|
21
|
+
192.168.0.100
|
22
|
+
192.168.0.101
|
23
|
+
192.168.0.102
|
24
|
+
]
|
25
|
+
})).to eq(
|
26
|
+
pve_node: 'pve_node_name',
|
27
|
+
vm_id: 1000,
|
28
|
+
vm_ip: '192.168.0.102'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'makes sure to not use an IP already assigned to another container even outside the VM ID range' do
|
34
|
+
with_sync_node do
|
35
|
+
mock_proxmox(mocked_pve_nodes: {
|
36
|
+
'pve_node_name' => {
|
37
|
+
lxc_containers: {
|
38
|
+
1 => { ip: '192.168.0.100' },
|
39
|
+
2 => { ip: '192.168.0.101' }
|
40
|
+
}
|
41
|
+
}
|
42
|
+
})
|
43
|
+
expect(call_reserve_proxmox_container(2, 1024, 1, config: {
|
44
|
+
vm_ips_list: %w[
|
45
|
+
192.168.0.100
|
46
|
+
192.168.0.101
|
47
|
+
192.168.0.102
|
48
|
+
]
|
49
|
+
})).to eq(
|
50
|
+
pve_node: 'pve_node_name',
|
51
|
+
vm_id: 1000,
|
52
|
+
vm_ip: '192.168.0.102'
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'makes sure to not use an IP already assigned to another container even on another PVE node' do
|
58
|
+
with_sync_node do
|
59
|
+
mock_proxmox(mocked_pve_nodes: {
|
60
|
+
'pve_node_name' => {},
|
61
|
+
'pve_other_node_name' => {
|
62
|
+
lxc_containers: {
|
63
|
+
1 => { ip: '192.168.0.100' },
|
64
|
+
2 => { ip: '192.168.0.101' }
|
65
|
+
}
|
66
|
+
}
|
67
|
+
})
|
68
|
+
expect(call_reserve_proxmox_container(2, 1024, 1, config: {
|
69
|
+
vm_ips_list: %w[
|
70
|
+
192.168.0.100
|
71
|
+
192.168.0.101
|
72
|
+
192.168.0.102
|
73
|
+
]
|
74
|
+
})).to eq(
|
75
|
+
pve_node: 'pve_node_name',
|
76
|
+
vm_id: 1000,
|
77
|
+
vm_ip: '192.168.0.102'
|
78
|
+
)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'does not reserve when no IP is available' do
|
83
|
+
with_sync_node do
|
84
|
+
mock_proxmox(mocked_pve_nodes: {
|
85
|
+
'pve_node_name' => {
|
86
|
+
lxc_containers: {
|
87
|
+
1 => { ip: '192.168.0.100' },
|
88
|
+
2 => { ip: '192.168.0.101' }
|
89
|
+
}
|
90
|
+
},
|
91
|
+
'pve_other_node_name' => {
|
92
|
+
lxc_containers: {
|
93
|
+
3 => { ip: '192.168.0.102' },
|
94
|
+
4 => { ip: '192.168.0.103' }
|
95
|
+
}
|
96
|
+
}
|
97
|
+
})
|
98
|
+
expect(call_reserve_proxmox_container(2, 1024, 1, config: {
|
99
|
+
vm_ips_list: %w[
|
100
|
+
192.168.0.100
|
101
|
+
192.168.0.101
|
102
|
+
192.168.0.102
|
103
|
+
]
|
104
|
+
})).to eq(error: 'no_available_ip')
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
@@ -0,0 +1,190 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
|
2
|
+
|
3
|
+
describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
4
|
+
|
5
|
+
context 'checking the reserve_proxmox_container sync tool' do
|
6
|
+
|
7
|
+
context 'checking resources limits when other LXC containers are present' do
|
8
|
+
|
9
|
+
it 'selects the PVE node when it has enough RAM despite existing containers' do
|
10
|
+
with_sync_node do
|
11
|
+
mock_proxmox(mocked_pve_nodes: {
|
12
|
+
'pve_node_name' => {
|
13
|
+
memory_total: 16 * 1024 * 1024 * 1024,
|
14
|
+
lxc_containers: {
|
15
|
+
1 => { maxmem: 4 * 1024 * 1024 * 1024 }
|
16
|
+
}
|
17
|
+
}
|
18
|
+
})
|
19
|
+
expect(call_reserve_proxmox_container(2, 4 * 1024, 1)).to eq(
|
20
|
+
pve_node: 'pve_node_name',
|
21
|
+
vm_id: 1000,
|
22
|
+
vm_ip: '192.168.0.100'
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'does not select the PVE node when it has not enough RAM because of existing containers' do
|
28
|
+
with_sync_node do
|
29
|
+
mock_proxmox(mocked_pve_nodes: {
|
30
|
+
'pve_node_name' => {
|
31
|
+
memory_total: 16 * 1024 * 1024 * 1024,
|
32
|
+
lxc_containers: {
|
33
|
+
1 => { maxmem: 14 * 1024 * 1024 * 1024 }
|
34
|
+
}
|
35
|
+
}
|
36
|
+
})
|
37
|
+
expect(call_reserve_proxmox_container(2, 4 * 1024, 1)).to eq(error: 'not_enough_resources')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'does not select the PVE node when RAM limit would be exceeded because of existing containers' do
|
42
|
+
with_sync_node do
|
43
|
+
mock_proxmox(mocked_pve_nodes: {
|
44
|
+
'pve_node_name' => {
|
45
|
+
memory_total: 16 * 1024 * 1024 * 1024,
|
46
|
+
lxc_containers: {
|
47
|
+
1 => { maxmem: 9 * 1024 * 1024 * 1024 }
|
48
|
+
}
|
49
|
+
}
|
50
|
+
})
|
51
|
+
expect(call_reserve_proxmox_container(2, 4 * 1024, 1)).to eq(error: 'not_enough_resources')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'selects the PVE node when it has enough disk despite existing containers' do
|
56
|
+
with_sync_node do
|
57
|
+
mock_proxmox(mocked_pve_nodes: {
|
58
|
+
'pve_node_name' => {
|
59
|
+
storage_total: 16 * 1024 * 1024 * 1024,
|
60
|
+
lxc_containers: {
|
61
|
+
1 => { maxdisk: 4 * 1024 * 1024 * 1024 }
|
62
|
+
}
|
63
|
+
}
|
64
|
+
})
|
65
|
+
expect(call_reserve_proxmox_container(2, 1024, 4)).to eq(
|
66
|
+
pve_node: 'pve_node_name',
|
67
|
+
vm_id: 1000,
|
68
|
+
vm_ip: '192.168.0.100'
|
69
|
+
)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'does not select the PVE node when it has not enough disk because of existing containers' do
|
74
|
+
with_sync_node do
|
75
|
+
mock_proxmox(mocked_pve_nodes: {
|
76
|
+
'pve_node_name' => {
|
77
|
+
storage_total: 16 * 1024 * 1024 * 1024,
|
78
|
+
lxc_containers: {
|
79
|
+
1 => { maxdisk: 14 * 1024 * 1024 * 1024 }
|
80
|
+
}
|
81
|
+
}
|
82
|
+
})
|
83
|
+
expect(call_reserve_proxmox_container(2, 1024, 4)).to eq(error: 'not_enough_resources')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'does not select the PVE node when disk limit would be exceeded because of existing containers' do
|
88
|
+
with_sync_node do
|
89
|
+
mock_proxmox(mocked_pve_nodes: {
|
90
|
+
'pve_node_name' => {
|
91
|
+
storage_total: 16 * 1024 * 1024 * 1024,
|
92
|
+
lxc_containers: {
|
93
|
+
1 => { maxdisk: 9 * 1024 * 1024 * 1024 }
|
94
|
+
}
|
95
|
+
}
|
96
|
+
})
|
97
|
+
expect(call_reserve_proxmox_container(2, 1024, 4)).to eq(error: 'not_enough_resources')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'selects the PVE node having the most free resources considering all LXC containers' do
|
102
|
+
with_sync_node do
|
103
|
+
# Commented is the current free space in each PVE node, as well as the % of free resource if the PVE node hosts the new container.
|
104
|
+
mock_proxmox(mocked_pve_nodes: {
|
105
|
+
# Free: 4gb => 100%
|
106
|
+
'pve_node_0_4gb' => {
|
107
|
+
memory_total: 4 * 1024 * 1024 * 1024
|
108
|
+
},
|
109
|
+
# Free: 10gb => 66%
|
110
|
+
'pve_node_8_18gb' => {
|
111
|
+
memory_total: 18 * 1024 * 1024 * 1024,
|
112
|
+
lxc_containers: {
|
113
|
+
1 => { maxmem: 2 * 1024 * 1024 * 1024 },
|
114
|
+
2 => { maxmem: 2 * 1024 * 1024 * 1024 },
|
115
|
+
3 => { maxmem: 4 * 1024 * 1024 * 1024 }
|
116
|
+
}
|
117
|
+
},
|
118
|
+
# Free: 24gb => 68.75%
|
119
|
+
'pve_node_40_64gb' => {
|
120
|
+
memory_total: 64 * 1024 * 1024 * 1024,
|
121
|
+
lxc_containers: {
|
122
|
+
4 => { maxmem: 40 * 1024 * 1024 * 1024 }
|
123
|
+
}
|
124
|
+
}
|
125
|
+
})
|
126
|
+
expect(call_reserve_proxmox_container(2, 4 * 1024, 1, config: { pve_nodes: nil })).to eq(
|
127
|
+
pve_node: 'pve_node_8_18gb',
|
128
|
+
vm_id: 1000,
|
129
|
+
vm_ip: '192.168.0.100'
|
130
|
+
)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'does not select the PVE node when the maximum number of containers has been hit' do
|
135
|
+
with_sync_node do
|
136
|
+
mock_proxmox(mocked_pve_nodes: {
|
137
|
+
'pve_node_name' => {
|
138
|
+
lxc_containers: {
|
139
|
+
# Make sure those containers are not expired
|
140
|
+
1000 => { creation_date: (Time.now - 60).utc },
|
141
|
+
1001 => { creation_date: (Time.now - 60).utc },
|
142
|
+
1002 => { creation_date: (Time.now - 60).utc },
|
143
|
+
1003 => { creation_date: (Time.now - 60).utc }
|
144
|
+
}
|
145
|
+
}
|
146
|
+
})
|
147
|
+
expect(call_reserve_proxmox_container(2, 1024, 4,
|
148
|
+
config: { limits: {
|
149
|
+
nbr_vms_max: 3,
|
150
|
+
cpu_loads_thresholds: [10, 10, 10],
|
151
|
+
ram_percent_used_max: 0.75,
|
152
|
+
disk_percent_used_max: 0.75
|
153
|
+
} }
|
154
|
+
)).to eq(error: 'exceeded_number_of_vms')
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'does not count containers outside the VM ID range in the containers limit' do
|
159
|
+
with_sync_node do
|
160
|
+
mock_proxmox(mocked_pve_nodes: {
|
161
|
+
'pve_node_name' => {
|
162
|
+
lxc_containers: {
|
163
|
+
# Make sure those containers are not expired
|
164
|
+
1000 => { creation_date: (Time.now - 60).utc },
|
165
|
+
1001 => { creation_date: (Time.now - 60).utc },
|
166
|
+
1 => {},
|
167
|
+
2 => {}
|
168
|
+
}
|
169
|
+
}
|
170
|
+
})
|
171
|
+
expect(call_reserve_proxmox_container(2, 1024, 4,
|
172
|
+
config: { limits: {
|
173
|
+
nbr_vms_max: 3,
|
174
|
+
cpu_loads_thresholds: [10, 10, 10],
|
175
|
+
ram_percent_used_max: 0.75,
|
176
|
+
disk_percent_used_max: 0.75
|
177
|
+
} }
|
178
|
+
)).to eq({
|
179
|
+
pve_node: 'pve_node_name',
|
180
|
+
vm_id: 1002,
|
181
|
+
vm_ip: '192.168.0.100'
|
182
|
+
})
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|
@@ -0,0 +1,200 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
|
2
|
+
|
3
|
+
describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
4
|
+
|
5
|
+
context 'checking the reserve_proxmox_container sync tool' do
|
6
|
+
|
7
|
+
context 'checking resources limits at the PVE node level' do
|
8
|
+
|
9
|
+
it 'reserves a resource on an empty PVE node having enough resources' do
|
10
|
+
with_sync_node do
|
11
|
+
mock_proxmox
|
12
|
+
expect(call_reserve_proxmox_container(2, 1024, 4)).to eq(
|
13
|
+
pve_node: 'pve_node_name',
|
14
|
+
vm_id: 1000,
|
15
|
+
vm_ip: '192.168.0.100'
|
16
|
+
)
|
17
|
+
expect_proxmox_actions_to_be [
|
18
|
+
[:post, 'nodes/pve_node_name/lxc', {
|
19
|
+
'cores' => 2,
|
20
|
+
'cpulimit' => 2,
|
21
|
+
'description' => /^===== HPC info =====\nnode: test_node\nenvironment: test_env\ncreation_date: .+\n/,
|
22
|
+
'hostname' => 'test.hostname.my-domain.com',
|
23
|
+
'memory' => 1024,
|
24
|
+
'net0' => 'name=eth0,bridge=vmbr0,gw=172.16.16.16,ip=192.168.0.100/32',
|
25
|
+
'ostemplate' => 'test_template.iso',
|
26
|
+
'rootfs' => 'local-lvm:4',
|
27
|
+
'vmid' => 1000
|
28
|
+
}]
|
29
|
+
]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'reserves a resource on an empty PVE node having enough resources using Proxmox user, password and realm from environment' do
|
34
|
+
with_sync_node do
|
35
|
+
ENV['hpc_user_for_proxmox'] = 'test_proxmox_user'
|
36
|
+
ENV['hpc_password_for_proxmox'] = 'test_proxmox_password'
|
37
|
+
ENV['hpc_realm_for_proxmox'] = 'test_proxmox_realm'
|
38
|
+
mock_proxmox(proxmox_user: 'test_proxmox_user', proxmox_password: 'test_proxmox_password', proxmox_realm: 'test_proxmox_realm')
|
39
|
+
expect(call_reserve_proxmox_container(2, 1024, 4)).to eq(
|
40
|
+
pve_node: 'pve_node_name',
|
41
|
+
vm_id: 1000,
|
42
|
+
vm_ip: '192.168.0.100'
|
43
|
+
)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'does not reserve a resource on an empty PVE node not having enough RAM in total' do
|
48
|
+
with_sync_node do
|
49
|
+
mock_proxmox
|
50
|
+
# Default Proxmox mock has 16 GB RAM. Try reserving 128 GB.
|
51
|
+
expect(call_reserve_proxmox_container(2, 128 * 1024, 4)).to eq(error: 'not_enough_resources')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'does not reserve a resource on an empty PVE node having enough RAM but with a limit that would be exceeded by the new container' do
|
56
|
+
with_sync_node do
|
57
|
+
mock_proxmox
|
58
|
+
# Default Proxmox mock has 16 GB RAM and limit is 75% (12 GB). Try reserving 13 GB.
|
59
|
+
expect(call_reserve_proxmox_container(2, 13 * 1024, 4)).to eq(error: 'not_enough_resources')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'does not reserve a resource on an empty PVE node not having enough disk in total' do
|
64
|
+
with_sync_node do
|
65
|
+
mock_proxmox
|
66
|
+
# Default Proxmox mock has 100 GB disk. Try reserving 128 GB.
|
67
|
+
expect(call_reserve_proxmox_container(2, 1024, 128)).to eq(error: 'not_enough_resources')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'does not reserve a resource on an empty PVE node having enough disk but with a limit that would be exceeded by the new container' do
|
72
|
+
with_sync_node do
|
73
|
+
mock_proxmox
|
74
|
+
# Default Proxmox mock has 100 GB disk and limit is 75% (75 GB). Try reserving 76 GB.
|
75
|
+
expect(call_reserve_proxmox_container(2, 1024, 76)).to eq(error: 'not_enough_resources')
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'does not reserve a resource on an empty PVE node exceeding a CPU load limit' do
|
80
|
+
with_sync_node do
|
81
|
+
# Default Proxmox mock has a limit of load 10. Try reserving while the load is greater.
|
82
|
+
mock_proxmox(mocked_pve_nodes: { 'pve_node_name' => { loadavg: [0.1, 11, 0.1] } })
|
83
|
+
expect(call_reserve_proxmox_container(2, 1024, 4)).to eq(error: 'not_enough_resources')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'chooses among several PVE nodes the one having enough resources' do
|
88
|
+
with_sync_node do
|
89
|
+
mock_proxmox(mocked_pve_nodes: {
|
90
|
+
'pve_node_1' => { loadavg: [0.1, 11, 0.1] },
|
91
|
+
'pve_node_2' => { memory_total: 1126 * 1024 * 1024 },
|
92
|
+
'pve_node_3' => {},
|
93
|
+
'pve_node_4' => { storage_total: 512 * 1024 * 1024 }
|
94
|
+
})
|
95
|
+
expect(call_reserve_proxmox_container(2, 1024, 4, config: { pve_nodes: %w[pve_node_1 pve_node_2 pve_node_3 pve_node_4] })).to eq(
|
96
|
+
pve_node: 'pve_node_3',
|
97
|
+
vm_id: 1000,
|
98
|
+
vm_ip: '192.168.0.100'
|
99
|
+
)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'chooses among several PVE nodes by discovering them instead of limiting them in the config' do
|
104
|
+
with_sync_node do
|
105
|
+
mock_proxmox(mocked_pve_nodes: {
|
106
|
+
'pve_node_1' => { loadavg: [0.1, 11, 0.1] },
|
107
|
+
'pve_node_2' => { memory_total: 1126 * 1024 * 1024 },
|
108
|
+
'pve_node_3' => {},
|
109
|
+
'pve_node_4' => { storage_total: 512 * 1024 * 1024 }
|
110
|
+
})
|
111
|
+
expect(call_reserve_proxmox_container(2, 1024, 4, config: { pve_nodes: nil })).to eq(
|
112
|
+
pve_node: 'pve_node_3',
|
113
|
+
vm_id: 1000,
|
114
|
+
vm_ip: '192.168.0.100'
|
115
|
+
)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'chooses among several PVE nodes the one having the most free resources' do
|
120
|
+
with_sync_node do
|
121
|
+
mock_proxmox(mocked_pve_nodes: {
|
122
|
+
'pve_node_1gb' => { memory_total: 1 * 1024 * 1024 * 1024 },
|
123
|
+
'pve_node_4.5gb' => { memory_total: 4608 * 1024 * 1024 },
|
124
|
+
'pve_node_5gb' => { memory_total: 5 * 1024 * 1024 * 1024 },
|
125
|
+
'pve_node_10gb' => { memory_total: 10 * 1024 * 1024 * 1024 },
|
126
|
+
'pve_node_7gb' => { memory_total: 7 * 1024 * 1024 * 1024 }
|
127
|
+
})
|
128
|
+
expect(call_reserve_proxmox_container(2, 4096, 4, config: { pve_nodes: %w[pve_node_1gb pve_node_4.5gb pve_node_5gb pve_node_10gb pve_node_7gb] })).to eq(
|
129
|
+
pve_node: 'pve_node_10gb',
|
130
|
+
vm_id: 1000,
|
131
|
+
vm_ip: '192.168.0.100'
|
132
|
+
)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'chooses among several PVE nodes the one having the most free resources and that are part of the authorized PVE nodes' do
|
137
|
+
with_sync_node do
|
138
|
+
mock_proxmox(mocked_pve_nodes: {
|
139
|
+
'pve_node_1gb' => { memory_total: 1 * 1024 * 1024 * 1024 },
|
140
|
+
'pve_node_4.5gb' => { memory_total: 4608 * 1024 * 1024 },
|
141
|
+
'pve_node_5gb' => { memory_total: 5 * 1024 * 1024 * 1024 },
|
142
|
+
'pve_node_10gb' => { memory_total: 10 * 1024 * 1024 * 1024 },
|
143
|
+
'pve_node_7gb' => { memory_total: 7 * 1024 * 1024 * 1024 }
|
144
|
+
})
|
145
|
+
expect(call_reserve_proxmox_container(2, 4096, 4, config: { pve_nodes: %w[pve_node_1gb pve_node_5gb pve_node_7gb] })).to eq(
|
146
|
+
pve_node: 'pve_node_7gb',
|
147
|
+
vm_id: 1000,
|
148
|
+
vm_ip: '192.168.0.100'
|
149
|
+
)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'does not reserve a resource if the only PVE nodes having resources are not in the list of authorized PVE nodes' do
|
154
|
+
with_sync_node do
|
155
|
+
mock_proxmox(mocked_pve_nodes: {
|
156
|
+
'pve_node_1gb' => { memory_total: 1 * 1024 * 1024 * 1024 },
|
157
|
+
'pve_node_4.5gb' => { memory_total: 4608 * 1024 * 1024 },
|
158
|
+
'pve_node_5gb' => { memory_total: 5 * 1024 * 1024 * 1024 },
|
159
|
+
'pve_node_10gb' => { memory_total: 10 * 1024 * 1024 * 1024 },
|
160
|
+
'pve_node_7gb' => { memory_total: 7 * 1024 * 1024 * 1024 }
|
161
|
+
})
|
162
|
+
expect(call_reserve_proxmox_container(2, 4096, 4, config: { pve_nodes: %w[pve_node_1gb pve_node_4.5gb] })).to eq(error: 'not_enough_resources')
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'chooses among several PVE nodes the one having the most free resources using coeffs between different criteria' do
|
167
|
+
with_sync_node do
|
168
|
+
# We ask to reserve 1GB of RAM and 1GB of disk.
|
169
|
+
# Commented are the % of those resources' usage when having such a container in each PVE node, with the resulting score considering RAM 3 times as important than disk.
|
170
|
+
mock_proxmox(mocked_pve_nodes: {
|
171
|
+
# 100% RAM 25% disk => 325
|
172
|
+
'pve_node_1gb_4gb' => { memory_total: 1 * 1024 * 1024 * 1024, storage_total: 4 * 1024 * 1024 * 1024 },
|
173
|
+
# 50% RAM 25% disk => 175
|
174
|
+
'pve_node_2gb_4gb' => { memory_total: 2 * 1024 * 1024 * 1024, storage_total: 4 * 1024 * 1024 * 1024 },
|
175
|
+
# 50% RAM 50% disk => 200
|
176
|
+
'pve_node_2gb_2gb' => { memory_total: 2 * 1024 * 1024 * 1024, storage_total: 2 * 1024 * 1024 * 1024 },
|
177
|
+
# 40% RAM 10% disk => 130
|
178
|
+
'pve_node_2.5gb_10gb' => { memory_total: 2560 * 1024 * 1024, storage_total: 10 * 1024 * 1024 * 1024 },
|
179
|
+
# 25% RAM 50% disk => 125
|
180
|
+
'pve_node_4gb_2gb' => { memory_total: 4 * 1024 * 1024 * 1024, storage_total: 2 * 1024 * 1024 * 1024 },
|
181
|
+
# 25% RAM 100% disk => 175
|
182
|
+
'pve_node_4gb_1gb' => { memory_total: 4 * 1024 * 1024 * 1024, storage_total: 1 * 1024 * 1024 * 1024 }
|
183
|
+
})
|
184
|
+
expect(call_reserve_proxmox_container(2, 1024, 1, config: {
|
185
|
+
coeff_ram_consumption: 3,
|
186
|
+
coeff_disk_consumption: 1,
|
187
|
+
pve_nodes: nil
|
188
|
+
})).to eq(
|
189
|
+
pve_node: 'pve_node_4gb_2gb',
|
190
|
+
vm_id: 1000,
|
191
|
+
vm_ip: '192.168.0.100'
|
192
|
+
)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|