Why upper case?
Klemens Nanni <[email protected]> wrote: > > > kmos noted that `-n' wouldn't bark at overallocation. > > Hoisting PRI reading and moving the `-n' check after constraint checking > makes it bail on invalid configs just as expected: > > $ cat ldom.conf > domain guest { > vdisk "/dev/null" > vcpu 128 > memory 1G > } > $ ldomctl init-sytem -n ldom.conf ; echo $? > 0 > $ ./obj/ldomctl init-sytem -n ldom.conf > ldomctl: not enough VCPU resources available > > > OK? > > > Index: config.c > =================================================================== > RCS file: /cvs/src/usr.sbin/ldomctl/config.c,v > retrieving revision 1.36 > diff -u -p -r1.36 config.c > --- config.c 17 Mar 2020 21:24:22 -0000 1.36 > +++ config.c 22 May 2020 21:01:17 -0000 > @@ -2792,18 +2798,6 @@ build_config(const char *filename, int n > 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) { > @@ -2822,6 +2816,19 @@ build_config(const char *filename, int n > errx(1, "not enough VCPU resources available"); > 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(); >
