vhostmd, the Virtual Host Metrics Daemon is a joint Novell-Red Hat project to provide some limited metrics about the host to virtual machines.
The hosting provider can use vhostmd to safely push some limited information about the host environment up to guests. So for example the hosting company can reveal the total load on the host, to help the guest user determine if that is causing performance problems in guest applications. Of course there are plenty of legal/contractual issues involved here which vhostmd doesn’t try to solve. It just provides a secure and flexible mechanism.
The implementation was done by Pat Campbell and it’s quite clever I think. In the host a daemon runs and generates the stats every few seconds as an XML file, which gets saved in a flat disk image.
The disk image is exported as a disk, read-only, to the chosen set of guests.
There’s some synchronization stuff and the guest has to open the disk image with
O_DIRECT, to ensure that the guest always sees the latest, non-corrupted stats.
But the mechanism is secure because guests can’t write to the disk, and even if they managed to find a way to do that, they wouldn’t gain anything by doing so.