Skip to content

brand/bhyve: support setting bhyve binary path - #550

Open
hrosenfeld wants to merge 1 commit into
omniosorg:masterfrom
hrosenfeld:bhyvepath
Open

brand/bhyve: support setting bhyve binary path#550
hrosenfeld wants to merge 1 commit into
omniosorg:masterfrom
hrosenfeld:bhyvepath

Conversation

@hrosenfeld

Copy link
Copy Markdown
Contributor

This change allows selecting a different bhyve binary to run:

add attr
     set name=bhyve
     set type=string
     set value=/usr/sbin/bhyve-experimental
end

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?

@citrus-it citrus-it left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this, it's something that I've often wanted!

Comment thread src/brand/bhyve/boot.py
# Default values
opts = {
'acpi': 'on', # No effect on illumos bhyve
'bhyve': '/usr/sbin/bhyve',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be something going on with whitespace here. This file is all spaces rather than tabs.

Comment thread src/brand/bhyve/boot.py Outdated
tf = fh.name
fh.close()
try:
os.rename(tf, f'{z.zoneroot}/etc/bhyve.env')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/brand/bhyve/boot.py
# Default values
opts = {
'acpi': 'on', # No effect on illumos bhyve
'bhyve': '/usr/sbin/bhyve',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably add this to the bhyve.7 man page too.

Comment thread src/brand/bhyve/init.c Outdated
mount_datasets();
setup_environment();

bhyve = getenv("BHYVE");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same whitespace question here - we use illumos conventions for a .c file so these should use tabs etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants