Files
cyborg/pyproject.toml
Sean Mooney 7b1fc570bd devstack: add pci-sim fake SR-IOV PCI passthrough test fixture
Testing Cyborg's pci_driver and Nova PCI passthrough normally requires
physical SR-IOV hardware. This change introduces pci-sim, an out-of-tree
Linux kernel module (fake_pci_sriov) that creates fake SR-IOV PCI devices
whose virtual functions can be bound to VFIO and assigned to QEMU guests.
This makes it possible to exercise the full Nova and Cyborg PCI passthrough
control plane, including device enumeration, VF assignment, and VFIO
passthrough to CirrOS guests, in a standard devstack VM with no physical
SR-IOV hardware present.

pci-sim/
  Source for the fake_pci_sriov out-of-tree kernel module. The module
  creates one fake PCI host bridge per PF, each with software-emulated
  VFs backed by a 16550-style UART loopback payload. Build artifacts are
  excluded via .gitignore. The directory is excluded from Python wheels
  and sdists via [tool.setuptools.packages.find].

devstack/
  lib/pci_sim provides functions to build, load, configure, and unload
  the module. All paths are expressed relative to CYBORG_DIR so they
  resolve correctly within the cyborg checkout.

  devstack/settings gains a new ENABLE_PCI_SIM master toggle
  (default False) and the full set of PCI_SIM_* variables to control
  the fake PCI topology and service integration.
  PCI_SIM_CONFIGURE_NOVA_PCI and PCI_SIM_CONFIGURE_CYBORG_PCI are both
  defaulted to ENABLE_PCI_SIM but provide a explicy opt out if required.

  plugin.sh drives the pci-sim lifecycle alongside cyborg's own phases.
  The pci-sim cyborg service configuration is applied before start_cyborg
  in the extra phase so the agent picks up pci_driver and
  passthrough_whitelist on first start.

  devstack/local-conf.pci-sim.sample provides a ready-to-use local.conf
  for a two-PF, four-VF-per-PF topology with both Nova and Cyborg
  integrations enabled.

tools/
  check-kernel-config.sh validates the running kernel's config against
  the requirements for fake_pci_sriov before attempting a build.
  run-devstack-serial-echo-test.sh creates test VMs using the pci-sim
  flavors and validates the UART echo path inside a CirrOS guest.

doc/source/contributor/pci-sim/
  New contributor documentation covering build instructions, devstack
  setup, plugin settings, testing procedures, and kernel config
  requirements. Linked from the contributor index.

Assisted-By: pi gpt-5.5
Assisted-By: pi sonnet-4.6
Change-Id: I14dba5d0de833c9f2df28478daacbf8250de2127
Signed-off-by: Sean Mooney <work@seanmooney.info>
2026-06-15 10:49:23 +01:00

128 lines
4.8 KiB
TOML

