Revert "add support for intel gpu device plugin"

This reverts commit 023be74256.
according to the architectural direction, labels should be
assigned by user manually instead of automaticly.

The HW detect and k8s_plugins configuration check which can
avoid user to assign plugin labels in imporper node will be
kept as semantic checks of labels.
it will be implemeted at https://review.opendev.org/#/c/691699/

Change-Id: I601dc84264864eb5b292edd47f5c53668193f994
Closes-bug: 1849326
This commit is contained in:
SidneyAn 2019-11-07 00:09:45 +08:00
parent 5ea284ea08
commit 93320956b4
4 changed files with 1 additions and 142 deletions

View File

@ -139,7 +139,6 @@ class AgentManager(service.PeriodicService):
PV = 'pv'
LVG = 'lvg'
HOST_FILESYSTEMS = 'host_filesystems'
K8S_DEVICE_PLUGIN = 'k8s_device_plugin'
# Note that this set must be extended when there are
# additional inventory required for the initial
@ -153,8 +152,7 @@ class AgentManager(service.PeriodicService):
DISK,
PV,
LVG,
HOST_FILESYSTEMS,
K8S_DEVICE_PLUGIN}
HOST_FILESYSTEMS}
def __init__(self, host, topic):
serializer = objects_base.SysinvObjectSerializer()
@ -840,8 +838,6 @@ class AgentManager(service.PeriodicService):
self._report_port_inventory(icontext, rpcapi,
port_list, pci_device_list)
self._report_supported_device_plugin(icontext, rpcapi, pci_device_list)
# Find list of numa_nodes and cpus for this ihost
inumas, icpus = self._inode_operator.inodes_get_inumas_icpus()
@ -960,39 +956,6 @@ class AgentManager(service.PeriodicService):
self._report_to_conductor_iplatform_avail()
self._iconfig_read_config_reported = config_uuid
@retrying.retry(wait_fixed=15 * 1000, stop_max_delay=300 * 1000,
retry_on_exception=_retry_on_missing_host_uuid)
def _report_supported_device_plugin(self, context, rpcapi=None, pci_device_list=None):
if not self._ihost_uuid:
raise exception.LocalHostUUIDNotFound()
if rpcapi is None:
rpcapi = conductor_rpcapi.ConductorAPI(
topic=conductor_rpcapi.MANAGER_TOPIC)
if pci_device_list is None:
port_list, pci_device_list, host_macs = self._get_ports_inventory()
device_plugin_labels = self._ipci_operator.get_support_dp_labels(pci_device_list)
if not device_plugin_labels:
LOG.info("device_plugin_labels is empty.")
self._inventory_reported.add(self.K8S_DEVICE_PLUGIN)
return
try:
rpcapi.device_plugin_labels_update_by_ihost(context,
self._ihost_uuid,
device_plugin_labels)
self._inventory_reported.add(self.K8S_DEVICE_PLUGIN)
except RemoteError as e:
LOG.error("device_plugin_labels_update_by_ihost RemoteError exc_type=%s" %
e.exc_type)
except exception.SysinvException:
LOG.exception("Sysinv Agent uncaught exception updating device plugin labels.")
pass
def subfunctions_get(self):
""" returns subfunctions on this host.
"""

View File

@ -168,33 +168,6 @@ class PCIDevice(object):
return "<PCIDevice '%s'>" % str(self)
class DevicePlugin(object):
'''Class to record specific information of each k8s device plugins'''
def __init__(self):
return
def get_label(pci_device_list):
return None
class IntelGPUdp(DevicePlugin):
def __init__(self):
return
def get_label(self, pci_device_list):
for device in pci_device_list:
if "VGA" in device['pclass'] and device['driver'] is not None:
if "i915" in device['driver']:
label = {}
label.update({'label_key': 'intelgpu'})
label.update({'label_value': 'enabled'})
return label
DEVICE_PLUGIN_LIST = [IntelGPUdp()]
class PCIOperator(object):
'''Class to encapsulate PCI operations for System Inventory'''
@ -694,13 +667,3 @@ class PCIOperator(object):
pci_attrs_array.append(attrs)
return pci_attrs_array
def get_support_dp_labels(self, pci_device_list):
labels = []
for device in DEVICE_PLUGIN_LIST:
label = device.get_label(pci_device_list)
if label is not None:
labels.append(label)
return labels

View File

@ -34,7 +34,6 @@ import filecmp
import fnmatch
import glob
import hashlib
import json
import math
import os
import re
@ -4204,56 +4203,6 @@ class ConductorManager(service.PeriodicService):
tsc.install_uuid)
greenthread.sleep(constants.FIX_INSTALL_UUID_INTERVAL_SECS)
def _get_kube_plugin_labels(self):
# this file will be generated after initial config process if the
# kubernetes device plugin list is not empty.
if not os.path.isfile('/etc/platform/enabled_kube_plugins'):
return None
try:
file_object = open('/etc/platform/enabled_kube_plugins')
plugins = json.loads(file_object.read())
labels = list(plugins.values())
return labels
except Exception as e:
LOG.error("failed to get kube_plugin list from file. \
exception: %s" % str(e))
return None
def device_plugin_labels_update_by_ihost(self, context,
host_uuid, device_plugin_labels):
"""Assign device plugin labels to an ihost with the supplied data.
:param context: an admin context
:param host_uuid: host uuid unique id
:param device_plugin_labels: kubernetes labels request to assign
"""
enabled_kube_labels = self._get_kube_plugin_labels()
if enabled_kube_labels is None:
LOG.info("Vendor k8s device plugin list is empty. \
Set parameters in ansible override file if required.")
return
host_uuid.strip()
try:
ihost = self.dbapi.ihost_get(host_uuid)
except exception.ServerNotFound:
LOG.exception("Invalid host_uuid %s" % host_uuid)
return
for label in device_plugin_labels:
kube_label = label['label_key'] + "=" + label['label_value']
if kube_label not in enabled_kube_labels:
continue
label.update({'host_id': ihost.id})
try:
self.dbapi.label_create(host_uuid, label)
except exception.HostLabelAlreadyExists:
pass
@periodic_task.periodic_task(spacing=CONF.conductor.audit_interval)
def _agent_update_request(self, context):
"""

View File

@ -426,22 +426,6 @@ class ConductorAPI(sysinv.openstack.common.rpc.proxy.RpcProxy):
return self.cast(context, self.make_msg('update_partition_config',
partition=partition))
def device_plugin_labels_update_by_ihost(self, context,
host_uuid, device_plugin_labels):
"""Assign device plugin labels to an ihost with the supplied data.
:param context: an admin context
:param host_uuid: host uuid unique id
:param device_plugin_labels: kubernetes labels request to assign
:returns: pass or fail
"""
return self.call(context,
self.make_msg('device_plugin_labels_update_by_ihost',
host_uuid=host_uuid,
device_plugin_labels=device_plugin_labels))
def iplatform_update_by_ihost(self, context,
ihost_uuid, imsg_dict):
"""Create or update memory for an ihost with the supplied data.