Comment 2 for bug 1276911

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.