[rhel7/master] Fix installing from a second iso (#1040722)
Vratislav Podzimek
vpodzime at redhat.com
Wed Aug 27 08:14:26 UTC 2014
On Tue, 2014-08-26 at 17:15 -0700, Brian C. Lane wrote:
> This fixes handling of the source from a second iso. eg. boot from a
> boot.iso with a DVD iso in a second drive.
>
> MOUNT_DIR has been changed from /mnt/install to /run/install so that the
> mount path will match /proc/mounts. Mounting via a symlink shows up as
> the real path, not the symlink.
>
> This was causing it to use util.unmount to teardown the install_device
> instead of the device's teardown method, leaving it in a state where it
> could later raise an error if the teardown method was used.
>
> This splits out parts of the YumPayload reset method and streamlines the
> setup of the source so that it unmounts the previous source, then sets
> up the new one, gets releasever and resets the yum object without the
> previous hack of having to call _setupInstallDevice twice.
>
> Resolves: rhbz#1040722
> ---
> pyanaconda/constants.py | 2 +-
> pyanaconda/packaging/yumpayload.py | 33 +++++++++++++++++++--------------
> 2 files changed, 20 insertions(+), 15 deletions(-)
>
> diff --git a/pyanaconda/constants.py b/pyanaconda/constants.py
> index a16a79d..2c8ca11 100644
> --- a/pyanaconda/constants.py
> +++ b/pyanaconda/constants.py
> @@ -66,7 +66,7 @@ ANACONDA_CLEANUP = "anaconda-cleanup"
> # This is a legacy variable; new code should use iutil.getSysroot()
> # or iutil.getTargetPhysicalRoot().
> ROOT_PATH = os.environ.get("ANACONDA_ROOT_PATH", "/mnt/sysimage")
> -MOUNT_DIR = "/mnt/install"
> +MOUNT_DIR = "/run/install"
> DRACUT_REPODIR = "/run/install/repo"
> DRACUT_ISODIR = "/run/install/source"
> ISO_DIR = MOUNT_DIR + "/isodir"
> diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
> index 5ba121a..935432f 100644
> --- a/pyanaconda/packaging/yumpayload.py
> +++ b/pyanaconda/packaging/yumpayload.py
> @@ -78,7 +78,7 @@ from blivet.size import Size
> import blivet.util
> import blivet.arch
>
> -from pyanaconda.image import opticalInstallMedia
> +from pyanaconda.image import opticalInstallMedia, verifyMedia
> from pyanaconda.image import mountImage
> from pyanaconda.image import findFirstIsoImage
>
> @@ -149,14 +149,15 @@ class YumPayload(PackagePayload):
>
> self.txID = None
>
> + self._groups = None
> + self._packages = []
> self._requiredPackages = []
> self._requiredGroups = []
>
> self.reset()
>
> - def reset(self, root=None, releasever=None):
> - """ Reset this instance to its initial (unconfigured) state. """
> -
> + def _reset_install_device(self):
> + """ Unmount the previous base repo and reset the install_device """
> # cdrom: install_device.teardown (INSTALL_TREE)
> # hd: umount INSTALL_TREE, install_device.teardown (ISO_DIR)
> # nfs: umount INSTALL_TREE
> @@ -183,14 +184,15 @@ class YumPayload(PackagePayload):
>
> self.install_device = None
>
> + def reset(self, root=None, releasever=None):
> + """ Reset this instance to its initial (unconfigured) state. """
> + self._reset_install_device()
> +
> # This value comes from a default install of the x86_64 Fedora 18. It
> # is meant as a best first guess only. Once package metadata is
> # available we can use that as a better value.
> self._space_required = Size(spec="3000 MB")
>
> - self._groups = None
> - self._packages = []
> -
> self._resetYum(root=root, releasever=releasever)
>
> def setup(self, storage):
> @@ -204,6 +206,9 @@ class YumPayload(PackagePayload):
>
> Setup _yum.preconf -- DO NOT TOUCH IT OUTSIDE THIS METHOD
> """
> + self._groups = None
> + self._packages = []
> +
> if root is None:
> root = self._root_dir
>
> @@ -477,6 +482,7 @@ reposdir=%s
> """
> log.info("configuring base repo")
>
> + self._reset_install_device()
> try:
> url, mirrorlist, sslverify = self._setupInstallDevice(self.storage, checkmount)
> except PayloadSetupError:
> @@ -493,12 +499,9 @@ reposdir=%s
> method.method, e)
>
> # start with a fresh YumBase instance & tear down old install device
> - self.reset(root=root, releasever=releasever)
> + self._resetYum(root=root, releasever=releasever)
> self._yumCacheDirHack()
>
> - # This needs to be done again, reset tore it down.
> - url, mirrorlist, sslverify = self._setupInstallDevice(self.storage, checkmount)
> -
> # If this is a kickstart install and no method has been set up, or
> # askmethod was given on the command line, we don't want to do
> # anything. Just disable all repos and return. This should avoid
> @@ -785,6 +788,11 @@ reposdir=%s
> elif method.method == "cdrom" or (checkmount and not method.method):
> # Did dracut leave the DVD or NFS mounted for us?
> device = blivet.util.get_mount_device(DRACUT_REPODIR)
> +
> + # Check for valid optical media if we didn't boot from one
> + if not verifyMedia(DRACUT_REPODIR):
> + self.install_device = opticalInstallMedia(storage.devicetree)
> +
> # Only look at the dracut mount if we don't already have a cdrom
> if device and not self.install_device:
> self.install_device = storage.devicetree.getDeviceByPath(device)
> @@ -802,9 +810,6 @@ reposdir=%s
> else:
> method.method = "cdrom"
> else:
> - # cdrom or no method specified -- check for media
> - if not self.install_device:
> - self.install_device = opticalInstallMedia(storage.devicetree)
> if self.install_device:
> if not method.method:
> method.method = "cdrom"
ACK.
--
Vratislav Podzimek
Anaconda Rider | RHCE | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list