Skip to content

Commit 29358dd

Browse files
zwopirsysradium
authored andcommitted
add vm action methods for resched and unresched (python-oca#39)
1 parent 0f26998 commit 29358dd

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

oca/tests/test_virtualmachine.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ def test_save_disk(self):
9090
def test_actions(self):
9191
oca.client = oca.Client('test:test')
9292
vm = oca.VirtualMachine(self.xml, self.client)
93-
for action in ['shutdown', 'shutdown_hard', 'poweroff', 'poweroff_hard', 'hold', 'release', 'stop', 'cancel',
94-
'suspend', 'resume', 'reboot', 'finalize', 'delete']:
93+
for action in ['shutdown', 'shutdown_hard', 'poweroff', 'poweroff_hard',
94+
'hold', 'release', 'stop', 'cancel', 'suspend', 'resume',
95+
'reboot', 'finalize', 'delete', 'resched', 'unresched']:
9596
self.client.call = Mock(return_value='')
9697
getattr(vm, action)()
9798
if action in ('shutdown_hard', 'poweroff_hard', 'undeploy_hard'):

oca/vm.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,18 @@ def delete(self):
306306
'''
307307
self._action('delete')
308308

309+
def resched(self):
310+
'''
311+
Set the rescheduling flag of the VM.
312+
'''
313+
self._action('resched')
314+
315+
def unresched(self):
316+
'''
317+
Remove the rescheduling flag of the VM.
318+
'''
319+
self._action('unresched')
320+
309321
def _action(self, action):
310322
self.client.call(self.METHODS['action'], action, self.id)
311323

0 commit comments

Comments
 (0)