Add support for NIC attributes

Provide support for SR-IOV and DPDK through new API version
for NICs.

Change-Id: I1a927c0e7333a422f94dd2937638f8d2ca38512f
Implements: blueprint nics-and-nodes-attributes-via-plugin
This commit is contained in:
Andriy Popovych 2016-08-08 14:46:38 +03:00
parent b8254231a1
commit 7531f8d65a
2 changed files with 44 additions and 16 deletions

View File

@ -752,10 +752,18 @@ class NailgunConfig(object):
ifaces_resp = self.req_session.get(
self.nailgun_url + api_url).json()
for iface in ifaces_resp:
if ('sriov' in iface['interface_properties'] and
iface['interface_properties']['sriov']['enabled']):
sriov_physnets.append(
iface['interface_properties']['sriov']['physnet'])
if 'interface_properties' in iface:
if ('sriov' in iface['interface_properties'] and
iface['interface_properties'][
'sriov']['enabled']):
sriov_physnets.append(
iface['interface_properties']['sriov']['physnet'])
else:
if ('sriov' in iface['attributes'] and
iface['attributes']['sriov']['enabled']['value']):
sriov_physnets.append(
iface['attributes']['sriov']['physnet']['value'])
self.compute.sriov_physnets = sriov_physnets
# Find first compute with enabled DPDK
@ -764,11 +772,22 @@ class NailgunConfig(object):
ifaces_resp = self.req_session.get(
self.nailgun_url + api_url).json()
for iface in ifaces_resp:
if 'dpdk' in iface['interface_properties']:
if 'enabled' in iface['interface_properties']['dpdk']:
if iface['interface_properties']['dpdk']['enabled']:
self.compute.dpdk_compute_fqdn = compute['fqdn']
break
if 'interface_properties' in iface:
if 'dpdk' in iface['interface_properties']:
if 'enabled' in iface['interface_properties']['dpdk']:
if iface['interface_properties'][
'dpdk']['enabled']:
self.compute.dpdk_compute_fqdn = compute[
'fqdn']
break
else:
if 'dpdk' in iface['attributes']:
if 'enabled' in iface['attributes']['dpdk']:
if iface['attributes']['dpdk'][
'enabled']['value']:
self.compute.dpdk_compute_fqdn = compute[
'fqdn']
break
self.compute.compute_nodes = compute_ips
ceph_nodes = filter(lambda node: 'ceph-osd' in node['roles'],

View File

@ -168,13 +168,22 @@ def _get_cluster_attrs(cluster_id, token=None):
'api/nodes/{id}/interfaces'.format(id=compute_id))
ifaces_resp = REQ_SES.get(ifaces_url).json()
for iface in ifaces_resp:
if ('sriov' in iface['interface_properties'] and
iface['interface_properties']['sriov']['enabled']):
sriov_compute_ids.append(compute_id)
if 'dpdk' in iface['interface_properties']:
if 'enabled' in iface['interface_properties']['dpdk']:
if iface['interface_properties']['dpdk']['enabled']:
dpdk_compute_ids.append(compute_id)
if 'interface_properties' in iface:
if ('sriov' in iface['interface_properties'] and
iface['interface_properties']['sriov']['enabled']):
sriov_compute_ids.append(compute_id)
if 'dpdk' in iface['interface_properties']:
if 'enabled' in iface['interface_properties']['dpdk']:
if iface['interface_properties']['dpdk']['enabled']:
dpdk_compute_ids.append(compute_id)
else:
if ('sriov' in iface['attributes'] and
iface['attributes']['sriov']['enabled']['value']):
sriov_compute_ids.append(compute_id)
if 'dpdk' in iface['attributes']:
if 'enabled' in iface['attributes']['dpdk']:
if iface['attributes']['dpdk']['enabled']['value']:
dpdk_compute_ids.append(compute_id)
deployment_tags = set()