Skip to content

XO 6 frontend compat - #3

Draft
nathanael-h wants to merge 3 commits into
mainfrom
xo6-compat
Draft

XO 6 frontend compat#3
nathanael-h wants to merge 3 commits into
mainfrom
xo6-compat

Conversation

@nathanael-h

Copy link
Copy Markdown
Member

This PR allows to run the xo-web frontend "XO 6" against this simulator. They're limitations, like no live data, no dashboard, no VNC console. But at least the frontend starts now, and static data is visible.

It also fix a VM halted parent in the mocked data set, and a code error for the Swgger UI.

image

The XO 6 web frontend (@xen-orchestra/web) drives everything over the
REST API: it streams collections as NDJSON and receives live updates
over a Server-Sent Events channel. Two areas were needed for it to run
against the simulator.

Auth:
- accept the `token` cookie set by the web UI's /dev/token page, in
  addition to the existing `authenticationToken` cookie and the
  Authorization header
- GET /users/me resolves to the default admin fixture in accept-any
  mode, since the pasted dev token was never issued by the simulator
- token issuing, optional enforcement middleware and the users fixture
  back the login flow

NDJSON / SSE:
- list, get-by-id and sub-collection endpoints emit newline-delimited
  JSON when `?ndjson=true`; the plain-JSON and URI-list behaviours are
  preserved
- add the SSE channel at GET /rest/v0/events (init + ping) plus
  POST/DELETE /events/:sseId/subscriptions; the handshake must complete
  before a watched collection performs its initial fetch
- stub the dashboard endpoints with empty aggregates and return an empty
  NDJSON list for sub-collections without fixture-backed relationships

Document the full workflow in the README.
`npm start` failed before binding: ts-node rejected the /docs route with
TS2769 (no overload matches this call).

Two problems overlapped. `swaggerUi.serve` is a RequestHandler array
passed where app.use expects a single handler, so it needs a spread. And
@types/swagger-ui-express nests its own @types/express 5.0.6 while the
project resolves @types/express 4.17.25 at top level, so the two
RequestHandler declarations do not structurally match: express 5 widened
IRouterMatcher paths to accept RegExp, and no cast-free spelling
compiles.

Type-only change; the handlers behave as before.

A cleaner fix would be a package.json `overrides` entry pinning the
transitive dep to the express 4 types, but that is a dependency decision
and this branch may be heading toward express 5.
ci-runner-01 is `"power_state": "Halted"` but its $container referenced a
host UUID from hosts.json. In XO's model $container is whatever currently
holds the VM: the host it is resident on while running, the pool when it
is not resident anywhere. Point it at the pool, which already matches its
$pool and $poolId.

The other running VMs keep their host containers. win-test is Suspended
and still references a host, which is intentional: a suspended VM keeps
its host affinity.
@nathanael-h
nathanael-h requested a review from gCyrille August 17, 2026 19:57
Comment thread README.md
issued tokens bind to the matching user, or to the first admin in accept-any
mode.

## Authentication

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate, sorry I missed this one, I'll fix the doc

@nathanael-h

Copy link
Copy Markdown
Member Author

The main point for XO 6 compat was mocking auth system. So here is a mocked auth system, which could be lazy, i.e. let any user/pwd or could be enforced.

@nathanael-h

Copy link
Copy Markdown
Member Author

I convert to draft, to rebase on #2

@nathanael-h
nathanael-h marked this pull request as draft August 18, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant