diff options
author | Tim Smith <tsmith@chef.io> | 2018-11-27 21:05:57 -0800 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-11-27 21:05:57 -0800 |
commit | cc91c6e325ae883ec84278c3b2205525b47be076 (patch) | |
tree | 79f6e5bb9cddbcf0461eaa9231b03f49083b886d | |
parent | af633604e28442884b131dd51a09738251d5f2b6 (diff) | |
download | ohai-nested_virt.tar.gz |
Linux Virtualization: Use the new nests `systems` format for lxd / lxcnested_virt
Somehow we never updated these for the new format. This means you can end up with data like this which is wrong in both the legacy and the new format.
```json
{
"systems": {
"xen": "guest"
},
"system": "lxd",
"role": "host"
}
```
with this change we get:
```json
{
"systems": {
"xen": "guest",
"lxd": "host"
},
"system": "lxd",
"role": "host"
}
```
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/ohai/plugins/linux/virtualization.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/ohai/plugins/linux/virtualization.rb b/lib/ohai/plugins/linux/virtualization.rb index f1c50a7f..a605bd9c 100644 --- a/lib/ohai/plugins/linux/virtualization.rb +++ b/lib/ohai/plugins/linux/virtualization.rb @@ -223,6 +223,7 @@ Ohai.plugin(:Virtualization) do logger.trace("Plugin Virtualization: /proc/self/cgroup and lxc-version command exist. Detecting as lxc host") virtualization[:system] = "lxc" virtualization[:role] = "host" + virtualization[:systems][:lxc] = "host" end # In general, the 'systems' framework from OHAI-182 is less susceptible to conflicts # But, this could overwrite virtualization[:systems][:lxc] = "guest" @@ -242,6 +243,7 @@ Ohai.plugin(:Virtualization) do logger.trace("Plugin Virtualization: /dev/lxd/sock exists. Detecting as lxd guest") virtualization[:system] = "lxd" virtualization[:role] = "guest" + virtualization[:systems][:lxd] = "guest" else # 'How' LXD is installed dictates the runtime data location # @@ -256,6 +258,7 @@ Ohai.plugin(:Virtualization) do logger.trace("Plugin Virtualization: #{devlxd} exists. Detecting as lxd host") virtualization[:system] = "lxd" virtualization[:role] = "host" + virtualization[:systems][:lxd] = "host" break end end |