Beispiel #1
0
    def _setup_harddrive_device(self, method, iso_device_path,
                                repo_device_path):
        url = None
        need_mount = False

        if method.biospart:
            log.warning("biospart support is not implemented")
            dev_spec = method.biospart
        else:
            dev_spec = method.partition
            need_mount = True
            # See if we used this method for stage2, thus dracut left it
            if iso_device_path and method.partition and \
               method.partition in iso_device_path and \
               DRACUT_ISODIR in repo_device_path:
                # Everything should be setup
                url = "file://" + DRACUT_REPODIR
                need_mount = False
                # We don't setup an install_device here
                # because we can't tear it down

        iso_device = payload_utils.resolve_device(self.storage, dev_spec)
        if need_mount:
            if not iso_device:
                raise PayloadSetupError(
                    "device for HDISO install %s does not exist" % dev_spec)

            self._setup_media(iso_device)
            url = "file://" + INSTALL_TREE
            self.install_device = iso_device

        return url
Beispiel #2
0
    def setup(self):
        super().setup()

        # Mount the live device and copy from it instead of the overlay at /
        osimg = payload_utils.resolve_device(self.data.method.partition)
        if not osimg:
            raise PayloadInstallError("Unable to find osimg for %s" %
                                      self.data.method.partition)

        osimg_path = payload_utils.get_device_path(osimg)
        if not stat.S_ISBLK(os.stat(osimg_path)[stat.ST_MODE]):
            exn = PayloadSetupError("%s is not a valid block device" %
                                    (self.data.method.partition, ))
            if errorHandler.cb(exn) == ERROR_RAISE:
                raise exn
        rc = payload_utils.mount(osimg_path,
                                 INSTALL_TREE,
                                 fstype="auto",
                                 options="ro")
        if rc != 0:
            raise PayloadInstallError("Failed to mount the install tree")

        # Grab the kernel version list now so it's available after umount
        self._update_kernel_version_list()

        source = os.statvfs(INSTALL_TREE)
        self.source_size = source.f_frsize * (source.f_blocks - source.f_bfree)
Beispiel #3
0
    def _setup_cdrom_device(self, method, iso_device_path, repo_device_path):
        url = None

        # FIXME: We really should not talk about NFS here - regression from re-factorization?

        # Check for valid optical media if we didn't boot from one
        if not verifyMedia(DRACUT_REPODIR):
            self.install_device = find_optical_install_media(self.storage)

        # Only look at the dracut mount if we don't already have a cdrom
        if repo_device_path and not self.install_device:
            self.install_device = payload_utils.resolve_device(self.storage, repo_device_path)
            url = "file://" + DRACUT_REPODIR
            if not method.method:
                # See if this is a nfs mount
                if ':' in repo_device_path:
                    # prepend nfs: to the url as that's what the parser
                    # wants.  Note we don't get options from this, but
                    # that's OK for the UI at least.
                    _options, host, path = util.parseNfsUrl("nfs:%s" % repo_device_path)
                    method.method = "nfs"
                    method.server = host
                    method.dir = path
                else:
                    method.method = "cdrom"
        else:
            if self.install_device:
                if not method.method:
                    method.method = "cdrom"
                self._setup_media(self.install_device)
                url = "file://" + INSTALL_TREE
            elif method.method == "cdrom":
                raise PayloadSetupError("no usable optical media found")

        return url
Beispiel #4
0
    def setup(self):
        super().setup()
        # Mount the live device and copy from it instead of the overlay at /
        osimg_spec = self._get_live_os_image()

        if not osimg_spec:
            raise PayloadSetupError("No live image found!")

        osimg = payload_utils.resolve_device(osimg_spec)
        if not osimg:
            raise PayloadSetupError(
                "Unable to find osimg for {}".format(osimg_spec))

        osimg_path = payload_utils.get_device_path(osimg)
        if not stat.S_ISBLK(os.stat(osimg_path)[stat.ST_MODE]):
            raise PayloadSetupError(
                "{} is not a valid block device".format(osimg_spec))

        rc = payload_utils.mount(osimg_path,
                                 INSTALL_TREE,
                                 fstype="auto",
                                 options="ro")
        if rc != 0:
            raise PayloadSetupError("Failed to mount the install tree")

        # Grab the kernel version list now so it's available after umount
        self._update_kernel_version_list()
Beispiel #5
0
 def _unmount_source_directory(self, mount_point):
     if os.path.ismount(mount_point):
         device_path = payload_utils.get_mount_device_path(mount_point)
         device = payload_utils.resolve_device(self.storage, device_path)
         if device:
             payload_utils.teardown_device(device)
         else:
             payload_utils.unmount(mount_point, raise_exc=True)
Beispiel #6
0
    def _setup_harddrive_addon_repo(self, ksrepo):
        iso_device = payload_utils.resolve_device(ksrepo.partition)
        if not iso_device:
            raise PayloadSetupError("device for HDISO addon repo install %s does not exist" %
                                    ksrepo.partition)

        ksrepo.generate_mount_dir()

        device_mount_dir = ISO_DIR + "-" + ksrepo.mount_dir_suffix
        install_root_dir = INSTALL_TREE + "-" + ksrepo.mount_dir_suffix

        self._find_and_mount_iso(iso_device, device_mount_dir, ksrepo.iso_path, install_root_dir)
        url = "file://" + install_root_dir

        return url