swift-storage charm generates invalid fstab entry

Bug #1762105 reported by Mitchell Monahan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Swift Storage Charm
Fix Released
High
Liam Young

Bug Description

When a swift-storage unit is configured using a path for a disk image as the 'block-device' configuration value (ie. block-device: '/var/local/swift.img|1G'), the hook fails with a message saying the 'config-changed' hook failed. After some investigation into the issue, I determined that the fstab entry being generated is invalid, causing the hook to fail with the following error (truncated to the last few lines:

  File "/var/lib/juju/agents/unit-swift-storage-1/charm/hooks/charmhelpers/core/fstab.py", line 79, in entries
    yield self._hydrate_entry(line)
  File "/var/lib/juju/agents/unit-swift-storage-1/charm/hooks/charmhelpers/core/fstab.py", line 70, in _hydrate_entry
    line.strip("\n").split()))
TypeError: __init__() takes at most 7 arguments (8 given)

After modifying the script to display the values of 'line', I see that it is generating an invalid fstab entry for the script with an extra space in it on the column for options:
/var/local/swift.img /srv/node/loop0 xfs loop, defaults 0 0

After doing a quick 'grep -nr "loop, "', I determined this is from lib/swift_storage_utils.py line 437. However, after modifying the value of the 'options' variable to be 'loop,defaults' instead of 'loop, defaults' as a temporary workaround until this was fixed upstream, I'm still getting the same generated fstab entry.

Revision history for this message
Liam Young (gnuoy) wrote :

Attempting to reproduce this

Liam Young (gnuoy)
Changed in charm-swift-storage:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Liam Young (gnuoy)
Revision history for this message
Liam Young (gnuoy) wrote :

Hi Mitchell, thanks for you bug report an analysis of the issue. I think the change you propose will fix the issue which makes me wonder whether you're also seeing Bug #1762390 ?

Revision history for this message
Mitchell Monahan (soccermitchy) wrote :

I'm not seeing that bug at all, unless it occurs after where I was having my issue. If it's after where the bug I found is, then I can't test it since, as I mentioned in my bug report, even after modifying that line of code I still seem to have the error that I pasted.

Revision history for this message
Liam Young (gnuoy) wrote :

Reproduce:
$ cat config.yaml
swift-storage:
    zone: 1
    block-device: '/var/local/swift.img|1G'

$ juju deploy --series xenial --config config.yaml \
  cs:~openstack-charmers-next/swift-storage-283

$ juju run --unit swift-storage/0 "grep swift.img /etc/fstab"
/var/local/swift.img /srv/node/loop0 xfs loop, defaults 0 0

$ juju run --unit swift-storage/0 "df -h /srv/node/loop0"
Filesystem Size Used Avail Use% Mounted on
/dev/loop1 1014M 33M 982M 4% /srv/node/loop0

$ juju run --unit swift-storage/0 "umount /srv/node/loop0"

$ juju run --unit swift-storage/0 "mount /srv/node/loop0"
mount: /etc/fstab: parse error: ignore entry at line 4.
mount: can't find /srv/node/loop0 in /etc/fstab

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

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

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

Reviewed: https://review.openstack.org/559988
Committed: https://git.openstack.org/cgit/openstack/charm-swift-storage/commit/?id=f75bd9762ace2ed4c06eb9f12abe128749e8874b
Submitter: Zuul
Branch: master

commit f75bd9762ace2ed4c06eb9f12abe128749e8874b
Author: Liam Young <email address hidden>
Date: Tue Apr 10 10:22:16 2018 +0000

    Fix broken fstab entry

    Whitespace between the fstab option is not valid, remove it.

    Change-Id: I1be789acc7bf92811f8d4e2c0f0661ebf3be1678
    Closes-Bug: #1762105

Changed in charm-swift-storage:
status: In Progress → Fix Committed
James Page (james-page)
Changed in charm-swift-storage:
milestone: none → 18.05
David Ames (thedac)
Changed in charm-swift-storage:
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.