CONF should not be read before ironic/common/service.prepare_service() call

Bug #1279774 reported by Max Lobur
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
Fix Released
Medium
Yuriy Zveryanskyy

Bug Description

Oslo config parses it's values from config when https://github.com/openstack/ironic/blob/master/ironic/common/service.py#L65 executed. It's called from prepare_service method of out services. So there are a few places where config read during parse time (before prepare_service) and therefore the options does not correspond to /etc/ironic/ironic.conf values, instead they always have defaults.

REST API service:
1. Config read
https://github.com/openstack/ironic/blob/master/ironic/api/config.py#L40
2. prepare_service (actual config parsing)
https://github.com/openstack/ironic/blob/master/ironic/cmd/api.py#L38

Conductor service:
1. Config read
https://github.com/openstack/ironic/blob/master/ironic/common/hash_ring.py#L49
https://github.com/openstack/ironic/blob/master/ironic/conductor/manager.py#L367
https://github.com/openstack/ironic/blob/master/ironic/conductor/manager.py#L372
2. prepare_service (actual config parsing)
https://github.com/openstack/ironic/blob/master/ironic/cmd/conductor.py#L39

I tested all these places with pdb and for each of them prepare_service follows the config read.

Revision history for this message
Haomeng,Wang (whaom) wrote :

A reference "Why does oslo.config have a CONF object? Global object SUCK!"

https://wiki.openstack.org/wiki/Oslo#Why_does_oslo.config_have_a_CONF_object.3F_Global_object_SUCK.21

Max Lobur (max-lobur)
description: updated
Changed in ironic:
assignee: nobody → Lucas Alvares Gomes (lucasagomes)
milestone: none → icehouse-3
Changed in ironic:
milestone: icehouse-3 → none
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic (master)

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

Changed in ironic:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic (master)

Reviewed: https://review.openstack.org/75883
Committed: https://git.openstack.org/cgit/openstack/ironic/commit/?id=45ce0adb0719c8fd76ff3a415f8bac02c294f2e5
Submitter: Jenkins
Branch: master

commit 45ce0adb0719c8fd76ff3a415f8bac02c294f2e5
Author: Lucas Alvares Gomes <email address hidden>
Date: Mon Feb 24 14:27:18 2014 +0000

    Do not use CONF as a default parameter value

    In the HashRing.__init__() the "replicas" parameter defaults to
    CONF.hash_distribution_replicas, the problem with this approach is
    that Ironic might not have loaded the configuration at the time this
    configuration is evaluated in the function definition. This patch fix
    the problem by using a placeholder value instead of the configuration
    option in the function definition.

    Partial-Bug: #1279774
    Change-Id: I5d8d7cd18a8a6b050f3aa448a337e0156e67ced5

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic (master)

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

Changed in ironic:
assignee: Lucas Alvares Gomes (lucasagomes) → Yuriy Zveryanskyy (yzveryanskyy)
aeva black (tenbrae)
Changed in ironic:
milestone: none → icehouse-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
aeva black (tenbrae) wrote :

Bug should be closed once https://review.openstack.org/#/c/81524/ lands.

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

Reviewed: https://review.openstack.org/81524
Committed: https://git.openstack.org/cgit/openstack/ironic/commit/?id=93b042c0be12f0530996f667e3a58543e952be74
Submitter: Jenkins
Branch: master

commit 93b042c0be12f0530996f667e3a58543e952be74
Author: Yuriy Zveryanskyy <email address hidden>
Date: Wed Mar 19 15:18:27 2014 +0200

    Fix 'spacing' parameters for periodic tasks

    conductor.manager module contains 'spacing' parameters for periodic
    tasks, they do not work because manager module imported before
    parsing config options.
    There is not such problem in Nova which uses create() method in class
    derived from common Service for lazy loading manager module.
    Because this derived class not needed for Ironic simple load_manager
    function added to common.service.

    Partial-Bug: #1279774
    Change-Id: Ib31024c8eaf75d38de09983459d86125847cdf30

aeva black (tenbrae)
Changed in ironic:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ironic:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ironic:
milestone: icehouse-rc1 → 2014.1
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.