diff options
author | pd <pd@cvs.openbsd.org> | 2019-12-12 03:53:39 +0000 |
---|---|---|
committer | pd <pd@cvs.openbsd.org> | 2019-12-12 03:53:39 +0000 |
commit | de2bcacdc0c2351ed03b993ac6d1367f62243ff3 (patch) | |
tree | f447721d7c43063ed5d246e26f2741ffb11ae6a4 /usr.sbin/vmd/vmd.h | |
parent | 4c41d600f210db58568c1c4650913cf9e8d34c0b (diff) |
vmd: start vms defined in vm.conf in a staggered fashion
This addresses 'thundering herd' problem when a lot of
vms are configured in vm.conf. A lot of vms booting in parallel can
overload the host and also mess up tsc calibration in openbsd guests as
it uses PIT which doesn't fire reliably if the host is overloaded.
We default to starting vms with parallelism of ncpuonline and a delay 30 seconds
between batches. This is configurable in vm.conf.
ok mlarkin@ (also addressed comments from cheloha@)
Diffstat (limited to 'usr.sbin/vmd/vmd.h')
-rw-r--r-- | usr.sbin/vmd/vmd.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/vmd/vmd.h b/usr.sbin/vmd/vmd.h index f6368dc621d..d7efb329e53 100644 --- a/usr.sbin/vmd/vmd.h +++ b/usr.sbin/vmd/vmd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmd.h,v 1.97 2019/09/07 09:11:14 tobhe Exp $ */ +/* $OpenBSD: vmd.h,v 1.98 2019/12/12 03:53:38 pd Exp $ */ /* * Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org> @@ -39,6 +39,7 @@ #define SET(_v, _m) ((_v) |= (_m)) #define CLR(_v, _m) ((_v) &= ~(_m)) #define ISSET(_v, _m) ((_v) & (_m)) +#define NELEM(a) (sizeof(a) / sizeof((a)[0])) #define VMD_USER "_vmd" #define VMD_CONF "/etc/vm.conf" @@ -56,6 +57,8 @@ #define VMD_SWITCH_TYPE "bridge" #define VM_DEFAULT_MEMORY 512 +#define VMD_DEFAULT_STAGGERED_START_DELAY 30 + /* Rate-limit fast reboots */ #define VM_START_RATE_SEC 6 /* min. seconds since last reboot */ #define VM_START_RATE_LIMIT 3 /* max. number of fast reboots */ @@ -280,6 +283,7 @@ struct vmd_vm { #define VM_STATE_SHUTDOWN 0x04 #define VM_STATE_RECEIVED 0x08 #define VM_STATE_PAUSED 0x10 +#define VM_STATE_WAITING 0x20 /* For rate-limiting */ struct timeval vm_start_tv; @@ -319,7 +323,10 @@ struct vmd_config { unsigned int cfg_flags; #define VMD_CFG_INET6 0x01 #define VMD_CFG_AUTOINET6 0x02 +#define VMD_CFG_STAGGERED_START 0x04 + struct timeval delay; + int parallelism; struct address cfg_localprefix; struct address cfg_localprefix6; }; |