honor zvm_default_admin_userid

we need do some changes according to zvm_default_admin_userid
zvm_default_admin_userid will be the primary conf options from
then on.

part of blueprint:add_zvm_default_admin_userid

Change-Id: I666262895acdf3b8972f6ac0a5a3a6f228836d6f
This commit is contained in:
jichenjc 2017-03-14 20:12:34 +08:00
parent 6e9210d7c1
commit 32b35e7e42
1 changed files with 8 additions and 1 deletions

View File

@ -276,11 +276,18 @@ class ZVMInstance(object):
def _create_user_id_body(self, boot_from_volume):
kwprofile = 'profile=%s' % CONF.zvm_user_profile
body = [kwprofile,
'password=%s' % CONF.zvm_user_default_password,
'cpu=%i' % self._instance['vcpus'],
'memory=%im' % self._instance['memory_mb'],
'privilege=%s' % CONF.zvm_user_default_privilege]
# if we don't set admin userid, then we will used old password
# field, otherwise, will use logon by method.
if not CONF.zvm_default_admin_userid:
body.append('password=%s' % CONF.zvm_user_default_password)
else:
body.append('password=LBYONLY')
body.append('logonby=%s' % CONF.zvm_default_admin_userid)
# if mkvm in lower version xcat won't support it
# they will ignore this param.
if not boot_from_volume: