From 43f8f7810b57d8d0a13701770fadd200d3c1ce7d Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 14 Apr 2020 14:21:43 +1200 Subject: [PATCH 1/2] set wipe, preserve more consistently .clear() is called on any object that is about to be put into a RAID or VG (and also before things are deleted but that does not matter here). Change it to always set wipe=superblock, and preserve=False on disks. This fixes making a RAID out of disks and might fix https://bugs.launchpad.net/subiquity/+bug/1837214 once and for all. --- subiquity/controllers/filesystem.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subiquity/controllers/filesystem.py b/subiquity/controllers/filesystem.py index b1645c6b..e70b3ddf 100644 --- a/subiquity/controllers/filesystem.py +++ b/subiquity/controllers/filesystem.py @@ -522,16 +522,16 @@ class FilesystemController(SubiquityController): getattr(self, 'delete_' + obj.type)(obj) def clear(self, obj): + if obj.type == "disk": + obj.preserve = False + obj.wipe = 'superblock' for subobj in obj.fs(), obj.constructed_device(): self.delete(subobj) def reformat(self, disk): - if disk.type == "disk": - disk.preserve = False - disk.wipe = 'superblock-recursive' - self.clear(disk) for p in list(disk.partitions()): - self.delete(p) + self.delete_partition(p) + self.clear(disk) def partition_disk_handler(self, disk, partition, spec): log.debug('partition_disk_handler: %s %s %s', disk, partition, spec) From 33cd2c356a7191b1f73969a6db96f73c1ff06301 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 14 Apr 2020 14:35:14 +1200 Subject: [PATCH 2/2] clear spare_devices before putting them in a raid --- subiquity/controllers/filesystem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subiquity/controllers/filesystem.py b/subiquity/controllers/filesystem.py index e70b3ddf..e8977c66 100644 --- a/subiquity/controllers/filesystem.py +++ b/subiquity/controllers/filesystem.py @@ -465,7 +465,7 @@ class FilesystemController(SubiquityController): return part def create_raid(self, spec): - for d in spec['devices']: + for d in spec['devices'] | spec['spare_devices']: self.clear(d) raid = self.model.add_raid( spec['name'],