pxe

package
v0.0.0-...-6410feb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PxeLinuxCfgPattern = `^pxelinux.cfg/01-(?P<mac>([0-9a-f]{2}-){5}[0-9a-f]{2})$`
	GrubCfgPattern     = `grub/grub.cfg-01-(?P<mac>([0-9a-f]{2}-){5}[0-9a-f]{2})$`
)

Functions

This section is empty.

Types

type Architecture

type Architecture int

Architecture describes a kind of CPU architecture

const (
	// ArchIA32 is a 32-bit x86 machine. It may also support X64
	// execution, but pxe has no way of kowning.
	ArchIA32 Architecture = iota
	// ArchX64 is a 64-bit x86 machine (aka amd64 aka x64)
	ArchX64
	ArchUnknown
)

Architecture types that pxe knows how to boot These architectures are self-reported by the booting machine. The machine may support additional execution mode. For example, legacy PC BIOS reports itself as an ArchIA32, but may also support ArchX64 execution

func (Architecture) String

func (a Architecture) String() string

type DHCPHandler

type DHCPHandler struct {
	// contains filtered or unexported fields
}

func (*DHCPHandler) ServeDHCP

func (h *DHCPHandler) ServeDHCP(ctx context.Context, pkt dhcp.Packet, _ *net.UDPAddr, _ *net.Interface) (dhcp.Packet, []string, error)

type Firmware

type Firmware int

Firmware describes a kind of firmware attempting to boot. This should only be used for selecting the right bootloader within pxe, kernel selection should key off the more generic Architecture

const (
	FirmwareX86PC   Firmware = iota // "Classic" x86 BIOS with PXE/UNDI support
	FirmwareEFI32                   // 32-bit x86 processor running EFI
	FirmwareEFI64                   // 64-bit x86 processor running EFI
	FirmwareEFIBC                   // 64-bit x86 processor running EFI
	FirmwareX86Ipxe                 // "Classic" x86 BIOS running iPXE (no UNDI support)
	FirmwareUnknown
)

The bootloaders that pxe knows how to handle

type IBaremetalInstance

type IBaremetalInstance interface {
	NeedPXEBoot() bool
	GetIPMINic(cliMac net.HardwareAddr) *types.SNic
	GetPXEDHCPConfig(arch uint16) (*dhcp.ResponseConfig, error)
	GetDHCPConfig(cliMac net.HardwareAddr) (*dhcp.ResponseConfig, error)
	InitAdminNetif(ctx context.Context, cliMac net.HardwareAddr, wireId string, nicType compute.TNicType, netType computeapi.TNetworkType, isDoImport bool, ipAddr string) error
	RegisterNetif(ctx context.Context, cliMac net.HardwareAddr, wireId string) error
	GetTFTPResponse() string
}

type IBaremetalManager

type IBaremetalManager interface {
	GetZoneId() string
	GetBaremetalByMac(mac net.HardwareAddr) IBaremetalInstance
	AddBaremetal(ctx context.Context, desc jsonutils.JSONObject) (IBaremetalInstance, error)
	GetClientSession() *mcclient.ClientSession
}

type Machine

type Machine struct {
	MAC  net.HardwareAddr
	Arch Architecture
}

A Machine describes a machine that is attempting to boot

type NetworkInterfaceIdent

type NetworkInterfaceIdent struct {
	Type   uint16
	Major  uint16
	Minior uint16
}

type Server

type Server struct {
	// Address to listen on, or empty for all interfaces
	Address     string
	DHCPPort    int
	ListenIface string
	TFTPPort    int
	TFTPRootDir string

	BaremetalManager IBaremetalManager
	// contains filtered or unexported fields
}

func (*Server) Serve

func (s *Server) Serve() error

type TFTPHandler

type TFTPHandler struct {
	RootDir          string
	BaremetalManager IBaremetalManager
}

func NewTFTPHandler

func NewTFTPHandler(rootDir string, baremetalManager IBaremetalManager) (*TFTPHandler, error)

func (*TFTPHandler) Handle

func (h *TFTPHandler) Handle(filename string, clientAddr net.Addr) (io.ReadCloser, int64, error)

Handle is called when client starts file download from server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL