def input(self, args, key): """ Grab the choice and update things. """ if not self._container.process_user_input(key): # TRANSLATORS: 's' to rescan devices if key.lower() == C_('TUI|Spoke Navigation|Partitioning', 's'): text = _("Warning: This will revert all changes done so far.\n" "Do you want to proceed?\n") question_window = YesNoDialog(text) ScreenHandler.push_screen_modal(question_window) if question_window.answer: # unset selected disks temporarily so that # storage_initialize() processes all devices disk_select_proxy = STORAGE.get_proxy(DISK_SELECTION) selected_disks = disk_select_proxy.SelectedDisks disk_select_proxy.SetSelectedDisks([]) print(_("Scanning disks. This may take a moment...")) storage_initialize(self.storage, self.data, self.storage.protected_dev_names) disk_select_proxy.SetSelectedDisks(selected_disks) self.data.mount.clear_mount_data() self._gather_mount_data_info() return InputState.PROCESSED_AND_REDRAW # TRANSLATORS: 'c' to continue elif key.lower() == C_('TUI|Spoke Navigation', 'c'): self.apply() return super().input(args, key) return InputState.PROCESSED
def input(self, args, key): """ Grab the choice and update things. """ if not self._container.process_user_input(key): # TRANSLATORS: 's' to rescan devices if key.lower() == C_('TUI|Spoke Navigation|Partitioning', 's'): text = _( "Warning: This will revert all changes done so far.\nDo you want to proceed?\n" ) question_window = YesNoDialog(text) ScreenHandler.push_screen_modal(question_window) if question_window.answer: # unset self.data.ignoredisk.onlyuse temporarily so that # storage_initialize() processes all devices ignoredisk = self.data.ignoredisk.onlyuse self.data.ignoredisk.onlyuse = [] print(_("Scanning disks. This may take a moment...")) storage_initialize( self.storage, self.data, self.storage.devicetree.protected_dev_names) self.data.ignoredisk.onlyuse = ignoredisk self.data.mount.clear_mount_data() self._gather_mount_data_info() self.redraw() return InputState.PROCESSED # TRANSLATORS: 'c' to continue elif key.lower() == C_('TUI|Spoke Navigation', 'c'): self.apply() return super(MountPointAssignSpoke, self).input(args, key) return InputState.PROCESSED
def _ensure_init_storage(self): """ If a different clearpart type was chosen or mount point assignment was chosen instead, we need to reset/rescan storage to revert all changes done by the previous run of doKickstartStorage() and get everything into the initial state. """ # the only safe options are: # 1) if nothing was set before (self._orig_clearpart_type is None) or if self._orig_clearpart_type == CLEAR_PARTITIONS_DEFAULT: return # 2) mount point assignment was done before and user just wants to tweak it if self._orig_mount_assign and self._do_mount_assign: return # else print(_("Reverting previous configuration. This may take a moment...")) # unset selected disks temporarily so that # storage_initialize() processes all devices disk_select_proxy = STORAGE.get_proxy(DISK_SELECTION) selected_disks = disk_select_proxy.SelectedDisks disk_select_proxy.SetSelectedDisks([]) storage_initialize(self.storage, self.data, self.storage.protected_dev_names) disk_select_proxy.SetSelectedDisks(selected_disks) self.data.mount.clear_mount_data()
def setUp(self): self.storage = InstallerStorage() # anaconda first configures disk images for (name, size) in iter(self.disks.items()): path = util.create_sparse_tempfile(name, size) self.storage.disk_images[name] = path # at this point the DMLinearDevice has correct size self.storage.setup_disk_images() # no kickstart available ksdata = kickstart.AnacondaKSHandler([]) # anaconda calls storage_initialize regardless of whether or not # this is an image install. Somewhere along the line this will # execute setup_disk_images() once more and the DMLinearDevice created # in this second execution has size 0 with patch('blivet.flags'): storage_initialize(self.storage, ksdata, [])
def _ensure_init_storage(self): """ If a different clearpart type was chosen or mount point assignment was chosen instead, we need to reset/rescan storage to revert all changes done by the previous run of doKickstartStorage() and get everything into the initial state. """ # the only safe options are: # 1) if nothing was set before (self._orig_clearpart_type is None) or # 2) mount point assignment was done before and user just wants to tweak it if self._orig_clearpart_type is None or (self._orig_mount_assign and self._do_mount_assign): return # else print(_("Reverting previous configuration. This may take a moment...")) # unset self.data.ignoredisk.onlyuse temporarily so that # storage_initialize() processes all devices ignoredisk = self.data.ignoredisk.onlyuse self.data.ignoredisk.onlyuse = [] storage_initialize(self.storage, self.data, self.storage.protected_dev_names) self.data.ignoredisk.onlyuse = ignoredisk self.data.mount.clear_mount_data()
def run(self, storage, data): """Format all found DASDs and update the storage. This method could be run in a separate thread. """ # Check if we have something to format. if not self._dasds: self.report.emit(_("Nothing to format")) return # Format all found DASDs. self.report.emit(_("Formatting DASDs")) self.do_format() # Update the storage. self.report.emit(_("Probing storage")) storage_initialize(storage, data, storage.protected_dev_names) # Update also the storage snapshot to reflect the changes. if on_disk_storage.created: on_disk_storage.dispose_snapshot() on_disk_storage.create_snapshot(storage)
def _rescan_devices(self): """Rescan devices.""" text = _("Warning: This will revert all changes done so far.\n" "Do you want to proceed?\n") question_window = YesNoDialog(text) ScreenHandler.push_screen_modal(question_window) if not question_window.answer: return # unset selected disks temporarily so that # storage_initialize() processes all devices disk_select_proxy = STORAGE.get_proxy(DISK_SELECTION) selected_disks = disk_select_proxy.SelectedDisks disk_select_proxy.SetSelectedDisks([]) print(_("Scanning disks. This may take a moment...")) storage_initialize(self.storage, self.data, self.storage.protected_dev_names) disk_select_proxy.SetSelectedDisks(selected_disks) self._manual_part_proxy.SetMountPoints([]) self._mount_info = self._gather_mount_info()