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


Python disks.applyDiskSelection函数代码示例

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


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

示例1: _doExecute

 def _doExecute(self):
     self._ready = False
     hubQ.send_not_ready(self.__class__.__name__)
     # on the off-chance dasdfmt is running, we can't proceed further
     threadMgr.wait(constants.THREAD_DASDFMT)
     hubQ.send_message(self.__class__.__name__, _("Saving storage configuration..."))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
     else:
         if self.autopart:
             self.run()
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
开发者ID:jresch,项目名称:anaconda,代码行数:32,代码来源:storage.py

示例2: apply

    def apply(self):
        applyDiskSelection(self.storage, self.data, self.selected_disks)
        self.data.autopart.autopart = self.autopart
        self.data.autopart.type = self.autoPartType
        self.data.autopart.encrypted = self.encrypted
        self.data.autopart.passphrase = self.passphrase

        if self.data.bootloader.bootDrive and \
           self.data.bootloader.bootDrive not in self.selected_disks:
            self.data.bootloader.bootDrive = ""
            self.storage.bootloader.reset()

        self.data.clearpart.initAll = True

        if not self.autopart_missing_passphrase:
            self.clearPartType = CLEARPART_TYPE_NONE
            self.data.clearpart.type = self.clearPartType

        self.storage.config.update(self.data)
        self.storage.autoPartType = self.data.autopart.type
        self.storage.encryptedAutoPart = self.data.autopart.encrypted
        self.storage.encryptionPassphrase = self.data.autopart.passphrase

        # If autopart is selected we want to remove whatever has been
        # created/scheduled to make room for autopart.
        # If custom is selected, we want to leave alone any storage layout the
        # user may have set up before now.
        self.storage.config.clearNonExistent = self.data.autopart.autopart
开发者ID:fabiand,项目名称:anaconda-1,代码行数:28,代码来源:storage.py

示例3: apply

    def apply(self):
        applyDiskSelection(self.storage, self.data, self.selected_disks)
        self.data.autopart.autopart = self.autopart
        self.data.autopart.type = self.autoPartType
        self.data.autopart.encrypted = self.encrypted
        self.data.autopart.passphrase = self.passphrase

        self.clearPartType = CLEARPART_TYPE_NONE

        if self.data.bootloader.bootDrive and \
           self.data.bootloader.bootDrive not in self.selected_disks:
            self.data.bootloader.bootDrive = ""
            self.storage.bootloader.reset()

        self.data.clearpart.initAll = True
        self.data.clearpart.type = self.clearPartType
        self.storage.config.update(self.data)
        self.storage.autoPartType = self.data.autopart.type
        self.storage.encryptedAutoPart = self.data.autopart.encrypted
        self.storage.encryptionPassphrase = self.data.autopart.passphrase

        # If autopart is selected we want to remove whatever has been
        # created/scheduled to make room for autopart.
        # If custom is selected, we want to leave alone any storage layout the
        # user may have set up before now.
        self.storage.config.clearNonExistent = self.data.autopart.autopart

        # refresh the autopart swap size suggestion with currently selected disks
        for request in self.storage.autoPartitionRequests:
            if request.fstype == "swap":
                disk_space = getAvailableDiskSpace(self.storage)
                request.size = swap_lib.swapSuggestion(disk_space=disk_space)
                break
开发者ID:akozumpl,项目名称:anaconda,代码行数:33,代码来源:storage.py

示例4: execute

 def execute(self):
     print(_("Generating updated storage configuration"))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartParseError) as e:
         log.error("storage configuration failed: %s", e)
         print(_("storage configuration failed: %s") % e)
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
         self.data.clearpart.type = CLEARPART_TYPE_ALL
         self.data.clearpart.initAll = False
         self.storage.config.update(self.data)
         self.storage.autopart_type = self.data.autopart.type
         self.storage.reset()
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         print(_("storage configuration failed: %s") % e)
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
     else:
         print(_("Checking storage configuration..."))
         report = storage_checker.check(self.storage)
         print("\n".join(report.all_errors))
         report.log(log)
         self.errors = report.errors
         self.warnings = report.warnings
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
开发者ID:jaymzh,项目名称:anaconda,代码行数:31,代码来源:storage.py

示例5: apply

    def apply(self):
        applyDiskSelection(self.storage, self.data, self.selected_disks)

        # some disks may have been added in this spoke, we need to recreate the
        # snapshot of on-disk storage
        if on_disk_storage.created:
            on_disk_storage.dispose_snapshot()
        on_disk_storage.create_snapshot(self.storage)
开发者ID:jaymzh,项目名称:anaconda,代码行数:8,代码来源:advanced_storage.py

