From 4a22f22189408356770fa29d9348eaf9606fcbcf Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 30 May 2019 10:07:26 +1200 Subject: [PATCH] when assembling vg from answers, check devices are ok_for_lvm_vg And similar for RAID. Fix a couple of the answers files that got this wrong and only worked by chance. --- examples/answers-lvm-dmcrypt.yaml | 2 +- examples/answers-lvm.yaml | 2 +- subiquity/controllers/filesystem.py | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/answers-lvm-dmcrypt.yaml b/examples/answers-lvm-dmcrypt.yaml index 082c62b3..016a66bb 100644 --- a/examples/answers-lvm-dmcrypt.yaml +++ b/examples/answers-lvm-dmcrypt.yaml @@ -19,7 +19,7 @@ Filesystem: action: PARTITION data: size: 1G - mount: null + fstype: null - *newpart - *newpart - *newpart diff --git a/examples/answers-lvm.yaml b/examples/answers-lvm.yaml index fac151bf..313f6784 100644 --- a/examples/answers-lvm.yaml +++ b/examples/answers-lvm.yaml @@ -19,7 +19,7 @@ Filesystem: action: PARTITION data: size: 1G - mount: null + fstype: null - *newpart - *newpart - *newpart diff --git a/subiquity/controllers/filesystem.py b/subiquity/controllers/filesystem.py index 522b71df..03808370 100644 --- a/subiquity/controllers/filesystem.py +++ b/subiquity/controllers/filesystem.py @@ -163,13 +163,19 @@ class FilesystemController(BaseController): raise Exception("could not resolve {}".format(id)) def _action_clean_devices_raid(self, devices): - return { + r = { self._action_get(d): v for d, v in zip(devices[::2], devices[1::2]) } + for d in r: + assert d.ok_for_raid + return r def _action_clean_devices_vg(self, devices): - return {self._action_get(d): 'active' for d in devices} + r = {self._action_get(d): 'active' for d in devices} + for d in r: + assert d.ok_for_lvm_vg + return r def _action_clean_level(self, level): return raidlevels_by_value[level]