From 36c99c3a4d3b029398e341781cd90eb0f1d31e4c Mon Sep 17 00:00:00 2001 From: Joe Cruz Date: Fri, 1 Feb 2013 10:34:41 -0600 Subject: [PATCH] Adds reset task status mgmt instance action Partially implements: blueprint reset-task-status-mgmt-api Change-Id: I54fa7a91f67910a95f217ea04f240d917e3121ec --- reddwarfclient/management.py | 7 +++++++ reddwarfclient/mcli.py | 5 +++++ tests/test_management.py | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/reddwarfclient/management.py b/reddwarfclient/management.py index 0c824d0..346999d 100644 --- a/reddwarfclient/management.py +++ b/reddwarfclient/management.py @@ -124,3 +124,10 @@ class Management(base.ManagerWithFind): """ body = {'update': {}} self._action(instance_id, body) + + def reset_task_status(self, instance_id): + """ + Set the task status to NONE. + """ + body = {'reset-task-status': {}} + self._action(instance_id, body) diff --git a/reddwarfclient/mcli.py b/reddwarfclient/mcli.py index 37c2821..f89bfe7 100644 --- a/reddwarfclient/mcli.py +++ b/reddwarfclient/mcli.py @@ -146,6 +146,11 @@ class InstanceCommands(common.AuthedCommandsBase): self._require('id') self._pretty_print(self.dbaas.management.migrate, self.id) + def reset_task_status(self): + """Set the instance's task status to NONE.""" + self._require('id') + self._pretty_print(self.dbaas.management.reset_task_status, self.id) + class StorageCommands(common.AuthedCommandsBase): """Commands to list devices info""" diff --git a/tests/test_management.py b/tests/test_management.py index c0b5336..ddbb38c 100644 --- a/tests/test_management.py +++ b/tests/test_management.py @@ -129,3 +129,9 @@ class ManagementTest(TestCase): self.management.update(1) self.assertEqual(1, self.management._action.call_count) self.assertEqual({'update': {}}, self.body_) + + def test_reset_task_status(self): + self._mock_action() + self.management.reset_task_status(1) + self.assertEqual(1, self.management._action.call_count) + self.assertEqual({'reset-task-status': {}}, self.body_)