[chef-dev] Re: improving ohai's awareness of OS 'flavors'


Chronological Thread 
  • From: Daniel DeLeo < >
  • To: Blake Irvin < >
  • Cc: " Dev" < >, Christopher Horrell < >, Eric Saxby < >, Bryan McLellan < >
  • Subject: [chef-dev] Re: improving ohai's awareness of OS 'flavors'
  • Date: Tue, 1 Oct 2013 11:36:28 -0700


On Tuesday, October 1, 2013 at 10:31 AM, Blake Irvin wrote:

At my day job (Wanelo), we do almost all of our work in SmartOS zones.  This means that, while 'uname' and similar commands will detect the global zone properly, this isn't actually that useful for automation, as it's the local zone configuration that's more important.  (For more on zones in SmartOS, see this document).

For example, Joyent is working on a 'flavor' of SmartOS called SNGL, which is meant to encourage a platform-agnostic approach to systems choice (basically, userland in SNGL looks a lot more like Debian-flavored Linux than mainline SmartOS).  While this is useful insofar as it should allow better cross-platform behavior for community cookbooks, it's also a pain for Chef users because ohai can only identify platform by kernel-specific information, which all zones on a piece of physical hardware, SNGL or otherwise, share.
Sounds like you just need to make the solaris platform plugin a little smarter? If SmartOS and SNGL are functionally different, they should be reported as different platforms. It's up to Joyent to provide a sane way to detect this, and then you can patch the plugin to handle that case.
 

Wrestling with these problems, it occurred to us that there are broader implications to the way that ohai reports platform information.  For example:

- It's hard to tell from ohai-generated attributes if you are on a custom-built AWS AMI that might need different Chef behavior than the 'stock' OS you baselined from
- Users of other 'container' technologies (jails/lxc) will likely need to identify container 'flavor'
- Anyone who prefers a package manager that's not the default for their system will have to monkeypatch ohai or hard-code attributes
Does ohai's virtualization detection cover these cases? If not, can it be made to do so?

As for non-default package managers, this is more of a Chef issue than an ohai issue, though there is some overlap. But if ohai can detect SNGL as distinct from SmartOS, then you just need to add the right entries in the platform selection code that exists now and everything should be fine.
 


A few extensions to ohai seem possible:

- Make ohai container-aware (that is, aware if it's being run inside a container and able to report container configuration) through additional attributes
This is what ohai's virtualization detection is for. If you need a new plugin to detect whatever "virtualization" technology you're using, we'd be happy to add it.
 
- Make ohai package manager aware (that is, don't assume package manager X just because you're on kernel Y) through additional attributes
I don't think Chef really needs this to work correctly in your use case. On the other hand, if you want ohai to collect this information, I don't see a reason why we wouldn't allow a plugin for it.
 


Before doing any work on this (likely in the form of a cookbook extending the platform attribute namespace) we'd like some feedback from people here on the Right Way™ to do this.


best,
Blake
I don't think Ohai or Chef need big architectural changes to support your use case, just some small enhancements to things that are already there. Patches for this stuff would be welcome, feel free to ask questions here if you run into trouble.

-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§