"Fossies" - the Fresh Open Source Software Archive

Member "openstack-cyborg-9.0.0/cyborg/common/constants.py" (5 Oct 2022, 3055 Bytes) of package /linux/misc/openstack/openstack-cyborg-9.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "constants.py" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 8.0.0_vs_9.0.0.

    1 # Copyright 2017 Huawei Technologies Co.,LTD.
    2 # All Rights Reserved.
    3 #
    4 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
    5 #    not use this file except in compliance with the License. You may obtain
    6 #    a copy of the License at
    7 #
    8 #         http://www.apache.org/licenses/LICENSE-2.0
    9 #
   10 #    Unless required by applicable law or agreed to in writing, software
   11 #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   12 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   13 #    License for the specific language governing permissions and limitations
   14 #    under the License.
   15 import os_resource_classes as orc
   16 
   17 CONDUCTOR_TOPIC = 'cyborg-conductor'
   18 AGENT_TOPIC = 'cyborg-agent'
   19 DEVICE_GPU = 'GPU'
   20 DEVICE_FPGA = 'FPGA'
   21 DEVICE_AICHIP = 'AICHIP'
   22 DEVICE_QAT = 'QAT'
   23 DEVICE_NIC = 'NIC'
   24 DEVICE_SSD = 'SSD'
   25 
   26 
   27 ARQ_STATES = (ARQ_INITIAL, ARQ_BIND_STARTED, ARQ_BOUND, ARQ_UNBOUND,
   28               ARQ_BIND_FAILED, ARQ_UNBIND_FAILED, ARQ_DELETING) = (
   29     'Initial', 'BindStarted', 'Bound', 'Unbound', 'BindFailed', 'UnbindFailed',
   30     'Deleting')
   31 
   32 
   33 ARQ_BIND_STAGE = (ARQ_PRE_BIND, ARQ_FINISH_BIND,
   34                   ARQ_OUFOF_BIND_FLOW) = (
   35     [ARQ_INITIAL, ARQ_BIND_STARTED],
   36     [ARQ_BOUND, ARQ_BIND_FAILED],
   37     [ARQ_UNBOUND, ARQ_DELETING])
   38 
   39 
   40 ARQ_BIND_STATUS = (ARQ_BIND_STATUS_FINISH, ARQ_BIND_STATUS_FAILED) = (
   41     "completed", "failed")
   42 
   43 
   44 ARQ_BIND_STATES_STATUS_MAP = {
   45     ARQ_BOUND: ARQ_BIND_STATUS_FINISH,
   46     ARQ_BIND_FAILED: ARQ_BIND_STATUS_FAILED,
   47     ARQ_DELETING: ARQ_BIND_STATUS_FAILED
   48 }
   49 
   50 # TODO(Shaohe): maybe we can use oslo automaton lib
   51 # ref: https://docs.openstack.org/automaton/latest/user/examples.html
   52 # The states in value list can transfrom to the key state
   53 ARQ_STATES_TRANSFORM_MATRIX = {
   54     ARQ_INITIAL: [],
   55     ARQ_BIND_STARTED: [ARQ_INITIAL, ARQ_UNBOUND],
   56     ARQ_BOUND: [ARQ_BIND_STARTED],
   57     ARQ_UNBOUND: [ARQ_INITIAL, ARQ_BIND_STARTED, ARQ_BOUND, ARQ_BIND_FAILED],
   58     ARQ_BIND_FAILED: [ARQ_BIND_STARTED, ARQ_BOUND],
   59     ARQ_DELETING: [ARQ_INITIAL, ARQ_BIND_STARTED, ARQ_BOUND,
   60                    ARQ_UNBOUND, ARQ_BIND_FAILED]
   61 }
   62 
   63 
   64 # Device type
   65 DEVICE_TYPE = (DEVICE_GPU, DEVICE_FPGA, DEVICE_AICHIP, DEVICE_QAT, DEVICE_NIC,
   66                DEVICE_SSD)
   67 
   68 
   69 # Attach handle type
   70 #  'TEST_PCI': used by fake driver, ignored by Nova virt driver.
   71 ATTACH_HANDLE_TYPES = (AH_TYPE_PCI, AH_TYPE_MDEV, AH_TYPE_TEST_PCI) = (
   72     "PCI", "MDEV", "TEST_PCI")
   73 
   74 
   75 # Control Path ID type
   76 CPID_TYPE = (CPID_TYPE_PCI) = ("PCI")
   77 
   78 
   79 # Resource Class
   80 RESOURCES = {
   81     "FPGA": orc.FPGA,
   82     "PGPU": orc.PGPU,
   83     "VGPU": orc.VGPU,
   84     "QAT": "CUSTOM_QAT",
   85     "NIC": "CUSTOM_NIC",
   86     "SSD": 'CUSTOM_SSD',
   87 }
   88 
   89 
   90 ACCEL_SPECS = (
   91     ACCEL_BITSTREAM_ID,
   92     ACCEL_FUNCTION_ID
   93 ) = (
   94     "accel:bitstream_id",
   95     "accel:function_id"
   96 )
   97 
   98 
   99 SUPPORT_RESOURCES = (
  100     FPGA, GPU, VGPU, PGPU, QAT, NIC, SSD) = (
  101     "FPGA", "GPU", "VGPU", "PGPU", "CUSTOM_QAT", "CUSTOM_NIC", "CUSTOM_SSD"
  102 )
  103 
  104 
  105 FPGA_TRAITS = (
  106     FPGA_FUNCTION_ID,
  107 ) = (
  108     "CUSTOM_FPGA_FUNCTION_ID",
  109 )
  110 
  111 
  112 RESOURCES_PREFIX = "resources:"