diff options
author | kn <kn@cvs.openbsd.org> | 2020-01-09 22:06:24 +0000 |
---|---|---|
committer | kn <kn@cvs.openbsd.org> | 2020-01-09 22:06:24 +0000 |
commit | d62a0ce85b22ab8e01d5e8bb8fb018f2cfa9fab4 (patch) | |
tree | 117c0e7836278a368f1cd8ef743a50fad14391e3 /usr.sbin/ldomctl | |
parent | 7df3a687f88313dd6fdfd999d77e5d168f47d637 (diff) |
Fail on incomplete guest parameters
Each guest needs vcpu and memory, otherwise it is invalid.
Each guest also needs at least one of vdisk, vnet or iodevice,
otherwise it has nothing to boot from.
OK kettenis
Diffstat (limited to 'usr.sbin/ldomctl')
-rw-r--r-- | usr.sbin/ldomctl/parse.y | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.sbin/ldomctl/parse.y b/usr.sbin/ldomctl/parse.y index 431da6f4032..5d6ffb8c785 100644 --- a/usr.sbin/ldomctl/parse.y +++ b/usr.sbin/ldomctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.14 2020/01/09 09:23:57 kn Exp $ */ +/* $OpenBSD: parse.y,v 1.15 2020/01/09 22:06:23 kn Exp $ */ /* * Copyright (c) 2012 Mark Kettenis <kettenis@openbsd.org> @@ -124,6 +124,25 @@ domain : DOMAIN STRING optnl '{' optnl { SIMPLEQ_INIT(&domain->iodev_list); } domainopts_l '}' { + if (strcmp(domain->name, "primary") != 0) { + if (domain->vcpu == 0) { + yyerror("vcpu is required: %s", + domain->name); + YYERROR; + } + if ( domain->memory == 0) { + yyerror("memory is required: %s", + domain->name); + YYERROR; + } + if (SIMPLEQ_EMPTY(&domain->vdisk_list) && + SIMPLEQ_EMPTY(&domain->vnet_list) && + SIMPLEQ_EMPTY(&domain->iodev_list)) { + yyerror("at least one bootable device" + " is required: %s", domain->name); + YYERROR; + } + } SIMPLEQ_INSERT_TAIL(&conf->domain_list, domain, entry); domain = NULL; } |