Pike: 16.0.9 fresh install builds a non-functional Glance

Bug #1759552 reported by Florian Haas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack-Ansible
Fix Released
Undecided
Unassigned

Bug Description

Currently (as of 16.0.9), a default install that uses a the Glance file store with a local (i.e. non-NFS) /var/lib/glance/images yields the following error when trying to upload an image.

$ openstack image create --disk-format=qcow2 --container-format=bare --file cirros.qcow2 --public cirros
Error finding address for http://192.168.122.101:9292/v2/images/934f0b78-ba7e-48f7-a7fa-f612f56de130/file: [Errno 32] Broken pipe

The reason is that /var/lib/images in the Glance container is owned by root:root immediately post-install, rather than glance:glance. As far as i can tell, the reason for this is as follows:

https://review.openstack.org/#/q/I716c9fe35391629532e67e212d45ea27a5422d1b introduced a change that only creates the /var/lib/glance/directory if it does not already exist:

- name: Stat the images directory
  stat:
    path: "{{ glance_system_user_home }}/images/"
  changed_when: false
  register: images_stat

- name: Create glance images dir
  file:
    path: "{{ glance_system_user_home }}/images/"
    state: directory
    owner: "{{ glance_system_user_name }}"
    group: "{{ glance_system_group_name }}"
    mode: "0755"
  when:
    - not images_stat.stat.exists | default(false) | bool

However, in a default (non-NFS) install, that directory isn't created from within the container, it is bind-mounted into it from /openstack/log/<host>_glance_container-<suffix> — which the lxc-containers-create.yml playbook does create with root:root permissions. So in that scenario, images_stat.stat.exists is always true, and the "Create glance images dir" task never fixes up the incorrect permissions, and Glance breaks.

Note that this will only affect fresh installs. Anything that was set up with Pike before that change was introduced will work just fine, because there the images directory does already exist, and it has the correct ownership.

I don't know what's the best way to fix this. Though I have no way to test with NFS, I am assuming that just removing the when check (or, for that matter, the preceding stat task altogether, images_stat.stat.exists isn't used anywhere else) would probably break NFS-based configurations — I am guessing that that was the motivation behind https://review.openstack.org/#/q/I716c9fe35391629532e67e212d45ea27a5422d1b in the first place.

Revision history for this message
Florian Haas (fghaas) wrote :

I should probably add: deploying with 16.0.8 should be fine too; the problematic change was cherry-picked into stable/pike 4 commits after the 16.0.8 release was cut:

$ git describe 8885125fb65da72a2f4daf4a9a742670810ba8ed
16.0.8-4-g8885125

So, for anyone making a fresh install with 16.0.8 and then doing an in-place upgrade to 16.0.9, this problem should not affect them.

Revision history for this message
Florian Haas (fghaas) wrote :

Related: bug 1742951

(I'm not marking this one as a duplicate though, as the fix only made it into Queens, and this is still broken in Pike).

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-ansible-os_glance (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/557373

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-ansible-os_glance (stable/pike)

Reviewed: https://review.openstack.org/557373
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-os_glance/commit/?id=97d19586aa7437ffee35d1cf46eb13bc00949c40
Submitter: Zuul
Branch: stable/pike

commit 97d19586aa7437ffee35d1cf46eb13bc00949c40
Author: Major Hayden <email address hidden>
Date: Fri Jan 12 08:14:44 2018 -0600

    Set glance images dir owners each time

    After a deployment of Queens, glance's images directory comes up with
    ownership of `root:root` when it should be `glance:glance`. This
    prevents an end user from uploading an image.

    This patch removes the stat check of the images directory and always
    ensures the directory is created. If the directory already exists,
    the create task will ensure that the directory has its ownership
    set appropriately.

    Closes-Bug: 1759552
    Change-Id: I286d6fbdfdec932ea031916f5460710a23d68374
    (cherry picked from commit 16778e29be085d7485722e1bf8a3cb2bda7c22db)

tags: added: in-stable-pike
Florian Haas (fghaas)
Changed in openstack-ansible:
status: New → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/openstack-ansible-os_glance 16.0.11

This issue was fixed in the openstack/openstack-ansible-os_glance 16.0.11 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to openstack-ansible-os_glance (stable/rocky)

Related fix proposed to branch: stable/rocky
Review: https://review.openstack.org/633993

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

Related fix proposed to branch: master
Review: https://review.openstack.org/634110

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

Reviewed: https://review.openstack.org/634110
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-os_glance/commit/?id=414df67f868867d1b95a4e8c0b4d2f4a30923595
Submitter: Zuul
Branch: master

commit 414df67f868867d1b95a4e8c0b4d2f4a30923595
Author: Juri Hudolejev <email address hidden>
Date: Thu Jan 31 09:31:25 2019 +0200

    Fix Glance NFS mount point ownership

    Glance NFS mounts are owned by `root` and are not writable by `glance`
    user. Proposed change sets the `glance_nfs_client.local_path`
    directory ownership to
    `glance_system_user_name:glance_system_group_name` so that
    Glance can write to that.

    Change-Id: I226827d4f44da098961b16fd4450104d7a367205
    Closes-Bug: 1813300
    Related-Bug: 1759552

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on openstack-ansible-os_glance (stable/rocky)

Change abandoned by Jonathan Rosser (<email address hidden>) on branch: stable/rocky
Review: https://review.opendev.org/633993
Reason: this is included in stein/train/ussuri and rocky is now extended-maintainance

Changed in openstack-ansible:
status: Fix Committed → Fix Released
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.