Skip to content

fix: real-mode boot on current QEMU/libvirt hosts, plus four Horizon dashboard fixes - #114

Merged
uw-sc merged 8 commits into
mainfrom
feature/host-os
Nov 10, 2026
Merged

uw-sc merged 8 commits into
mainfrom
feature/host-os

Conversation

@uw-sc

@uw-sc uw-sc commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

A test pass on a current Linux host — openSUSE Tumbleweed with QEMU 11.1.2, modular libvirt (virtqemud)
and SELinux enforcing — found two real-mode boot blockers, an RGW test fixture that would not start under
SELinux, and four Horizon failures. One commit per fix.

What's in it

Real mode on current QEMU/libvirt

  • Machine type. The domain XML pinned machine='pc-i440fx-2.12', which QEMU 11.0 removed, so every
    real-mode create failed at define (does not support machine type 'pc-i440fx-2.12'). It now renders
    pc, the alias for the running QEMU's current i440fx type (pc-i440fx-11.1 here). The
    docs/REAL_LIBVIRT_MODE.md example follows.
  • Per-instance directory. Where libvirt runs QEMU as an unprivileged user, the guest then failed to
    start with console.log: Permission denied: <state_path>/instances/<id> was root:root 0755, and QEMU
    opens the serial log there itself. A DAC failure, not SELinux — it fails with setenforce 0 too. Both
    create paths (image boot and boot-from-volume) now chown the directory to the uid:gid libvirt reports
    for QEMU, the value already read at startup for the console-socket directory. Stub mode is unchanged.

RGW test fixture

  • deployments/docker-compose.rgw-test.yml mounts the RGW entrypoint :ro. Under SELinux enforcing the
    container cannot execute it (exit 126), RGW never starts and docker compose up -d hangs. :ro,z
    relabels it; a no-op where SELinux is off, as on the CI runner.

