diff options
Diffstat (limited to 'vmdb/tags.py')
-rw-r--r-- | vmdb/tags.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/vmdb/tags.py b/vmdb/tags.py index 0e59f1a..25703ef 100644 --- a/vmdb/tags.py +++ b/vmdb/tags.py @@ -34,6 +34,14 @@ class Tags: item = self._get(tag) return item["dev"] + def get_uuid(self, tag): + item = self._get(tag) + return item["uuid"] + + 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 +67,8 @@ class Tags: "builder_mount_point": None, "fstype": None, "target_mount_point": None, + "uuid": None, + "dm": None, } def set_dev(self, tag, dev): @@ -80,6 +90,18 @@ class Tags: raise AlreadyHasFsType(tag) item["fstype"] = fstype + def set_uuid(self, tag, uuid): + item = self._get(tag) + if item["uuid"] is not None: + raise AlreadyHasUuid(tag) + item["uuid"] = 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 +151,16 @@ class AlreadyHasTargetMountPoint(Exception): super().__init__("Already has target mount point: {}".format(tag)) +class AlreadyHasUuid(Exception): + def __init__(self, tag): + super().__init__("Already has UUID: {}".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)) |