========
DevStack
========

pci-sim is built into the Cyborg DevStack plugin.  No separate
``enable_plugin`` line is needed — enabling Cyborg is sufficient:

.. code-block:: ini

   enable_plugin cyborg https://opendev.org/openstack/cyborg

   PCI_SIM_CONFIGURE_NOVA_PCI=True
   PCI_SIM_CONFIGURE_CYBORG_PCI=True

A ready-to-use sample configuration is provided in the Cyborg repository at
``devstack/local-conf.pci-sim.sample``.

Plugin settings
===============

``ENABLE_PCI_SIM``
  Master switch.  Set to ``False`` to skip all pci-sim phases (build, load,
  configuration, and test-resource creation).  Defaults to ``False``.

``PCI_SIM_BUILD``
  Build and install the module during the DevStack ``install`` phase.
  Defaults to ``True``.

``PCI_SIM_LOAD``
  Load ``fake_pci_sriov`` after building it.  Defaults to ``True``.

``PCI_SIM_ALLOW_UNSAFE_INTERRUPTS``
  Allow VFIO on hosts without interrupt remapping support by setting
  ``vfio_iommu_type1.allow_unsafe_interrupts`` before probing the fake VFs.
  Defaults to ``True`` for nested/devstack test environments.

``PCI_SIM_NUM_PFS``
  Number of fake SR-IOV physical functions to create.  Defaults to ``2``.

``PCI_SIM_NUM_VFS``
  Number of virtual functions to enable on each fake PF.  Defaults to ``4``.
  The current module supports ``0`` through ``7`` VFs per PF.

``PCI_SIM_CONFIGURE_NOVA_PCI``
  Configure Nova to consume pci-sim VFs directly using Nova's ``[pci]``
  ``device_spec`` and ``alias`` options.  Defaults to ``False``.  Nova entries
  are generated by exact VF address and use ``managed=\"no\"``.  The plugin
  updates both ``/etc/nova/nova.conf`` and, when present, DevStack's compute
  service config ``/etc/nova/nova-cpu.conf``.

``PCI_SIM_CONFIGURE_CYBORG_PCI``
  Configure Cyborg's generic ``pci_driver`` to manage pci-sim VFs using
  Cyborg's ``[agent] enabled_drivers`` and ``[pci] passthrough_whitelist``
  options.  Defaults to ``False``.  If both Nova and Cyborg configuration are
  enabled, the plugin assigns whole PFs in round-robin order: all VFs from PF0
  to Nova, all VFs from PF1 to Cyborg, and so on.

``PCI_SIM_NOVA_PCI_IN_PLACEMENT``
  When Nova PCI configuration is enabled, configure
  ``[pci] report_in_placement`` and
  ``[filter_scheduler] pci_in_placement``.  Defaults to ``True``.

``PCI_SIM_CREATE_TEST_FLAVORS``
  Create convenience test resources during ``stack/test-config``.  Defaults to
  ``True``.  When Nova PCI configuration is enabled, the plugin creates a
  flavor named by ``PCI_SIM_NOVA_FLAVOR_NAME`` with
  ``pci_passthrough:alias``.  When
  Cyborg PCI configuration is enabled, the plugin creates a Cyborg device
  profile named by ``PCI_SIM_CYBORG_DEVICE_PROFILE_NAME`` and a flavor named by
  ``PCI_SIM_CYBORG_FLAVOR_NAME`` with ``accel:device_profile``.

``PCI_SIM_MODULE_ARGS``
  Optional extra arguments passed to ``modprobe fake_pci_sriov`` when
  ``PCI_SIM_LOAD=True``.  Do not include ``num_pfs`` here; use
  ``PCI_SIM_NUM_PFS`` instead.
