[pve-devel] [PATCH v2 ha-manager 7/7] tests: add test for shutdown policy override
Fiona Ebner
f.ebner at proxmox.com
Tue Jun 20 12:54:36 CEST 2023
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
No changes in v2.
src/test/test-shutdown-policy-override/README | 3 +
.../test-shutdown-policy-override/cmdlist | 4 ++
.../datacenter.cfg | 10 ++++
.../hardware_status | 5 ++
.../test-shutdown-policy-override/log.expect | 57 +++++++++++++++++++
.../manager_status | 1 +
.../service_config | 6 ++
7 files changed, 86 insertions(+)
create mode 100644 src/test/test-shutdown-policy-override/README
create mode 100644 src/test/test-shutdown-policy-override/cmdlist
create mode 100644 src/test/test-shutdown-policy-override/datacenter.cfg
create mode 100644 src/test/test-shutdown-policy-override/hardware_status
create mode 100644 src/test/test-shutdown-policy-override/log.expect
create mode 100644 src/test/test-shutdown-policy-override/manager_status
create mode 100644 src/test/test-shutdown-policy-override/service_config
diff --git a/src/test/test-shutdown-policy-override/README b/src/test/test-shutdown-policy-override/README
new file mode 100644
index 0000000..b9c71ce
--- /dev/null
+++ b/src/test/test-shutdown-policy-override/README
@@ -0,0 +1,3 @@
+Test shutdown policy override.
+
+Expect that the policy from the override is used.
diff --git a/src/test/test-shutdown-policy-override/cmdlist b/src/test/test-shutdown-policy-override/cmdlist
new file mode 100644
index 0000000..a86b9e2
--- /dev/null
+++ b/src/test/test-shutdown-policy-override/cmdlist
@@ -0,0 +1,4 @@
+[
+ [ "power node1 on", "power node2 on", "power node3 on"],
+ [ "shutdown node3" ]
+]
diff --git a/src/test/test-shutdown-policy-override/datacenter.cfg b/src/test/test-shutdown-policy-override/datacenter.cfg
new file mode 100644
index 0000000..0a188bd
--- /dev/null
+++ b/src/test/test-shutdown-policy-override/datacenter.cfg
@@ -0,0 +1,10 @@
+{
+ "ha": {
+ "shutdown_policy": "migrate"
+ },
+ "local-overrides": {
+ "ha": {
+ "shutdown_policy": "freeze"
+ }
+ }
+}
diff --git a/src/test/test-shutdown-policy-override/hardware_status b/src/test/test-shutdown-policy-override/hardware_status
new file mode 100644
index 0000000..451beb1
--- /dev/null
+++ b/src/test/test-shutdown-policy-override/hardware_status
@@ -0,0 +1,5 @@
+{
+ "node1": { "power": "off", "network": "off" },
+ "node2": { "power": "off", "network": "off" },
+ "node3": { "power": "off", "network": "off" }
+}
diff --git a/src/test/test-shutdown-policy-override/log.expect b/src/test/test-shutdown-policy-override/log.expect
new file mode 100644
index 0000000..4aecc4f
--- /dev/null
+++ b/src/test/test-shutdown-policy-override/log.expect
@@ -0,0 +1,57 @@
+info 0 hardware: starting simulation
+info 20 cmdlist: execute power node1 on
+info 20 node1/crm: status change startup => wait_for_quorum
+info 20 node1/lrm: status change startup => wait_for_agent_lock
+info 20 cmdlist: execute power node2 on
+info 20 node2/crm: status change startup => wait_for_quorum
+info 20 node2/lrm: status change startup => wait_for_agent_lock
+info 20 cmdlist: execute power node3 on
+info 20 node3/crm: status change startup => wait_for_quorum
+info 20 node3/lrm: status change startup => wait_for_agent_lock
+info 20 node1/crm: got lock 'ha_manager_lock'
+info 20 node1/crm: status change wait_for_quorum => master
+info 20 node1/crm: node 'node1': state changed from 'unknown' => 'online'
+info 20 node1/crm: node 'node2': state changed from 'unknown' => 'online'
+info 20 node1/crm: node 'node3': state changed from 'unknown' => 'online'
+info 20 node1/crm: adding new service 'vm:103' on node 'node3'
+info 20 node1/crm: adding new service 'vm:104' on node 'node3'
+info 20 node1/crm: adding new service 'vm:105' on node 'node3'
+info 20 node1/crm: adding new service 'vm:106' on node 'node3'
+info 20 node1/crm: service 'vm:103': state changed from 'request_start' to 'started' (node = node3)
+info 20 node1/crm: service 'vm:104': state changed from 'request_start' to 'started' (node = node3)
+info 20 node1/crm: service 'vm:105': state changed from 'request_start' to 'started' (node = node3)
+info 20 node1/crm: service 'vm:106': state changed from 'request_start' to 'started' (node = node3)
+info 22 node2/crm: status change wait_for_quorum => slave
+info 24 node3/crm: status change wait_for_quorum => slave
+info 25 node3/lrm: got lock 'ha_agent_node3_lock'
+info 25 node3/lrm: status change wait_for_agent_lock => active
+info 25 node3/lrm: starting service vm:103
+info 25 node3/lrm: service status vm:103 started
+info 25 node3/lrm: starting service vm:104
+info 25 node3/lrm: service status vm:104 started
+info 25 node3/lrm: starting service vm:105
+info 25 node3/lrm: service status vm:105 started
+info 25 node3/lrm: starting service vm:106
+info 25 node3/lrm: service status vm:106 started
+info 120 cmdlist: execute shutdown node3
+info 120 node3/lrm: got shutdown request with shutdown policy 'freeze'
+info 120 node3/lrm: shutdown LRM, stop and freeze all services
+info 120 node1/crm: service 'vm:103': state changed from 'started' to 'freeze'
+info 120 node1/crm: service 'vm:104': state changed from 'started' to 'freeze'
+info 120 node1/crm: service 'vm:105': state changed from 'started' to 'freeze'
+info 120 node1/crm: service 'vm:106': state changed from 'started' to 'freeze'
+info 125 node3/lrm: stopping service vm:103
+info 125 node3/lrm: service status vm:103 stopped
+info 125 node3/lrm: stopping service vm:104
+info 125 node3/lrm: service status vm:104 stopped
+info 125 node3/lrm: stopping service vm:105
+info 125 node3/lrm: service status vm:105 stopped
+info 125 node3/lrm: stopping service vm:106
+info 125 node3/lrm: service status vm:106 stopped
+info 126 node3/lrm: exit (loop end)
+info 126 shutdown: execute crm node3 stop
+info 125 node3/crm: server received shutdown request
+info 145 node3/crm: exit (loop end)
+info 145 shutdown: execute power node3 off
+info 160 node1/crm: node 'node3': state changed from 'online' => 'unknown'
+info 720 hardware: exit simulation - done
diff --git a/src/test/test-shutdown-policy-override/manager_status b/src/test/test-shutdown-policy-override/manager_status
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/src/test/test-shutdown-policy-override/manager_status
@@ -0,0 +1 @@
+{}
diff --git a/src/test/test-shutdown-policy-override/service_config b/src/test/test-shutdown-policy-override/service_config
new file mode 100644
index 0000000..d6f4fd9
--- /dev/null
+++ b/src/test/test-shutdown-policy-override/service_config
@@ -0,0 +1,6 @@
+{
+ "vm:103": { "node": "node3", "state": "enabled" },
+ "vm:104": { "node": "node3", "state": "enabled" },
+ "vm:105": { "node": "node3", "state": "enabled" },
+ "vm:106": { "node": "node3", "state": "enabled" }
+}
--
2.39.2
More information about the pve-devel
mailing list