当前位置: 首页>>代码示例>>Python>>正文


Python services.STORAGE类代码示例

本文整理汇总了Python中pyanaconda.modules.common.constants.services.STORAGE的典型用法代码示例。如果您正苦于以下问题:Python STORAGE类的具体用法?Python STORAGE怎么用?Python STORAGE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了STORAGE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, data, storage, payload):
        super().__init__(data, storage, payload)
        self.title = N_("Installation Destination")
        self._container = None

        self._bootloader_observer = STORAGE.get_observer(BOOTLOADER)
        self._bootloader_observer.connect()

        self._disk_init_observer = STORAGE.get_observer(DISK_INITIALIZATION)
        self._disk_init_observer.connect()

        self._disk_select_observer = STORAGE.get_observer(DISK_SELECTION)
        self._disk_select_observer.connect()

        self._auto_part_observer = STORAGE.get_observer(AUTO_PARTITIONING)
        self._auto_part_observer.connect()

        self._selected_disks = self._disk_select_observer.proxy.SelectedDisks

        # This list gets set up once in initialize and should not be modified
        # except perhaps to add advanced devices. It will remain the full list
        # of disks that can be included in the install.
        self._available_disks = []

        if not flags.automatedInstall:
            # default to using autopart for interactive installs
            self._auto_part_observer.proxy.SetEnabled(True)

        self._ready = False
        self._select_all = False
        self._auto_part_enabled = None

        self.errors = []
        self.warnings = []
开发者ID:rvykydal,项目名称:anaconda,代码行数:34,代码来源:storage.py

示例2: _reset_storage

def _reset_storage(storage):
    """Do reset the storage.

    FIXME: Call the DBus task instead of this function.

    :param storage: an instance of the Blivet's storage object
    """
    # 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()
开发者ID:rvykydal,项目名称:anaconda,代码行数:27,代码来源:initialization.py

示例3: write_storage_configuration

def write_storage_configuration(storage, sysroot=None):
    """Write the storage configuration to sysroot.

    :param storage: the storage object
    :param sysroot: a path to the target OS installation
    """
    if sysroot is None:
        sysroot = util.getSysroot()

    if not os.path.isdir("%s/etc" % sysroot):
        os.mkdir("%s/etc" % sysroot)

    _write_escrow_packets(storage, sysroot)

    storage.make_mtab()
    storage.fsset.write()
    iscsi.write(sysroot, storage)

    fcoe_proxy = STORAGE.get_proxy(FCOE)
    fcoe_proxy.WriteConfiguration(sysroot)

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

    _write_dasd_conf(storage, sysroot)
开发者ID:rvykydal,项目名称:anaconda,代码行数:26,代码来源:installation.py

示例4: applyDiskSelection

def applyDiskSelection(storage, data, use_names):
    onlyuse = use_names[:]
    for disk in (d for d in storage.disks if d.name in onlyuse):
        onlyuse.extend(d.name for d in disk.ancestors
                       if d.name not in onlyuse
                       and d.is_disk)

    disk_select_proxy = STORAGE.get_proxy(DISK_SELECTION)
    disk_select_proxy.SetSelectedDisks(onlyuse)

    disk_init_proxy = STORAGE.get_proxy(DISK_INITIALIZATION)
    disk_init_proxy.SetDrivesToClear(use_names)
开发者ID:zhangsju,项目名称:anaconda,代码行数:12,代码来源:disks.py

示例5: _configure_partitioning

    def _configure_partitioning(self, storage):
        """Configure the partitioning.

        :param storage: an instance of Blivet
        """
        log.debug("Executing the automatic partitioning.")

        # Create the auto partitioning proxy.
        auto_part_proxy = STORAGE.get_proxy(AUTO_PARTITIONING)

        # Set the filesystem type.
        fstype = auto_part_proxy.FilesystemType

        if fstype:
            storage.set_default_fstype(fstype)
            storage.set_default_boot_fstype(fstype)

        # Set the default pbkdf args.
        pbkdf_args = self._luks_format_args.get('pbkdf_args', None)

        if pbkdf_args and not luks_data.pbkdf_args:
            luks_data.pbkdf_args = pbkdf_args

        # Set the minimal entropy.
        min_luks_entropy = self._luks_format_args.get('min_luks_entropy', None)

        if min_luks_entropy is not None:
            luks_data.min_entropy = min_luks_entropy

        # Get the autopart requests.
        requests = self._get_autopart_requests(storage)

        # Do the autopart.
        self._do_autopart(storage, self._scheme, requests, self._encrypted, self._luks_format_args)
