Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions hops/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func ToPack(h *Hops, buildContext string) (*PackInstructions, error) {
var framework Framework
instr := &PackInstructions{
Annots: map[string]string{
"com.urunc.unikernel.useDMBlock": "false",
"com.urunc.unikernel.mountRootfs": "false",
"com.urunc.unikernel.unikernelType": h.Platform.Framework,
"com.urunc.unikernel.cmdline": h.Cmd,
"com.urunc.unikernel.hypervisor": h.Platform.Monitor,
Expand Down Expand Up @@ -160,7 +160,7 @@ func ToPack(h *Hops, buildContext string) (*PackInstructions, error) {
if !framework.SupportsRootfsType("raw") {
return nil, fmt.Errorf("%s does not support raw rootfs type", framework.Name())
}
instr.Annots["com.urunc.unikernel.useDMBlock"] = "true"
instr.Annots["com.urunc.unikernel.mountRootfs"] = "true"
// Switch the base to the rootfs's From image
// and copy the kernel inside it.
if h.Kernel.From != "local" {
Expand Down Expand Up @@ -193,7 +193,7 @@ func ToPack(h *Hops, buildContext string) (*PackInstructions, error) {
case "initrd":
instr.Annots["com.urunc.unikernel.initrd"] = DefaultRootfsPath
case "raw":
instr.Annots["com.urunc.unikernel.useDMBlock"] = "true"
instr.Annots["com.urunc.unikernel.mountRootfs"] = "true"
default:
return nil, fmt.Errorf("Unexpected RootfsType value from framework")
}
Expand Down
2 changes: 2 additions & 0 deletions hops/unikraft.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ func (i *UnikraftInfo) SupportsRootfsType(rootfsType string) bool {
switch rootfsType {
case "initrd":
return true
case "raw":
return true
default:
return false
}
Expand Down
10 changes: 7 additions & 3 deletions hops/unikraft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,16 @@ func TestUnikraftGetRootfsType(t *testing.T) {

func TestUnikraftSupportsRootfsType(t *testing.T) {
unikraft := &UnikraftInfo{}
t.Run("Supported rootfs type", func(t *testing.T) {
t.Run("Supported rootfs type initrd", func(t *testing.T) {
require.Equal(t, true, unikraft.SupportsRootfsType("initrd"))

})
t.Run("Unsupported rootfs type", func(t *testing.T) {
require.Equal(t, false, unikraft.SupportsRootfsType("raw"))
t.Run("Unsupported rootfs type raw", func(t *testing.T) {
require.Equal(t, true, unikraft.SupportsRootfsType("raw"))

})
t.Run("Unsupported rootfs type block", func(t *testing.T) {
require.Equal(t, false, unikraft.SupportsRootfsType("block"))

})
}
Expand Down
Loading