Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions tests/test_pacemaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 9 additions & 2 deletions vm_manager/helpers/pacemaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]

Expand Down
Loading