How to use the blivet.arch.is_s390 function in blivet

To help you get started, we’ve selected a few blivet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rhinstaller / anaconda / pyanaconda / storage / initialization.py View on Github external
# Set the flags.
    blivet_flags.auto_dev_updates = True
    blivet_flags.selinux_reset_fcon = True
    blivet_flags.keep_empty_ext_partitions = False
    blivet_flags.discard_new = True
    blivet_flags.selinux = conf.security.selinux
    blivet_flags.dmraid = conf.storage.dmraid
    blivet_flags.ibft = conf.storage.ibft
    blivet_flags.multipath_friendly_names = conf.storage.multipath_friendly_names
    blivet_flags.allow_imperfect_devices = conf.storage.allow_imperfect_devices

    # Platform class setup depends on flags, re-initialize it.
    platform.update_from_flags()

    # Load plugins.
    if arch.is_s390():
        load_plugin_s390()

    # Set the blacklist.
    udev.device_name_blacklist = [r'^mtd', r'^mmcblk.+boot', r'^mmcblk.+rpmb', r'^zram', '^ndblk']

    # We need this so all the /dev/disk/* stuff is set up.
    udev.trigger(subsystem="block", action="change")
github QubesOS / qubes-installer-qubes-os / anaconda / pyanaconda / timezone.py View on Github external
def time_initialize(timezone, storage, bootloader):
    """
    Try to guess if RTC uses UTC time or not, set timezone.isUtc properly and
    set system time from RTC using the UTC guess.
    Guess is done by searching for bootable ntfs devices.

    :param timezone: ksdata.timezone object
    :param storage: blivet.Blivet instance
    :param bootloader: bootloader.Bootloader instance

    """

    if arch.is_s390():
        # nothing to do on s390(x) were hwclock doesn't exist
        return

    if not timezone.isUtc and not flags.automatedInstall:
        # if set in the kickstart, no magic needed here
        threadMgr.wait(THREAD_STORAGE)
        ntfs_devs = filter(lambda dev: dev.format.name == "ntfs",
                           storage.devices)

        timezone.isUtc = not bootloader.has_windows(ntfs_devs)

    cmd = "hwclock"
    args = ["--hctosys"]
    if timezone.isUtc:
        args.append("--utc")
    else:
github QubesOS / qubes-installer-qubes-os / anaconda / pyanaconda / ui / tui / spokes / storage.py View on Github external
if keyid < 0:
                return key
            self.selection = keyid
            if len(self.disks) > 1 and keyid == len(self.disks):
                self._select_all_disks()
            else:
                self._update_disk_list(self.disks[keyid])
            return INPUT_PROCESSED
        except (ValueError, IndexError):
            # TRANSLATORS: 'c' to continue
            if key.lower() == C_('TUI|Spoke Navigation', 'c'):
                if self.selected_disks:
                    # check selected disks to see if we have any unformatted DASDs
                    # if we're on s390x, since they need to be formatted before we
                    # can use them.
                    if arch.is_s390():
                        _disks = [d for d in self.disks if d.name in self.selected_disks]
                        to_format = [d for d in _disks if d.type == "dasd" and
                                     blockdev.s390.dasd_needs_format(d.busid)]
                        if to_format:
                            self.run_dasdfmt(to_format)
                            return None

                    # make sure no containers were split up by the user's disk
                    # selection
                    self.errors.extend(checkDiskSelection(self.storage,
                                                          self.selected_disks))
                    if self.errors:
                        # The disk selection has to make sense before we can
                        # proceed.
                        return None
github rhinstaller / anaconda / pyanaconda / format_dasd.py View on Github external
def is_supported():
        """Is DASD formatting supported on this machine?"""
        return arch.is_s390()
github rhinstaller / anaconda / pyanaconda / modules / storage / reset.py View on Github external
def _reload_modules(self):
        """Reload the additional modules."""
        if conf.target.is_image:
            return

        iscsi.startup()
        fcoe.startup()

        if arch.is_s390():
            zfcp.startup()
