Add pci-alias option

Add a new pci-alias option which supports the use of PCI
devices in flavors. This allows, for example, a GPU or
a SR-IOV device to be automatically allocated to an
instance using a specific flavor.

Change-Id: I249ba04085d37657df0c8e3bb21723a388f08938
Closes-Bug: 1649868
This commit is contained in:
Zhang Hua 2017-02-16 15:30:18 +08:00 committed by James Page
parent 5d3c601dd4
commit 2eabf254f3
6 changed files with 33 additions and 0 deletions

View File

@ -416,6 +416,23 @@ options:
description: |
List of filter class names to use for filtering hosts when not specified in
the request.
pci-alias:
type: string
default:
description: |
The pci-passthrough-whitelist option of nova-compute charm is used for
specifying which PCI devices are allowed passthrough. pci-alias is more
a convenience that can be used in conjunction with Nova flavor properties
to automatically assign required PCI devices to new instances. You could,
for example, have a GPU flavor or a SR-IOV flavor:
pci-alias='{"vendor_id":"8086","product_id":"10ca","name":"a1"}'
This configures a new PCI alias 'a1' which will request a PCI device with
a vendor id of 0x8086 and a product id of 10ca.
For more information about the syntax of pci_alias, refer to
https://docs.openstack.org/ocata/config-reference/compute/config-options.html
api-rate-limit-rules:
type: string
default:

View File

@ -261,6 +261,8 @@ class NovaConfigContext(context.WorkerConfigContext):
def __call__(self):
ctxt = super(NovaConfigContext, self).__call__()
ctxt['scheduler_default_filters'] = config('scheduler-default-filters')
if config('pci-alias'):
ctxt['pci_alias'] = config('pci-alias')
ctxt['cpu_allocation_ratio'] = config('cpu-allocation-ratio')
ctxt['ram_allocation_ratio'] = config('ram-allocation-ratio')
addr = resolve_address(INTERNAL)

View File

@ -35,6 +35,9 @@ scheduler_default_filters = {{ scheduler_default_filters }},{{ additional_neutro
{% else %}
scheduler_default_filters = {{ scheduler_default_filters }}
{% endif %}
{% if pci_alias %}
pci_alias = {{ pci_alias }}
{% endif %}
cpu_allocation_ratio = {{ cpu_allocation_ratio }}
ram_allocation_ratio = {{ ram_allocation_ratio }}

View File

@ -35,6 +35,9 @@ scheduler_default_filters = {{ scheduler_default_filters }},{{ additional_neutro
{% else %}
scheduler_default_filters = {{ scheduler_default_filters }}
{% endif %}
{% if pci_alias %}
pci_alias = {{ pci_alias }}
{% endif %}
cpu_allocation_ratio = {{ cpu_allocation_ratio }}
ram_allocation_ratio = {{ ram_allocation_ratio }}

View File

@ -32,6 +32,9 @@ scheduler_default_filters = {{ scheduler_default_filters }},{{ additional_neutro
{% else %}
scheduler_default_filters = {{ scheduler_default_filters }}
{% endif %}
{% if pci_alias %}
pci_alias = {{ pci_alias }}
{% endif %}
cpu_allocation_ratio = {{ cpu_allocation_ratio }}
ram_allocation_ratio = {{ ram_allocation_ratio }}

View File

@ -183,3 +183,8 @@ auth_strategy=keystone
[wsgi]
api_paste_config=/etc/nova/api-paste.ini
[pci]
{% if pci_alias %}
alias = {{ pci_alias }}
{% endif %}