Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
kernelRootParams: define agnostic commonkernelRootParams
Browse files Browse the repository at this point in the history
Let's define agnostic commonkernelRootParams for all hypervisors,
including qemu, firecracker, etc. for now, it has two scenarios,
one for NVDIMM, one for virtio-blk.

Fixes: #1642

Signed-off-by: Penny Zheng <[email protected]>
  • Loading branch information
Pennyzct committed May 29, 2019
1 parent 919615f commit 7e6fcdd
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
7 changes: 2 additions & 5 deletions virtcontainers/fc.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,8 @@ const (
fcDiskPoolSize = 8
)

var fcKernelParams = []Param{
var fcKernelParams = append(commonVirtioblkKernelRootParams, []Param{
// The boot source is the first partition of the first block device added
{"root", "/dev/vda1"},
{"rootflags", "data=ordered,errors=remount-ro ro"},
{"rootfstype", "ext4"},
{"pci", "off"},
{"reboot", "k"},
{"panic", "1"},
Expand All @@ -70,7 +67,7 @@ var fcKernelParams = []Param{
// Firecracker doesn't support ACPI
// Fix kernel error "ACPI BIOS Error (bug)"
{"acpi", "off"},
}
}...)

func (s vmmState) String() string {
switch s {
Expand Down
14 changes: 14 additions & 0 deletions virtcontainers/hypervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ const (
// In some architectures the maximum number of vCPUs depends on the number of physical cores.
var defaultMaxQemuVCPUs = MaxQemuVCPUs()

// agnostic list of kernel root parameters for NVDIMM
var commonNvdimmKernelRootParams = []Param{ //nolint: unused, deadcode, varcheck
{"root", "/dev/pmem0p1"},
{"rootflags", "dax,data=ordered,errors=remount-ro ro"},
{"rootfstype", "ext4"},
}

// agnostic list of kernel root parameters for virtio-blk
var commonVirtioblkKernelRootParams = []Param{ //nolint: unused, deadcode, varcheck
{"root", "/dev/vda1"},
{"rootflags", "data=ordered,errors=remount-ro ro"},
{"rootfstype", "ext4"},
}

// deviceType describes a virtualized device type.
type deviceType int

Expand Down
6 changes: 1 addition & 5 deletions virtcontainers/qemu_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ var qemuPaths = map[string]string{
QemuQ35: defaultQemuPath,
}

var kernelRootParams = []Param{
{"root", "/dev/pmem0p1"},
{"rootflags", "dax,data=ordered,errors=remount-ro ro"},
{"rootfstype", "ext4"},
}
var kernelRootParams = commonNvdimmKernelRootParams

var kernelParams = []Param{
{"tsc", "reliable"},
Expand Down
5 changes: 4 additions & 1 deletion virtcontainers/qemu_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ var kernelParams = []Param{
{"iommu.passthrough", "0"},
}

// For now, AArch64 doesn't support DAX, so we couldn't use
// commonNvdimmKernelRootParams, the agnostic list of kernel
// root parameters for NVDIMM
var kernelRootParams = []Param{
{"root", "/dev/pmem0p1"},
{"rootflags", "data=ordered,errors=remount-ro rw"},
{"rootflags", "data=ordered,errors=remount-ro ro"},
{"rootfstype", "ext4"},
}

Expand Down
4 changes: 1 addition & 3 deletions virtcontainers/qemu_s390x.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ var kernelParams = []Param{
{"console", "ttysclp0"},
}

var kernelRootParams = []Param{
{"root", "/dev/vda1"},
}
var kernelRootParams = commonVirtioblkKernelRootParams

var supportedQemuMachines = []govmmQemu.Machine{
{
Expand Down

0 comments on commit 7e6fcdd

Please sign in to comment.