From a57196a5e5bf765f982d8b9f4af017f8b7666c0b Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 21 May 2019 11:01:54 +1200 Subject: [PATCH] fix deletion of raid/volgroup with >1 partition/lv "for x in obj.partitions(): self.delete_partition(x)" is unsafe when delete_partition mutates the list .partitions() returns... --- subiquity/controllers/filesystem.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subiquity/controllers/filesystem.py b/subiquity/controllers/filesystem.py index cefa9478..b630496a 100644 --- a/subiquity/controllers/filesystem.py +++ b/subiquity/controllers/filesystem.py @@ -339,7 +339,7 @@ class FilesystemController(BaseController): return self.delete_raid(raid.constructed_device()) # XXX self.delete_filesystem(raid.fs()) - for p in raid.partitions(): + for p in list(raid.partitions()): self.delete_partition(p) self.model.remove_raid(raid) @@ -355,7 +355,7 @@ class FilesystemController(BaseController): create_lvm_volgroup = create_volgroup def delete_volgroup(self, vg): - for lv in vg._partitions: + for lv in list(vg.partitions()): self.delete_logical_volume(lv) for d in vg.devices: if d.type == "dm_crypt":