Add boot image management with ISO extraction and serving
Upload Proxmox ISOs via API or dashboard UI, extract kernel+initrd using pure-Go iso9660 library, store on disk, and serve over HTTP for PXE booting. Dynamic kernel/initrd filenames per image replace the previous hardcoded paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"provisioning/internal/db"
|
||||
"provisioning/internal/events"
|
||||
"provisioning/internal/httpserver"
|
||||
"provisioning/internal/image"
|
||||
"provisioning/internal/model"
|
||||
"provisioning/internal/orchestrator"
|
||||
"provisioning/internal/pxe"
|
||||
@@ -39,6 +40,10 @@ func newTestServer(t *testing.T) *httptest.Server {
|
||||
hub := events.NewHub()
|
||||
t.Cleanup(func() { hub.Shutdown(context.Background()) })
|
||||
|
||||
imageDir := filepath.Join(tmp, "images")
|
||||
os.MkdirAll(imageDir, 0o755)
|
||||
imageSvc := &image.Service{Store: images, ImageDir: imageDir}
|
||||
|
||||
cfg := &config.Config{
|
||||
Server: config.Server{
|
||||
Bind: "127.0.0.1:0",
|
||||
@@ -68,6 +73,8 @@ func newTestServer(t *testing.T) *httptest.Server {
|
||||
ServerTypes: serverTypes,
|
||||
}
|
||||
|
||||
imageAPI := &api.ImageAPI{Svc: imageSvc}
|
||||
|
||||
hostAPI := &api.HostAPI{
|
||||
Hosts: hosts,
|
||||
Ops: ops,
|
||||
@@ -94,6 +101,7 @@ func newTestServer(t *testing.T) *httptest.Server {
|
||||
Ops: ops,
|
||||
Locks: locks,
|
||||
Images: images,
|
||||
ImageSvc: imageSvc,
|
||||
Runner: runner,
|
||||
Orchestrator: hostOrch,
|
||||
Hub: hub,
|
||||
@@ -103,10 +111,12 @@ func newTestServer(t *testing.T) *httptest.Server {
|
||||
}
|
||||
|
||||
router := httpserver.NewRouter(httpserver.Deps{
|
||||
HostAPI: hostAPI,
|
||||
BootAPI: bootAPI,
|
||||
UI: ui,
|
||||
Hub: hub,
|
||||
HostAPI: hostAPI,
|
||||
BootAPI: bootAPI,
|
||||
ImageAPI: imageAPI,
|
||||
UI: ui,
|
||||
Hub: hub,
|
||||
ImageDir: imageDir,
|
||||
})
|
||||
|
||||
return httptest.NewServer(router)
|
||||
|
||||
Reference in New Issue
Block a user