'Ensure a mountpoint is available for an attachment, mounting it
if necessary.
If this is the first attachment on this mountpoint, we will mount it
with:
mount -t <fstype> <options> <export> <mountpoint>
:param fstype: The filesystem type to be passed to mount command.
:param export: The type-specific identifier of the filesystem to be
mounted. e.g. for nfs \'host.example.com:/mountpoint\'.
:param vol_name: The name of the volume on the remote filesystem.
:param mountpoint: The directory where the filesystem will be
mounted on the local compute host.
:param instance: The instance the volume will be attached to.
:param options: An arbitrary list of additional arguments to be
passed to the mount command immediate before export
and mountpoint.'

def mount(self, fstype, export, vol_name, mountpoint, instance, options):

    LOG.debug('_HostMountState.mount(fstype=%(fstype)s,    export=%(export)s,    vol_name=%(vol_name)s,    %(mountpoint)s,    options=%(options)s)    generation    %(gen)s', {'fstype': fstype, 'export': export, 'vol_name': vol_name, 'mountpoint': mountpoint, 'options': options, 'gen': self.generation})
    with self._get_locked(mountpoint) as mount:
        if (not os.path.ismount(mountpoint)):
            LOG.debug('Mounting    %(mountpoint)s    generation    %(gen)s', {'mountpoint': mountpoint, 'gen': self.generation})
            utils.execute('mkdir', '-p', mountpoint)
            mount_cmd = ['mount', '-t', fstype]
            if (options is not None):
                mount_cmd.extend(options)
            mount_cmd.extend([export, mountpoint])
            try:
                utils.execute(run_as_root=True, *mount_cmd)
            except Exception:
                if os.path.ismount(mountpoint):
                    LOG.exception(_('Error    mounting    %(fstype)s    export    %(export)s    on    %(mountpoint)s.    Continuing    because    mountpount    is    mounted    despite    this.'), {'fstype': fstype, 'export': export, 'mountpoint': mountpoint})
                else:
                    del self.mountpoints[mountpoint]
                    raise
        mount.add_attachment(vol_name, instance.uuid)
    LOG.debug('_HostMountState.mount()    for    %(mountpoint)s    generation    %(gen)s    completed    successfully', {'mountpoint': mountpoint, 'gen': self.generation})
