Skip to content

Commit 5eac0fe

Browse files
authored
Add support for ephemeral_deploy and enable_hw_sync parameters to deploy() (#302)
1 parent 18aad07 commit 5eac0fe

2 files changed

Lines changed: 50 additions & 1 deletion

File tree

maas/client/viscera/machines.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,9 @@ async def deploy(
480480
comment: str = None,
481481
wait: bool = False,
482482
install_kvm: bool = False,
483-
wait_interval: int = 5
483+
wait_interval: int = 5,
484+
ephemeral_deploy: bool = False,
485+
enable_hw_sync: bool = False
484486
):
485487
"""Deploy this machine.
486488
@@ -494,6 +496,8 @@ async def deploy(
494496
:param comment: A comment for the event log.
495497
:param wait: If specified, wait until the deploy is complete.
496498
:param wait_interval: How often to poll, defaults to 5 seconds
499+
:param ephemeral_deploy: Deploy a machine in Ephemeral mode
500+
:param enable_hw_sync: Enables periodic hardware sync
497501
"""
498502
params = {"system_id": self.system_id}
499503

@@ -513,6 +517,11 @@ async def deploy(
513517
params["hwe_kernel"] = hwe_kernel
514518
if comment is not None:
515519
params["comment"] = comment
520+
if ephemeral_deploy:
521+
params["ephemeral_deploy"] = ephemeral_deploy
522+
if enable_hw_sync:
523+
params["enable_hw_sync"] = enable_hw_sync
524+
516525
self._reset(await self._handler.deploy(**params))
517526
if not wait:
518527
return self

maas/client/viscera/tests/test_machines.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,46 @@ def test__deploy_with_kvm_install(self):
259259
system_id=machine.system_id, install_kvm=True
260260
)
261261

262+
def test__deploy_with_ephemeral_deploy(self):
263+
system_id = make_name_without_spaces("system-id")
264+
hostname = make_name_without_spaces("hostname")
265+
data = {
266+
"system_id": system_id,
267+
"hostname": hostname,
268+
"status": NodeStatus.READY,
269+
}
270+
deploying_data = {
271+
"system_id": system_id,
272+
"hostname": hostname,
273+
"status": NodeStatus.DEPLOYING,
274+
}
275+
machine = make_machines_origin().Machine(data)
276+
machine._handler.deploy.return_value = deploying_data
277+
machine.deploy(ephemeral_deploy=True, wait=False)
278+
machine._handler.deploy.assert_called_once_with(
279+
system_id=machine.system_id, ephemeral_deploy=True
280+
)
281+
282+
def test__deploy_with_enable_hw_sync(self):
283+
system_id = make_name_without_spaces("system-id")
284+
hostname = make_name_without_spaces("hostname")
285+
data = {
286+
"system_id": system_id,
287+
"hostname": hostname,
288+
"status": NodeStatus.READY,
289+
}
290+
deploying_data = {
291+
"system_id": system_id,
292+
"hostname": hostname,
293+
"status": NodeStatus.DEPLOYING,
294+
}
295+
machine = make_machines_origin().Machine(data)
296+
machine._handler.deploy.return_value = deploying_data
297+
machine.deploy(enable_hw_sync=True, wait=False)
298+
machine._handler.deploy.assert_called_once_with(
299+
system_id=machine.system_id, enable_hw_sync=True
300+
)
301+
262302
def test__deploy_with_wait_failed(self):
263303
system_id = make_name_without_spaces("system-id")
264304
hostname = make_name_without_spaces("hostname")

0 commit comments

Comments
 (0)