示例6: on_specialized_clicked

    def on_specialized_clicked(self, button):
        # Don't want to run apply or execute in this case, since we have to
        # collect some more disks first.  The user will be back to this spoke.
        self.applyOnSkip = False

        # However, we do want to apply current selections so the disk cart off
        # the filter spoke will display the correct information.
        applyDiskSelection(self.storage, self.data, self.selected_disks)

        self.skipTo = "FilterSpoke"
        NormalSpoke.on_back_clicked(self, button)
开发者ID:rtruxal,项目名称:anaconda,代码行数:11,代码来源:storage.py

示例7: _check_dasd_formats

    def _check_dasd_formats(self):
        rc = DASD_FORMAT_NO_CHANGE
        dasds = self.storage.devicetree.make_unformatted_dasd_list(self.storage.devicetree.dasd)
        if len(dasds) > 0:
            # We want to apply current selection before running dasdfmt to
            # prevent this information from being lost afterward
            applyDiskSelection(self.storage, self.data, self.selected_disks)
            dialog = DasdFormatDialog(self.data, self.storage, dasds)
            ignoreEscape(dialog.window)
            rc = self.run_lightbox_dialog(dialog)

        return rc
开发者ID:fabiand,项目名称:anaconda-1,代码行数:12,代码来源:storage.py

示例8: _check_dasd_formats

    def _check_dasd_formats(self):
        rc = DASD_FORMAT_NO_CHANGE
        dasds = (d for d in self.storage.devicetree.devices
                 if d.type == "dasd" and blockdev.s390.dasd_needs_format(d.busid))
        if len(dasds) > 0:
            # We want to apply current selection before running dasdfmt to
            # prevent this information from being lost afterward
            applyDiskSelection(self.storage, self.data, self.selected_disks)
            dialog = DasdFormatDialog(self.data, self.storage, dasds)
            ignoreEscape(dialog.window)
            rc = self.run_lightbox_dialog(dialog)

        return rc
开发者ID:evol262,项目名称:anaconda,代码行数:13,代码来源:storage.py

示例9: _initialize

    def _initialize(self):
        hubQ.send_message(self.__class__.__name__, _(constants.PAYLOAD_STATUS_PROBING_STORAGE))

        threadMgr.wait(constants.THREAD_STORAGE)
        threadMgr.wait(constants.THREAD_CUSTOM_STORAGE_INIT)

        self.disks = getDisks(self.storage.devicetree)

        # if there's only one disk, select it by default
        if len(self.disks) == 1 and not self.selected_disks:
            applyDiskSelection(self.storage, self.data, [self.disks[0].name])

        self._ready = True
        hubQ.send_ready(self.__class__.__name__, False)
开发者ID:fabiand,项目名称:anaconda-1,代码行数:14,代码来源:storage.py

示例10: on_specialized_clicked

    def on_specialized_clicked(self, button):
        # there will be changes in disk selection, revert storage to an early snapshot (if it exists)
        if on_disk_storage.created:
            on_disk_storage.reset_to_snapshot(self.storage)

        # Don't want to run apply or execute in this case, since we have to
        # collect some more disks first.  The user will be back to this spoke.
        self.applyOnSkip = False

        # However, we do want to apply current selections so the disk cart off
        # the filter spoke will display the correct information.
        applyDiskSelection(self.storage, self.data, self.selected_disks)

        self.skipTo = "FilterSpoke"
        NormalSpoke.on_back_clicked(self, button)
开发者ID:fabiand,项目名称:anaconda-1,代码行数:15,代码来源:storage.py

