diff options
author | kn <kn@cvs.openbsd.org> | 2020-05-22 21:40:17 +0000 |
---|---|---|
committer | kn <kn@cvs.openbsd.org> | 2020-05-22 21:40:17 +0000 |
commit | 8eb2436863ca6d5d4fc68d9d8d13c320d56dc973 (patch) | |
tree | 15fbbcdbcf2551457c736257d9eec11d9b4a2c79 | |
parent | 396a70befc8163330ba08acb62ad0b763ba8f0ce (diff) |
Make "init-system -n" check vcpu and memory constraints
kmos noted that "-n" wouldn't bark at overallocation, only running without
it would do so.
Hoit setup code and delay the noaction bailout just after constraint checks
such that they're always done.
OK kmos
-rw-r--r-- | usr.sbin/ldomctl/config.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/usr.sbin/ldomctl/config.c b/usr.sbin/ldomctl/config.c index 8c5486da04f..33506c36bf3 100644 --- a/usr.sbin/ldomctl/config.c +++ b/usr.sbin/ldomctl/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.36 2020/03/17 21:24:22 kn Exp $ */ +/* $OpenBSD: config.c,v 1.37 2020/05/22 21:40:16 kn Exp $ */ /* * Copyright (c) 2012, 2018 Mark Kettenis @@ -2792,18 +2792,6 @@ build_config(const char *filename, int noaction) SIMPLEQ_INIT(&conf.domain_list); if (parse_config(filename, &conf) < 0) exit(1); - if (noaction) - exit(0); - - pri = md_read("pri"); - if (pri == NULL) - err(1, "unable to get PRI"); - hvmd = md_read("hv.md"); - if (hvmd == NULL) - err(1, "unable to get Hypervisor MD"); - - pri_init(pri); - pri_alloc_memory(hv_membase, hv_memsize); SIMPLEQ_FOREACH(domain, &conf.domain_list, entry) { if (strcmp(domain->name, "primary") == 0) { @@ -2823,6 +2811,19 @@ build_config(const char *filename, int noaction) if (memory > total_memory || primary_memory == 0) errx(1, "not enough memory available"); + if (noaction) + exit(0); + + pri = md_read("pri"); + if (pri == NULL) + err(1, "unable to get PRI"); + hvmd = md_read("hv.md"); + if (hvmd == NULL) + err(1, "unable to get Hypervisor MD"); + + pri_init(pri); + pri_alloc_memory(hv_membase, hv_memsize); + hvmd_init(hvmd); primary = primary_init(); |