check if export is already mounted before mounting it (LibvirtNFSVolumeDriver)

Bug #1280306 reported by Christian Berendt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Wishlist
Leandro Ignacio Costantino

Bug Description

At the moment there is no check in _mount_nfs if the export is already mounted. It will be tried to mount the export and if the export is already mounted an exception is thrown following in a WARNING message that the export is already mounted. This pollutes the logs with useless WARNING messages and if there is a real exception (for example the NFS export is not reachable) we only have a WARNING in the logs.

    def _mount_nfs(self, mount_path, nfs_share, options=None, ensure=False):
        """Mount nfs export to mount path."""
        utils.execute('mkdir', '-p', mount_path)

        # Construct the NFS mount command.
        nfs_cmd = ['mount', '-t', 'nfs']
        if CONF.libvirt.nfs_mount_options is not None:
            nfs_cmd.extend(['-o', CONF.libvirt.nfs_mount_options])
        if options is not None:
            nfs_cmd.extend(options.split(' '))
        nfs_cmd.extend([nfs_share, mount_path])

        try:
            utils.execute(*nfs_cmd, run_as_root=True)
        except processutils.ProcessExecutionError as exc:
            if ensure and 'already mounted' in exc.message:
                LOG.warn(_("%s is already mounted"), nfs_share)
            else:
                raise

affects: horizon → nova
Revision history for this message
Sahid Orentino (sahid-ferdjaoui) wrote :
tags: added: libvirt volumes
Changed in nova:
importance: Undecided → Wishlist
Changed in nova:
assignee: nobody → Leandro Ignacio Costantino (leandro-i-costantino)
status: New → Incomplete
status: Incomplete → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/75029
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=ce9913c6551b84d58860dfdf7ea91250d9acf148
Submitter: Jenkins
Branch: master

commit ce9913c6551b84d58860dfdf7ea91250d9acf148
Author: Leandro I. Costantino <email address hidden>
Date: Thu Feb 20 10:03:46 2014 -0300

    Check if nfs/glusterfs export is already mounted

    _mount_nfs() do not check if the nfs_share is already mounted on
    the same mnt path and pollutes logs with warnings about
    'mount.nfs: xxx busy or already mounted'.

    The patch will add the method is_mounted to libvirt/utils.py and
    use the findmnt tool to find if the same network share on the same target
    mount point is already mounted.
    If 'findmnt' is not available for any reason (part of utils-linux),
    the check will always return False.

    Closes-Bug: #1280306
    Change-Id: I1d7384ba2f1f1bb82bfbae96cca2772266d2583e

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-rc1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-rc1 → 2014.1
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.