_get_host_sysinfo_serial_os fails with different exceptions if the machine-id file is not present or if it is empty

Bug #1475353 reported by Andrea Rosa
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Andrea Rosa

Bug Description

When the sysinfo_serial config parameter for the libvirt driver is set to 'os', the defined behavior is:
- return the value found in /etc/machine-id file or
- return an error if the file is not present.
There is an additional scenario where the file is present but it is empty
(https://bugs.launchpad.net/ubuntu/+source/nova/+bug/1413293) in that case we want nova to behave as if the file was missed.
At the moment the missing file and an empty file return different exceptions:
- IOError for a missing file
- IndexError for an empty file
Both of these errors are too general and don't give a big help in debugging the issue.

Please note that we do not want to fix the issue about a missing/empty machine-id file, that is something related to a bad OS installation/configuration or a bad image, the proposed fix is just to keep nova behaves consistently and giving back to the user a more clear and precise error.

Changed in nova:
assignee: nobody → Andrea Rosa (andrea-rosa-m)
tags: added: low-hanging-fruit
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/202640

Changed in nova:
status: New → In Progress
summary: - _get_host_sysinfo_serial_os fails if the machine-id file is empty
+ _get_host_sysinfo_serial_os fails with different exceptions if the file
+ is not present or if it is empty
description: updated
summary: - _get_host_sysinfo_serial_os fails with different exceptions if the file
- is not present or if it is empty
+ _get_host_sysinfo_serial_os fails with different exceptions if the
+ machine-id file is not present or if it is empty
Changed in nova:
assignee: Andrea Rosa (andrea-rosa-m) → Alexis Lee (alexisl)
Changed in nova:
assignee: Alexis Lee (alexisl) → Andrea Rosa (andrea-rosa-m)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit a118c155f47711a2d4ba8aee7a6b8849a62de4bb
Author: Andrea Rosa <email address hidden>
Date: Thu Jul 16 16:12:14 2015 +0100

    Raise NovaException for missing/empty machine-id

    When the sysinfo_serial config parameter is set to 'os', Nova tries to
    get the UUID for the host operating system from the /etc/machine-id
    file. Currently if the file is missing, Nova return an IOError
    exception. If the file is present but empty, Nova will return an
    IndexError exception.

    We want to have the same behaviour in both cases and return an error
    with clearer and more useful information. This patch makes Nova return
    a NovaException when the machine-id file is either missing or empty.

    Closes-Bug: 1475353
    Change-Id: I2b163d6a42f66ab660c3728b1e29b4b64efbceba

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → liberty-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: liberty-3 → 12.0.0
Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → High
tags: added: libvirt
Changed in nova:
importance: High → Medium
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.