diff mbox series

[bug#41820] file-systems: Add record type <nfs-share> for a file system device.

Message ID 39F7973C-8A64-4B6D-9A26-D98AA7F37475@vodafonemail.de
State New
Headers show
Series [bug#41820] file-systems: Add record type <nfs-share> for a file system device. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job

Commit Message

Stefan July 1, 2020, 6:48 p.m. UTC
Hi Mathieu!

> * As you probably noticed the bootloading & system part of Guix is
> moving a lot recently. This patch does not apply on master, so it would
> be nice if you could rebase it and pass "--base=auto" option to "git
> format-patch" so that it's easier to apply it.

OK.

> * It would be nice to have tests for this functionality. There's already
> a (gnu tests nfs) module, testing the NFS service. Maybe you could add a
> test case of a marionette booting from a local NFS share.

I tried. Unfortunately on my little aarch64 SBC compiling the necessary packages takes days – there are no substitutes available – and in the end qemu-5 has a failing test. I retried and rebased and retried and wasted days in the end. I’m a bit frustrated. :-(

  TEST    iotest-qcow2: 244 [fail]
QEMU          -- "/tmp/guix-build-qemu-5.0.0.drv-0/qemu-5.0.0/tests/qemu-iotests/../../aarch64-softmmu/qemu-system-aarch64" -nodefaults -display none -machine
 virt -accel qtest
QEMU_IMG      -- "/tmp/guix-build-qemu-5.0.0.drv-0/qemu-5.0.0/tests/qemu-iotests/../../qemu-img"
QEMU_IO       -- "/tmp/guix-build-qemu-5.0.0.drv-0/qemu-5.0.0/tests/qemu-iotests/../../qemu-io"  --cache writeback --aio threads -f qcow2
QEMU_NBD      -- "/tmp/guix-build-qemu-5.0.0.drv-0/qemu-5.0.0/tests/qemu-iotests/../../qemu-nbd"
IMGFMT        -- qcow2 (compat=1.1)
IMGPROTO      -- file
PLATFORM      -- Linux/aarch64  5.5.9
TEST_DIR      -- /tmp/guix-build-qemu-5.0.0.drv-0/qemu-5.0.0/tests/qemu-iotests/scratch
SOCK_DIR      -- /tmp/guix-build-qemu-5.0.0.drv-0/tmp.qUme9gv2Jy
SOCKET_SCM_HELPER -- /tmp/guix-build-qemu-5.0.0.drv-0/qemu-5.0.0/tests/qemu-iotests/socket_scm_helper




This is the test that I wrote and wanted to try. Maybe you can pick it up and give it a try.


(define (run-nfs-root-fs-test)
  "Run a test of an OS mounting its root file system via NFS."
  (define nfs-root-server-os
    (marionette-operating-system
     (operating-system
       (inherit %nfs-os)
       (file-systems %base-file-systems)
       (services
         (modify-services (operating-system-user-services %nfs-os)
           (nfs-service-type
            config
            =>
            (nfs-configuration
             (debug '(nfs nfsd mountd))
             (exports '(("/export"
                         "*(rw,insecure,no_subtree_check,crossmnt,fsid=root,no_root_squash,insecure,async)"))))))))
     #:requirements '(nscd)
     #:imported-modules '((gnu services herd)
                          (guix combinators))))

  (define nfs-root-client-os
    (marionette-operating-system
     (operating-system
       (inherit %nfs-os)
       (kernel-arguments '("ip=dhcp"))
       (file-systems (cons
                      (file-system
                        (type "nfs")
                        (mount-point "/")
                        (device (nfs-share ":/export"))
                        (options "addr=0.0.0.0,vers=4.2"))
                     %base-file-systems)))
     #:requirements '(nscd)
     #:imported-modules '((gnu services herd)
                          (guix combinators))))

  (define test
    (with-imported-modules '((gnu build marionette))
      #~(begin
          (use-modules (gnu build marionette)
                       (srfi srfi-64))

          (define server-marionette
            (make-marionette (list #$(virtual-machine nfs-root-server-os))))
          (define client-marionette
            (make-marionette (list #$(virtual-machine nfs-root-client-os))))

          (mkdir #$output)
          (chdir #$output)

          (test-begin "start-nfs-root-server")
          (marionette-eval
           '(begin
              (use-modules (gnu services herd))

              (current-output-port
               (open-file "/dev/console" "w0"))
              (chmod "/export" #o777)
              (symlink "/gnu" "/export/gnu")
              (start-service 'nscd))
              (start-service 'networking)
              (start-service 'nfs)
          server-marionette)

          ;; Wait for the NFS services to be up and running.
          (test-assert "nfs services are running"
           (wait-for-file "/var/run/rpc.statd.pid" server-marionette))

          (test-begin "boot-nfs-root-client")
          (marionette-eval
           '(begin
              (use-modules (gnu services herd))

              (current-output-port
               (open-file "/dev/console" "w0"))
               (with-output-to-file "/var/run/mounts"
                (lambda () (system* "mount")))
               (chmod "/var/run/mounts" #o777))
          client-marionette)

          (test-assert "nfs-root-client booted")
          (marionelle-eval
           '(begin
              (and (file-exists? "/export/var/run/mounts")
                   (system* "cat" "/export/var/run/mounts")))
          server-marionette)

          (test-end)
          (exit (= (test-runner-fail-count (test-runner-current)) 0)))))

  (gexp->derivation "nfs-server-test" test))

(define %test-nfs-root-fs
  (system-test
   (name "nfs-root-fs")
   (description "Test that an NFS server can be started and exported
directories can be mounted.")
   (value (run-nfs-root-fs-test))))


Bye

Stefan
diff mbox series

Patch

--- /tmp/guix-build-qemu-5.0.0.drv-0/qemu-5.0.0/tests/qemu-iotests/244.out      2020-04-28 16:49:25.000000000 +0000
+++ /tmp/guix-build-qemu-5.0.0.drv-0/qemu-5.0.0/tests/qemu-iotests/244.out.bad  2020-06-29 10:27:02.036147483 +0000
@@ -74,6 +74,7 @@ 
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 1048576/1048576 bytes at offset 1048576
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+Pattern verification failed at offset 2097152, 2097152 bytes
 read 2097152/2097152 bytes at offset 2097152
 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 1048576/1048576 bytes at offset 4194304
@@ -108,7 +109,7 @@ 
 read 4194304/4194304 bytes at offset 2097152
 4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)

-Images are identical.
+Content mismatch at offset 2097152!
 qcow2 file size after I/O: 327680

 === bdrv_co_block_status test for file and offset=0 ===