Failed to boot vm with pci_alias's name including space in nova.conf

Bug #1638200 reported by zhaolihui
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Alex Xu
Newton
Fix Committed
Low
Lee Yarwood

Bug Description

Description
===========
Failed to boot vm with pci_alias's name including space in nova.conf.

Steps to reproduce
==================
1.modify the key pci_alias, pci_passthrough_whitelist and scheduler_default_filters in /etc/nova/nova.conf
pci_alias = {"name": "Cirrus Logic", "product_id": "0ff2", "vendor_id": "10de"}
pci_passthrough_whitelist = [{"product_id": "0ff2", "vendor_id": "10de"}]
scheduler_default_filters = ...,PciPassthroughFilter

2.restart nova-api, nova-scheduler, nova-conductor, nova-compute serivces

3.update a flavor's metadata with command
nova flavor-key m1.tiny set "pci_passthrough:alias"="Cirrus Logic:1"

4.create instance with command
nova boot --flavor m1.tiny --image cirror --nic net-id=xxxxxxxxx vm_name

Expected result
===============
There will be a vm with gpu passthrough.

Actual result
=============
Failed to boot vm.
Error occurs in nova-api.log

Environment
===========
1. Devstack with newton version

Logs
==============
2016-11-01 12:13:27.523 ^[[01;31mERROR nova.api.openstack.extensions [^[[01;36mreq-82f58a79-76b9-49e7-a8e9-44e8b43eaea4 ^[[00;36madmin admin^[[01;31m] ^[[01;35m^[[01;31mUnexpected exception in API method^[[00m
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00mTraceback (most recent call last):
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m File "/opt/stack/nova/nova/api/openstack/extensions.py", line 478, in wrapped
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m return f(*args, **kwargs)
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m File "/opt/stack/nova/nova/api/validation/__init__.py", line 73, in wrapper
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m return func(*args, **kwargs)
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m File "/opt/stack/nova/nova/api/validation/__init__.py", line 73, in wrapper
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m return func(*args, **kwargs)
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m File "/opt/stack/nova/nova/api/validation/__init__.py", line 73, in wrapper
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m return func(*args, **kwargs)
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m File "/opt/stack/nova/nova/api/openstack/compute/servers.py", line 629, in create
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m **create_kwargs)
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m File "/opt/stack/nova/nova/hooks.py", line 154, in inner
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m rv = f(*args, **kwargs)
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m File "/opt/stack/nova/nova/compute/api.py", line 1563, in create
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m check_server_group_quota=check_server_group_quota)
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m File "/opt/stack/nova/nova/compute/api.py", line 1146, in _create_instance
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m reservation_id, max_count)
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m File "/opt/stack/nova/nova/compute/api.py", line 871, in _validate_and_build_base_options
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m instance_type)
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m File "/opt/stack/nova/nova/pci/request.py", line 177, in get_pci_requests_from_flavor
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m flavor['extra_specs']['pci_passthrough:alias'])
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m File "/opt/stack/nova/nova/pci/request.py", line 129, in _translate_alias_to_requests
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m raise exception.PciRequestAliasNotDefined(alias=name)
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00mPciRequestAliasNotDefined: PCI alias CirrusLogic is not defined
^[[01;31m2016-11-01 12:13:27.523 TRACE nova.api.openstack.extensions ^[[01;35m^[[00m
2016-11-01 12:13:27.527 ^[[00;36mINFO nova.api.openstack.wsgi [^[[01;36mreq-82f58a79-76b9-49e7-a8e9-44e8b43eaea4 ^[[00;36madmin admin^[[00;36m] ^[[01;35m^[[00;36mHTTP exception thrown: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.<class 'nova.exception.PciRequestAliasNotDefined'>^[[00m

Tags: pci
zhaolihui (zhaolh)
Changed in nova:
assignee: nobody → zhaolihui (zhaolh)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/392077

Changed in nova:
status: New → In Progress
zhaolihui (zhaolh)
Changed in nova:
status: In Progress → Confirmed
status: Confirmed → In Progress
assignee: zhaolihui (zhaolh) → nobody
zhaolihui (zhaolh)
Changed in nova:
assignee: nobody → zhaolihui (zhaolh)
Changed in nova:
assignee: zhaolihui (zhaolh) → Alex Xu (xuhj)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/392077
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=9b88e755d93200811487d2f778735869f8fe07af
Submitter: Jenkins
Branch: master

commit 9b88e755d93200811487d2f778735869f8fe07af
Author: zhaolihui <email address hidden>
Date: Tue Nov 1 16:09:04 2016 +0800

    Fix pci_alias that include white spaces

    When the PCI alias was getting translated to a PCI request,
    all the white spaces were getting removed. So the pci_passthrough:alias
    specified in the flavor never matched the device in pci_alias.
    This patch fixes the bug by only stripping the white spaces
    at the beginning or the end of the elements

    Change-Id: I2888b03faf6c25bcb6011db40100d925972c2231
    Closes-Bug: #1638200

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/406075

Tony Breeds (o-tony)
Changed in nova:
importance: Undecided → Low
Matt Riedemann (mriedem)
tags: added: pci
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/newton)

Reviewed: https://review.openstack.org/406075
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=e58af8e32d415e112e491abce9f4e8b8d882fb80
Submitter: Jenkins
Branch: stable/newton

commit e58af8e32d415e112e491abce9f4e8b8d882fb80
Author: zhaolihui <email address hidden>
Date: Tue Nov 1 16:09:04 2016 +0800

    Fix pci_alias that include white spaces

    When the PCI alias was getting translated to a PCI request,
    all the white spaces were getting removed. So the pci_passthrough:alias
    specified in the flavor never matched the device in pci_alias.
    This patch fixes the bug by only stripping the white spaces
    at the beginning or the end of the elements

    Conflicts:
      nova/tests/unit/pci/test_request.py

    NOTE(lyarwood): Test conflict caused by the reorganisation of PCI options
    as part of I886045ab4e6bdb8418fd1ccdcd811417ecb4ad4a.

    Change-Id: I2888b03faf6c25bcb6011db40100d925972c2231
    Closes-Bug: #1638200
    (cherry picked from commit 9b88e755d93200811487d2f778735869f8fe07af)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 15.0.0.0b2

This issue was fixed in the openstack/nova 15.0.0.0b2 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 14.0.3

This issue was fixed in the openstack/nova 14.0.3 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.