2
0
mirror of https://opendev.org/x/pyghmi synced 2026-04-01 07:43:39 +00:00

Allow Confluent to create users with KVM bit

Fixes a bug when Confluent creates the IPMI user - it was not setting
the KVM bit and the created users do not have permission to launch the
console.

Change-Id: I324cffecb5b973eafa31c108db9d89caa93100a0
This commit is contained in:
luyf5
2021-08-30 14:40:45 +08:00
parent e9a1ed6710
commit d3f0046839
3 changed files with 38 additions and 0 deletions

View File

@@ -1654,6 +1654,9 @@ class Command(object):
response = self.raw_command(netfn=0x06, command=0x43, data=data)
if 'error' in response:
raise Exception(response['error'])
# Set KVM and VMedia Allowed if is administrator
if privilege_level == 'administrator':
self.set_extended_privilleges(uid)
return True
def get_user_access(self, uid, channel=None):
@@ -2074,3 +2077,10 @@ class Command(object):
def apply_license(self, filename, progress=None, data=None):
self.oem_init()
return self._oem.apply_license(filename, progress, data)
def set_extended_privilleges(self, uid):
"""Set user extended privillege as 'KVM & VMedia Allowed'
"""
self.oem_init()
return self._oem.set_oem_extended_privilleges(uid)

View File

@@ -384,3 +384,15 @@ class OEMHandler(object):
def get_user_expiration(self, uid):
return None
def set_oem_extended_privilleges(self, uid):
"""Set user extended privillege as 'KVM & VMedia Allowed'
|KVM & VMedia Not Allowed 0x00 0x00 0x00 0x00
|KVM Only Allowed 0x01 0x00 0x00 0x00
|VMedia Only Allowed 0x02 0x00 0x00 0x00
|KVM & VMedia Allowed 0x03 0x00 0x00 0x00
:param uid: User ID.
"""
return False

View File

@@ -1106,3 +1106,19 @@ class OEMHandler(generic.OEMHandler):
if self.has_xcc:
return self.immhandler.apply_license(filename, progress, data)
return super(OEMHandler, self).apply_license(filename, progress, data)
def set_oem_extended_privilleges(self, uid):
"""Set user extended privillege as 'KVM & VMedia Allowed'
|KVM & VMedia Not Allowed 0x00 0x00 0x00 0x00
|KVM Only Allowed 0x01 0x00 0x00 0x00
|VMedia Only Allowed 0x02 0x00 0x00 0x00
|KVM & VMedia Allowed 0x03 0x00 0x00 0x00
:param uid: User ID.
"""
if self.has_tsm:
self.ipmicmd.xraw_command(netfn=0x32, command=0xa3, data=(
uid, 0x03, 0x00, 0x00, 0x00))
return True
return False