From: David Lehman <dlehman(a)redhat.com>
---
blivet/devices/partition.py | 5 +++--
blivet/formats/disklabel.py | 1 +
blivet/populator/helpers/disklabel.py | 1 +
blivet/populator/helpers/partition.py | 1 +
blivet/udev.py | 8 ++++++++
5 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/blivet/devices/partition.py b/blivet/devices/partition.py
index ce358e3..3a098a3 100644
--- a/blivet/devices/partition.py
+++ b/blivet/devices/partition.py
@@ -66,7 +66,7 @@ class PartitionDevice(StorageDevice):
_resizable = True
default_size = DEFAULT_PART_SIZE
- def __init__(self, name, fmt=None,
+ def __init__(self, name, fmt=None, uuid=None,
size=None, grow=False, maxsize=None, start=None, end=None,
major=None, minor=None, bootable=None,
sysfs_path='', parents=None, exists=False,
@@ -85,6 +85,7 @@ def __init__(self, name, fmt=None,
For existing partitions only:
+ :keyword str uuid: partition UUID (not filesystem UUID)
:keyword major: the device major
:type major: long
:keyword minor: the device minor
@@ -142,7 +143,7 @@ def __init__(self, name, fmt=None,
else:
size = self.default_size
- StorageDevice.__init__(self, name, fmt=fmt, size=size,
+ StorageDevice.__init__(self, name, fmt=fmt, uuid=uuid, size=size,
major=major, minor=minor, exists=exists,
sysfs_path=sysfs_path, parents=parents)
diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py
index aa4d1ab..da28d96 100644
--- a/blivet/formats/disklabel.py
+++ b/blivet/formats/disklabel.py
@@ -49,6 +49,7 @@ def __init__(self, **kwargs):
"""
:keyword device: full path to the block device node
:type device: str
+ :keyword str uuid: disklabel UUID
:keyword label_type: type of disklabel to create
:type label_type: str
:keyword exists: whether the formatting exists
diff --git a/blivet/populator/helpers/disklabel.py
b/blivet/populator/helpers/disklabel.py
index e9aa8b2..ed4e355 100644
--- a/blivet/populator/helpers/disklabel.py
+++ b/blivet/populator/helpers/disklabel.py
@@ -91,6 +91,7 @@ def run(self):
try:
fmt = formats.get_format("disklabel",
device=self.device.path,
+ uuid=udev.device_get_disklabel_uuid(self.data),
exists=True)
except InvalidDiskLabelError as e:
log.info("no usable disklabel on %s", self.device.name)
diff --git a/blivet/populator/helpers/partition.py
b/blivet/populator/helpers/partition.py
index 4af23d7..ff6190e 100644
--- a/blivet/populator/helpers/partition.py
+++ b/blivet/populator/helpers/partition.py
@@ -105,6 +105,7 @@ def run(self):
device = None
try:
device = PartitionDevice(name, sysfs_path=sysfs_path,
+ uuid=udev.device_get_partition_uuid(self.data),
major=udev.device_get_major(self.data),
minor=udev.device_get_minor(self.data),
exists=True, parents=[disk])
diff --git a/blivet/udev.py b/blivet/udev.py
index 89121bc..39229dd 100644
--- a/blivet/udev.py
+++ b/blivet/udev.py
@@ -645,6 +645,14 @@ def device_get_disklabel_type(info):
return info.get("ID_PART_TABLE_TYPE")
+
+def device_get_disklabel_uuid(info):
+ return info.get("ID_PART_TABLE_UUID")
+
+
+def device_get_partition_uuid(info):
+ return info.get("ID_PART_ENTRY_UUID")
+
# iscsi disks' ID_PATH form depends on the driver:
# for software iscsi:
# ip-${iscsi_address}:${iscsi_port}-iscsi-${iscsi_tgtname}-lun-${lun}
--
To view this commit on github, visit
https://github.com/rhinstaller/blivet/commit/851a49d56651c4be4e8b73b7a711...