[pve-devel] [PATCH pve-ha-manager 7/7] add test to for previous commit

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Dec 21 16:45:26 CET 2015



On 12/21/2015 04:38 PM, Thomas Lamprecht wrote:
> This shows why we need always to 'delete' (i.e. setting it to 0)
> the service from the old node when relocating or migrating.
>
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
>   src/test/test-service-command3/README          |  1 +
>   src/test/test-service-command3/cmdlist         |  5 +++
>   src/test/test-service-command3/hardware_status |  5 +++
>   src/test/test-service-command3/log.expect      | 43 ++++++++++++++++++++++++++
>   src/test/test-service-command3/manager_status  |  1 +
>   src/test/test-service-command3/service_config  |  3 ++
>   6 files changed, 58 insertions(+)
>   create mode 100644 src/test/test-service-command3/README
>   create mode 100644 src/test/test-service-command3/cmdlist
>   create mode 100644 src/test/test-service-command3/hardware_status
>   create mode 100644 src/test/test-service-command3/log.expect
>   create mode 100644 src/test/test-service-command3/manager_status
>   create mode 100644 src/test/test-service-command3/service_config
>
> diff --git a/src/test/test-service-command3/README b/src/test/test-service-command3/README
> new file mode 100644
> index 0000000..f8bffe3
> --- /dev/null
> +++ b/src/test/test-service-command3/README
> @@ -0,0 +1 @@
> +Test user triggered service migration.
> diff --git a/src/test/test-service-command3/cmdlist b/src/test/test-service-command3/cmdlist
> new file mode 100644
> index 0000000..31da836
> --- /dev/null
> +++ b/src/test/test-service-command3/cmdlist
> @@ -0,0 +1,5 @@
> +[
> +    [ "power node1 on", "power node2 on", "power node3 on"],
> +    [ "service vm:103 migrate node1" ],
> +    [ "service vm:103 migrate node3" ]
> +]
> diff --git a/src/test/test-service-command3/hardware_status b/src/test/test-service-command3/hardware_status
> new file mode 100644
> index 0000000..451beb1
> --- /dev/null
> +++ b/src/test/test-service-command3/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-service-command3/log.expect b/src/test/test-service-command3/log.expect
> new file mode 100644
> index 0000000..2edcd5d
> --- /dev/null
> +++ b/src/test/test-service-command3/log.expect
> @@ -0,0 +1,43 @@
> +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     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    120      cmdlist: execute service vm:103 migrate node1
> +info    120    node1/crm: got crm command: migrate vm:103 node1
> +info    120    node1/crm: migrate service 'vm:103' to node 'node1' (running)
> +info    120    node1/crm: service 'vm:103': state changed from 'started' to 'migrate'  (node = node3, target = node1)
> +info    125    node3/lrm: service vm:103 - start migrate to node 'node1'
> +info    125    node3/lrm: service vm:103 - end migrate to node 'node1'
> +info    140    node1/crm: service 'vm:103': state changed from 'migrate' to 'started'  (node = node1)
> +info    141    node1/lrm: got lock 'ha_agent_node1_lock'
> +info    141    node1/lrm: status change wait_for_agent_lock => active
> +info    141    node1/lrm: starting service vm:103
> +info    141    node1/lrm: service status vm:103 started
> +info    220      cmdlist: execute service vm:103 migrate node3
> +info    220    node1/crm: got crm command: migrate vm:103 node3
> +info    220    node1/crm: migrate service 'vm:103' to node 'node3' (running)
> +info    220    node1/crm: service 'vm:103': state changed from 'started' to 'migrate'  (node = node1, target = node3)
> +info    221    node1/lrm: service vm:103 - start migrate to node 'node3'
> +info    221    node1/lrm: service vm:103 - end migrate to node 'node3'
> +info    240    node1/crm: service 'vm:103': state changed from 'migrate' to 'started'  (node = node3)

Without the previous patch the following two lines are missing:

> +info    245    node3/lrm: starting service vm:103
> +info    245    node3/lrm: service status vm:103 started

Because the service does not gets started on the new node as it has 
still the old status in the service_status_node3 file after a migration.

As this covers more the test code than the HA code and I already added a 
simple migration test in the "add service migrate/relocate to regression 
tests" patch, this test is not really needed to be committed, imo.

> +info    820     hardware: exit simulation - done
> diff --git a/src/test/test-service-command3/manager_status b/src/test/test-service-command3/manager_status
> new file mode 100644
> index 0000000..0967ef4
> --- /dev/null
> +++ b/src/test/test-service-command3/manager_status
> @@ -0,0 +1 @@
> +{}
> diff --git a/src/test/test-service-command3/service_config b/src/test/test-service-command3/service_config
> new file mode 100644
> index 0000000..c6860e7
> --- /dev/null
> +++ b/src/test/test-service-command3/service_config
> @@ -0,0 +1,3 @@
> +{
> +    "vm:103": { "node": "node3", "state": "enabled" }
> +}




More information about the pve-devel mailing list