开发者ID:rvykydal,项目名称:anaconda,代码行数:34,代码来源:automatic_partitioning.py

示例6: execute

    def execute(self, storage, dry_run=False):
        """Execute the bootloader."""
        log.debug("Execute the bootloader with dry run %s.", dry_run)
        bootloader_proxy = STORAGE.get_proxy(BOOTLOADER)

        # Skip bootloader for s390x image installation.
        if blivet.arch.is_s390() \
                and conf.target.is_image \
                and bootloader_proxy.BootloaderMode == BOOTLOADER_ENABLED:
            bootloader_proxy.SetBootloaderMode(BOOTLOADER_SKIPPED)

        # Is the bootloader enabled?
        if bootloader_proxy.BootloaderMode != BOOTLOADER_ENABLED:
            storage.bootloader.skip_bootloader = True
            log.debug("Bootloader is not enabled, skipping.")
            return

        # Update the disk list. Disks are already sorted by Blivet.
        storage.bootloader.set_disk_list([d for d in storage.disks if d.partitioned])

        # Apply the settings.
        self._update_flags(storage, bootloader_proxy)
        self._apply_args(storage, bootloader_proxy)
        self._apply_location(storage, bootloader_proxy)
        self._apply_password(storage, bootloader_proxy)
        self._apply_timeout(storage, bootloader_proxy)
        self._apply_drive_order(storage, bootloader_proxy, dry_run=dry_run)
        self._apply_boot_drive(storage, bootloader_proxy, dry_run=dry_run)

        # Set the stage2 and stage1 devices.
        if not dry_run:
            storage.bootloader.stage2_device = storage.boot_device
            storage.bootloader.set_stage1_device(storage.devices)
开发者ID:rvykydal,项目名称:anaconda,代码行数:33,代码来源:execution.py

示例7: _get_initialization_config

    def _get_initialization_config(self):
        """Get the initialization config.

        FIXME: This is a temporary method.
        """
        config = DiskInitializationConfig()

        # Update the config.
        disk_init_proxy = STORAGE.get_proxy(DISK_INITIALIZATION)
        config.initialization_mode = disk_init_proxy.InitializationMode
        config.drives_to_clear = disk_init_proxy.DrivesToClear
        config.devices_to_clear = disk_init_proxy.DevicesToClear
        config.initialize_labels = disk_init_proxy.InitializeLabelsEnabled
        config.format_unrecognized = disk_init_proxy.FormatUnrecognizedEnabled
        config.clear_non_existent = False

        # Update the disk label.
        disk_label = disk_init_proxy.DefaultDiskLabel

        if disk_label and not DiskLabel.set_default_label_type(disk_label):
            log.warning("%s is not a supported disklabel type on this platform. "
                        "Using default disklabel %s instead.", disk_label,
                        DiskLabel.get_platform_label_types()[0])

        return config
开发者ID:rvykydal,项目名称:anaconda,代码行数:25,代码来源:noninteractive_partitioning.py

示例8: __init__

    def __init__(self, data, storage, payload):
        """
        :see: pyanaconda.ui.common.Spoke.__init__
        :param data: data object passed to every spoke to load/store data
                     from/to it
        :type data: pykickstart.base.BaseHandler
        :param storage: object storing storage-related information
                        (disks, partitioning, bootloader, etc.)
        :type storage: blivet.Blivet
        :param payload: object storing payload-related information
        :type payload: pyanaconda.payload.Payload
        """

        self._error = None
        self._back_already_clicked = False
        self._storage_playground = None
        self.label_actions = None
        self.button_reset = None
        self.button_undo = None

        self._bootloader_observer = STORAGE.get_observer(BOOTLOADER)
        self._bootloader_observer.connect()

        StorageCheckHandler.__init__(self)
        NormalSpoke.__init__(self, data, storage, payload)
