Example #1
0
    def _is_volume_removed(self, volume, storage_pool):
        if volume.deviceNumber == 0:
            container = get_compute().get_container(docker_client(),
                                                    volume.instance)
            return container is None
        else:
            path = self._path_to_volume(volume)
            # Check for volmgr managed volume, must be done before "isHostPath"
            if volmgr.volume_exists(path):
                return False
            if volume.data.fields['isHostPath']:
                # If this is a host path volume, we'll never really remove it
                # from disk, so just report is as removed for the purpose of
                # handling the event.
                return True

            return not os.path.exists(path)
Example #2
0
    def _is_volume_removed(self, volume, storage_pool):
        if volume.deviceNumber == 0:
            container = get_compute().get_container(docker_client(),
                                                    volume.instance)
            return container is None
        else:
            path = self._path_to_volume(volume)
            # Check for volmgr managed volume, must be done before "isHostPath"
            if volmgr.volume_exists(path):
                return False
            if volume.data.fields['isHostPath']:
                # If this is a host path volume, we'll never really remove it
                # from disk, so just report is as removed for the purpose of
                # handling the event.
                return True

            return not os.path.exists(path)
Example #3
0
 def _do_volume_remove(self, volume, storage_pool, progress):
     if volume.deviceNumber == 0:
         container = get_compute().get_container(docker_client(),
                                                 volume.instance)
         if container is None:
             return
         remove_container(docker_client(), container)
     else:
         path = self._path_to_volume(volume)
         # Check for volmgr managed volume, must be done before "isHostPath"
         if volmgr.volume_exists(path):
             log.info("Deleting volmgr managed volume: %s" % path)
             volmgr.remove_volume(path)
             return
         if not volume.data.fields['isHostPath']:
             if os.path.exists(path):
                 log.info("Deleting volume: %s" % volume.uri)
                 shutil.rmtree(path)
Example #4
0
 def _do_volume_remove(self, volume, storage_pool, progress):
     if volume.deviceNumber == 0:
         container = get_compute().get_container(docker_client(),
                                                 volume.instance)
         if container is None:
             return
         remove_container(docker_client(), container)
     else:
         path = self._path_to_volume(volume)
         # Check for volmgr managed volume, must be done before "isHostPath"
         if volmgr.volume_exists(path):
             log.info("Deleting volmgr managed volume: %s" % path)
             volmgr.remove_volume(path)
             return
         if not volume.data.fields['isHostPath']:
             if os.path.exists(path):
                 log.info("Deleting volume: %s" % volume.uri)
                 shutil.rmtree(path)