Desktop Virtualization: Part I

Background

I have a long history of building PCs: I started with my first back in high school. I think it was an Athlon XP 2300+ and I first had a Radeon 9500 Pro, which I eventually upgraded to a 9800 XT that I think I was able to modify to be a Radeon 9800 Pro. Something like that. Once I graduated college and started working full-time, I had a bit more money to burn and I built a more serious i7-based system with a GTX 480 that I eventually ran in SLI. Since then, I've built servers and desktops and had pretty broad exposure to issues you might have when building a PC.

Throughout all this, I've still preferred Mac OS X for daily use, even with its flaws. I'd maybe even consider Linux, but Windows and me have never really gotten along. It's purely preference: I think Windows is a great OS, I like the MS development platform—especially under Satya—but I like OS X and Linux more, I could never get behind Powershell, and I still prefer *NIX-based development. Of course, I also like playing video games—like, AAA titles that really only run on Windows—and the current generation of consoles don't appeal to me.

I've been thinking about building a dedicated, Windows-based gaming PC for months now, and I was this close to hitting "Submit Order" on NewEgg the other day when I had the same hesitation I've had for a while: I don't want my fastest and most capable machine to be running Windows. My 2013 MacBook Air on which I'm writing this post is showing its age, so I want something I can use—and enjoy using—for tasks other than gaming.

The Idea

I maintain a few server machines at home on which I run a variety of virtual machines: Server 2012 for headless scanning with my Fujitsu iX500, Ubuntu for Plex, Fedora for FreeIPA, etc. I don't use VMWare or Hyper-V or anything off-the-shelf for this, I use Xen running on a stripped-down install of Ubuntu Server. It's really performant, and I've done things like PCI passthrough for a RAID controller and USB passthrough for setting up the scanner (which now works over WiFi).

I watched a video a while back of someone virtualizing 7 fully-functional, separate gaming machines, something which is possible now with things like VT-d that allow you to pass PCI devices—even high-performance ones like cutting-edge GPUs—to a virtual machine with little to no impact on performance. So, I got to thinking: why not do something like this for my desktop, too?

The idea is to run a stripped-down hypervisor that manages a few different virtual machines: Windows for gaming (and maybe media or photo editing), Linux with a desktop environment for development, and maybe even an OS X virtual machine. I'd have a dedicated video card for gaming under Windows (probably a GTX 980 Ti) and another lower-end GPU for Linux/OS X, each connected to different monitors. I'd then pass through a USB controller to each OS and switch keyboard and mouse between them as necessary for the lowest latency possible. This would also allow me to connect my USB DACs to whichever machine I want to listen to. This requires a bit more cabling and the additional cost of a second GPU, but I think it's worth it.

The underlying system would be something like a single-socket Xeon E5-1650 v3 with a few gigabytes of RAM, an NVMe SSD, and an X520-DA2 10 Gigabit Ethernet card (because, of course, I already have 10GbE set up for my servers). I'm thinking I'll boot the hypervisor off of a small Intel SATA SSD and then use the NVMe disk for VM storage with ZFS ZVOLs so I can do things like snapshots and compression. Imagine being able to snapshot the VMs periodically, store them on my fileserver—over the fast network, encrypt and back them up offsite, etc. Complicated? Yes. Cool? Absolutely.

I'll probably have to use KVM instead of Xen, and maybe even another distro than Ubuntu, but the base Linux system will tie in nicely to my existing infrastructure. I can use Salt to manage all the insanely-complex setup specifics (stubbing out PCI devices, running customized and patched versions of things), track metrics with collectd, logs with Logstash, etc. This is going to be a complicated thing to set up, but I feel less guilty about it than just buying a Windows machine to be used almost solely for gaming because I think I'll learn a hell of a lot during the process.

Would love feedback on this, unless it's to tell me that I'm delusional, because—trust me—I'm already aware of that.