def setUp(self): """ Do any setup required prior to running a test. """ flags.image_install = True self.blivet = Blivet() self.addCleanup(self._clean_up) self.set_up_storage()
def restore_state(self): """Get the second machine snapshot, compare it to the first one and perform the cleaning. Return list of devices that could not be removed.""" new_state_snapshot = self._get_snapshot() diff = self._get_diff(self.org_state_snapshot, new_state_snapshot) if diff: print("These devices were not properly cleaned by tests:\n" + "\n".join(diff)) print("Removing by force...") # Put information into the syslog to be able to track possible issues syslog.syslog( "Following devices were not removed after UDisks2 D-Bus" + " tests and will be removed by force: %s" % str(diff)[1:-1]) blvt = Blivet() blvt.reset() for device in diff: # kill all processes that are using the device # get list of mountpoints from blivet mountpoint dictionary mountpoints = [ mpoint for mpoint, dev in blvt.mounts.mounts_cache.mountpoints.items() if dev == device ] for mountpoint in mountpoints: self._run_command("fuser -km %s" % mountpoint) # just try to remove everything blvt.config.exclusive_disks = diff blvt.reset() blvt.devicetree.teardown_all() self._run_command("modprobe -r scsi_debug") self._run_command("targetcli clearconfig confirm=True") for disk_file in glob.glob("/var/tmp/udisks_test_disk*"): os.unlink(disk_file) cleaned_state_snapshot = self._get_snapshot() not_cleaned = self._get_diff(self.org_state_snapshot, cleaned_state_snapshot) if not_cleaned: print("Failed to remove following devices:\n" + "\n".join(not_cleaned)) else: print("Devices successfully removed.") return not_cleaned
def setUp(self): self.blivet = Blivet() # anaconda first configures disk images for (name, size) in iter(self.disks.items()): path = util.create_sparse_tempfile(name, size) self.blivet.disk_images[name] = path # at this point the DMLinearDevice has correct size self.blivet.setup_disk_images() # emulates setting the anaconda flags which later update # blivet flags as the first thing to do in storage_initialize flags.image_install = True # 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 storage_initialize(self.blivet, ksdata, [])
def setUp(self): """ Do any setup required prior to running a test. """ self.blivet = Blivet() self.addCleanup(self._clean_up) self.set_up_storage()
spokeClass = v except TypeError: pass if not spokeClass: try: spokeClass = getattr(spokeModule, spokeClassName) except KeyError: print "%s %s could not be found in %s" % (SpokeText, spokeClassName, spokeModuleName) sys.exit(1) print "Running %s %s from %s" % (spokeText, spokeClass, spokeModule) ksdata = makeVersion() storage = Blivet(ksdata=ksdata) storage.reset() instclass = DefaultInstall() payload = YumPayload(ksdata) payload.setup(storage) spoke = spokeClass(ksdata, storage, payload, instclass) if hasattr(spoke, "register_event_cb"): spoke.register_event_cb("continue", lambda: Gtk.main_quit()) spoke.register_event_cb("quit", lambda: Gtk.main_quit()) if hasattr(spoke, "set_path"): spoke.set_path( "categories", [("pyanaconda.ui.gui.categories.%s",
def __init__(self, manager): super().__init__(manager) self._blivet = Blivet() self._id = ObjectID().id self._manager.add_object(self) self._set_up_callbacks()