]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume exceptions create an error for size allocations
authorAlfredo Deza <adeza@redhat.com>
Tue, 22 May 2018 16:57:19 +0000 (12:57 -0400)
committerAndrew Schoen <aschoen@redhat.com>
Mon, 11 Jun 2018 14:47:18 +0000 (09:47 -0500)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit b035bb0f54d4a7777ce242798bdeb18ad0dc28e0)

src/ceph-volume/ceph_volume/exceptions.py

index 211d9d09b9e04d01e8a4006b1e2df34c7dee50a1..f40b7b11d37a9811a94ea2bc64cb9a8a0a717429 100644 (file)
@@ -79,3 +79,16 @@ class MultipleVGsError(Exception):
     def __str__(self):
         msg = "Got more than 1 result looking for volume group: %s" % self.vg_name
         return msg
+
+
+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