diff --git a/tests/test_pacemaker.py b/tests/test_pacemaker.py index b85eb9f..4bd4071 100644 --- a/tests/test_pacemaker.py +++ b/tests/test_pacemaker.py @@ -313,9 +313,17 @@ def test_pin_location_names_the_constraint(self, p, crm): "hyp1", ] - def test_default_location_moves_the_resource(self, p, crm): + def test_default_location_names_the_constraint(self, p, crm): p.default_location("hyp1") - assert crm.command == ["crm", "resource", "move", RESOURCE, "hyp1"] + assert crm.command == [ + "crm", + "configure", + "location", + "seapath-preferred-vm1", + RESOURCE, + "inf:", + "hyp1", + ] class TestAddColocation: diff --git a/vm_manager/helpers/pacemaker.py b/vm_manager/helpers/pacemaker.py index 87e92f4..70e8589 100644 --- a/vm_manager/helpers/pacemaker.py +++ b/vm_manager/helpers/pacemaker.py @@ -346,12 +346,19 @@ def default_location(self, node): Set the VM default location. The VM will be deployed on the given node unless the node is up. + + Written as a constraint of its own rather than with + `crm resource move`, whose `cli-prefer-` constraint is + indistinguishable from a manual move and is removed by + `crm resource clear`. """ args = [ "crm", - "resource", - "move", + "configure", + "location", + f"seapath-preferred-{self._resource}", self._resource, + "inf:", node, ]