ldom.conf: curly braces in vnet block

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ldom.conf: curly braces in vnet block

Klemens Nanni-2
ldom.conf(5) says

        vnet [{keyword=value ...}]
                Assign a vnet(4) network interface to the guest domain.  This
                keyword can be used multiple times.  The curly braces are
                optional and can contain the following keywords:

But curly braces must not exist:

        $ cat -n vnet.conf
        1  domain guest {
        2   vcpu 1
        3   memory 1G
        4   vnet { mtu=1500 }
        5  }
        $ ldomctl init-system -n vnet.conf
        vnet.conf:4 syntax error
        $ sed -i /vnet/s,[{}],,g vnet.conf
        $ ldomctl init-system -n vnet.conf ; echo $?
        0

Since it has been like this for years apparently, the question is which
part should be fixed:  documentation or code?  I opt for the latter
since that is what other parsers such as vm.conf(5) do, plus it reads
much better structurally, imho.

I came across this when implementing specific options for `vdisk', hence
I copied the `vnet' block and ran into above thing.

Given that noone complained so far about this:  Does anyone use
`mac-addr' or `mtu'?  If so, do you prefer appending it without curly
braces on the same line?  I'm curious.

Reply | Threaded
Open this post in threaded view
|

Re: ldom.conf: curly braces in vnet block

Andrew Grillet
I have used the mac-addr feature (for netboot reasons). I think this
probably caused me grief
but I assumed I was at fault and did not bother reporting it.

I prefer same line, no curly braces, and accurate documentation. And also
error messages
that are more explicit:
Vnet.conf:4 Syntax error - Unexpected  "{" found.


On Sun, 2 Feb 2020 at 11:20, Klemens Nanni <[hidden email]> wrote:

> ldom.conf(5) says
>
>         vnet [{keyword=value ...}]
>                 Assign a vnet(4) network interface to the guest domain.
> This
>                 keyword can be used multiple times.  The curly braces are
>                 optional and can contain the following keywords:
>
> But curly braces must not exist:
>
>         $ cat -n vnet.conf
>         1  domain guest {
>         2       vcpu 1
>         3       memory 1G
>         4       vnet { mtu=1500 }
>         5  }
>         $ ldomctl init-system -n vnet.conf
>         vnet.conf:4 syntax error
>         $ sed -i /vnet/s,[{}],,g vnet.conf
>         $ ldomctl init-system -n vnet.conf ; echo $?
>         0
>
> Since it has been like this for years apparently, the question is which
> part should be fixed:  documentation or code?  I opt for the latter
> since that is what other parsers such as vm.conf(5) do, plus it reads
> much better structurally, imho.
>
> I came across this when implementing specific options for `vdisk', hence
> I copied the `vnet' block and ran into above thing.
>
> Given that noone complained so far about this:  Does anyone use
> `mac-addr' or `mtu'?  If so, do you prefer appending it without curly
> braces on the same line?  I'm curious.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: ldom.conf: curly braces in vnet block

Klemens Nanni-2
On Sun, Feb 02, 2020 at 01:50:58PM +0000, Andrew Grillet wrote:
> I have used the mac-addr feature (for netboot reasons). I think this
> probably caused me grief
> but I assumed I was at fault and did not bother reporting it.
Please consider to do so in the future.

> I prefer same line, no curly braces, and accurate documentation. And also
> error messages
> that are more explicit:
> Vnet.conf:4 Syntax error - Unexpected  "{" found.
Same or new line makes no difference, but curly braces is what all other
parsers I can find in base do.  They support lines with mutliple space
delimited keywords (most of them can be specified multiple times), but
once unique options are specified (such as a MAC address), those are
usually enclosed in their own semantic block.

It seems off to break with what vm.conf(5) already does here, so I'll
probably wip up a diff to make the following work:

        domain guest {
                vnet
                vnet { mtu=1500 }
                vnet {
                        mac-addr=00:11:...
                }
                ...
        }

Reply | Threaded
Open this post in threaded view
|

Re: ldom.conf: curly braces in vnet block

Klemens Nanni-2
In reply to this post by Klemens Nanni-2
On Sun, Feb 02, 2020 at 12:08:56PM +0100, Klemens Nanni wrote:

> ldom.conf(5) says
>
> vnet [{keyword=value ...}]
>        Assign a vnet(4) network interface to the guest domain.  This
>        keyword can be used multiple times.  The curly braces are
>        optional and can contain the following keywords:
>
> But curly braces must not exist:
>
> $ cat -n vnet.conf
> 1  domain guest {
> 2   vcpu 1
> 3   memory 1G
> 4   vnet { mtu=1500 }
> 5  }
> $ ldomctl init-system -n vnet.conf
> vnet.conf:4 syntax error
> $ sed -i /vnet/s,[{}],,g vnet.conf
> $ ldomctl init-system -n vnet.conf ; echo $?
> 0
I've tried converting parse.y to mandatory curly braces with space
separated (incl. optional newlines) keyword=value pairs, but I got lost
in yacc errors, consistency flaws, etc.

Unless I find more motiviation for this or some other parse.y hacker
wants to help, here's a diff to update ldom.conf(5) to reflect working
syntax.

I'd like to commit this soon in order to continue with my actual diff
for introducing vdisk options.

OK?


Index: ldom.conf.5
===================================================================
RCS file: /cvs/src/usr.sbin/ldomctl/ldom.conf.5,v
retrieving revision 1.10
diff -u -p -r1.10 ldom.conf.5
--- ldom.conf.5 13 Jan 2020 09:29:41 -0000 1.10
+++ ldom.conf.5 5 Feb 2020 20:06:21 -0000
@@ -64,12 +64,12 @@ can be a block device node or a disk ima
 .Cm create-vdisk
 command.
 This keyword can be used multiple times.
-.It Ic vnet Op Brq Ar keyword Ns = Ns Ar value ...
+.It Ic vnet Op Ar keyword Ns = Ns Ar value ...
 Assign a
 .Xr vnet 4
 network interface to the guest domain.
 This keyword can be used multiple times.
-The curly braces are optional and can contain the following keywords:
+Valid options are:
 .Bl -tag -width Ds
 .It Ic mac-addr Ns = Ns Ar address
 Configure the MAC address of the interface.