#2 Use virtiofs instead of 9p
Merged 4 years ago by crobinso. Opened 4 years ago by fidencio.
rpms/ fidencio/kata-osbuilder wip/virtiofs  into  master

@@ -0,0 +1,54 @@ 

+ From 69f807d45f1eafa2694d50619c79bee64fec178a Mon Sep 17 00:00:00 2001

+ From: Fabiano Fidêncio <fidencio@redhat.com>

+ Date: Thu, 6 Feb 2020 22:02:19 +0100

+ Subject: [PATCH] mount: Use virtiofs instead of virtio_fs as typeVirtioFS

+ MIME-Version: 1.0

+ Content-Type: text/plain; charset=UTF-8

+ Content-Transfer-Encoding: 8bit

+ 

+ virtio_fs was used in the early stages of the driver development

+ 

+ Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>

+ ---

+  mount.go      | 2 +-

+  mount_test.go | 6 +++---

+  2 files changed, 4 insertions(+), 4 deletions(-)

+ 

+ diff --git a/agent-1.10.0/mount.go b/agent-1.10.0/mount.go

+ index b824b8f..8988646 100644

+ --- a/mount.go

+ +++ b/mount.go

+ @@ -27,7 +27,7 @@ import (

+  

+  const (

+  	type9pFs       = "9p"

+ -	typeVirtioFS   = "virtio_fs"

+ +	typeVirtioFS   = "virtiofs"

+  	typeRootfs     = "rootfs"

+  	typeTmpFs      = "tmpfs"

+  	procMountStats = "/proc/self/mountstats"

+ diff --git a/mount_test.go b/mount_test.go

+ index 684a018..e13ed07 100644

+ --- a/mount_test.go

+ +++ b/mount_test.go

+ @@ -445,14 +445,14 @@ func TestMount(t *testing.T) {

+  		{"", "/foo", "9p", 0, "", true},

+  		{"proc", "", "9p", 0, "", true},

+  		{"proc", "/proc", "", 0, "", true},

+ -		{"proc", "", "virtio_fs", 0, "", true},

+ -		{"proc", subdir, "virtio_fs", 0, "", true},

+ +		{"proc", "", "virtiofs", 0, "", true},

+ +		{"proc", subdir, "virtiofs", 0, "", true},

+  		{"proc", subdir, "foo", 0, "", true},

+  		{symLinkName, symLinkDest, "moo", 0, "", true},

+  		{existsFile, existingNonCreatableFile, "bind", 0, "", true},

+  		{"tmpfs", validSubdir, "tmpfs", 0, "", true},

+  		{"proc", validSubdir, "9p", 0, "", true},

+ -		{"proc", validSubdir, "virtio_fs", 0, "", true},

+ +		{"proc", validSubdir, "virtiofs", 0, "", true},

+  	}

+  

+  	for i, d := range data {

+ -- 

+ 2.18.1

+ 

file modified
+1 -1
@@ -59,7 +59,7 @@ 

  DRACUT_OPTIONS="--no-compress --conf /dev/null --confdir ./dracut/dracut.conf.d"

  

  # Build the dracut overlay fs

- ./rootfs-builder/rootfs.sh -o ${OSBUILDER_VERSION} -r ${DRACUT_OVERLAY}

+ EXTRA_PKGS="bash coreutils" ./rootfs-builder/rootfs.sh -o ${OSBUILDER_VERSION} -r ${DRACUT_OVERLAY}

  mkdir -p ${DRACUT_OVERLAY}/etc/modules-load.d

  echo ${DRACUT_KMODULES} | tr " " "\n" > ${DRACUT_OVERLAY}/etc/modules-load.d/kata-modules.conf

  

file modified
+7
@@ -33,6 +33,7 @@ 

  Source1: %{git1}/archive/%{version}/agent-%{version}.tar.gz

  Source2: fedora-kata-osbuilder.sh

  Source3: kata-osbuilder-generate.service

+ Source4: agent-0001-mount-Use-virtiofs-instead-of-virtio_fs-as-typeVirti.patch

  

  # Adjust rootfs.sh to pull more pieces from the kata-agent dir,

  # like systemd units. Not acceptable as is for upstream, we need
@@ -44,6 +45,9 @@ 

  # List of drivers needed in the initrd.

  # Needs to be submitted upstream

  Patch03: osbuilder-0003-dracut-Add-Fedora-virtio-kernel-modules-to-the-initr.patch

+ # List of modules added to dracut.

+ # Needs to be submitted upstream

+ Patch04: osbuilder-0004-Add-bash-busybox-and-rescue-as-part-of-base-modules.patch

  

  BuildRequires: git

  BuildRequires: go-rpm-macros
@@ -101,6 +105,9 @@ 

  %prep

  %autosetup -Sgit -n osbuilder-%{version}

  tar -xvf %{SOURCE1} > /dev/null

+ pushd agent-%{version}

+ patch -p1 < %{SOURCE4}

+ popd

  

  

  %build

@@ -23,7 +23,7 @@ 

  +#drivers=""

  +

  +# Fedora: add kata virtio modules to the initrd.

- +drivers="9p 9pnet_virtio vmw_vsock_virtio_transport virtio_console virtio_blk virtio_scsi virtio_net"

+ +drivers="vmw_vsock_virtio_transport virtio_console virtio_blk virtio_scsi virtio_net fuse virtiofs"

  -- 

  2.21.0

  

@@ -0,0 +1,26 @@ 

+ From 1a1c32772a2a84afa7df5731559eee9301dc8fa4 Mon Sep 17 00:00:00 2001

+ From: rpm-build <rpm-build>

+ Date: Fri, 14 Feb 2020 17:48:48 +0100

+ Subject: [PATCH] Add bash, busybox, and rescue as part of base modules

+ MIME-Version: 1.0

+ Content-Type: text/plain; charset=UTF-8

+ Content-Transfer-Encoding: 8bit

+ 

+ Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>

+ ---

+  dracut/dracut.conf.d/05-base.conf | 2 +-

+  1 file changed, 1 insertion(+), 1 deletion(-)

+ 

+ diff --git a/dracut/dracut.conf.d/05-base.conf b/dracut/dracut.conf.d/05-base.conf

+ index 1dd41c4..18d07b0 100644

+ --- a/dracut/dracut.conf.d/05-base.conf

+ +++ b/dracut/dracut.conf.d/05-base.conf

+ @@ -14,4 +14,4 @@ hostonly_cmdline="no"

+  # create reproducible images

+  reproducible="yes"

+  # dracut modules to include (NOTE: these are NOT kernel modules)

+ -dracutmodules="kernel-modules udev-rules syslog systemd"

+ +dracutmodules="kernel-modules udev-rules syslog systemd bash busybox rescue"

+ -- 

+ 2.24.1

+ 

Those changes are needed in order to use virtiofs instead of 9p.

2 new commits added

  • Add bash and coreutils to the image
  • Add bash, busybox, and rescue as part of base modules
4 years ago

Also, some basic changes in order to have a way to debug the VM created by kata in case something goes wrong.

Pull-Request has been merged by crobinso

4 years ago