diff options
author | kn <kn@cvs.openbsd.org> | 2020-05-22 21:54:21 +0000 |
---|---|---|
committer | kn <kn@cvs.openbsd.org> | 2020-05-22 21:54:21 +0000 |
commit | 9eecd49d4c5c3df4e991e1c01228de1212f5fc8b (patch) | |
tree | 1571f070fbda701a6de02767275ec6b45b18a924 /usr.sbin/ldomctl | |
parent | 644b7b26d886687d34677bc35af3fdcba05f7b1c (diff) |
Revert previous
Total vcpu and memory are read from the PRI so constraint checks must not
be done before that, noted by kettenis.
The fact that "total_cpus" as a global variable (initialized with zero) is
always smaller than the total number of configured vcpus and the fact that
I only tested a negative example without a positive one made me jump the
trigger, sorry.
Diffstat (limited to 'usr.sbin/ldomctl')
-rw-r--r-- | usr.sbin/ldomctl/config.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/usr.sbin/ldomctl/config.c b/usr.sbin/ldomctl/config.c index 33506c36bf3..700cac08616 100644 --- a/usr.sbin/ldomctl/config.c +++ b/usr.sbin/ldomctl/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.37 2020/05/22 21:40:16 kn Exp $ */ +/* $OpenBSD: config.c,v 1.38 2020/05/22 21:54:20 kn Exp $ */ /* * Copyright (c) 2012, 2018 Mark Kettenis @@ -2792,6 +2792,18 @@ 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) { @@ -2811,19 +2823,6 @@ 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(); |