summaryrefslogtreecommitdiff
path: root/vmdb/tags.py
diff options
context:
space:
mode:
Diffstat (limited to 'vmdb/tags.py')
-rw-r--r--vmdb/tags.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/vmdb/tags.py b/vmdb/tags.py
index 0e59f1a..60001d1 100644
--- a/vmdb/tags.py
+++ b/vmdb/tags.py
@@ -34,6 +34,18 @@ class Tags:
item = self._get(tag)
return item["dev"]
+ def get_fsuuid(self, tag):
+ item = self._get(tag)
+ return item["fsuuid"]
+
+ def get_luksuuid(self, tag):
+ item = self._get(tag)
+ return item["luksuuid"]
+
+ def get_dm(self, tag):
+ item = self._get(tag)
+ return item["dm"]
+
def get_builder_mount_point(self, tag):
item = self._get(tag)
return item["builder_mount_point"]
@@ -59,6 +71,9 @@ class Tags:
"builder_mount_point": None,
"fstype": None,
"target_mount_point": None,
+ "fsuuid": None,
+ "luksuuid": None,
+ "dm": None,
}
def set_dev(self, tag, dev):
@@ -80,6 +95,24 @@ class Tags:
raise AlreadyHasFsType(tag)
item["fstype"] = fstype
+ def set_fsuuid(self, tag, uuid):
+ item = self._get(tag)
+ if item["fsuuid"] is not None:
+ raise AlreadyHasFsUuid(tag)
+ item["fsuuid"] = uuid
+
+ def set_luksuuid(self, tag, uuid):
+ item = self._get(tag)
+ if item["luksuuid"] is not None:
+ raise AlreadyHasLuksUuid(tag)
+ item["luksuuid"] = uuid
+
+ def set_dm(self, tag, name):
+ item = self._get(tag)
+ if item["dm"] is not None:
+ raise AlreadyHasDeviceMapper(tag)
+ item["dm"] = name
+
def set_target_mount_point(self, tag, target_mount_point):
item = self._get(tag)
if item["target_mount_point"] is not None:
@@ -129,6 +162,21 @@ class AlreadyHasTargetMountPoint(Exception):
super().__init__("Already has target mount point: {}".format(tag))
+class AlreadyHasFsUuid(Exception):
+ def __init__(self, tag):
+ super().__init__("Already has fs UUID: {}".format(tag))
+
+
+class AlreadyHasLuksUuid(Exception):
+ def __init__(self, tag):
+ super().__init__("Already has LuksUUID: {}".format(tag))
+
+
+class AlreadyHasDeviceMapper(Exception):
+ def __init__(self, tag):
+ super().__init__("Already has device-mapper name: {}".format(tag))
+
+
class NeedBothMountPoints(Exception):
def __init__(self, target_mp):
super().__init__("Need both mount points set, target: {}".format(target_mp))