On Thu, Mar 07, 2019 at 09:00:55PM +0100, Theo Buehler wrote:
> On Thu, Mar 07, 2019 at 08:52:45PM +0100, Klemens Nanni wrote:
> > vmd(8) does not support numerical names with `start' and `receive'.
> > It never worked, the manuals are now clearer about this, but error
> > handling can still be improved:
> 
> I'm not sure I understand. This works fine for me with -current from
> yesterday (I have vms configured in my vm.conf).
> 
> $ vmctl start 1
> vmctl: started vm 1 successfully, tty /dev/ttyp0
Hm.  That works because the first VM defined in your vm.conf(5) has a
valid non-numerical name and gets assigned ID 1.

With predefined VMs it works as you showed because ctl_start() parses
the name as ID really, that is valid IDs will be accepted although the
vmctl(8) always said `vmctl start name ...' not `vmctl start id ...'.

The problem I faced is creating new VMs on the fly, possibly without
any vm.conf present.  Here the name passed on the command line is used
to create a new VM instead of referencing an existing one.

This never worked but the manual said it would be possible.  With
`receive' it's even more visible, as it never possibly uses the passed
name as ID.

Here's an example:

        $ vmctl create /10.img -s 10M
        vmctl: raw imagefile created
        # cat >/etc/vm.conf <<EOF
        vm "10" {
                disable
                boot "/bsd.rd"
                disk "/10.img"
        }
        vm "a" {
                disable
                boot "/bsd.rd"
                disk "/10.img"
        }
        EOF
        # rcctl restart vmd
        vmd(ok)
        vmd(ok)
        # vmctl show
           ID   PID VCPUS  MAXMEM  CURMEM     TTY        OWNER NAME
            1     -     1    512M       -       -         root 10
            2     -     1    512M       -       -         root a

Note how it fails to start the VM when referenced by its numerical name
"10", but "a", 1 (or 2) work fine:

        # vmctl start 10
        vmctl: could not open disk image(s)

Corresponding vmd log:
        Mar  7 22:16:44 eru vmd[90156]: invalid configuration, no devices

        # vmctl start 1
        vmctl: started vm 1 successfully, tty /dev/ttypo
        # vmctl stop 1 -f
        stopping vm: forced to terminate vm 1
        # vmctl start a
        vmctl: started vm 2 successfully, tty /dev/ttypo

That is wonky, but I see how `start' must indeed accept IDs in the case
of predefined VMs.

I'll work on docs to clarify this further without touching code, thanks.

Reply via email to