def test_unmounts_filesystem_with_mount_point(self): node = factory.make_Node() mount_point = factory.make_absolute_path() mount_options = factory.make_name("options") filesystem = factory.make_Filesystem(node=node, mount_point=mount_point, mount_options=mount_options) form = UnmountNonStorageFilesystemForm( node, data={"mount_point": mount_point}) self.assertTrue(form.is_valid(), form.errors) form.save() self.assertThat(reload_object(filesystem), Is(None))
def unmount_special(self, params): """Unmount a special-purpose filesystem, like tmpfs. :param mount_point: Path on the filesystem to unmount. :attention: This is more or less a copy of `unmount_special` from `m.api.machines`. """ machine = self.get_object(params) self._preflight_special_filesystem_modifications("unmount", machine) form = UnmountNonStorageFilesystemForm(machine, data=params) if form.is_valid(): form.save() else: raise HandlerValidationError(form.errors)