'--hint' argument to 'nova boot ' should be a key-value pair

Bug #1845322 reported by Stephen Finucane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
Low
Stephen Finucane
Rocky
Fix Committed
Low
Stephen Finucane
Stein
Fix Committed
Low
Stephen Finucane
Train
Fix Committed
Low
Stephen Finucane

Bug Description

The '--hint' argument for the 'nova boot' command allows you to "[s]end arbitrary key/value pairs to the scheduler for custom use." However, if you forget the key part of this, the request will succeed but the hint argument will be silently ignored.

This was originally reported on Bugzilla for OSC [1] but the issue applies to novaclient too.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1541239

Changed in python-novaclient:
assignee: nobody → Stephen Finucane (stephenfinucane)
status: New → Confirmed
importance: Undecided → Low
Changed in python-novaclient:
status: Confirmed → In Progress
Revision history for this message
Balazs Gibizer (balazs-gibizer) wrote :
Download full text (3.7 KiB)

The openstackclient also affected

stack@ubuntu:~/python-novaclient$ openstack server create --image cirros-0.4.0-x86_64-disk --flavor c1 --nic net-id=public vm2 --hint boooo --wait

+-------------------------------------+-----------------------------------------------------------------+
| Field | Value |
+-------------------------------------+-----------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | ubuntu |
| OS-EXT-SRV-ATTR:hypervisor_hostname | ubuntu |
| OS-EXT-SRV-ATTR:instance_name | instance-0000000a |
| OS-EXT-STS:power_state | Running |
| OS-EXT-STS:task_state | None |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2019-09-27T13:05:14.000000 |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | public=172.24.4.213, 2001:db8::3c1 |
| adminPass | 94ZaJHBr7NXP |
| config_drive | |
| created | 2019-09-27T13:05:10Z |
| flavor | cirros256 (c1) |
| hostId | e49117b578d17a8939ca10059654c3f498e90b2397778d2403afb686 |
| id | bf0865af-0479-48c6-bb7e-954ee96b463e |
| image | cirros-0.4.0-x86_64-disk (c77c6f1a-0ea3-43c5-91a3-bb93a9a685b7) |
| key_name | None |
| name | vm2 |
| progress | 0 |
| project_id | 6a124352af224fab81f25dab21f1aa4e |
| properties | |
| security_groups | name='d...

Read more...

Revision history for this message
Balazs Gibizer (balazs-gibizer) wrote :

Opened a bug about the openstackclient part https://storyboard.openstack.org/#!/story/2006628

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (master)

Reviewed: https://review.opendev.org/684762
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=6954aacd54e85859fecde22ac04db1ce7601dd35
Submitter: Zuul
Branch: master

commit 6954aacd54e85859fecde22ac04db1ce7601dd35
Author: Stephen Finucane <email address hidden>
Date: Wed Sep 25 12:10:21 2019 +0100

    Stop silently ignoring invalid 'nova boot --hint' options

    The '--hint' option for 'nova boot' expects a key-value pair like so:

      nova boot --hint group=245e1dfe-2d0e-4139-80a9-fce124948896 ...

    However, the command doesn't complain if this isn't the case, meaning
    typos like the below aren't indicated to the user:

      nova boot --hint 245e1dfe-2d0e-4139-80a9-fce124948896

    Due to how we'd implemented this here, this ultimately results in us
    POSTing the following as part of the body to 'os-servers':

      {
        ...
        "OS-SCH-HNT:scheduler_hints": {
          "245e1dfe-2d0e-4139-80a9-fce124948896": null
        }
        ...
      }

    Which is unfortunately allowed and ignored by nova due to the use of
    'additionalProperties' in the schema [1]

    Do what we do for loads of other options and explicitly fail on invalid
    values.

    [1] https://github.com/openstack/nova/blob/19.0.0/nova/api/openstack/compute/schemas/servers.py#L142-L146

    Change-Id: I0f9f75cba68e7582d32d4aab2f8f077b4360d386
    Signed-off-by: Stephen Finucane <email address hidden>
    Closes-Bug: #1845322

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

Fix proposed to branch: stable/train
Review: https://review.opendev.org/685980

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (stable/stein)