开发者ID:rvykydal,项目名称:anaconda,代码行数:25,代码来源:blivet_gui.py

示例9: _filter_default_partitions

def _filter_default_partitions(requests):
    """Filter default partitions based on the kickstart data.

    :param requests: a list of requests
    :return: a customized list of requests
    """
    auto_part_proxy = STORAGE.get_proxy(AUTO_PARTITIONING)
    skipped_mountpoints = set()
    skipped_fstypes = set()

    # Create sets of mountpoints and fstypes to remove from autorequests.
    if auto_part_proxy.Enabled:
        # Remove /home if --nohome is selected.
        if auto_part_proxy.NoHome:
            skipped_mountpoints.add("/home")

        # Remove /boot if --noboot is selected.
        if auto_part_proxy.NoBoot:
            skipped_mountpoints.add("/boot")

        # Remove swap if --noswap is selected.
        if auto_part_proxy.NoSwap:
            skipped_fstypes.add("swap")

            # Swap will not be recommended by the storage checker.
            # TODO: Remove this code from this function.
            from pyanaconda.storage.checker import storage_checker
            storage_checker.add_constraint(STORAGE_SWAP_IS_RECOMMENDED, False)

    # Skip mountpoints we want to remove.
    return [
        req for req in requests
        if req.mountpoint not in skipped_mountpoints
           and req.fstype not in skipped_fstypes
    ]
开发者ID:rvykydal,项目名称:anaconda,代码行数:35,代码来源:partitioning.py

示例10: _set_storage_defaults

    def _set_storage_defaults(self, storage):
        fstype = None
        boot_fstype = None

        # Get the default fstype from a kickstart file.
        auto_part_proxy = STORAGE.get_proxy(AUTO_PARTITIONING)

        if auto_part_proxy.Enabled and auto_part_proxy.FilesystemType:
            fstype = auto_part_proxy.FilesystemType
            boot_fstype = fstype
        # Or from an install class.
        elif self.instClass.defaultFS:
            fstype = self.instClass.defaultFS
            boot_fstype = None

        # Set the default fstype.
        if fstype:
            storage.set_default_fstype(fstype)

        # Set the default boot fstype.
        if boot_fstype:
            storage.set_default_boot_fstype(boot_fstype)

        # Set the default LUKS version.
        luks_version = self.instClass.default_luks_version

        if luks_version:
            storage.set_default_luks_version(luks_version)

        # Set the default partitioning.
        storage.set_default_partitioning(self.instClass.default_partitioning)
开发者ID:zhangsju,项目名称:anaconda,代码行数:31,代码来源:anaconda.py

示例11: setup

    def setup(self, storage, ksdata, payload):
        # the kdump addon should run only if requested
        if not flags.cmdline.getbool("kdump_addon", default=False):
            return

        bootloader_proxy = STORAGE.get_proxy(BOOTLOADER)

        # Clear any existing crashkernel bootloader arguments
        extra_args = bootloader_proxy.ExtraArguments
        new_args = [arg for arg in extra_args
                    if not arg.startswith('crashkernel=')]

        # Copy our reserved amount to the bootloader arguments
        if self.enabled:
            # Ensure that the amount is an amount in MB
            if self.reserveMB[-1] != 'M':
                self.reserveMB += 'M'
            new_args.append(' crashkernel=%s' % self.reserveMB)

        bootloader_proxy.SetExtraArguments(new_args)

        # Do the same thing with the storage.bootloader.boot_args set
        if storage.bootloader.boot_args:
            crashargs = [arg for arg in storage.bootloader.boot_args \
                    if arg.startswith('crashkernel=')]
            storage.bootloader.boot_args -= set(crashargs)

        if self.enabled:
            storage.bootloader.boot_args.add('crashkernel=%s' % self.reserveMB)
            ksdata.packages.packageList.append("kexec-tools")
        if self.enablefadump and os.path.exists(FADUMP_CAPABLE_FILE):
                storage.bootloader.boot_args.add('fadump=on')