[build-system]
requires = ["pbr>=6.0.0", "setuptools>=64.0.0"]
build-backend = "pbr.build"
[project]
name = "openstack-cyborg"
description = "Distributed Acceleration Management as a Service"
readme = {file = "README.rst", content-type = "text/x-rst"}
license = {text = "Apache-2.0"}
requires-python = ">=3.10"
authors = [
{name = "OpenStack", email = "openstack-discuss@lists.openstack.org"},
]
classifiers = [
"Environment :: OpenStack",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dynamic = ["version", "dependencies"]
[project.urls]
"Bug Tracker" = "https://bugs.launchpad.net/cyborg/"
"Documentation" = "https://docs.openstack.org/cyborg/latest/"
"Source Code" = "https://opendev.org/openstack/cyborg"
[project.scripts]
cyborg-api = "cyborg.cmd.api:main"
cyborg-conductor = "cyborg.cmd.conductor:main"
cyborg-dbsync = "cyborg.cmd.dbsync:main"
cyborg-agent = "cyborg.cmd.agent:main"
cyborg-status = "cyborg.cmd.status:main"
[project.entry-points."oslo.policy.policies"]
"cyborg.api" = "cyborg.policies:list_policies"
[project.entry-points."oslo.config.opts"]
cyborg = "cyborg.conf.opts:list_opts"
[project.entry-points."cyborg.database.migration_backend"]
sqlalchemy = "cyborg.db.sqlalchemy.migration"
[project.entry-points."cyborg.accelerator.driver"]
intel_fpga_driver = "cyborg.accelerator.drivers.fpga.intel.driver:IntelFPGADriver"
inspur_fpga_driver = "cyborg.accelerator.drivers.fpga.inspur.driver:InspurFPGADriver"
xilinx_fpga_driver = "cyborg.accelerator.drivers.fpga.xilinx.driver:XilinxFPGADriver"
nvmf_spdk_driver = "cyborg.accelerator.drivers.spdk.nvmf.nvmf:NVMFDRIVER"
nvidia_gpu_driver = "cyborg.accelerator.drivers.gpu.nvidia.driver:NVIDIAGPUDriver"
fake_driver = "cyborg.accelerator.drivers.fake:FakeDriver"
huawei_ascend_driver = "cyborg.accelerator.drivers.aichip.huawei.ascend:AscendDriver"
intel_qat_driver = "cyborg.accelerator.drivers.qat.intel.driver:IntelQATDriver"
intel_nic_driver = "cyborg.accelerator.drivers.nic.intel.driver:IntelNICDriver"
inspur_nvme_ssd_driver = "cyborg.accelerator.drivers.ssd.inspur.driver:InspurNVMeSSDDriver"
pci_driver = "cyborg.accelerator.drivers.pci.pci.driver:PCIDriver"
[tool.setuptools.packages.find]
# pci-sim/ is an out-of-tree kernel module and must not be packaged in
# cyborg wheels or sdists. Restricting auto-discovery to cyborg* ensures
# it is excluded from both the wheel and the sdist (pbr.build delegates
# to setuptools.build_meta for both).
include = ["cyborg*"]
# NOTE: data-files is deprecated by setuptools in favour of package_data,
# but package_data installs files inside the Python package tree and is not
# a suitable replacement for operator-facing configuration files that must
# be installed to system paths (e.g. /etc/cyborg/). These two files are
# required at runtime by PasteDeploy (api-paste.ini) and oslo.policy
# (policy.yaml), so we keep data-files as the only available mechanism for
# this use case. Distribution packages (deb/rpm) typically override this
# location via their own packaging rules.
[tool.setuptools.data-files]
"etc/cyborg" = ["etc/cyborg/policy.yaml", "etc/cyborg/api-paste.ini"]
[tool.ruff]
line-length = 79
target-version = "py310"
[tool.ruff.lint]
select = ["E4", "E7", "E9", "F", "G", "I", "LOG", "S", "UP", "W", "C90"]
external = ["H"]
ignore = [
# asserts used for type narrowing only
"S101",
# S104 Possible binding to all interfaces
"S104",
# S105/S106 Possible hardcoded password
"S105",
"S106",
# S110 try-except-pass — logged elsewhere
"S110",
# UP031 % format — defer f-string migration to a later pass
"UP031",
# UP032 f-string — defer migration to a later pass
"UP032",
]
[tool.ruff.lint.per-file-ignores]
"cyborg/tests/*" = ["S"]
# pci-sim scripts are system-level test fixtures that intentionally call
# subprocess with controlled arguments; suppress the subprocess audit rules.
"pci-sim/*" = ["S"]
[tool.ruff.lint.isort]
known-first-party = ["cyborg"]
force-single-line = true
lines-after-imports = 2
lines-between-types = 1
section-order = ["future", "standard-library", "third-party", "first-party"]
# this is the default but just being explicit about the behavior
# in case that ever changes.
force-sort-within-sections = false
[tool.ruff.lint.mccabe]
max-complexity = 20
[tool.ruff.format]
quote-style = "preserve"
docstring-code-format = true