Exemple #1
0
    def _mount(self):
        if self._config.volume_dir.startswith(('~', '/')):
            self._volume_root = os.path.expanduser(self._config.volume_dir)
        else:
            self._volume_root = os.path.join(self._config.aminator_root,
                                             self._config.volume_dir)
        self._mountpoint = os.path.join(self._volume_root,
                                        os.path.basename(self._dev))
        if not os.path.exists(self._mountpoint):
            os.makedirs(self._mountpoint)

        if not mounted(self._mountpoint):
            # Handle optional partition
            dev = self._dev
            if self._blockdevice.partition is not None:
                dev = '{0}{1}'.format(dev, self._blockdevice.partition)

            mountspec = MountSpec(dev, None, self._mountpoint, None)

            result = mount(mountspec)
            if not result.success:
                msg = 'Unable to mount {0.dev} at {0.mountpoint}: {1}'.format(
                    mountspec, result.result.std_err)
                log.critical(msg)
                raise VolumeException(msg)
        log.debug(
            'Mounted {0.dev} at {0.mountpoint} successfully'.format(mountspec))
Exemple #2
0
 def _mount(self, mountspec):
     if not mounted(mountspec):
         result = mount(mountspec)
         if not result.success:
             msg = 'Unable to mount {0.dev} at {0.mountpoint}: {1}'.format(mountspec, result.result.std_err)
             log.critical(msg)
             return False
     log.debug('Device {0.dev} mounted at {0.mountpoint}'.format(mountspec))
     return True
 def _mount(self, mountspec):
     if not mounted(mountspec):
         result = mount(mountspec)
         if not result.success:
             msg = 'Unable to mount {0.dev} at {0.mountpoint}: {1}'.format(
                 mountspec, result.result.std_err)
             log.critical(msg)
             return False
     log.debug('Device {0.dev} mounted at {0.mountpoint}'.format(mountspec))
     return True
Exemple #4
0
 def _configure_chroot_mounts(self):
     config = self._config.plugins[self.full_name]
     for mountdef in config.chroot_mounts:
         dev, fstype, mountpoint, options = mountdef
         mountspec = MountSpec(dev, fstype, os.path.join(self._mountpoint, mountpoint.lstrip('/')), options)
         log.debug('Attempting to mount {0}'.format(mountspec))
         if not mounted(mountspec.mountpoint):
             result = mount(mountspec)
             if not result.success:
                 log.critical('Unable to configure chroot: {0.std_err}'.format(result.result))
                 return False
     log.debug('Mounts configured')
     return True
Exemple #5
0
    def _mount(self):
        if self._config.volume_dir.startswith(('~', '/')):
            self._volume_root = os.path.expanduser(self._config.volume_dir)
        else:
            self._volume_root = os.path.join(self._config.aminator_root, self._config.volume_dir)
        self._mountpoint = os.path.join(self._volume_root, os.path.basename(self._dev))
        if not os.path.exists(self._mountpoint):
            os.makedirs(self._mountpoint)

        if not mounted(self._mountpoint):
            mountspec = MountSpec(self._dev, None, self._mountpoint, None)
            result = mount(mountspec)
            if not result.success:
                msg = 'Unable to mount {0.dev} at {0.mountpoint}: {1}'.format(mountspec, result.result.std_err)
                log.critical(msg)
                raise VolumeException(msg)
        log.debug('Mounted {0.dev} at {0.mountpoint} successfully'.format(mountspec))