Merge lp:~andreserl/maas/ipmi_usercreation_ilo_versions into lp:maas/1.2

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: no longer in the source branch.
Merged at revision: 1363
Proposed branch: lp:~andreserl/maas/ipmi_usercreation_ilo_versions
Merge into: lp:maas/1.2
Diff against target: 101 lines (+33/-24)
2 files modified
contrib/preseeds_v2/enlist_userdata (+17/-14)
etc/maas/commissioning-user-data (+16/-10)
To merge this branch: bzr merge lp:~andreserl/maas/ipmi_usercreation_ilo_versions
Reviewer Review Type Date Requested Status
Scott Moser (community) Approve
Review via email: mp+147460@code.launchpad.net

Commit message

This branch creates a new approach of generating maas related IPMI user. The IPMI user creation is done by slots. However, in the newest iLO versions, even though you try to create a user in SlotX, it will be created in the first available slot. This branch handles that. (This is backwards compatible with older versions)

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

The amount of untested code going into the preseeds is frankly frightening. We have to come up with a testing scenario for this code ASAP.

Revision history for this message
Andres Rodriguez (andreserl) wrote :

While I agree that the preseeds are untested, I don't agree that in this particular scenario tested code would have helped as your comment seems to imply. The reason of this bug/branch is far from being unstested or, is possibility of discovery is far from being that case.

This is present due to the implementation differences between iLO versions (which is this case applies for 1.X and 2.X), and which differs from the latest 3.X.

Now, in favor of having things like this tested, you would either have to test it in different proper hardware, or simulate the implementations to perform the accurate tests.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

On Monday 11 Feb 2013 01:13:24 you wrote:
> While I agree that the preseeds are untested, I don't agree that in this
> particular scenario tested code would have helped as your comment seems to
> imply. The reason of this bug/branch is far from being unstested or, is
> possibility of discovery is far from being that case.
>
> This is present due to the implementation differences between iLO versions
> (which is this case applies for 1.X and 2.X), and which differs from the
> latest 3.X.
>
> Now, in favor of having things like this tested, you would either have to
> test it in different proper hardware, or simulate the implementations to
> perform the accurate tests.

I wasn't commenting about this particular scenario; it is indeed an
unfortunate bug.

