From c616da80487b83e8506e3fa18cc707fd50f5eb5c Mon Sep 17 00:00:00 2001 From: chenke Date: Tue, 3 Mar 2020 14:55:43 +0800 Subject: [PATCH] Remove useless interfaces in agent These APIs are introduced in V1 and will not be used in V2. At the same time, it will cause us some misunderstandings. Change-Id: I1a8f56e1b891d85bd35a416bbd0a5be6b30d9f33 Story: 2007363 Task: 38918 --- cyborg/agent/manager.py | 26 -------------------------- cyborg/agent/rpcapi.py | 22 ---------------------- 2 files changed, 48 deletions(-) diff --git a/cyborg/agent/manager.py b/cyborg/agent/manager.py index bf2e1f0d..2ff88a42 100644 --- a/cyborg/agent/manager.py +++ b/cyborg/agent/manager.py @@ -47,19 +47,6 @@ class AgentManager(periodic_task.PeriodicTasks): def periodic_tasks(self, context, raise_on_error=False): return self.run_periodic_tasks(context, raise_on_error=raise_on_error) - def hardware_list(self, context, values): - """List installed hardware.""" - pass - - def fpga_program(self, context, deployable_uuid, image_uuid): - """Program a FPGA region, image can be a url or local file""" - # TODO(Shaohe Feng) Get image from glance. - # And add claim and rollback logical. - path = self._download_bitstream(context, image_uuid) - dep = self.cond_api.deployable_get(context, deployable_uuid) - driver = self.fpga_driver.create(dep.vendor) - driver.program(dep.address, path) - def fpga_program_v2(self, context, controlpath_id, bitstream_uuid, driver_name): # TODO() Use tempfile module? @@ -72,19 +59,6 @@ class AgentManager(periodic_task.PeriodicTasks): LOG.info('Driver program() API returned code %s', ret) os.remove(download_path) - def _download_bitstream(self, context, bitstream_uuid): - """Download the bistream - - :param context: the context - :param bistream_uuid: v4 uuid of the bitstream to reprogram - :returns: the path to bitstream downloaded, None if fail to download - """ - download_path = "/tmp/" + bitstream_uuid + ".bin" - self.image_api.download(context, - bitstream_uuid, - dest_path=download_path) - return download_path - @periodic_task.periodic_task(run_immediately=True) def update_available_resource(self, context, startup=True): """Update all kinds of accelerator resources from their drivers.""" diff --git a/cyborg/agent/rpcapi.py b/cyborg/agent/rpcapi.py index b56c08e5..6f341c4e 100644 --- a/cyborg/agent/rpcapi.py +++ b/cyborg/agent/rpcapi.py @@ -20,7 +20,6 @@ import oslo_messaging as messaging from cyborg.common import constants from cyborg.common import rpc -from cyborg import objects from cyborg.objects import base as objects_base from oslo_log import log @@ -52,27 +51,6 @@ class AgentAPI(object): version_cap=self.RPC_API_VERSION, serializer=serializer) - def hardware_list(self, context, values): - """Signal the agent to find local hardware.""" - pass - - def program_fpga_with_bitstream(self, - context, - deployable_uuid, - bitstream_uuid): - """Actiion to program a target FPGA""" - version = '1.0' - - dpl_get = objects.Deployable.get(context, deployable_uuid) - if not dpl_get: - # TODO(Li Liu) throw an exception here - return 0 - - cctxt = self.client.prepare(server=dpl_get.host, version=version) - return cctxt.call(context, 'fpga_program', - deployable_uuid=deployable_uuid, - image_uuid=bitstream_uuid) - def fpga_program_v2(self, context, hostname, controlpath_id, bitstream_uuid, driver_name): LOG.info('Agent fpga_program_v2: hostname: (%s) ' +