Horizon

  • Default role. OPENSTACK_KEYSTONE_DEFAULT_ROLE was _member_, which Lightstack has never seeded
    (it seeds admin, member, reader). Create Project, Manage Members and Manage Groups returned to the
    list without opening, the error only in Django's messages cookie. Create User preselects its role from
    the same setting and, with nothing resolved, fell through to admin, the lowest seeded id (derived from
    Horizon's source, not reproduced). Now member, upstream Horizon's own default. The chart copy is
    regenerated with make horizon-chart-sync; docs/HORIZON_DEPLOYMENT.md and the RGW fixtures'
    accepted-roles lists drop _member_ as well.
  • Create Image. The modal loads GET /v2/schemas/metadefs/namespace before it renders; the 404 made it
    throw a TypeError and fail with "Unable to retrieve namespace". Glance now serves static schema
    documents under /v2/schemas/metadefs/*.
  • Instance detail. GET /v2.1/servers/{id} omitted image for a boot-from-volume server — what
    Horizon's launch wizard creates by default — and the detail page 500'd (AttributeError: image).
    image is now always present, {id} or "" as in upstream Nova, through one helper shared with
    /servers/detail, which already did this.
  • Image upload. HORIZON_IMAGES_UPLOAD_MODE = 'direct' sends the browser straight to Glance on
    :9292, which Lightstack's localhost-only CORS allowlist refuses and a tunnelled browser cannot reach.
    legacy has the Horizon server stream the upload in-cluster.

docs/compatibility/HORIZON_COMPATIBILITY_REPORT.md records the role defect as F19 (fixed here) and,
as F20, the gap it had been hiding: group role assignments on a project are unrouted, so
Manage Members → Save fails once any Keystone group exists. F20 stays open; nothing seeds a group.

No schema change, no migration, no new modules. API: new read-only /v2/schemas/metadefs/* routes, and
GET /v2.1/servers/{id} always carries image.

Operator notes

  • Horizon caches the default role per process. The chart's checksum/config annotation rolls the pod on
    helm upgrade; under Compose, recreate the horizon container.
  • Users created through Horizon's Create User with a primary project may hold admin from the old
    default; openstack role assignment list --names shows them.

Testing

  • make lint — 0 issues; gofmt clean; go build ./... green.
  • go test ./internal/glance/... ./internal/nova/... ./pkg/hypervisor/... — green (SQLite test backend),
    including the new regression tests TestGenerateVMXMLMachineTypePortable,
    TestPrepareInstanceDirOwnsDirInRealMode, TestPrepareInstanceDirStubModeJustCreates,
    TestMetadefsSchemaRoutes and TestServerImageField.
  • make horizon-chart-check — chart copy in sync; helm unittest charts/horizon — 3/3.
  • openSUSE Tumbleweed host, real mode:
    • A guest defines with machine='pc' on QEMU 11.1.2 (virsh domxml-to-native → -machine pc-i440fx-11.1)
    • A guest starts with QEMU unprivileged (no user = "root" in qemu.conf)
    • The RGW fixture comes up under SELinux enforcing
    • Create Project opens and creates; Create User preselects member
    • The Create Image modal opens
    • An image uploads through Horizon
    • A boot-from-volume instance's detail page renders

🤖 Generated with Claude Code

@uw-sc
uw-sc added this pull request to stack #113 November 4, 2026 08:08
@uw-sc
uw-sc requested a balanced review from Copilot November 4, 2026 08:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The plural metadefs schema endpoints return individual-resource schemas instead of collection schemas, exposing incorrect response contracts to schema consumers.

1 open issue
What changed in this PR

This PR addresses real-mode boot failures on current QEMU/libvirt hosts and four Horizon dashboard issues. It also updates the RGW test fixture for SELinux-enforcing hosts, without schema changes or new dependencies.

Changes:

  • Use a portable QEMU machine type and prepare QEMU-owned instance directories.
  • Correct Horizon role and upload settings, add Glance metadata schemas, and consistently return Nova’s image field.
  • Add regression tests and update deployment guidance and compatibility records.
File Description
pkg/​hypervisor/​xml_template.go Use the current pc machine alias.
pkg/​hypervisor/​xml_template_test.go Test portable machine-type generation.
pkg/​hypervisor/​libvirt.go Store cached QEMU ownership.
pkg/​hypervisor/​disk.go Prepare QEMU-owned instance directories.
pkg/​hypervisor/​disk_test.go Test real and stub directory preparation.
pkg/​hypervisor/​console_dir.go Cache ownership from libvirt capabilities.
internal/​nova/​server_image_field_test.go Test server image-field representations.
internal/​nova/​handlers.go Prepare boot directories and consistently include image.
internal/​glance/​metadefs.go Add metadata-definition schema handlers.
internal/​glance/​metadefs_schema_test.go Test schema endpoint responses.
internal/​glance/​images.go Register metadata-definition schema routes.
docs/​testing/​rook-rgw-fixture.md Align accepted roles with seeded roles.
docs/​REAL_LIBVIRT_MODE.md Update the machine-type example.
docs/​HORIZON_DEPLOYMENT.md Correct Horizon’s default role.
docs/​compatibility/​HORIZON_COMPATIBILITY_REPORT.md Record the role fix and remaining group-assignment gap.
deployments/​rook/​setup-rook-rgw.sh Remove the unseeded default accepted role.
deployments/​rgw-keystone-entrypoint.sh Align RGW’s accepted-role defaults.
deployments/​horizon-config/​local_settings Correct the default role and enable server-side uploads.
deployments/​docker-compose.rgw-test.yml Relabel the entrypoint mount for SELinux.
charts/​horizon/​files/​local_settings Synchronize Horizon chart settings.

Review effort: Balanced

Comment thread internal/glance/images.go Resolved
@uw-sc uw-sc self-assigned this Nov 5, 2026
@uw-sc
uw-sc requested a balanced review from Copilot November 5, 2026 09:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Several plural metadef schema endpoints incorrectly serve singleton schemas, while tests do not verify actual ownership changes or production route wiring.

3 open issues

Review effort: Balanced

Comment thread internal/glance/metadefs_schema_test.go Resolved
Comment thread pkg/hypervisor/disk_test.go Resolved
@uw-sc
uw-sc requested a balanced review from Copilot November 5, 2026 11:59
@uw-sc
uw-sc marked this pull request as ready for review November 5, 2026 12:03
@uw-sc
uw-sc requested a review from senolcolak November 5, 2026 12:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The helper-only test would not catch the missing image response-key regression, leaving handler behavior for NULL and populated image_id values unverified.

1 open issue
3 resolved since last review

Review effort: Balanced

senolcolak
senolcolak previously approved these changes Nov 6, 2026

@senolcolak senolcolak left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

copilot has some complains, that needs to be solved (image field is missing) besides that good to go.

Base automatically changed from feature/600-database-sqlite-backup-integrity-check-and-restore to main November 6, 2026 14:39
Uwe Schwaeke added 8 commits November 6, 2026 15:39
The domain XML pinned machine='pc-i440fx-2.12', a type QEMU dropped after
6.x. On a current QEMU (e.g. 11.x on openSUSE Tumbleweed) every real-mode
server create failed at define with "does not support machine type
'pc-i440fx-2.12'". Render the generic 'pc' alias instead: it always
resolves to the running QEMU's current i440fx machine, so a guest defines
on any supported QEMU. A regression test asserts the portable type and
guards against re-pinning an obsolete one; the example in
docs/REAL_LIBVIRT_MODE.md is updated to match.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
The rgw-integration fixture bind-mounts rgw-keystone-entrypoint.sh into
the non-privileged ceph/demo container. On an SELinux-enforcing host
(openSUSE/Fedora/RHEL) the host file keeps a label the container cannot
read, so the entrypoint fails with "Permission denied" (exit 126): the
rgw service never starts, the lightstack service blocks on it, and
`docker compose up -d` hangs.

Add the `,z` mount option so the runtime relabels the file to a shared,
container-readable type. It is a no-op where SELinux is disabled (the CI
runner), so the rgw-integration-tests job is unaffected.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
…al mode)

Real-mode server create defined the domain but failed to START with
"console.log: Permission denied" on hosts where libvirt runs QEMU as the
confined libvirt-qemu user (e.g. openSUSE's modular virtqemud). The
per-instance directory (<state_path>/instances/<id>) was created root:root
0755 and never chowned to the QEMU user, so QEMU could not create the serial
<log file> chardev it opens itself. Older libvirt opened that log as root in
the daemon, which masked the gap; newer libvirt does not.

Cache the uid:gid libvirt runs QEMU as (its DAC base label, already read for
the console-socket directory in SPEC-021) and chown each per-instance
directory to it on create, mirroring console_dir.go. Root stays able to stage
the overlay there because it is exempt from the directory's mode. Stub mode is
unchanged. Both create paths -- image boot and boot-from-volume -- use the new
VMManager.PrepareInstanceDir; a regression test covers the real-mode chown and
the stub-mode no-op.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
Both dashboard settings files (deployments/horizon-config/local_settings
and its generated chart copy) set OPENSTACK_KEYSTONE_DEFAULT_ROLE =
"_member_", the legacy member role older Keystone releases created.
Lightstack seeds admin, member and reader (migration 002) and never
_member_, so Horizon's once-per-process role lookup against
GET /v3/roles found nothing. Two things followed. Identity -> Projects
-> Create Project (and Manage Members / Manage Groups on an existing
project) bounced silently: the members step raised 'Could not find
default role "_member_"', folded into a redirect back to the list, with
the text only in the Django messages cookie. Identity -> Users -> Create
User, which preselects the same role and sorts the choices by id, fell
through to admin (the lowest seeded role id), so a user created through
the dashboard with a primary project was granted admin unless the
operator changed the field.

Set member -- upstream Horizon's own default (openstack_dashboard/
defaults.py) and the value every other Horizon config in the tree
already used -- and regenerate the chart copy with `make
horizon-chart-sync`. This corrects Lightstack's own deployment artifact
in the sense of SPEC-020 FR-018a (justified against upstream,
compensating for no missing API); it is not a Horizon override. Horizon
caches the resolved role, so a running dashboard needs a restart; the
chart's checksum/config annotation rolls the pod on upgrade.

Also: docs/HORIZON_DEPLOYMENT.md carried the same value; the RGW
fixtures' accepted-roles lists drop the dead _member_ (matching
docs/OBJECT_STORAGE_S3.md); the Horizon compatibility report records
this as F19 and, as F20, the gap it had been hiding -- group role
assignments on a project are unrouted, so Manage Members -> Save fails
once any Keystone group exists (none is seeded; SPEC-023 scopes group
assignments out).

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
Horizon's Angular "Create Image" modal loads GET /v2/schemas/metadefs/namespace
before it renders. Lightstack had no such route, so the request 404'd, the modal's
response handler read `.data` off undefined (TypeError), and the create failed with
"Unable to retrieve namespace / project / create image".

Add the static metadefs schema documents upstream Glance serves
(namespace[s], resource_type[s], object[s], propert{y,ies}, tag[s]). They are
fixed JSON, so they need no database and no auth-specific state.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
The single-server GET only set response["image"] when image_id was non-NULL, so a
boot-from-volume server omitted the key entirely. Horizon's instance-detail view
reads server.image unconditionally, so novaclient raised "AttributeError: image"
and the page 500'd. /detail already emitted "" for that case, so the two handlers
had drifted.

Extract serverImageField(), shared by both handlers: an {id} object for an
image-booted server, "" for a boot-from-volume one — present either way, matching
upstream Nova.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
HORIZON_IMAGES_UPLOAD_MODE='direct' uploads from the browser straight to
Glance:9292 via CORS. Lightstack's CORS allowlist is localhost-only, so through a
tunnel the browser cannot reach Glance and the upload fails. 'legacy' has the
Horizon server stream the image in-cluster, which works regardless of how the
browser reaches Horizon.

Apply to both the chart and the compose horizon-config copies (kept in sync by
`make horizon-chart-sync`).

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
TestEnsureOwnedDir and TestPrepareConsoleSocketDir chowned the console socket directory to this process's own uid:gid, which a new directory already has, so they passed with the chown removed. New subtests ask for an owner the directory does not have (nobody:nogroup as root, otherwise a second group of this user) and check that the owner changed.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
@uw-sc
uw-sc merged commit d77d01a into main Nov 10, 2026
11 checks passed
@uw-sc
uw-sc deleted the feature/host-os branch November 10, 2026 07:36
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.

3 participants