Skip to content

Commit

Permalink
chore: rolling back Firecracker v1.0.0 changes (#393)
Browse files Browse the repository at this point in the history
Flintlock is broken with Firecracker v1.0.0 changes, specifically
cloud-init and mmds. These changes are being rolled back and will be
made on a separate branch.

Signed-off-by: Richard Case <[email protected]>
  • Loading branch information
richardcase authored Feb 15, 2022
1 parent 11b7da1 commit 899ddc4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 31 deletions.
19 changes: 5 additions & 14 deletions infrastructure/firecracker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func WithMicroVM(vm *models.MicroVM) ConfigOption {
cfg.MachineConfig = MachineConfig{
MemSizeMib: vm.Spec.MemoryInMb,
VcpuCount: vm.Spec.VCPU,
SMT: false,
HTEnabled: false,
}

cfg.NetDevices = []NetworkInterfaceConfig{}
Expand Down Expand Up @@ -115,16 +115,6 @@ func WithMicroVM(vm *models.MicroVM) ConfigOption {
cfg.BootSource.InitrdPath = &initrdPath
}

cfg.Mmds = &MMDSConfig{
NetworkInterfaces: []string{},
}

for _, iface := range vm.Spec.NetworkInterfaces {
if iface.AllowMetadataRequests {
cfg.Mmds.NetworkInterfaces = append(cfg.Mmds.NetworkInterfaces, iface.GuestDeviceName)
}
}

return nil
}
}
Expand Down Expand Up @@ -192,9 +182,10 @@ func createNetworkIface(iface *models.NetworkInterface, status *models.NetworkIn
}

netInt := &NetworkInterfaceConfig{
IfaceID: iface.GuestDeviceName,
HostDevName: hostDevName,
GuestMAC: macAddr,
IfaceID: iface.GuestDeviceName,
HostDevName: hostDevName,
GuestMAC: macAddr,
AllowMMDSRequests: iface.AllowMetadataRequests,
}

return netInt
Expand Down
15 changes: 4 additions & 11 deletions infrastructure/firecracker/testdata/vm_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,13 @@
"machine-config": {
"vcpu_count": 2,
"mem_size_mib": 1024,
"smt": false,
"ht_enabled": false,
"track_dirty_pages": false
},
"balloon": null,
"network-interfaces": [
{
"iface_id": "mdms1",
"host_dev_name": "tap0"
}
],
"mmds-config": {
"network_interfaces": ["mdms1"]
},
"network-interfaces": [],
"vsock": null,
"logger": null,
"metrics": null
"metrics": null,
"mmds-config": null
}
14 changes: 8 additions & 6 deletions infrastructure/firecracker/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ type MachineConfig struct {
VcpuCount int64 `json:"vcpu_count"`
// MemSizeMib is the memory size in MiB.
MemSizeMib int64 `json:"mem_size_mib"`
// SMT enables or disabled hyperthreading.
SMT bool `json:"smt"`
// HTEnabled enables or disabled hyperthreading.
HTEnabled bool `json:"ht_enabled"`
// CPUTemplate is a CPU template that it is used to filter the CPU features exposed to the guest.
CPUTemplate *string `json:"cpu_template,omitempty"`
// TrackDirtyPages enables or disables dirty page tracking. Enabling allows incremental snapshots.
Expand Down Expand Up @@ -103,6 +103,12 @@ type NetworkInterfaceConfig struct {
HostDevName string `json:"host_dev_name"`
// GuestMAC is the mac address to use.
GuestMAC string `json:"guest_mac,omitempty"`
// AllowMMDSRequests is true the device model will reply to HTTP GET
// requests sent to the MMDS address via this interface. In this case,
// both ARP requests for `169.254.169.254` and TCP segments heading to the
// same address are intercepted by the device model, and do not reach
// the associated TAP device.
AllowMMDSRequests bool `json:"allow_mmds_requests"`
// RxRateLimiter is the rate limiter for received packages.
// RxRateLimiter *RateLimiterConfig `json:"rx_rate_limiter,omitempty"`
// TxRateLimiter is the rate limiter for transmitted packages.
Expand Down Expand Up @@ -143,10 +149,6 @@ type MetricsConfig struct {
type MMDSConfig struct {
// IPV4Address is the MMDS IPv4 configured address.
IPV4Address *string `json:"ipv4_address,omitempty"`
// NetworkInterfaces that has access to the metadata service.
NetworkInterfaces []string `json:"network_interfaces"`
// Version of the MMDS.
Version *string `json:"version,omitempty"`
}

type VsockDeviceConfig struct {
Expand Down

0 comments on commit 899ddc4

Please sign in to comment.