From 945ccbf5fa8a1bc9adf9c5f4484e4ba46e4354f9 Mon Sep 17 00:00:00 2001
From: David Lehman <dlehman@redhat.com>
Date: Tue, 26 Jun 2012 18:05:45 -0500
Subject: [PATCH 07/14] Cleanups to restore things after the merge of master
 onto newui.

---
 pyanaconda/bootloader.py            |   27 +++++----------------------
 pyanaconda/storage/__init__.py      |    7 +++++--
 pyanaconda/storage/devices.py       |   16 ++++++----------
 pyanaconda/storage/partitioning.py  |    2 +-
 pyanaconda/ui/gui/spokes/storage.py |    2 +-
 5 files changed, 18 insertions(+), 36 deletions(-)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index b86b57a..4a54a03 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -778,7 +778,7 @@ class BootLoader(object):
         dracut_devices.extend(storage.fsset.swapDevices)
 
         # Does /usr have its own device? If so, we need to tell dracut
-        usr_device = self.storage.mountpoints.get("/usr")
+        usr_device = storage.mountpoints.get("/usr")
         if usr_device:
             dracut_devices.extend([usr_device])
 
@@ -980,8 +980,8 @@ class GRUB(BootLoader):
 
     packages = ["grub"]
 
-    def __init__(self, storage):
-        super(GRUB, self).__init__(storage)
+    def __init__(self, platform=None):
+        super(GRUB, self).__init__(platform=platform)
         self.encrypted_password = ""
 
     #
@@ -1357,8 +1357,8 @@ class GRUB2(GRUB):
     stage2_raid_levels = [mdraid.RAID0, mdraid.RAID1, mdraid.RAID4,
                           mdraid.RAID5, mdraid.RAID6, mdraid.RAID10]
 
-    def __init__(self, storage):
-        super(GRUB2, self).__init__(storage)
+    def __init__(self, platform=None):
+        super(GRUB2, self).__init__(platform=platform)
         self.boot_args.add("$([ -x /usr/sbin/rhcrashkernel-param ] && "\
                             "/usr/sbin/rhcrashkernel-param)")
 
@@ -1708,9 +1708,6 @@ class Yaboot(YabootSILOBase):
     stage2_device_types = ["partition", "mdarray"]
     stage2_device_raid_levels = [mdraid.RAID1]
 
-    def __init__(self, storage):
-        BootLoader.__init__(self, storage)
-
     #
     # configuration
     #
@@ -2000,20 +1997,6 @@ class ZIPL(BootLoader):
         buf = iutil.execWithCapture("zipl", [],
                                     stderr="/dev/tty5",
                                     root=ROOT_PATH)
-        for line in buf.splitlines():
-            if line.startswith("Preparing boot device: "):
-                # Output here may look like:
-                #     Preparing boot device: dasdb (0200).
-                #     Preparing boot device: dasdl.
-                # We want to extract the device name and pass that.
-                name = re.sub(".+?: ", "", line)
-                name = re.sub("(\s\(.+\))?\.$", "", name)
-                device = self.storage.devicetree.getDeviceByName(name)
-                if not device:
-                    raise BootLoaderError("could not find IPL device")
-
-                self.stage1_device = device
-
 
 class SILO(YabootSILOBase):
     name = "SILO"
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index 195ebef..be795b3 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -1021,8 +1021,11 @@ class Storage(object):
             # set up the volume label, using hostname if necessary
             if not name:
                 hostname = ""
-                if hasattr(self.anaconda, "network"):
-                    hostname = self.anaconda.network.hostname
+                if self.data:
+                    for nd in self.data.network.dataList():
+                        if nd.hostname:
+                            hostname = nd.hostname
+                            break
 
                 name = self.suggestContainerName(prefix="btrfs",
                                                  hostname=hostname)
diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index 9c69dfb..1e22138 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -3909,9 +3909,6 @@ class BTRFSDevice(StorageDevice):
         self.sysfsPath = self.parents[0].sysfsPath
         log.debug("%s sysfsPath set to %s" % (self.name, self.sysfsPath))
 
-    def _statusWindow(self, intf=None, title="", msg=""):
-        return self._progressWindow(intf=intf, title=title, msg=msg)
-
     def _postCreate(self):
         super(BTRFSDevice, self)._postCreate()
         self.format.exists = True
@@ -4066,24 +4063,23 @@ class BTRFSVolumeDevice(BTRFSDevice):
 
         return subvols
 
-    def createSubVolumes(self, intf=None):
+    def createSubVolumes(self):
         self._do_temp_mount()
         for name, subvol in self.subvolumes:
             if subvol.exists:
                 continue
-            subvolume.create(mountpoint=self._temp_dir_prefix, intf=intf)
+            subvolume.create(mountpoint=self._temp_dir_prefix)
         self._undo_temp_mount()
 
     def removeSubVolume(self, name):
         raise NotImplementedError()
 
-    def _create(self, w):
+    def _create(self):
         log_method_call(self, self.name, status=self.status)
         btrfs.create_volume(devices=[d.path for d in self.parents],
                             label=self.format.label,
                             data=self.dataLevel,
-                            metadata=self.metaDataLevel,
-                            progress=w)
+                            metadata=self.metaDataLevel)
 
     def _destroy(self):
         log_method_call(self, self.name, status=self.status)
@@ -4110,14 +4106,14 @@ class BTRFSSubVolumeDevice(BTRFSDevice):
         log_method_call(self, name=self.name, orig=orig, kids=self.kids)
         self.volume.setup(orig=orig)
 
-    def _create(self, w):
+    def _create(self):
         log_method_call(self, self.name, status=self.status)
         self.volume._do_temp_mount()
         mountpoint = self.volume.format._mountpoint
         if not mountpoint:
             raise RuntimeError("btrfs subvol create requires mounted volume")
 
-        btrfs.create_subvolume(mountpoint, self.name, progress=w)
+        btrfs.create_subvolume(mountpoint, self.name)
         self.volume._undo_temp_mount()
 
     def _destroy(self):
diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index d4df6e8..d764134 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -282,7 +282,7 @@ def scheduleShrinkActions(storage):
 def doAutoPartition(storage, data):
     log.debug("doAutoPart: %s" % storage.doAutoPart)
     log.debug("encryptedAutoPart: %s" % storage.encryptedAutoPart)
-    log.debug("lvmAutoPart: %s" % storage.lvmAutoPart)
+    log.debug("autoPartType: %s" % storage.autoPartType)
     log.debug("clearPartType: %s" % storage.config.clearPartType)
     log.debug("clearPartDisks: %s" % storage.config.clearPartDisks)
     log.debug("autoPartitionRequests:\n%s" % "".join([str(p) for p in storage.autoPartitionRequests]))
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 626634b..4e597a7 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -257,7 +257,7 @@ class StorageSpoke(NormalSpoke):
         self.data.autopart.autopart = self.autopart
 
         # no thanks, lvm
-        self.data.autopart.lvm = False
+        self.data.autopart.type = AUTOPART_TYPE_PLAIN
 
         if self.autopart:
             self.clearPartType = CLEARPART_TYPE_ALL
-- 
1.7.7.6

