Swift-storage charm doesn't add disks to fstab

Bug #1276911 reported by Brad Marshall
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
swift-storage (Juju Charms Collection)
Fix Released
Medium
Jorge Niedbalski

Bug Description

The latest version of swift-storage - I tested using r24 - doesn't setup fstab entries for any of the block devices. This means once the swift-storage nodes reboot, the filesystems don't mount.

The code in setup_storage() in swift_storage_utils.py calls mount (from charmhelpers.core.host) with persist=True, but looking at the code in host.py (line 151 onwards in my copy), we see:

    if persist:
        # TODO: update fstab
        pass

Either a fix needs to be made to charmhelpers, or a work around put in place in swift-storage charm to not rely on unfinished code.

Please let me know if you need any further information.

Related branches

Changed in swift-storage (Juju Charms Collection):
assignee: nobody → charmers (charmers)
Darryl Weaver (dweaver)
Changed in swift-storage (Juju Charms Collection):
status: New → Confirmed
Revision history for this message
Darryl Weaver (dweaver) wrote :

I've tried going back to revision 18 and this bug is still there, no fstab entry and so the filesystems don't mount on reboot.

Revision history for this message
Darryl Weaver (dweaver) wrote :

As stated above, host.py needs to be updated for the mount and umount functions:

def mount(device, mountpoint, options=None, persist=False):
    """Mount a filesystem at a particular mountpoint"""
    cmd_args = ['mount']
    if options is not None:
        cmd_args.extend(['-o', options])
    cmd_args.extend([device, mountpoint])
    try:
        subprocess.check_output(cmd_args)
    except subprocess.CalledProcessError, e:
        log('Error mounting {} at {}\n{}'.format(device, mountpoint, e.output))
        return False
    if persist:
        # TODO: update fstab
        pass
    return True

def umount(mountpoint, persist=False):
    """Unmount a filesystem"""
    cmd_args = ['umount', mountpoint]
    try:
        subprocess.check_output(cmd_args)
    except subprocess.CalledProcessError, e:
        log('Error unmounting {}\n{}'.format(mountpoint, e.output))
        return False
    if persist:
        # TODO: update fstab
        pass
    return True

The only issue I see here is that the file system type is not passed to the function and the fstab entry wants the file system type also (in this case xfs), whereas mount can be used without the file system type.
I also cannot find any other charm using this charm helper section, e.g. the ceph charm does not use it and hence does not see the same issue after a reboot.

Darryl Weaver (dweaver)
tags: added: se-demolab
Revision history for this message
James Page (james-page) wrote :

The swift-storage charm has never persisted mount points; but this really does need to happen.

Might not be that trivial to implement due to daemons startup timing.

Changed in swift-storage (Juju Charms Collection):
importance: Undecided → Medium
status: Confirmed → Triaged
tags: added: landscape
Changed in swift-storage (Juju Charms Collection):
status: Triaged → In Progress
Changed in swift-storage (Juju Charms Collection):
assignee: charmers (charmers) → Jorge Niedbalski (niedbalski)
Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

OK, fix/tests committed. Linked branch, please review.

Changed in swift-storage (Juju Charms Collection):
status: In Progress → Fix Committed
Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

Merged on branch, persistence option is available on the charm.

Changed in swift-storage (Juju Charms Collection):
status: Fix Committed → Fix Released
James Page (james-page)
Changed in swift-storage (Juju Charms Collection):
status: Fix Released → Fix Committed
tags: added: cloud-installer
Revision history for this message
pootow (pootow-7) wrote :

There is also a bug in trusty version. The fstab is indeed writen, but the file system type is wrong as the hook made a `xfs` fs but the fstab is writen as `ext3` and this is a very serious problem because this will prevent the box from boot!!

Changed in swift-storage (Juju Charms Collection):
status: Fix Committed → New
Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

@pootow,

Could you show me your resulting fstab file? How are you sure that the hook made a 'xfs' entry?

Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

@pootow, @jamespage

I can see a divergence between the changes made by me ( lp:~niedbalski/charms/precise/swift-storage/add-fstab-persist) and the changes proposed on lp:~james-page/charms/trusty/swift-storage/fstab-persist. Particularly the following lines, this will cause the @pootow reported error:

 def determine_block_devices():
@@ -181,8 +189,7 @@
         _dev = os.path.basename(dev)
         _mp = os.path.join('/srv', 'node', _dev)
         mkdir(_mp, owner='swift', group='swift')
- mount(dev, '/srv/node/%s' % _dev, persist=True,
- filesystem="xfs")
+ mount(dev, '/srv/node/%s' % _dev, persist=True)

@jamespage, Any chance to update the code to reflect the original changes?

Revision history for this message
pootow (pootow) wrote :

Sorry for the late response, here is my fstab:

root@node2:~# cat /etc/fstab
LABEL=cloudimg-rootfs / ext4 defaults 0 0
/dev/sdb /srv/node/sdb ext3 defaults 0 0
/dev/sdc /srv/node/sdc ext3 defaults 0 0
/dev/sdd /srv/node/sdd ext3 defaults 0 0

Chris Glass (tribaal)
Changed in swift-storage (Juju Charms Collection):
status: New → In Progress
Chris Glass (tribaal)
Changed in swift-storage (Juju Charms Collection):
status: In Progress → Fix Committed
tags: added: openstack
tags: added: cts
Changed in swift-storage (Juju Charms Collection):
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.