Esempio n. 1
0
 def _teardown_chroot_mounts(self):
     if not self.plugin_config.get('recursive_unmount', False):
         if self.plugin_config.get('configure_mounts', True):
             for mountdef in reversed(self.plugin_config.chroot_mounts):
                 dev, fstype, mountpoint, options = mountdef
                 mountpoint = mountpoint.lstrip('/')
                 mountpoint = os.path.join(self.root_mountspec.mountpoint, mountpoint)
                 mountspec = MountSpec(dev, fstype, mountpoint, options)
                 log.debug('Attempting to unmount {0.mountpoint}'.format(mountspec))
                 try:
                     self._unmount(mountspec)
                 except VolumeException as ve:
                     log.critical('Unable to unmount {0.mountpoint}'.format(mountspec))
                     return False
             log.debug('Checking for stray mounts')
             for mountpoint in lifo_mounts(self.root_mountspec.mountpoint):
                 log.debug('Stray mount found: {0}, attempting to unmount'.format(mountpoint))
                 try:
                     self._unmount(mountpoint)
                 except VolumeException as ve:
                     log.critical('Unable to unmount {0}'.format(mountpoint))
                     return False
     if not self._unmount_root():
         err = 'Unable to unmount root volume at {0.mountpoint)'
         err = err.format(self.root_mountspec)
         log.critical(err)
         return False
     log.debug('Teardown of chroot mounts succeeded!')
     return True
 def _teardown_chroot_mounts(self):
     if not self.plugin_config.get('recursive_unmount', False):
         if self.plugin_config.get('configure_mounts', True):
             for mountdef in reversed(self.plugin_config.chroot_mounts):
                 dev, fstype, mountpoint, options = mountdef
                 mountpoint = mountpoint.lstrip('/')
                 mountpoint = os.path.join(self.root_mountspec.mountpoint,
                                           mountpoint)
                 mountspec = MountSpec(dev, fstype, mountpoint, options)
                 log.debug('Attempting to unmount {0.mountpoint}'.format(
                     mountspec))
                 try:
                     self._unmount(mountspec)
                 except VolumeException as ve:
                     log.critical('Unable to unmount {0.mountpoint}'.format(
                         mountspec))
                     return False
             log.debug('Checking for stray mounts')
             for mountpoint in lifo_mounts(self.root_mountspec.mountpoint):
                 log.debug(
                     'Stray mount found: {0}, attempting to unmount'.format(
                         mountpoint))
                 try:
                     self._unmount(mountpoint)
                 except VolumeException as ve:
                     log.critical(
                         'Unable to unmount {0}'.format(mountpoint))
                     return False
     if not self._unmount_root():
         err = 'Unable to unmount root volume at {0.mountpoint)'
         err = err.format(self.root_mountspec)
         log.critical(err)
         return False
     log.debug('Teardown of chroot mounts succeeded!')
     return True
Esempio n. 3
0
 def _teardown_chroot_mounts(self):
     config = self._config.plugins[self.full_name]
     for mountdef in reversed(config.chroot_mounts):
         dev, fstype, mountpoint, options = mountdef
         mountspec = MountSpec(
             dev, fstype,
             os.path.join(self._mountpoint, mountpoint.lstrip('/')),
             options)
         log.debug('Attempting to unmount {0}'.format(mountspec))
         if not mounted(mountspec.mountpoint):
             log.warn('{0} not mounted'.format(mountspec.mountpoint))
             continue
         result = unmount(mountspec.mountpoint)
         if not result.success:
             log.error(
                 'Unable to unmount {0.mountpoint}: {1.stderr}'.format(
                     mountspec, result))
             return False
     log.debug('Checking for stray mounts')
     for mountpoint in lifo_mounts(self._mountpoint):
         log.debug('Stray mount found: {0}, attempting to unmount'.format(
             mountpoint))
         result = unmount(mountpoint)
         if not result.success:
             log.error(
                 'Unable to unmount {0.mountpoint}: {1.stderr}'.format(
                     mountspec, result))
             return False
     log.debug('Teardown of chroot mounts succeeded!')
     return True
Esempio n. 4
0
 def _teardown_chroot_mounts(self):
     config = self._config.plugins[self.full_name]
     for mountdef in reversed(config.chroot_mounts):
         dev, fstype, mountpoint, options = mountdef
         mountspec = MountSpec(dev, fstype, os.path.join(self._mountpoint, mountpoint.lstrip('/')), options)
         log.debug('Attempting to unmount {0}'.format(mountspec))
         if not mounted(mountspec.mountpoint):
             log.warn('{0} not mounted'.format(mountspec.mountpoint))
             continue
         result = unmount(mountspec.mountpoint)
         if not result.success:
             log.error('Unable to unmount {0.mountpoint}: {1.stderr}'.format(mountspec, result))
             return False
     log.debug('Checking for stray mounts')
     for mountpoint in lifo_mounts(self._mountpoint):
         log.debug('Stray mount found: {0}, attempting to unmount'.format(mountpoint))
         result = unmount(mountpoint)
         if not result.success:
             log.error('Unable to unmount {0.mountpoint}: {1.stderr}'.format(mountspec, result))
             return False
     log.debug('Teardown of chroot mounts succeeded!')
     return True