glance-registry start report error

Bug #982787 reported by shake.chen
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
glance (Ubuntu)
Opinion
Undecided
Unassigned

Bug Description

last week I install gance and have no problem. but todoy

I use the newest glance package
root@node6:/var/log/glance# apt-cache policy glance
glance:
  Installed: 2012.1-0ubuntu2
  Candidate: 2012.1-0ubuntu2
  Version table:
 *** 2012.1-0ubuntu2 0
        500 http://cn.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status

when I restart glance-registry service

# service glance-registry restart

the log would show

2012-04-16 13:15:23 10595 INFO [sqlalchemy.engine.base.Engine] (1,)
2012-04-16 13:15:23 10595 INFO [sqlalchemy.engine.base.Engine] ROLLBACK
2012-04-16 13:15:23 10595 ERROR [glance.registry.db.api] (ProgrammingError) (1146, "Table 'glance.images' doesn't exist") 'SELECT images.created_at AS images_created_at, images.updated_at AS images_updated_at, images.deleted_at AS images_deleted_at, images.deleted AS images_deleted, images.id AS images_id, images.name AS images_name, images.disk_format AS images_disk_format, images.container_format AS images_container_format, images.size AS images_size, images.status AS images_status, images.is_public AS images_is_public, images.location AS images_location, images.checksum AS images_checksum, images.min_disk AS images_min_disk, images.min_ram AS images_min_ram, images.owner AS images_owner, images.protected AS images_protected \nFROM images \n LIMIT %s' (1,)
2012-04-16 13:15:23 10595 ERROR [glance.registry.db.api] Could not ensure database connection and consistency. Ensure database configuration and permissions are correct and database has been migrated since last upgrade by running 'glance-manage db_sync'

when I run

root@node6:/var/log/glance# glance index
Failed to show index. Got error:
The request returned 500 Internal Server Error

