Ejemplo n.º 1
0
    def reset_with_task(self):
        """Reset the storage model.

        We will reset a copy of the current storage model
        and switch the models if the reset is successful.

        :return: a DBus path to a task
        """
        # Copy the storage.
        storage = self.storage.copy()

        # Set up the storage.
        storage.ignored_disks = self._disk_selection_module.ignored_disks
        storage.exclusive_disks = self._disk_selection_module.exclusive_disks
        storage.protected_devices = self._disk_selection_module.protected_devices
        storage.disk_images = self._disk_selection_module.disk_images

        # Create the task.
        task = StorageResetTask(storage)
        # FIXME: Don't set the storage if the task has failed.
        task.stopped_signal.connect(lambda: self.set_storage(storage))

        # Publish the task.
        path = self.publish_task(STORAGE.namespace, task)
        return path
Ejemplo n.º 2
0
    def repopulate_storage(self):
        """Repopulate the storage."""
        # Update the widgets.
        self._conditionNotebook.set_current_page(PAGE_RESULT_SUCCESS)

        # Update the namespaces info.
        nvdimm.update_namespaces_info()

        # Get the task.
        task = StorageResetTask(self._storage)
        task.stopped_signal.connect(lambda: self.repopulate_finished(task))

        # Start the task.
        task.start()

        self._repopulateSpinner.start()
Ejemplo n.º 3
0
    def reset_with_task(self):
        """Reset the storage model.

        We will reset a copy of the current storage model
        and switch the models if the reset is successful.

        :return: a task
        """
        # Copy the storage.
        storage = self.storage.copy()

        # Set up the storage.
        storage.ignored_disks = self._disk_selection_module.ignored_disks
        storage.exclusive_disks = self._disk_selection_module.exclusive_disks
        storage.protected_devices = self._disk_selection_module.protected_devices
        storage.disk_images = self._disk_selection_module.disk_images

        # Create the task.
        task = StorageResetTask(storage)
        task.succeeded_signal.connect(lambda: self.set_storage(storage))
        return task
Ejemplo n.º 4
0
 def reset_test(self):
     """Test the reset."""
     storage = Mock()
     task = StorageResetTask(storage)
     task.run()
     storage.reset.assert_called_once()