Fix proposed to branch: stable/stein
Review: https://review.opendev.org/685981

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.opendev.org/685983

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to python-novaclient (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/685986

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to python-novaclient (master)

Reviewed: https://review.opendev.org/685986
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=48634ed51e64f10424eef5bfb18dc63eda051c1d
Submitter: Zuul
Branch: master

commit 48634ed51e64f10424eef5bfb18dc63eda051c1d
Author: Stephen Finucane <email address hidden>
Date: Tue Oct 1 15:43:26 2019 +0100

    Add release note for bug 1845322

    In change I0f9f75cba68e7582d32d4aab2f8f077b4360d386, we modified the
    behavior of the ``--hint`` option for the ``boot`` command. We want to
    backport this so add a release note to alert users to the change in
    behavior.

    Change-Id: I753e9a0cda1e118578373c519cf2fb2dd605a623
    Signed-off-by: Stephen Finucane <email address hidden>
    Related-Bug: #1845322

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (stable/train)

Reviewed: https://review.opendev.org/685980
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=33627242e8f845934bcc5affb616108a79d28cbe
Submitter: Zuul
Branch: stable/train

commit 33627242e8f845934bcc5affb616108a79d28cbe
Author: Stephen Finucane <email address hidden>
Date: Wed Sep 25 12:10:21 2019 +0100

    Stop silently ignoring invalid 'nova boot --hint' options

    The '--hint' option for 'nova boot' expects a key-value pair like so:

      nova boot --hint group=245e1dfe-2d0e-4139-80a9-fce124948896 ...

    However, the command doesn't complain if this isn't the case, meaning
    typos like the below aren't indicated to the user:

      nova boot --hint 245e1dfe-2d0e-4139-80a9-fce124948896

    Due to how we'd implemented this here, this ultimately results in us
    POSTing the following as part of the body to 'os-servers':

      {
        ...
        "OS-SCH-HNT:scheduler_hints": {
          "245e1dfe-2d0e-4139-80a9-fce124948896": null
        }
        ...
      }

    Which is unfortunately allowed and ignored by nova due to the use of
    'additionalProperties' in the schema [1]

    Do what we do for loads of other options and explicitly fail on invalid
    values.

    NOTE(stephenfin): This includes the release note first added separately
    in change I753e9a0cda1e118578373c519cf2fb2dd605a623.

    [1] https://github.com/openstack/nova/blob/19.0.0/nova/api/openstack/compute/schemas/servers.py#L142-L146

    Change-Id: I0f9f75cba68e7582d32d4aab2f8f077b4360d386
    Signed-off-by: Stephen Finucane <email address hidden>
    Closes-Bug: #1845322
    (cherry picked from commit 6954aacd54e85859fecde22ac04db1ce7601dd35)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (stable/stein)

Reviewed: https://review.opendev.org/685981
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=c7e793c22e72d4d426a6d10e9c2cfa426fedd365
Submitter: Zuul
Branch: stable/stein

commit c7e793c22e72d4d426a6d10e9c2cfa426fedd365
Author: Stephen Finucane <email address hidden>
Date: Wed Sep 25 12:10:21 2019 +0100

    Stop silently ignoring invalid 'nova boot --hint' options

    The '--hint' option for 'nova boot' expects a key-value pair like so:

      nova boot --hint group=245e1dfe-2d0e-4139-80a9-fce124948896 ...

    However, the command doesn't complain if this isn't the case, meaning
    typos like the below aren't indicated to the user:

      nova boot --hint 245e1dfe-2d0e-4139-80a9-fce124948896

    Due to how we'd implemented this here, this ultimately results in us
    POSTing the following as part of the body to 'os-servers':

      {
        ...
        "OS-SCH-HNT:scheduler_hints": {
          "245e1dfe-2d0e-4139-80a9-fce124948896": null
        }
        ...
      }

    Which is unfortunately allowed and ignored by nova due to the use of
    'additionalProperties' in the schema [1]

    Do what we do for loads of other options and explicitly fail on invalid
    values.

    NOTE(stephenfin): This includes the release note first added separately
    in change I753e9a0cda1e118578373c519cf2fb2dd605a623.

    [1] https://github.com/openstack/nova/blob/19.0.0/nova/api/openstack/compute/schemas/servers.py#L142-L146

    Change-Id: I0f9f75cba68e7582d32d4aab2f8f077b4360d386
    Signed-off-by: Stephen Finucane <email address hidden>
    Closes-Bug: #1845322
    (cherry picked from commit 6954aacd54e85859fecde22ac04db1ce7601dd35)
    (cherry picked from commit 33627242e8f845934bcc5affb616108a79d28cbe)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (stable/rocky)

Reviewed: https://review.opendev.org/685983
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=6a38838a412f7b4f7820eb98c82a7ced5299ee44
Submitter: Zuul
Branch: stable/rocky

commit 6a38838a412f7b4f7820eb98c82a7ced5299ee44
Author: Stephen Finucane <email address hidden>
Date: Wed Sep 25 12:10:21 2019 +0100

    Stop silently ignoring invalid 'nova boot --hint' options

    The '--hint' option for 'nova boot' expects a key-value pair like so:

      nova boot --hint group=245e1dfe-2d0e-4139-80a9-fce124948896 ...

    However, the command doesn't complain if this isn't the case, meaning
    typos like the below aren't indicated to the user:

      nova boot --hint 245e1dfe-2d0e-4139-80a9-fce124948896

    Due to how we'd implemented this here, this ultimately results in us
    POSTing the following as part of the body to 'os-servers':

      {
        ...
        "OS-SCH-HNT:scheduler_hints": {
          "245e1dfe-2d0e-4139-80a9-fce124948896": null
        }
        ...
      }

    Which is unfortunately allowed and ignored by nova due to the use of
    'additionalProperties' in the schema [1]

    Do what we do for loads of other options and explicitly fail on invalid
    values.

    NOTE(stephenfin): This includes the release note first added separately
    in change I753e9a0cda1e118578373c519cf2fb2dd605a623.

    [1] https://github.com/openstack/nova/blob/19.0.0/nova/api/openstack/compute/schemas/servers.py#L142-L146

    Change-Id: I0f9f75cba68e7582d32d4aab2f8f077b4360d386
    Signed-off-by: Stephen Finucane <email address hidden>
    Closes-Bug: #1845322
    (cherry picked from commit 6954aacd54e85859fecde22ac04db1ce7601dd35)
    (cherry picked from commit 33627242e8f845934bcc5affb616108a79d28cbe)
    (cherry picked from commit c7e793c22e72d4d426a6d10e9c2cfa426fedd365)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-novaclient 16.0.0

This issue was fixed in the openstack/python-novaclient 16.0.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-novaclient 13.0.2

This issue was fixed in the openstack/python-novaclient 13.0.2 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-novaclient 11.0.1

This issue was fixed in the openstack/python-novaclient 11.0.1 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.