Skip to content

Commit 47b2366

Browse files
committed
Change useDMBlock annotation to mountRootfs
Change the annotation that bunny uses for "raw" rootfs types from useDMBlock to mountRootfs, since urunc has changed this annotation. Furthermore, with the support of shared-fs in urunc, we can boot Unikraft unikernels with raw rootfs type. Therefore, add the supported type in Unikraft. Signed-off-by: Charalampos Mainas <cmainas@nubificus.co.uk>
1 parent 7288389 commit 47b2366

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

hops/package.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func ToPack(h *Hops, buildContext string) (*PackInstructions, error) {
8282
var framework Framework
8383
instr := &PackInstructions{
8484
Annots: map[string]string{
85-
"com.urunc.unikernel.useDMBlock": "false",
85+
"com.urunc.unikernel.mountRootfs": "false",
8686
"com.urunc.unikernel.unikernelType": h.Platform.Framework,
8787
"com.urunc.unikernel.cmdline": h.Cmd,
8888
"com.urunc.unikernel.hypervisor": h.Platform.Monitor,
@@ -160,7 +160,7 @@ func ToPack(h *Hops, buildContext string) (*PackInstructions, error) {
160160
if !framework.SupportsRootfsType("raw") {
161161
return nil, fmt.Errorf("%s does not support raw rootfs type", framework.Name())
162162
}
163-
instr.Annots["com.urunc.unikernel.useDMBlock"] = "true"
163+
instr.Annots["com.urunc.unikernel.mountRootfs"] = "true"
164164
// Switch the base to the rootfs's From image
165165
// and copy the kernel inside it.
166166
if h.Kernel.From != "local" {
@@ -193,7 +193,7 @@ func ToPack(h *Hops, buildContext string) (*PackInstructions, error) {
193193
case "initrd":
194194
instr.Annots["com.urunc.unikernel.initrd"] = DefaultRootfsPath
195195
case "raw":
196-
instr.Annots["com.urunc.unikernel.useDMBlock"] = "true"
196+
instr.Annots["com.urunc.unikernel.mountRootfs"] = "true"
197197
default:
198198
return nil, fmt.Errorf("Unexpected RootfsType value from framework")
199199
}

hops/unikraft.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ func (i *UnikraftInfo) SupportsRootfsType(rootfsType string) bool {
5353
switch rootfsType {
5454
case "initrd":
5555
return true
56+
case "raw":
57+
return true
5658
default:
5759
return false
5860
}

hops/unikraft_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,16 @@ func TestUnikraftGetRootfsType(t *testing.T) {
101101

102102
func TestUnikraftSupportsRootfsType(t *testing.T) {
103103
unikraft := &UnikraftInfo{}
104-
t.Run("Supported rootfs type", func(t *testing.T) {
104+
t.Run("Supported rootfs type initrd", func(t *testing.T) {
105105
require.Equal(t, true, unikraft.SupportsRootfsType("initrd"))
106106

107107
})
108-
t.Run("Unsupported rootfs type", func(t *testing.T) {
109-
require.Equal(t, false, unikraft.SupportsRootfsType("raw"))
108+
t.Run("Unsupported rootfs type raw", func(t *testing.T) {
109+
require.Equal(t, true, unikraft.SupportsRootfsType("raw"))
110+
111+
})
112+
t.Run("Unsupported rootfs type block", func(t *testing.T) {
113+
require.Equal(t, false, unikraft.SupportsRootfsType("block"))
110114

111115
})
112116
}

0 commit comments

Comments
 (0)