curtin-dev team mailing list archive
-
curtin-dev team
-
Mailing list archive
-
Message #02758
[Merge] ~ogayot/curtin:lunar-2023-04-03 into curtin:ubuntu/lunar
Olivier Gayot has proposed merging ~ogayot/curtin:lunar-2023-04-03 into curtin:ubuntu/lunar.
Commit message:
block-meta: fix failed disk lookup when WWN includes extension
curtin's storage config extracts the WWN of a disk from one of the
following udev variables:
* ID_WWN_WITH_EXTENSION (preferred)
* ID_WWN
However, when trying to look the disk up later in the block-meta code,
curtin only tries to match the WWN value against the ID_WWN variable
(and another variable related to DM multipath).
This means that the disk can not be be found just based on the wwn if
the ID_WWN and ID_WWN_WITH_EXTENSION variables don't hold the same
value.
In the past, that was often okay because other fields (such as disk path
or serial) would still make the disk lookup succeed.
However, the following patch introduced a restriction. In v2, all fields
specified must now match for the disk lookup to be successful:
8c5f87ed block_meta: all fields on a disk action must match with v2 config
Fixed by matching against the ID_WWN_WITH_EXTENSION (preferred) and then
ID_WWN.
(cherry picked from commit 73da3c4f47ea22d58f57371594a396c5434ab260)
Requested reviews:
curtin developers (curtin-dev)
For more details, see:
https://code.launchpad.net/~ogayot/curtin/+git/curtin/+merge/440267
Cherry pick to ubuntu/lunar of the change introduced in https://code.launchpad.net/~ogayot/curtin/+git/curtin/+merge/440232.
--
Your team curtin developers is requested to review the proposed merge of ~ogayot/curtin:lunar-2023-04-03 into curtin:ubuntu/lunar.
diff --git a/curtin/commands/block_meta.py b/curtin/commands/block_meta.py
index c0e595d..7988f3a 100644
--- a/curtin/commands/block_meta.py
+++ b/curtin/commands/block_meta.py
@@ -513,7 +513,8 @@ def v2_get_path_to_disk(vol):
cands.append(set([dev['DEVNAME'] for dev in new_devs]))
if 'wwn' in vol:
- add_cands(*disk_by_keys(vol['wwn'], 'DM_WWN', 'ID_WWN'))
+ add_cands(*disk_by_keys(vol['wwn'],
+ 'DM_WWN', 'ID_WWN_WITH_EXTENSION', 'ID_WWN'))
if 'serial' in vol:
add_cands(
*disk_by_keys(
diff --git a/tests/unittests/test_commands_block_meta.py b/tests/unittests/test_commands_block_meta.py
index 0c198e6..82530ff 100644
--- a/tests/unittests/test_commands_block_meta.py
+++ b/tests/unittests/test_commands_block_meta.py
@@ -222,6 +222,23 @@ class TestGetPathToStorageVolume(CiTestCase):
devname,
block_meta.get_path_to_storage_volume(disk_id, s_cfg))
+ def test_v2_match_wwn_with_extension(self):
+ wwn = self.random_string()
+ extension = self.random_string()
+ devname = self.random_string()
+ self.m_udev_all.return_value = [
+ {'DEVNAME': devname,
+ 'ID_WWN': wwn,
+ 'ID_WWN_WITH_EXTENSION': wwn + extension},
+ ]
+ disk_id = self.random_string()
+ cfg = {'id': disk_id, 'type': 'disk', 'wwn': wwn + extension}
+ s_cfg = OrderedDict({disk_id: cfg})
+ s_cfg.version = 2
+ self.assertEqual(
+ devname,
+ block_meta.get_path_to_storage_volume(disk_id, s_cfg))
+
def test_v2_match_wwn_prefer_mpath(self):
wwn = self.random_string()
devname1 = self.random_string()
Follow ups