Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/bug-968729 into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #968729 in MAAS: "No UI to start a node"
https://bugs.launchpad.net/maas/+bug/968729
For more details, see:
https://code.launchpad.net/~jtv/maas/bug-968729/+merge/100762
This starts a node, from the UI, into its current profile, without user_data.
Adding an action like this is incredibly easy thanks to Raphaël's node actions
framework. We'll soon want more of these.
The option to start a node is offered only when a node is in Allocated or Ready
state, and only to its owner (which a Ready node will not have) and to admins.
Starting a node wipes any user_data the node may have stored in the metadata
service, so even if the node were already booting, clicking this button could
be disruptive to any ongoing commissioning or installation etc. Once a user
has acquired a node and it's in Allocated state, however, it's their own
lookout.
You'll note that I wrote only positive tests — no negative tests to verify that
the action won't be offered for other node states, or for people without proper
permissions. That's all data-driven now, essentially a matter of
configuration. There are no new moving parts to test there.
Something that's still missing is feedback to the user — bug 973272. The
button reloads the page, and the rest of the story is that hopefully the node
in question is firing up now. We really ought to tell the user something like
“The node has been given the command to start up.” (Which implies that whether
the node actually does start up is still a separate question.)
--
https://code.launchpad.net/~jtv/maas/bug-968729/+merge/100762
Your team Launchpad code reviewers is requested to review the proposed merge of
lp:~jtv/maas/bug-968729 into lp:maas.
=== modified file 'src/maasserver/forms.py'
--- src/maasserver/forms.py 2012-04-04 06:51:17 +0000
+++ src/maasserver/forms.py 2012-04-04 10:05:27 +0000
@@ -225,6 +225,14 @@
'execute': lambda node, user: Node.accept_enlistment(node),
},
],
+ NODE_STATUS.READY: [
+ {
+ 'display': "Start node",
+ 'permission': NODE_PERMISSION.EDIT,
+ 'execute': lambda node, user: Node.objects.start_nodes(
+ [node.system_id], user)
+ },
+ ],
}
=== modified file 'src/maasserver/tests/test_forms.py'
--- src/maasserver/tests/test_forms.py 2012-04-04 06:51:17 +0000
+++ src/maasserver/tests/test_forms.py 2012-04-04 10:05:27 +0000
@@ -41,6 +41,7 @@
NODE_STATUS_CHOICES_DICT,
POWER_TYPE_CHOICES,
)
+from maasserver.provisioning import get_provisioning_api_proxy
from maasserver.testing.factory import factory
from maasserver.testing.testcase import TestCase
from testtools.matchers import (
@@ -328,6 +329,16 @@
self.assertRaises(PermissionDenied, form.save)
+ def test_start_action_starts_ready_node_for_owner(self):
+ node = factory.make_node(
+ status=NODE_STATUS.READY, owner=factory.make_user())
+ form = get_action_form(node.owner)(
+ node, {NodeActionForm.input_name: "Start node"})
+ form.save()
+
+ power_status = get_provisioning_api_proxy().power_status
+ self.assertEqual('start', power_status.get(node.system_id))
+
class TestHostnameFormField(TestCase):
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help : https://help.launchpad.net/ListHelp