lima icon indicating copy to clipboard operation
lima copied to clipboard

Add save functionality to limayaml

Open afbjorklund opened this issue 1 year ago • 2 comments

Make it possible to fill in the defaults (null) with limactl validate, with a workaround for python yaml.

Was using a local patched version to test with the jsonschema and such, might as well be a flag ?

You can validate more than one yaml, then the output will be formatted with document separators.

limactl validate examples/default.yaml examples/ubuntu.yaml


Found an interesting python bug (libyaml difference?), when using check-jsonschema:

Schema validation errors were encountered.
  default.yaml::$.mounts[0].location: None is not of type 'string'
mounts:
- location: ~
  mountPoint: ~
  writable: false
  sshfs:
    cache: true
    followSymlinks: false
    sftpDriver: ""
  9p:
    securityModel: none
    protocolVersion: 9p2000.L
    msize: 128KiB
    cache: fscache
- location: /tmp/lima
  mountPoint: /tmp/lima
  writable: true
  sshfs:
    cache: true
    followSymlinks: false
    sftpDriver: ""
  9p:
    securityModel: none
    protocolVersion: 9p2000.L
    msize: 128KiB
    cache: mmap

Added a workaround, not sure which language is "right" according to yaml spec ?

afbjorklund avatar May 12 '24 10:05 afbjorklund

According to yaml.org, ~ is the representation of the null value. It is not a valid string.

There is a similar go-yaml bug (similar to "~"), if you try to marshal the string "null"

afbjorklund avatar May 12 '24 10:05 afbjorklund

There are some minor differences between this output and the limactl info output (as JSON)

Due to the difference in sequence indentation, and to the missing default for Virtiofs on Linux/9p.

@@ -33,6 +33,7 @@
     protocolVersion: 9p2000.L
     msize: 128KiB
     cache: fscache
+    virtiofs: {}
 - location: /tmp/lima
   mountPoint: /tmp/lima
   writable: true
@@ -45,6 +46,7 @@
     protocolVersion: 9p2000.L
     msize: 128KiB
     cache: mmap
+    virtiofs: {}
 mountType: reverse-sshfs
 mountInotify: false
 ssh:

commit 8b7bab1c449c3f0db34e4802a18024bc4b21db54 (limactl info | jq .defaultTemplate | yq -p json). Only in experimental:

--- default.yaml
+++ virtiofs-linux.yaml
@@ -33,6 +33,8 @@
     protocolVersion: 9p2000.L
     msize: 128KiB
     cache: fscache
+  virtiofs:
+    queueSize: 1024
 - location: /tmp/lima
   mountPoint: /tmp/lima
   writable: true
@@ -45,7 +47,9 @@
     protocolVersion: 9p2000.L
     msize: 128KiB
     cache: mmap
-mountType: reverse-sshfs
+  virtiofs:
+    queueSize: 1024
+mountType: virtiofs
 mountInotify: false
 ssh:
   localPort: 0

afbjorklund avatar May 12 '24 18:05 afbjorklund