开发者ID:daveyoung,项目名称:kdump-anaconda-addon,代码行数:32,代码来源:kdump.py

示例12: do_format

    def do_format(self):
        """Format with a remote task."""
        disk_names = [disk.name for disk in self._dasds]
        task_path = self._dasd_module.FormatWithTask(disk_names)

        task_proxy = STORAGE.get_proxy(task_path)
        sync_run_task(task_proxy, callback=self._report_progress)
开发者ID:zhangsju,项目名称:anaconda,代码行数:7,代码来源:format_dasd.py

示例13: __init__

    def __init__(self, data, storage, disks, show_remove=True, set_boot=True):
        super().__init__(data)
        self._storage = storage
        self.disks = []

        self._view = self.builder.get_object("disk_tree_view")
        self._store = self.builder.get_object("disk_store")
        self._selection = self.builder.get_object("disk_selection")
        self._summary_label = self.builder.get_object("summary_label")

        self._set_button = self.builder.get_object("set_as_boot_button")
        self._remove_button = self.builder.get_object("remove_button")

        self._bootloader_proxy = STORAGE.get_proxy(BOOTLOADER)

        self._previousID = None

        for disk in disks:
            self._store.append([False,
                                "%s (%s)" % (disk.description, disk.serial),
                                str(disk.size),
                                str(self._storage.get_disk_free_space([disk])),
                                disk.name,
                                disk.id])
        self.disks = disks[:]
        self._update_summary()

        if not show_remove:
            self.builder.get_object("remove_button").hide()

        if not set_boot:
            self._set_button.hide()

        if not disks:
            return

        # Don't select a boot device if no boot device is asked for.
        if self._bootloader_proxy.BootloaderMode != BOOTLOADER_ENABLED:
            return

        # Set up the default boot device.  Use what's in the ksdata if anything,
        # then fall back to the first device.
        boot_drive = self._bootloader_proxy.Drive
        default_id = None

        if boot_drive:
            for d in self.disks:
                if d.name == boot_drive:
                    default_id = d.id

        if not default_id:
            default_id = self.disks[0].id

        # And then select it in the UI.
        for row in self._store:
            if row[ID_COL] == default_id:
                self._previousID = row[ID_COL]
                row[IS_BOOT_COL] = True
                break
开发者ID:rvykydal,项目名称:anaconda,代码行数:59,代码来源:cart.py

示例14: ignore_nvdimm_blockdevs

def ignore_nvdimm_blockdevs():
    """Add nvdimm devices to be ignored to the ignored disks."""
    if conf.target.is_directory:
        return

    nvdimm_proxy = STORAGE.get_proxy(NVDIMM)
    ignored_nvdimm_devs = nvdimm_proxy.GetDevicesToIgnore()

    if not ignored_nvdimm_devs:
        return

    log.debug("Adding NVDIMM devices %s to ignored disks", ",".join(ignored_nvdimm_devs))

    disk_select_proxy = STORAGE.get_proxy(DISK_SELECTION)
    ignored_disks = disk_select_proxy.IgnoredDisks
    ignored_disks.extend(ignored_nvdimm_devs)
    disk_select_proxy.SetIgnoredDisks(ignored_disks)
开发者ID:rvykydal,项目名称:anaconda,代码行数:17,代码来源:utils.py

示例15: reset_bootloader

def reset_bootloader(storage):
    """Reset the bootloader.

    :param storage: an instance of the Blivet's storage object
    """
    bootloader_proxy = STORAGE.get_proxy(BOOTLOADER)
    bootloader_proxy.SetDrive(BOOTLOADER_DRIVE_UNSET)
    storage.bootloader.reset()
开发者ID:rvykydal,项目名称:anaconda,代码行数:8,代码来源:initialization.py


注:本文中的pyanaconda.modules.common.constants.services.STORAGE类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。