Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions planb/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@
Q_MAIN_QUEUE = 'main'
Q_CLUSTER_QUEUE = os.environ.get('Q_CLUSTER_QUEUE', Q_MAIN_QUEUE)

# The worker queue for dutree tasks, limited to 1 worker. See how this is set
# The worker queue for dutree tasks, limited to 3 workers. See how this is set
# in the bqcluster management command.
Q_DUTREE_QUEUE = 'dutree'
Q_DUTREE_WORKERS = 1
Q_DUTREE_WORKERS = 3

Q_CLUSTER = {
'name': 'planb', # redis prefix AND default broker (yuck!)
Expand Down
21 changes: 18 additions & 3 deletions planb/storage/zfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@
logger = logging.getLogger(__name__)


class WorkonFailure(Exception):
pass


class LocalFilesetMissing(WorkonFailure):
"""Expected storage "fileset" was not found"""
pass


class LocalMountFailure(WorkonFailure):
"""Expected storage "fileset+snapshot" mount failed"""
# (maybe the snapshot doesn't exist)
pass


class PerformCommands:
@classmethod
def ensure_defaults(cls, config):
Expand Down Expand Up @@ -490,8 +505,8 @@ def begin_work(self, data_path=None):
break
else:
# No luck after the Nth attempt. Fail.
raise ValueError('Failed to work on {!r} ({})'.format(
path, self.name)) # FIXME: better exception
raise LocalMountFailure('Failed to work on {!r} ({})'.format(
path, self.name))

def end_work(self):
# Leave directory, so it can be unmounted.
Expand Down Expand Up @@ -519,7 +534,7 @@ def get_data_path(self):
if not hasattr(self, '_get_data_path'):
local_path = self.get_mount_path()
if not local_path:
raise ValueError(
raise LocalFilesetMissing(
'path {!r} for {!r} does not exist'.format(
local_path, self.name))
self._get_data_path = os.path.join(local_path, 'data')
Expand Down
Loading