However it's not an excuse to not have test coverage. Would could easily have
prevented bug 1103716, for example, with proper test coverage. We don't need
to test in real hardware situations (that's what QA is for), we just need unit
tests to make sure the preseeds are not broken in stupid ways.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

Sorry for the IRC paste:

<roaksoax> bigjools: how are you guys testing preseeds? I need to get this asap:
<roaksoax> https://code.launchpad.net/~andreserl/maas/ipmi_usercreation_ilo_versions/+merge/147460
<bigjools> roaksoax: there is no preseed testing at all
<roaksoax> bigjools: howdy btw :)
<bigjools> yo :)
<roaksoax> bigjools: so what can be done with that? I'm just really worried about that to hit maas/1.2 since FF is next week :)
<roaksoax> and I wanted to upload maas this week
<bigjools> roaksoax: you could do what jtv did with the user data. He split out the python bits to separate files that are included in the main template
<bigjools> then make sure the python bits are unit-testable
<roaksoax> bigjools: right, that;'s for trunk though
<roaksoax> bigjools: i don't want to introduce that big of a change for maas/1.2
<bigjools> just splitting them out is good enough for me, we can add tests later
<bigjools> it's a tiny change
<roaksoax> bigjools: right, though the split you mention is not backported to maas/1.2
<roaksoax> bigjools: and jtv did that with commissioning only, not enlistment :)
<bigjools> I know
<roaksoax> since enlistment is not controlled by a metadataserver
<bigjools> oh wait, are our preseeds not templated?
<bigjools> crapola
<bigjools> ok yes it's not a small change then :)
<roaksoax> yeah the commissioning stuff is not templated in lp:maas/1.2
<roaksoax> bigjools: that's why I was suggesting to get that in as it is only for lp:maas/1.2 since it is really a bugfix
<bigjools> roaksoax: +1, although I hate it :(
<bigjools> roaksoax: I think you need someone like smoser to sanity check that, I don't really know enough about iLO

Revision history for this message
Julian Edwards (julian-edwards) wrote :

In summary: get a +1 from smoser and this can land. We'll fix tests in trunk.

Revision history for this message
Scott Moser (smoser) wrote :

Its sane enough.
We've verified it doesn't cause regression in lab and via other testing, so I think we need to go with it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'contrib/preseeds_v2/enlist_userdata'
2--- contrib/preseeds_v2/enlist_userdata 2012-11-30 17:34:43 +0000
3+++ contrib/preseeds_v2/enlist_userdata 2013-02-27 15:46:21 +0000
4@@ -40,14 +40,6 @@
5 chmod "${2:-644}" "${IPMI_CONFIG_D}/$1"
6 }
7
8- add_ipmi_config "01-user-privileges.ipmi" <<"END_IPMI_USER_PRIVILEGES"
9- Section User3
10- Enable_User Yes
11- Lan_Enable_IPMI_Msgs Yes
12- Lan_Privilege_Limit Administrator
13- EndSection
14- END_IPMI_USER_PRIVILEGES
15-
16 add_ipmi_config "02-global-config.ipmi" <<"END_IPMI_CONFIG"
17 Section Lan_Channel
18 Volatile_Access_Mode Always_Available
19@@ -99,9 +91,23 @@
20 res = show_re.search(output)
21 return res.group()
22
23+ def get_ipmi_user_number(user):
24+ for i in range(1, 17):
25+ ipmi_user_number = "User%s" % i
26+ (status, output) = commands.getstatusoutput('bmc-config --checkout --key-pair="%s:Username"' % ipmi_user_number)
27+ if user in output:
28+ return ipmi_user_number
29+ return None
30+
31 def commit_ipmi_user_settings(user, password):
32- (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="User3:Username=%s"' % user)
33- (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="User3:Password=%s"' % password)
34+ ipmi_user_number = get_ipmi_user_number(user)
35+ if ipmi_user_number is None:
36+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="User10:Username=%s"' % user)
37+ ipmi_user_number = get_ipmi_user_number(user)
38+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Password=%s"' % (ipmi_user_number, password))
39+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Enable_User=Yes"' % ipmi_user_number)
40+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Lan_Enable_IPMI_Msgs=Yes"' % ipmi_user_number)
41+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Lan_Privilege_Limit=Administrator"' % ipmi_user_number)
42
43 def commit_ipmi_settings(config):
44 (status, output) = commands.getstatusoutput('bmc-config --commit --filename %s' % config)
45@@ -147,10 +153,7 @@
46 time.sleep(120)
47
48 # create user/pass
49- if args.commission_creds:
50- IPMI_MAAS_USER="maas-commission"
51- else:
52- IPMI_MAAS_USER="maas"
53+ IPMI_MAAS_USER="maas"
54 IPMI_MAAS_PASSWORD=generate_random_password()
55
56 # Configure IPMI user/password
57
58=== modified file 'etc/maas/commissioning-user-data'
59--- etc/maas/commissioning-user-data 2013-02-06 16:17:19 +0000
60+++ etc/maas/commissioning-user-data 2013-02-27 15:46:21 +0000
61@@ -198,14 +198,6 @@
62 lshw -xml
63 END_LSHW
64
65-add_ipmi_config "01-user-privileges.ipmi" <<"END_IPMI_USER_PRIVILEGES"
66-Section User3
67- Enable_User Yes
68- Lan_Enable_IPMI_Msgs Yes
69- Lan_Privilege_Limit Administrator
70-EndSection
71-END_IPMI_USER_PRIVILEGES
72-
73 add_ipmi_config "02-global-config.ipmi" <<"END_IPMI_CONFIG"
74 Section Lan_Channel
75 Volatile_Access_Mode Always_Available
76@@ -256,9 +248,23 @@
77 res = show_re.search(output)
78 return res.group()
79
80+def get_ipmi_user_number(user):
81+ for i in range(1, 17):
82+ ipmi_user_number = "User%s" % i
83+ (status, output) = commands.getstatusoutput('bmc-config --checkout --key-pair="%s:Username"' % ipmi_user_number)
84+ if user in output:
85+ return ipmi_user_number
86+ return None
87+
88 def commit_ipmi_user_settings(user, password):
89- (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="User3:Username=%s"' % user)
90- (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="User3:Password=%s"' % password)
91+ ipmi_user_number = get_ipmi_user_number(user)
92+ if ipmi_user_number is None:
93+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="User10:Username=%s"' % user)
94+ ipmi_user_number = get_ipmi_user_number(user)
95+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Password=%s"' % (ipmi_user_number, password))
96+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Enable_User=Yes"' % ipmi_user_number)
97+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Lan_Enable_IPMI_Msgs=Yes"' % ipmi_user_number)
98+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Lan_Privilege_Limit=Administrator"' % ipmi_user_number)
99
100 def commit_ipmi_settings(config):
101 (status, output) = commands.getstatusoutput('bmc-config --commit --filename %s' % config)

Subscribers

People subscribed via source and target branches

to status/vote changes: