Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Ubuntu Kernel Team (http://www.linux-archive.org/ubuntu-kernel-team/)
-   -   Update bootloader disk list after running clearpart. (http://www.linux-archive.org/ubuntu-kernel-team/675974-update-bootloader-disk-list-after-running-clearpart.html)

David Lehman 06-22-2012 08:22 PM

Update bootloader disk list after running clearpart.
 
---
pyanaconda/storage/__init__.py | 9 ++++++---
pyanaconda/storage/partitioning.py | 3 +++
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index 60acb4d..5919de6 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -509,9 +509,7 @@ class Storage(object):
if self.bootloader:
# clear out bootloader attributes that refer to devices that are
# no longer in the tree
- boot_disks = [d for d in self.disks if d.partitioned]
- boot_disks.sort(cmp=self.compareDisks, key=lambda d: d.name)
- self.bootloader.set_disk_list(boot_disks)
+ self.updateBootLoaderDiskList()
self.bootloader.stage1_disk = None
self.bootloader.stage1_device = None
self.bootloader.stage2_device = None
@@ -1526,6 +1524,11 @@ class Storage(object):
self._bootloader = self.platform.bootloaderClass(self.platform)
return self._bootloader

+ def updateBootLoaderDiskList(self):
+ boot_disks = [d for d in self.disks if d.partitioned]
+ boot_disks.sort(cmp=self.compareDisks, key=lambda d: d.name)
+ self.bootloader.set_disk_list(boot_disks)
+
def setUpBootLoader(self):
""" Propagate ksdata into BootLoader. """
if not self.bootloader or not self.data:
diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index 5ade308..d4df6e8 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -524,6 +524,9 @@ def clearPartitions(storage):
storage.devicetree.registerAction(destroy_action)
storage.devicetree.registerAction(create_action)

+ if storage.bootloader:
+ storage.updateBootLoaderDiskList()
+
def removeEmptyExtendedPartitions(storage):
for disk in storage.partitioned:
log.debug("checking whether disk %s has an empty extended" % disk.name)
--
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 07:51 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.