diff options
Diffstat (limited to 'vmdb/tags.py')
-rw-r--r-- | vmdb/tags.py | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/vmdb/tags.py b/vmdb/tags.py index 25703ef..60001d1 100644 --- a/vmdb/tags.py +++ b/vmdb/tags.py @@ -34,9 +34,13 @@ class Tags: item = self._get(tag) return item["dev"] - def get_uuid(self, tag): + def get_fsuuid(self, tag): item = self._get(tag) - return item["uuid"] + return item["fsuuid"] + + def get_luksuuid(self, tag): + item = self._get(tag) + return item["luksuuid"] def get_dm(self, tag): item = self._get(tag) @@ -67,7 +71,8 @@ class Tags: "builder_mount_point": None, "fstype": None, "target_mount_point": None, - "uuid": None, + "fsuuid": None, + "luksuuid": None, "dm": None, } @@ -90,11 +95,17 @@ class Tags: raise AlreadyHasFsType(tag) item["fstype"] = fstype - def set_uuid(self, tag, uuid): + 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["uuid"] is not None: - raise AlreadyHasUuid(tag) - item["uuid"] = uuid + if item["luksuuid"] is not None: + raise AlreadyHasLuksUuid(tag) + item["luksuuid"] = uuid def set_dm(self, tag, name): item = self._get(tag) @@ -151,9 +162,14 @@ class AlreadyHasTargetMountPoint(Exception): super().__init__("Already has target mount point: {}".format(tag)) -class AlreadyHasUuid(Exception): +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 UUID: {}".format(tag)) + super().__init__("Already has LuksUUID: {}".format(tag)) class AlreadyHasDeviceMapper(Exception): |