示例11: _doExecute

 def _doExecute(self):
     self._ready = False
     hubQ.send_not_ready(self.__class__.__name__)
     # on the off-chance dasdfmt is running, we can't proceed further
     threadMgr.wait(constants.THREAD_DASDFMT)
     hubQ.send_message(self.__class__.__name__, _("Saving storage configuration..."))
     if flags.automatedInstall and self.data.autopart.encrypted and not self.data.autopart.passphrase:
         self.autopart_missing_passphrase = True
         StorageChecker.errors = [_("Passphrase for autopart encryption not specified.")]
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
         return
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartParseError) as e:
         log.error("storage configuration failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
     else:
         if self.autopart or (flags.automatedInstall and (self.data.autopart.autopart or self.data.partition.seen)):
             # run() executes StorageChecker.checkStorage in a seperate threat
             self.run()
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
开发者ID:fabiand,项目名称:anaconda-1,代码行数:39,代码来源:storage.py

示例12: execute

 def execute(self):
     print(_("Generating updated storage configuration"))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         print(_("storage configuration failed: %s") % e)
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
         self.data.clearpart.type = CLEARPART_TYPE_ALL
         self.data.clearpart.initAll = False
         self.storage.config.update(self.data)
         self.storage.autoPartType = self.data.autopart.type
         self.storage.reset()
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         print(_("storage configuration failed: %s") % e)
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
     else:
         print(_("Checking storage configuration..."))
         exns = sanity_check(self.storage)
         errors = [str(exn) for exn in exns if isinstance(exn, SanityError)]
         warnings = [str(exn) for exn in exns if isinstance(exn, SanityWarning)]
         (self.errors, self.warnings) = (errors, warnings)
         for e in self.errors:
             log.error(e)
             print(e)
         for w in self.warnings:
             log.warning(w)
             print(w)
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
开发者ID:galleguindio,项目名称:anaconda,代码行数:36,代码来源:storage.py

示例13: on_back_clicked

    def on_back_clicked(self, button):
        # We can't exit early if it looks like nothing has changed because the
        # user might want to change settings presented in the dialogs shown from
        # within this method.

        # Do not enter this method multiple times if user clicking multiple times
        # on back button
        if self._back_clicked:
            return
        else:
            self._back_clicked = True

        # Remove all non-existing devices if autopart was active when we last
        # refreshed.
        if self._previous_autopart:
            self._previous_autopart = False
            for partition in self.storage.partitions[:]:
                # check if it's been removed in a previous iteration
                if not partition.exists and \
                   partition in self.storage.partitions:
                    self.storage.recursiveRemove(partition)

        # make sure no containers were split up by the user's disk selection
        self.clear_info()
        self.errors = checkDiskSelection(self.storage, self.selected_disks)
        if self.errors:
            # The disk selection has to make sense before we can proceed.
            self.set_error(_("There was a problem with your disk selection. "
                             "Click here for details."))
            self._back_clicked = False
            return

        # hide/unhide disks as requested
        for disk in self.disks:
            if disk.name not in self.selected_disks and \
               disk in self.storage.devices:
                self.storage.devicetree.hide(disk)
            elif disk.name in self.selected_disks and \
                 disk not in self.storage.devices:
                self.storage.devicetree.unhide(disk)

        # show the installation options dialog
        disks = [d for d in self.disks if d.name in self.selected_disks]
        disks_size = sum((d.size for d in disks), Size(0))

        # No disks selected?  The user wants to back out of the storage spoke.
        if not disks:
            NormalSpoke.on_back_clicked(self, button)
            return

        if arch.isS390():
            # check for unformatted DASDs and launch dasdfmt if any discovered
            dasds = self.storage.devicetree.make_unformatted_dasd_list(disks)
            if len(dasds) > 0:
                # We want to apply current selection before running dasdfmt to
                # prevent this information from being lost afterward
                applyDiskSelection(self.storage, self.data, self.selected_disks)
                dialog = DasdFormatDialog(self.data, self.storage, dasds)
                ignoreEscape(dialog.window)
                rc = self.run_lightbox_dialog(dialog)
                if rc == 1:
                    # User hit OK on the dialog
                    self.refresh()
                elif rc == 2:
                    # User clicked uri to return to hub.
                    NormalSpoke.on_back_clicked(self, button)
                    return
                elif rc != 2:
                    # User either hit cancel on the dialog or closed it via escape,
                    # there was no formatting done.
                    # NOTE: rc == 2 means the user clicked on the link that takes t
                    # back to the hub.
                    self._back_clicked = False
                    return

        # Figure out if the existing disk labels will work on this platform
        # you need to have at least one of the platform's labels in order for
        # any of the free space to be useful.
        disk_labels = set(disk.format.labelType for disk in disks
                              if hasattr(disk.format, "labelType"))
        platform_labels = set(platform.diskLabelTypes)
        if disk_labels and platform_labels.isdisjoint(disk_labels):
            disk_free = 0
            fs_free = 0
            log.debug("Need disklabel: %s have: %s", ", ".join(platform_labels),
                                                     ", ".join(disk_labels))
        else:
            free_space = self.storage.getFreeSpace(disks=disks,
                                                   clearPartType=CLEARPART_TYPE_NONE)
            disk_free = sum(f[0] for f in free_space.values())
            fs_free = sum(f[1] for f in free_space.values())

        required_space = self.payload.spaceRequired
        auto_swap = sum((r.size for r in self.storage.autoPartitionRequests
                                if r.fstype == "swap"), Size(0))
        if self.autopart and auto_swap == Size(0):
            # autopartitioning requested, but not applied yet (=> no auto swap
            # requests), ask user for enough space to fit in the suggested swap
            auto_swap = autopart.swapSuggestion()

#.........这里部分代码省略.........
开发者ID:jresch,项目名称:anaconda,代码行数:101,代码来源:storage.py


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