launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #15245
[Merge] lp:~andreserl/maas/ipmi_usercreation_ilo_versions into lp:maas/1.2
Andres Rodriguez has proposed merging lp:~andreserl/maas/ipmi_usercreation_ilo_versions into lp:maas/1.2.
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)
Requested reviews:
MAAS Maintainers (maas-maintainers)
Related bugs:
Bug #1119696 in MAAS: "IPMI User Creation on iLO differs between version"
https://bugs.launchpad.net/maas/+bug/1119696
For more details, see:
https://code.launchpad.net/~andreserl/maas/ipmi_usercreation_ilo_versions/+merge/147460
--
https://code.launchpad.net/~andreserl/maas/ipmi_usercreation_ilo_versions/+merge/147460
Your team MAAS Maintainers is requested to review the proposed merge of lp:~andreserl/maas/ipmi_usercreation_ilo_versions into lp:maas/1.2.
=== modified file 'contrib/preseeds_v2/enlist_userdata'
--- contrib/preseeds_v2/enlist_userdata 2012-11-30 17:34:43 +0000
+++ contrib/preseeds_v2/enlist_userdata 2013-02-27 15:46:21 +0000
@@ -40,14 +40,6 @@
chmod "${2:-644}" "${IPMI_CONFIG_D}/$1"
}
- add_ipmi_config "01-user-privileges.ipmi" <<"END_IPMI_USER_PRIVILEGES"
- Section User3
- Enable_User Yes
- Lan_Enable_IPMI_Msgs Yes
- Lan_Privilege_Limit Administrator
- EndSection
- END_IPMI_USER_PRIVILEGES
-
add_ipmi_config "02-global-config.ipmi" <<"END_IPMI_CONFIG"
Section Lan_Channel
Volatile_Access_Mode Always_Available
@@ -99,9 +91,23 @@
res = show_re.search(output)
return res.group()
+ def get_ipmi_user_number(user):
+ for i in range(1, 17):
+ ipmi_user_number = "User%s" % i
+ (status, output) = commands.getstatusoutput('bmc-config --checkout --key-pair="%s:Username"' % ipmi_user_number)
+ if user in output:
+ return ipmi_user_number
+ return None
+
def commit_ipmi_user_settings(user, password):
- (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="User3:Username=%s"' % user)
- (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="User3:Password=%s"' % password)
+ ipmi_user_number = get_ipmi_user_number(user)
+ if ipmi_user_number is None:
+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="User10:Username=%s"' % user)
+ ipmi_user_number = get_ipmi_user_number(user)
+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Password=%s"' % (ipmi_user_number, password))
+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Enable_User=Yes"' % ipmi_user_number)
+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Lan_Enable_IPMI_Msgs=Yes"' % ipmi_user_number)
+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Lan_Privilege_Limit=Administrator"' % ipmi_user_number)
def commit_ipmi_settings(config):
(status, output) = commands.getstatusoutput('bmc-config --commit --filename %s' % config)
@@ -147,10 +153,7 @@
time.sleep(120)
# create user/pass
- if args.commission_creds:
- IPMI_MAAS_USER="maas-commission"
- else:
- IPMI_MAAS_USER="maas"
+ IPMI_MAAS_USER="maas"
IPMI_MAAS_PASSWORD=generate_random_password()
# Configure IPMI user/password
=== modified file 'etc/maas/commissioning-user-data'
--- etc/maas/commissioning-user-data 2013-02-06 16:17:19 +0000
+++ etc/maas/commissioning-user-data 2013-02-27 15:46:21 +0000
@@ -198,14 +198,6 @@
lshw -xml
END_LSHW
-add_ipmi_config "01-user-privileges.ipmi" <<"END_IPMI_USER_PRIVILEGES"
-Section User3
- Enable_User Yes
- Lan_Enable_IPMI_Msgs Yes
- Lan_Privilege_Limit Administrator
-EndSection
-END_IPMI_USER_PRIVILEGES
-
add_ipmi_config "02-global-config.ipmi" <<"END_IPMI_CONFIG"
Section Lan_Channel
Volatile_Access_Mode Always_Available
@@ -256,9 +248,23 @@
res = show_re.search(output)
return res.group()
+def get_ipmi_user_number(user):
+ for i in range(1, 17):
+ ipmi_user_number = "User%s" % i
+ (status, output) = commands.getstatusoutput('bmc-config --checkout --key-pair="%s:Username"' % ipmi_user_number)
+ if user in output:
+ return ipmi_user_number
+ return None
+
def commit_ipmi_user_settings(user, password):
- (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="User3:Username=%s"' % user)
- (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="User3:Password=%s"' % password)
+ ipmi_user_number = get_ipmi_user_number(user)
+ if ipmi_user_number is None:
+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="User10:Username=%s"' % user)
+ ipmi_user_number = get_ipmi_user_number(user)
+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Password=%s"' % (ipmi_user_number, password))
+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Enable_User=Yes"' % ipmi_user_number)
+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Lan_Enable_IPMI_Msgs=Yes"' % ipmi_user_number)
+ (status, output) = commands.getstatusoutput('bmc-config --commit --key-pair="%s:Lan_Privilege_Limit=Administrator"' % ipmi_user_number)
def commit_ipmi_settings(config):
(status, output) = commands.getstatusoutput('bmc-config --commit --filename %s' % config)
Follow ups