The response body:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 336, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 210, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 279, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1086, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1055, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/keystone/middleware/auth_token.py", line 176, in __call__
    return self.app(env, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 210, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 279, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1086, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1055, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 210, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 477, in __call__
    request, **action_args)
  File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 494, in dispatch
    return method(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 134, in index
    images = registry.get_images_list(req.context, **params)
  File "/usr/lib/python2.7/dist-packages/glance/registry/__init__.py", line 129, in get_images_list
    return c.get_images(**kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/registry/client.py", line 77, in get_images
    res = self.do_request("GET", "/images", params=params)
  File "/usr/lib/python2.7/dist-packages/glance/common/client.py", line 58, in wrapped
    return func(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/common/client.py", line 420, in do_request
    headers=headers)
  File "/usr/lib/python2.7/dist-packages/glance/common/client.py", line 75, in wrapped
    return func(self, method, url, body, headers)
  File "/usr/lib/python2.7/dist-packages/glance/common/client.py", line 557, in _do_request
    raise exception.ClientConnectionError(e)
ClientConnectionError: There was an error connecting to a server
Details: [Errno 111] ECONNREFUSED

root@node6:/var/log/glance#

Tags: openstack
Revision history for this message
shake.chen (shake-chen) wrote :

Hi

before I use

root@node6:~# apt-cache policy glance
glance:
  Installed: 2012.1-0ubuntu1
  Candidate: 2012.1-0ubuntu1
  Version table:
 *** 2012.1-0ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status

install and have no problem.

the newest package have problem.

root@node6:/var/log/glance# apt-cache policy glance
glance:
  Installed: 2012.1-0ubuntu2
  Candidate: 2012.1-0ubuntu2
  Version table:
 *** 2012.1-0ubuntu2 0
        500 http://cn.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status

Revision history for this message
Chang Wang (wangchang365) wrote :

i have met the same problem,may somebody help me ???

tags: added: openstack
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in glance (Ubuntu):
status: New → Confirmed
Revision history for this message
ZhengPeng Hou (zhengpeng-hou) wrote :

glance (2012.1-0ubuntu2) precise; urgency=low

  [ Adam Gandelman ]
  * debian/patches/disable_db_table_auto_create.patch: Disable auto-creation
    of database schema at service start, inspect for consistenty and advise
    running manual migrations instead.

Changed in glance (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
shake.chen (shake-chen) wrote :

the problem can be manual

I install phpmyadmin login ,delete the table in glance.

root@node6:~# glance-manage version_control 0
root@node6:~# glance-manage db_sync
/usr/lib/python2.7/dist-packages/glance/registry/db/migrate_repo/versions/003_add_disk_format.py:47: SADeprecationWarning: useexisting is deprecated. Use extend_existing.
  useexisting=True)
root@node6:~# clear

root@node6:~# service glance-api restart && service glance-registry restart
glance-api stop/waiting
glance-api start/running, process 13321
stop: Unknown instance:
glance-registry start/running, process 13327
root@node6:~# glance index
root@node6:~#

Revision history for this message
Marco CONSONNI (marco-consonni) wrote :

I experimented the same problem when I tried to configure MySql database.

After installing glance with

-- apt-get install glance

I started all the services with

-- glance-control all start

Everything seemde to be OK.

Only some complains from the scrubber, as reported in the log file (scrubber.log)

2012-04-16 13:24:02 7768 ERROR [glance.store.filesystem] Could not find filesystem_store_datadir in configuration options.
2012-04-16 13:24:02 7768 ERROR [glance.store.base] Failed to configure store correctly. Disabling add method.
2012-04-16 13:24:02 7768 ERROR [glance.store.s3] Could not find s3_store_host in configuration options.
2012-04-16 13:24:02 7768 ERROR [glance.store.base] Failed to configure store correctly. Disabling add method.
2012-04-16 13:24:02 7768 ERROR [glance.store.swift] Could not find swift_store_auth_address in configuration options.
2012-04-16 13:24:02 7768 ERROR [glance.store.base] Failed to configure store correctly. Disabling add method.

But I think this is not a DB problem: maybe it's a problem related to the storage back-end configuration.

---
Then I tried to use MySQL for the registry.

I prepared a SQL DB (as reported here http://docs.openstack.org/trunk/openstack-compute/install/content/configure-glance-mysql.html) and I modified glance-registry.conf (as reported here http://glance.openstack.org/configuring.html).

I restarted all the services and I got the error reported at the beginning of this bug report.

I presume the problem is in the DB that is not migrated from sqlite to MySQL.

Could you possibly indicate how to do that manually or to create MySQL DB tables and indexes from scratch?

Changed in glance (Ubuntu):
status: Invalid → Opinion
status: Opinion → Invalid
Revision history for this message
Marco CONSONNI (marco-consonni) wrote :

Hello,

I looked into the problem a little further and it seems to me that this is a genuine bug.
If I switch from sqlite (that works) to MySQL and restart all the services, I get the errors I illustrated in my previous post.

The only way I found for surpassing the problem is to manually define into MySQL all the tables I find in sqlite and restart all the services.

At this point glance-registry does not complain any longer.

The following is the MySQL DDL I obtained by reverse-engineering sqlite schema:

CREATE TABLE images (
        id VARCHAR(36) NOT NULL,
        name VARCHAR(255),
        size BIGINT,
        status VARCHAR(30) NOT NULL,
        is_public BOOL NOT NULL,
        location TEXT,
        created_at DATETIME NOT NULL,
        updated_at DATETIME,
        deleted_at DATETIME,
        deleted BOOL NOT NULL,
        disk_format VARCHAR(20),
        container_format VARCHAR(20),
        checksum VARCHAR(32),
        owner VARCHAR(255),
        min_disk INTEGER,
        min_ram INTEGER,
        protected BOOL,
        PRIMARY KEY (id),
        CHECK (is_public IN (0, 1)),
        CHECK (deleted IN (0, 1))
);

CREATE TABLE image_members (
        id INTEGER NOT NULL AUTO_INCREMENT
        ,image_id VARCHAR(36) NOT NULL
        ,member VARCHAR(255) NOT NULL
        ,can_share BOOL NOT NULL
        ,created_at DATETIME NOT NULL
        ,updated_at DATETIME
        ,deleted_at DATETIME
        ,deleted BOOL NOT NULL
        ,UNIQUE (image_id, member)
        ,CHECK (can_share IN (0, 1))
        ,CHECK (deleted IN (0, 1))
        ,PRIMARY KEY (id)
        ,FOREIGN KEY(image_id) REFERENCES images (id)
);

CREATE TABLE image_properties (
        id INTEGER NOT NULL AUTO_INCREMENT,
        image_id VARCHAR(36) NOT NULL,
        name VARCHAR(255) NOT NULL,
        value TEXT,
        created_at DATETIME NOT NULL,
        updated_at DATETIME,
        deleted_at DATETIME,
        deleted BOOL NOT NULL,
        PRIMARY KEY (id),
        CHECK (deleted IN (0, 1)),
        UNIQUE (image_id, name),
        FOREIGN KEY(image_id) REFERENCES images (id)
);

CREATE INDEX ix_image_properties_name ON image_properties (name)
CREATE INDEX ix_image_members_deleted ON image_members (deleted);
CREATE INDEX ix_image_members_image_id ON image_members (image_id);
CREATE INDEX ix_image_members_image_id_member ON image_members (image_id, member);
CREATE INDEX ix_images_deleted ON images (deleted);
CREATE INDEX ix_images_is_public ON images (is_public);

Note that I submitted these instructions into mysql by connecting with command "mysql -u <myGlanceUser> -p <MyGlanceDB>"

Changed in glance (Ubuntu):
status: Invalid → Opinion
Revision history for this message
Adam Gandelman (gandelman-a) wrote :

To provide consistency with other Openstack components, the Ubuntu packages now require a manual run of database migrations to initialize schema on a new database, or when upgrading. This is handled by packaging if configured to use sqlite (default) but is required when reconfigured to use an external db or non-default sqlite database. As mentioned already, a new database:

glance-manage version_control 0
glance-manage db_sync

For more context please see post at http://<email address hidden>/msg09969.html

Revision history for this message
Marco CONSONNI (marco-consonni) wrote :

I do agree, the reported instructions fix the problem.
Thanks.

Brian Waldon (bcwaldon)
no longer affects: glance
Revision history for this message
Carlos Borroto (cjav) wrote :
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.