コード例 #1
0
    def _get_os_data(self, root):
        """Get the OS data.

        :param root: an instance of Root
        :return: an instance of OSData
        """
        data = OSData()
        data.os_name = root.name or ""
        data.swap_devices = [device.name for device in root.swaps]
        data.mount_points = {
            path: device.name
            for path, device in root.mounts.items()
        }
        return data
コード例 #2
0
    def CollectSupportedSystems(self) -> List[Structure]:
        """Collect supported existing or new installations.

        :return: a list of data about found installations
        """
        return OSData.to_structure_list(
            self.implementation.collect_supported_systems())
コード例 #3
0
    def GetExistingSystems(self) -> List[Structure]:
        """"Get existing GNU/Linux installations.

        :return: a list of data about found installations
        """
        return OSData.to_structure_list(
            self.implementation.get_existing_systems())
コード例 #4
0
    def GenerateSystemData(self, boot_drive: Str) -> Structure:
        """Generate the new installation data.

        :param boot_drive: a name of the boot drive
        :return: a structure with data about the new installation
        """
        return OSData.to_structure(
            self.implementation.generate_system_data(boot_drive))
コード例 #5
0
ファイル: rescue.py プロジェクト: yubihong/anaconda
    def find_roots(self):
        """List of found roots."""
        task_path = self._device_tree_proxy.FindExistingSystemsWithTask()

        task_proxy = STORAGE.get_proxy(task_path)
        sync_run_task(task_proxy)

        roots = OSData.from_structure_list(
            self._device_tree_proxy.GetExistingSystems())

        if not roots:
            self.status = RescueModeStatus.ROOT_NOT_FOUND

        return roots
コード例 #6
0
    def __init__(self, data, payload, partitioning, disks):
        super().__init__(data)
        self._disks = disks

        # Get the device tree.
        self._device_tree = STORAGE.get_proxy(
            partitioning.GetDeviceTree()
        )

        # Get roots of existing systems.
        self._roots = OSData.from_structure_list(
            self._device_tree.GetExistingSystems()
        )

        # Get the required device size.
        required_space = payload.space_required.get_bytes()
        required_size = self._device_tree.GetRequiredDeviceSize(required_space)

        self._required_size = Size(required_size)
        self._initial_free_space = Size(0)
        self._selected_reclaimable_space = Size(0)
        self._can_shrink_something = False

        self._disk_store = self.builder.get_object("diskStore")
        self._selection = self.builder.get_object("diskView-selection")
        self._view = self.builder.get_object("diskView")
        self._disk_store = self.builder.get_object("diskStore")
        self._reclaimable_label = self.builder.get_object("reclaimableSpaceLabel")
        self._selected_label = self.builder.get_object("selectedSpaceLabel")
        self._required_label = self.builder.get_object("requiredSpaceLabel")

        self._required_label.set_markup(
            _("Installation requires a total of <b>%s</b> for system data.")
            % escape_markup(str(self._required_size))
        )

        self._reclaim_desc_label = self.builder.get_object("reclaimDescLabel")
        self._resize_button = self.builder.get_object("resizeButton")
        self._preserve_button = self.builder.get_object("preserveButton")
        self._shrink_button = self.builder.get_object("shrinkButton")
        self._delete_button = self.builder.get_object("deleteButton")
        self._resize_slider = self.builder.get_object("resizeSlider")