Fix sriov-related methods

- Introduce new method for getting devops node based
  on nailgun node's id
- Add missing 'value' key to enabling sriov

Change-Id: I95b60c25eab97e8577a16481741a76db99207976
(cherry picked from commit 8d2ccd2d26)
This commit is contained in:
Vladimir Khlyunev 2017-01-10 23:04:22 +04:00
parent 92725b64bc
commit f1d636e508
1 changed files with 13 additions and 3 deletions

View File

@ -1216,6 +1216,17 @@ class FuelWebClient29(object):
if nailgun_node:
return self.get_devops_node_by_mac(nailgun_node['mac'])
@logwrap
def get_devops_node_by_nailgun_node_id(self, nailgun_node_id):
"""Return devops node by nailgun node id
:type nailgun_node_id: int
:rtype: Node or None
"""
nailgun_node = [node for node in self.client.list_nodes() if
node['id'] == nailgun_node_id].pop()
return self.get_devops_node_by_mac(nailgun_node['mac'])
@logwrap
def get_devops_node_by_nailgun_fqdn(self, fqdn):
"""Return devops node with nailgun fqdn
@ -3159,8 +3170,7 @@ class FuelWebClient29(object):
def check_sriov(self, nailgun_node_id):
nailgun_node_ifaces = self.client.get_node_interfaces(
nailgun_node_id)
devops_node = self.get_devops_node_by_nailgun_node(
nailgun_node_id)
devops_node = self.get_devops_node_by_nailgun_node_id(nailgun_node_id)
devops_sriov_macs = [i.mac_address for i in devops_node.interfaces
if 'sriov' in i.features]
nailgun_sriov_nics = []
@ -3194,7 +3204,7 @@ class FuelWebClient29(object):
'sriov']['sriov_totalvfs']
else:
interface['attributes']['sriov']['enabled']['value'] = True
interface['attributes']['sriov']['numvfs'] = \
interface['attributes']['sriov']['numvfs']['value'] = \
interface['meta']['sriov']['totalvfs']
self.client.put_node_interfaces(