[PATCH rhel7-branch] Fix problems with the hdiso method.
Chris Lumens
clumens at redhat.com
Tue Aug 19 20:34:21 UTC 2014
(1) Be more lenient when it comes to deciding if the hdiso method has changed.
The user can specify "/dev/sda1" or "sda", and they can give the file name with
or without a leading slash. anaconda internally follows different rules, which
leads to situations where we compare "/dev/sda1" to "sda1" and device things
have changed. Of course, they haven't.
(2) The user may also specify the HDISO source via inst.repo=hd:/dev/disk/by-uuid
which we completely fail to handle. Fix that.
(3) If the user gives us a bad value for inst.repo= (like an invalid path,
perhaps from a typo), handle it in the UI with an error instead of raising a
traceback that doesn't make much sense.
(4) Fix two problems caused by cherry-picked patches.
(5) The big one - if you boot up via some method that also involves mounting the
install.img from an HDISO source, the install.img will keep all our mount points
tied up. There's not really any way to fix this because there's no way to
unmount the install.img, and there's nowhere to move it to that doesn't involve
eating up more memory. Thus, just prevent people from changing the source when
in this situation and slap a tooltip up explaining why.
Resolves: rhbz#980483
---
pyanaconda/packaging/yumpayload.py | 10 +++++++++-
pyanaconda/ui/gui/spokes/source.py | 32 +++++++++++++++++++++++---------
pyanaconda/ui/tui/spokes/source.py | 10 ++++++++--
3 files changed, 40 insertions(+), 12 deletions(-)
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 8643fb6..e97790f 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -483,7 +483,11 @@ reposdir=%s
retrieval fails.
"""
log.info("configuring base repo")
- url, mirrorlist, sslverify = self._setupInstallDevice(self.storage, checkmount)
+
+ try:
+ url, mirrorlist, sslverify = self._setupInstallDevice(self.storage, checkmount)
+ except PayloadSetupError:
+ self.data.method.method = None
releasever = None
method = self.data.method
@@ -702,8 +706,12 @@ reposdir=%s
needmount = False
# We don't setup an install_device here
# because we can't tear it down
+
isodevice = storage.devicetree.resolveDevice(devspec)
if needmount:
+ if not isodevice:
+ raise PayloadSetupError("device for HDISO install %s does not exist" % devspec)
+
self._setUpMedia(isodevice)
url = "file://" + INSTALL_TREE
self.install_device = isodevice
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index 60f4cad..d1ce6a1 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -43,7 +43,7 @@ from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.packaging import PayloadError, MetadataError, PackagePayload
from pyanaconda import constants
-from blivet.util import get_mount_paths
+from blivet.util import get_mount_device, get_mount_paths
__all__ = ["SourceSpoke"]
@@ -239,7 +239,7 @@ class IsoChooser(GUIObject):
# pylint: disable-msg=W0221
def refresh(self, currentFile=""):
GUIObject.refresh(self)
- self._chooser = self.builder.get_object("isoChooserDialog")
+ self._chooser = self.builder.get_object("isoChooser")
self._chooser.connect("current-folder-changed", self.on_folder_changed)
self._chooser.set_filename(constants.ISO_DIR + "/" + currentFile)
@@ -341,8 +341,8 @@ class SourceSpoke(NormalSpoke):
# The / gets stripped off by payload.ISOImage
self.data.method.dir = "/" + self._currentIsoFile
if (old_source.method == "harddrive" and
- old_source.partition == self.data.method.partition and
- old_source.dir == self.data.method.dir):
+ self.storage.devicetree.resolveDevice(old_source.partition) == part and
+ old_source.dir in [self._currentIsoFile, "/" + self._currentIsoFile]):
return False
# Make sure anaconda doesn't touch this device.
@@ -667,6 +667,10 @@ class SourceSpoke(NormalSpoke):
added = False
active = 0
idx = 0
+
+ if self.data.method.method == "harddrive":
+ methodDev = self.storage.devicetree.resolveDevice(self.data.method.partition)
+
for dev in potentialHdisoSources(self.storage.devicetree):
# path model size format type uuid of format
dev_info = { "model" : self._sanitize_model(dev.disk.model),
@@ -682,7 +686,7 @@ class SourceSpoke(NormalSpoke):
dev_info["label"] = "\n" + dev_info["label"]
store.append([dev, "%(model)s %(path)s (%(size)s MB) %(format)s %(label)s" % dev_info])
- if self.data.method.method == "harddrive" and self.data.method.partition in [dev.path, dev.name]:
+ if self.data.method.method == "harddrive" and dev == methodDev:
active = idx
added = True
idx += 1
@@ -760,10 +764,20 @@ class SourceSpoke(NormalSpoke):
# Setup the addon repos
self._reset_repoStore()
- # Then, some widgets get enabled/disabled/greyed out depending on
- # how others are set up. We can use the signal handlers to handle
- # that condition here too.
- self.on_protocol_changed(self._protocolComboBox)
+ if self.data.method.method == "harddrive" and \
+ get_mount_device(constants.DRACUT_ISODIR) == get_mount_device(constants.DRACUT_REPODIR):
+ # If the stage2 image is mounted from an HDISO source, there's really
+ # no way we can tear down that source to allow the user to change it.
+ # Thus, this portion of the spoke should be insensitive.
+ for widget in [self._autodetectButton, self._autodetectBox, self._isoButton,
+ self._isoBox, self._networkButton, self._networkBox]:
+ widget.set_sensitive(False)
+ widget.set_tooltip_text(_("The installation source is in use by the installer and cannot be changed."))
+ else:
+ # Then, some widgets get enabled/disabled/greyed out depending on
+ # how others are set up. We can use the signal handlers to handle
+ # that condition here too.
+ self.on_protocol_changed(self._protocolComboBox)
@property
def showable(self):
diff --git a/pyanaconda/ui/tui/spokes/source.py b/pyanaconda/ui/tui/spokes/source.py
index 0ee70c4..50e3583 100644
--- a/pyanaconda/ui/tui/spokes/source.py
+++ b/pyanaconda/ui/tui/spokes/source.py
@@ -32,9 +32,9 @@ from pyanaconda.iutil import DataHolder
from pyanaconda.constants import THREAD_SOURCE_WATCHER, THREAD_SOFTWARE_WATCHER, THREAD_PAYLOAD
from pyanaconda.constants import THREAD_PAYLOAD_MD, THREAD_STORAGE, THREAD_STORAGE_WATCHER
-from pyanaconda.constants import THREAD_CHECK_SOFTWARE, ISO_DIR, DRACUT_ISODIR
+from pyanaconda.constants import THREAD_CHECK_SOFTWARE, ISO_DIR, DRACUT_ISODIR, DRACUT_REPODIR
-from blivet.util import get_mount_paths
+from blivet.util import get_mount_device, get_mount_paths
import re
import os
@@ -239,6 +239,12 @@ class SourceSpoke(SourceSwitchHandler, EditTUISpoke):
self._window += [TextWidget(message), ""]
return True
+ if self.data.method.method == "harddrive" and \
+ get_mount_device(DRACUT_ISODIR) == get_mount_device(DRACUT_REPODIR):
+ message = _("The installation source is in use by the installer and cannot be changed.")
+ self._window += [TextWidget(message), ""]
+ return True
+
_methods = [_("CD/DVD"), _("Local ISO file"), _("Network")]
if args == 3:
text = [TextWidget(_(p)) for p in self._protocols]
--
1.9.3
More information about the anaconda-patches
mailing list