Serve full ISO for PXE boot via proxmox-iso-url kernel param
The Proxmox installer needs the full ISO to access packages and installer data. Previously the ISO was deleted after extracting kernel+initrd. Now we keep it as original.iso and serve it via HTTP. The iPXE script passes proxmox-iso-url=<url> so the installer fetches the ISO over the network instead of scanning block devices. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+11
-11
@@ -15,9 +15,9 @@ type Images struct {
|
||||
|
||||
func (s *Images) Create(ctx context.Context, img model.Image) (int64, error) {
|
||||
res, err := s.DB.ExecContext(ctx, `
|
||||
INSERT INTO images(name, kind, version, kernel_path, initrd_path, is_default)
|
||||
VALUES(?,?,?,?,?,?)
|
||||
`, img.Name, img.Kind, img.Version, img.KernelPath, img.InitrdPath, boolToInt(img.IsDefault))
|
||||
INSERT INTO images(name, kind, version, kernel_path, initrd_path, iso_path, is_default)
|
||||
VALUES(?,?,?,?,?,?,?)
|
||||
`, img.Name, img.Kind, img.Version, img.KernelPath, img.InitrdPath, img.ISOPath, boolToInt(img.IsDefault))
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("insert image: %w", err)
|
||||
}
|
||||
@@ -25,7 +25,7 @@ func (s *Images) Create(ctx context.Context, img model.Image) (int64, error) {
|
||||
}
|
||||
|
||||
func (s *Images) List(ctx context.Context) ([]model.Image, error) {
|
||||
rows, err := s.DB.QueryContext(ctx, `SELECT id, name, kind, version, kernel_path, initrd_path, is_default, created_at FROM images ORDER BY name`)
|
||||
rows, err := s.DB.QueryContext(ctx, `SELECT id, name, kind, version, kernel_path, initrd_path, iso_path, is_default, created_at FROM images ORDER BY name`)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("list images: %w", err)
|
||||
}
|
||||
@@ -35,7 +35,7 @@ func (s *Images) List(ctx context.Context) ([]model.Image, error) {
|
||||
var img model.Image
|
||||
var isDefault int
|
||||
var createdAt string
|
||||
if err := rows.Scan(&img.ID, &img.Name, &img.Kind, &img.Version, &img.KernelPath, &img.InitrdPath, &isDefault, &createdAt); err != nil {
|
||||
if err := rows.Scan(&img.ID, &img.Name, &img.Kind, &img.Version, &img.KernelPath, &img.InitrdPath, &img.ISOPath, &isDefault, &createdAt); err != nil {
|
||||
return nil, fmt.Errorf("scan image: %w", err)
|
||||
}
|
||||
img.IsDefault = isDefault == 1
|
||||
@@ -46,11 +46,11 @@ func (s *Images) List(ctx context.Context) ([]model.Image, error) {
|
||||
}
|
||||
|
||||
func (s *Images) GetDefault(ctx context.Context) (*model.Image, error) {
|
||||
row := s.DB.QueryRowContext(ctx, `SELECT id, name, kind, version, kernel_path, initrd_path, is_default, created_at FROM images WHERE is_default = 1 LIMIT 1`)
|
||||
row := s.DB.QueryRowContext(ctx, `SELECT id, name, kind, version, kernel_path, initrd_path, iso_path, is_default, created_at FROM images WHERE is_default = 1 LIMIT 1`)
|
||||
var img model.Image
|
||||
var isDefault int
|
||||
var createdAt string
|
||||
if err := row.Scan(&img.ID, &img.Name, &img.Kind, &img.Version, &img.KernelPath, &img.InitrdPath, &isDefault, &createdAt); err != nil {
|
||||
if err := row.Scan(&img.ID, &img.Name, &img.Kind, &img.Version, &img.KernelPath, &img.InitrdPath, &img.ISOPath, &isDefault, &createdAt); err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
@@ -62,11 +62,11 @@ func (s *Images) GetDefault(ctx context.Context) (*model.Image, error) {
|
||||
}
|
||||
|
||||
func (s *Images) Get(ctx context.Context, id int64) (*model.Image, error) {
|
||||
row := s.DB.QueryRowContext(ctx, `SELECT id, name, kind, version, kernel_path, initrd_path, is_default, created_at FROM images WHERE id = ?`, id)
|
||||
row := s.DB.QueryRowContext(ctx, `SELECT id, name, kind, version, kernel_path, initrd_path, iso_path, is_default, created_at FROM images WHERE id = ?`, id)
|
||||
var img model.Image
|
||||
var isDefault int
|
||||
var createdAt string
|
||||
if err := row.Scan(&img.ID, &img.Name, &img.Kind, &img.Version, &img.KernelPath, &img.InitrdPath, &isDefault, &createdAt); err != nil {
|
||||
if err := row.Scan(&img.ID, &img.Name, &img.Kind, &img.Version, &img.KernelPath, &img.InitrdPath, &img.ISOPath, &isDefault, &createdAt); err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
@@ -94,11 +94,11 @@ func (s *Images) SetDefault(ctx context.Context, id int64) error {
|
||||
}
|
||||
|
||||
func (s *Images) GetByName(ctx context.Context, name string) (*model.Image, error) {
|
||||
row := s.DB.QueryRowContext(ctx, `SELECT id, name, kind, version, kernel_path, initrd_path, is_default, created_at FROM images WHERE name = ?`, name)
|
||||
row := s.DB.QueryRowContext(ctx, `SELECT id, name, kind, version, kernel_path, initrd_path, iso_path, is_default, created_at FROM images WHERE name = ?`, name)
|
||||
var img model.Image
|
||||
var isDefault int
|
||||
var createdAt string
|
||||
if err := row.Scan(&img.ID, &img.Name, &img.Kind, &img.Version, &img.KernelPath, &img.InitrdPath, &isDefault, &createdAt); err != nil {
|
||||
if err := row.Scan(&img.ID, &img.Name, &img.Kind, &img.Version, &img.KernelPath, &img.InitrdPath, &img.ISOPath, &isDefault, &createdAt); err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user