github rhinstaller / anaconda / pyanaconda / storage / initialization.py View on Github external
"""
    # Set the ignored and exclusive disks.
    disk_select_proxy = STORAGE.get_proxy(DISK_SELECTION)
    storage.ignored_disks = disk_select_proxy.IgnoredDisks
    storage.exclusive_disks = disk_select_proxy.ExclusiveDisks
    storage.protected_devices = disk_select_proxy.ProtectedDevices
    storage.disk_images = disk_select_proxy.DiskImages

    # Reload additional modules.
    if not conf.target.is_image:
        iscsi.startup()

        fcoe_proxy = STORAGE.get_proxy(FCOE)
        fcoe_proxy.ReloadModule()

        if arch.is_s390():
            zfcp_proxy = STORAGE.get_proxy(ZFCP)
            zfcp_proxy.ReloadModule()

    # Do the reset.
    storage.reset()
github QubesOS / qubes-installer-qubes-os / anaconda / pyanaconda / storage_utils.py View on Github external
"megabytes which is usually too small to "
                              "install %s.") % (productName,)))
    else:
        exns.append(
           SanityError(_("You have not defined a root partition (/), "
                        "which is required for installation of %s "
                        "to continue.") % (productName,)))

    # Prevent users from installing on s390x with (a) no /boot volume, (b) the
    # root volume on LVM, and (c) the root volume not restricted to a single
    # PV
    # NOTE: There is not really a way for users to create a / volume
    # restricted to a single PV.  The backend support is there, but there are
    # no UI hook-ups to drive that functionality, but I do not personally
    # care.  --dcantrell
    if arch.is_s390() and '/boot' not in storage.mountpoints and root:
        if root.type == 'lvmlv' and not root.single_pv:
            exns.append(
               SanityError(_("This platform requires /boot on a dedicated "
                            "partition or logical volume.  If you do not "
                            "want a /boot volume, you must place / on a "
                            "dedicated non-LVM partition.")))

    # FIXME: put a check here for enough space on the filesystems. maybe?

    for (mount, size) in checkSizes:
        if mount in filesystems and filesystems[mount].size < size:
            exns.append(
               SanityWarning(_("Your %(mount)s partition is less than "
                              "%(size)s which is lower than recommended "
                              "for a normal %(productName)s install.")
                            % {'mount': mount, 'size': size,
github storaged-project / blivet / blivet / formats / disklabel.py View on Github external
def _get_best_label_type(self):
        label_type = self._default_label_type
        label_types = self.get_platform_label_types()[:]
        if label_type in label_types:
            label_types.remove(label_type)
        if label_type:
            label_types.insert(0, label_type)

        if arch.is_s390():
            if blockdev.s390.dasd_is_fba(self.device):
                # the device is FBA DASD
                return "msdos"
            elif self.parted_device.type == parted.DEVICE_DASD:
                # the device is DASD
                return "dasd"
            elif util.detect_virt():
                # check for dasds exported into qemu as normal virtio/scsi disks
                try:
                    _parted_disk = parted.Disk(device=self.parted_device)
                except (_ped.DiskLabelException, _ped.IOException, NotImplementedError):
                    pass
                else:
                    if _parted_disk.type == "dasd":
                        return "dasd"
github QubesOS / qubes-installer-qubes-os / anaconda / pyanaconda / timezone.py View on Github external
if not os.access(rooted_tz_file, os.R_OK):
        log.error("Timezone to be linked (%s) doesn't exist", rooted_tz_file)
    else:
        try:
            # os.symlink fails if link_path exists, so try to remove it first
            os.remove(link_path)
        except OSError:
            pass

        try:
            os.symlink(relative_path, link_path)
        except OSError as oserr:
            log.error("Error when symlinking timezone (from %s): %s",
                      rooted_tz_file, oserr.strerror)

    if arch.is_s390():
        # there is no HW clock on s390(x)
        return

    try:
        fobj = open(os.path.normpath(root + "/etc/adjtime"), "r")
        lines = fobj.readlines()
        fobj.close()
    except IOError:
        lines = ["0.0 0 0.0\n", "0\n"]

    try:
        with open(os.path.normpath(root + "/etc/adjtime"), "w") as fobj:
            fobj.write(lines[0])
            fobj.write(lines[1])
            if timezone.isUtc:
                fobj.write("UTC\n")