← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1280306] [NEW] check if export is already mounted before mounting it (LibvirtNFSVolumeDriver)

 

Public bug reported:

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: nova
     Importance: Undecided
         Status: New

** Project changed: horizon => nova

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1280306

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

Status in OpenStack Compute (Nova):
  New

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1280306/+subscriptions


Follow ups

References