brand/bhyve: support setting bhyve binary path - #550
Conversation
citrus-it
left a comment
There was a problem hiding this comment.
Thanks for doing this, it's something that I've often wanted!
| # Default values | ||
| opts = { | ||
| 'acpi': 'on', # No effect on illumos bhyve | ||
| 'bhyve': '/usr/sbin/bhyve', |
There was a problem hiding this comment.
There seems to be something going on with whitespace here. This file is all spaces rather than tabs.
| tf = fh.name | ||
| fh.close() | ||
| try: | ||
| os.rename(tf, f'{z.zoneroot}/etc/bhyve.env') |
There was a problem hiding this comment.
bhyve.env is already something that people use and I don't think we should change the brand to just start always overwriting it. A lot of my zones have this file with something in there, for example.
Should we perhaps use /etc/bhyve.boot.env for things that are generated from this boot script, and then have init read this as well as /etc/bhyve.env so we can have the best of both worlds?
There was a problem hiding this comment.
How about not using bhyve.env at all?
- let init.c always exec "/tmp/bhyve"
- let boot.py copy the binary given in opts['bhyve'] to /tmp/bhyve
| # Default values | ||
| opts = { | ||
| 'acpi': 'on', # No effect on illumos bhyve | ||
| 'bhyve': '/usr/sbin/bhyve', |
There was a problem hiding this comment.
I think we should probably add this to the bhyve.7 man page too.
| mount_datasets(); | ||
| setup_environment(); | ||
|
|
||
| bhyve = getenv("BHYVE"); |
There was a problem hiding this comment.
Same whitespace question here - we use illumos conventions for a .c file so these should use tabs etc.
7515981 to
f5f075f
Compare
This change allows selecting a different bhyve binary to run:
The selected bhyve binary must exist in both the global zone and the bhyve zone at the same path. Due to lofs mounts of /usr into the zone this happens to be the case if the bhyve binary resides somewhere in /usr in the global zone.
Perhaps it would be a good idea to just copy the selected bhyve binary into /tmp and run it from there, allowing it to reside anywhere in the global zone and obviating the need for bhyve.env?