It just happened to be added to the end of the file because it is the newest. Because the blocks of code that look for each virtualization type are not a giant conditional, but effectively separate, you will overwrite earlier data if you meet the conditions for more than one virtualization system.

The error case is something like this:
Oh look, I'm on EC2! set virtualization[:system] = "xen" && virtualization[role] = "guest"
Oh man, looks like I also support being a LXC host, since I have cgroup support, set virtualization[:system] = "lxc" && virtualization[:role] = guest

That second case almost always is true, so I added the requirement that lxc-version exists (which generally comes from actively choosing to install the LXC user tools), but also if we happen to have those installed, don't overwrite anything we've already found just to be safe.

I think we'd benefit from a small refactor to add utility methods to set these values that always check to make sure we're not overwriting and log a warn if we tried to. Not sure if I'd consider that in scope here or not, could go either way.