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 print(_("Scanning disks. This may take a moment...")) reset_storage(self.storage, scan_all=True) self._manual_part_proxy.SetMountPoints([]) self._mount_info = self._gather_mount_info()
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 print(_("Scanning disks. This may take a moment...")) reset_storage(self.storage, scan_all=True) self._manual_part_proxy.SetMountPoints([]) self._mount_info = self._gather_mount_info()
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() # anaconda calls initialize_storage 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'): reset_storage(self.storage)
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_init_mode == 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...")) reset_storage(self.storage, scan_all=True) self._manual_part_proxy.SetMountPoints([])
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_init_mode == 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...")) reset_storage(self.storage, scan_all=True) self._manual_part_proxy.SetMountPoints([])
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")) reset_storage(storage) # 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 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")) reset_storage(storage) # 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 execute(self): print(_("Generating updated storage configuration")) try: configure_storage(self.storage, self.data) except StorageConfigurationError as e: print(_("storage configuration failed: %s") % e) self.errors = [str(e)] reset_bootloader(self.storage) reset_storage(self.storage, scan_all=True) except BootloaderConfigurationError as e: print(_("storage configuration failed: %s") % e) self.errors = [str(e)] reset_bootloader(self.storage) 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: reset_custom_storage_data(self.data) self._ready = True
def execute(self): print(_("Generating updated storage configuration")) try: configure_storage(self.storage, self.data) except StorageConfigurationError as e: print(_("storage configuration failed: %s") % e) self.errors = [str(e)] reset_bootloader(self.storage) reset_storage(self.storage, scan_all=True) except BootloaderConfigurationError as e: print(_("storage configuration failed: %s") % e) self.errors = [str(e)] reset_bootloader(self.storage) 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: reset_custom_storage_data(self.data) self._ready = True
def execute(self): print(_("Generating updated storage configuration")) try: do_kickstart_storage(self.storage, self.data) except (StorageError, KickstartParseError) as e: log.error("storage configuration failed: %s", e) print(_("storage configuration failed: %s") % e) self.errors = [str(e)] # Prepare for reset. self._bootloader_observer.proxy.SetDrive(BOOTLOADER_DRIVE_UNSET) self._disk_init_observer.proxy.SetInitializationMode( CLEAR_PARTITIONS_ALL) self._disk_init_observer.proxy.SetInitializeLabelsEnabled(False) self.storage.autopart_type = self._auto_part_observer.proxy.Type # The reset also calls self.storage.config.update(). reset_storage(self.storage) # Now set data 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._bootloader_observer.proxy.SetDrive(BOOTLOADER_DRIVE_UNSET) 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