summaryrefslogtreecommitdiffstats
path: root/src/ceph-volume/ceph_volume/exceptions.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/ceph-volume/ceph_volume/exceptions.py
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/ceph-volume/ceph_volume/exceptions.py')
-rw-r--r--src/ceph-volume/ceph_volume/exceptions.py63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/ceph-volume/ceph_volume/exceptions.py b/src/ceph-volume/ceph_volume/exceptions.py
new file mode 100644
index 00000000..5c642948
--- /dev/null
+++ b/src/ceph-volume/ceph_volume/exceptions.py
@@ -0,0 +1,63 @@
+import os
+
+
+class ConfigurationError(Exception):
+
+ def __init__(self, cluster_name='ceph', path='/etc/ceph', abspath=None):
+ self.cluster_name = cluster_name
+ self.path = path
+ self.abspath = abspath or "%s.conf" % os.path.join(self.path, self.cluster_name)
+
+ def __str__(self):
+ return 'Unable to load expected Ceph config at: %s' % self.abspath
+
+
+class ConfigurationSectionError(Exception):
+
+ def __init__(self, section):
+ self.section = section
+
+ def __str__(self):
+ return 'Unable to find expected configuration section: "%s"' % self.section
+
+
+class ConfigurationKeyError(Exception):
+
+ def __init__(self, section, key):
+ self.section = section
+ self.key = key
+
+ def __str__(self):
+ return 'Unable to find expected configuration key: "%s" from section "%s"' % (
+ self.key,
+ self.section
+ )
+
+
+class SuffixParsingError(Exception):
+
+ def __init__(self, suffix, part=None):
+ self.suffix = suffix
+ self.part = part
+
+ def __str__(self):
+ return 'Unable to parse the %s from systemd suffix: %s' % (self.part, self.suffix)
+
+
+class SuperUserError(Exception):
+
+ def __str__(self):
+ return 'This command needs to be executed with sudo or as root'
+
+
+class SizeAllocationError(Exception):
+
+ def __init__(self, requested, available):
+ self.requested = requested
+ self.available = available
+
+ def __str__(self):
+ msg = 'Unable to allocate size (%s), not enough free space (%s)' % (
+ self.requested, self.available
+ )
+ return msg