OpenStack Image Registry and Delivery Service (Glance)

glance-control registry start tracebacks w/ IndexError

Reported by Pete Zaitcev on 2012-01-21
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Undecided
Mark McLoughlin

Bug Description

I wanted to test a trivial and obviously correct fix for bug 917438 properly, so I built and installed git HEAD. The configuration files are properly updated for the xxxx-paste.ini breakout (verified by inspection). But on start, this happens:

[root@kvm-rei zaitcev]# glance-control registry start
Traceback (most recent call last):
  File "/usr/bin/glance-control", line 218, in <module>
    do_start(server, conf, args)
  File "/usr/bin/glance-control", line 145, in do_start
    conf_file = conf.config_file[-1]
IndexError: list index out of range

This worked with Glance 2011.3 RPM packaged by markmc.

It seems to me that this code cannot possibly work, and I do not know how to fix it. A suggestion from author is necessary.

bin/glance-control does

if __name__ == '__main__':
    conf = config.GlanceConfigOpts(usage=USAGE)
    args = conf()
    server = args.pop(0).lower()
    ...........
            do_start(server, conf, args)
    try:
        if args and os.path.exists(args[0]):
            conf_file = os.path.abspath(os.path.expanduser(args[0]))
        else:
            # Assume paste config is in the last config file
            conf_file = conf.config_file[-1]
    except RuntimeError, err:
        sys.exit("Could not find any configuration file to use: %s" % err)

This fails because config_file can only be set when the paste configuration is processed, but this cannot be done until the server is known, which happens after the conf is constructed.

Note that although this configuration is one that does not set either flavour= or config_file= it is not the problem here. Problem is that glance-control loads the configuration before it knows the server.

Possibly related commit 57c4e9b6c686f1303c815698cc68b95bf9b033e7

Mark McLoughlin (markmc) on 2012-01-23
Changed in glance:
assignee: nobody → Mark McLoughlin (markmc)
status: New → In Progress
Mark McLoughlin (markmc) wrote :

Pete - I think the comment confused you a little here because it refers to "paste config", but the comment harks back to the day when glance's main config file was a paste config file

i.e. this code is brokenly trying to find the config file for the server it is starting

Pete Zaitcev (zaitcev) wrote :

Mark - if you hint how you think it is best to fix it, I think I can implement and test the fix, assuming you agree with my findings about the root cause.

Reviewed: https://review.openstack.org/3293
Committed: http://github.com/openstack/glance/commit/3b2ef8e29e21ce1c00c33de8f3521b3c7cf8d241
Submitter: Jenkins
Branch: master

commit 3b2ef8e29e21ce1c00c33de8f3521b3c7cf8d241
Author: Mark McLoughlin <email address hidden>
Date: Mon Jan 23 08:18:57 2012 +0000

    glance-control need not locate a server's config file (lp#919520)

    Before converting to cfg, glance-control would use find_config_file() to
    locate the servers config file if the user did not explicitly specify
    it.

    With the change over to cfg, we screwed that code up. However, we should
    instead just allow the server to locate its own config file rather than
    trying to guess what it will use.

    Change-Id: I422839ae4c684ff2de3a0a96dd54c6b74ce6df97

Changed in glance:
status: In Progress → Fix Committed
Pete Zaitcev (zaitcev) wrote :

I rebuilt an RPM from the git master, including the fix above, and now the following fails without a message:

[root@kvm-rei glance]# glance-control registry start
Removing stale pid file /var/run/glance/glance-registry.pid
Starting glance-registry
[root@kvm-rei glance]#

However, the registry server just disappears, leaving a stale PID file. Nothing in /var/log/glance/registry.log.

So, I'm unable to verify the fix until I figure that out. The patch looks ok, but...

Pete Zaitcev (zaitcev) wrote :

Fix confirmed to work.

Thierry Carrez (ttx) on 2012-01-25
Changed in glance:
milestone: none → essex-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in glance:
milestone: essex-3 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers