0

I am new to virtualization as a concept, and am particularly interested in Xen.

A machine is a complex system composed of many parts/constituents:

  • CPUs (one or more)
  • RAM
  • Hard drive
  • Network card
  • Motherboard
  • Operating system running on top of everything
  • Much more...

And so I imagine that a virtual machine must also model/virtualize all of these components. I played around with VirtualBox (just for ease/convenience) and sure enough, I had to select all of these things to "assemble" a virtual machine.

As a programmer, this piques my interest. Say I have a brand new network card, or CPU, or memory chip (whatever, doesn't matter) that I would like to make compatible with a hypervisor like Xen. Meaning, I want to write some code (?) produce some kind of binary/plugin, and allow Xen to use this artifact when constructing new virtual machines. So again, say I just created my own network card, the SmeebEthernets 5000; when using Xen hypervisor to create a new, say, Linux VM, I want that Linux VM to be able to use my SmeebEthernets 5000 network card.

I'm wondering:

  • What language/frameworks/APIs do I use?
  • What is the resultant (compiled/linked/packaged) artifact that is produced (which is then compatible with whatever Xen expects)?
  • Is this process different for each type of virtualized component (CPU, network card, OS, mobo, etc.)?
  • Is there any kind of open source community building these types of virtualized components, repos I could peruse, etc.?

Example:

enter image description here

In the screenshot above, I have the choice between several bridged adapters. I'm sure Xen offers similar choices...but how? For instance in order to make the "Interl(R) Ethernet Connection I217-LM" an available choice in VBox, something had to be registered with VBox at some point...I'm asking what?

smeeb
  • 211
  • 1
  • 5
  • 13
  • 1
    You have kind of missed the point of virtualization ... – Fox May 13 '15 at 20:51
  • Thanks @Fox (+1) - but how so? – smeeb May 14 '15 at 13:07
  • 1
    One of the points of virtualization is abstracting the hardware layer. What you show in the screenshot are host devices which are controlled by the host OS and it's driver. VB does not care if it's Intel, Realtek, or what not. The flip side (guest devices) do emulate some real virtual hardware, but that is mostly for backwards compatibility. Most modern OSs support virtio (or similar) devices, which are simpler and faster than emulation. btw. this is one of the reasons we may see the dawn of library OSs. – Fox May 14 '15 at 13:17
  • Thanks @Fox (+1 again): so just to confirm I understand what you're saying here: **(1)** in my screenshot above, those options are actually drivers that are available to my **host**, yes? And they are simply "forwarded" on to my guest? And **(2)** it seems like there are some use cases where guest devices are virtualized. So my question there is: what are the appropriate use cases, and how are these guest devices virtualized? I think this was the root of my question: how does one "write" a virtualized guest device? Thanks again! – smeeb May 14 '15 at 14:16
  • (1) Yes. Those devices are host devices. (2) There are several ways of getting hardware work in the virtual machine. Take a look at [qemu git repo](http://git.qemu.org/?p=qemu.git;a=tree;f=hw;) There are all the drivers provided in kvm through qemu. Generally there are two components to most virtualized hardware. The guest "API" (either emulated hw, like e1000, or pure virtual device like virtio-net) and the host interface (qemu has SLIRP, VDE, tap and Socket). Usuallly host OS takes care of connecting the host interface to the real world. In your case bridging virtual and real interfaces. – Fox May 14 '15 at 15:47
  • And some reading on [getting started](http://wiki.qemu.org/Documentation/GettingStartedDevelopers) developing QEMU. You can compare the QEMUs approach providing emulated devices (e1000,ne2k,etc.) to [novm](https://github.com/google/novm) which does provide only the base virtual (virtio) devices (=no emulation) to keep the code simple. – Fox May 14 '15 at 15:51

1 Answers1

1

smeeb,

Depending on what your trying to do as a developer. XEN, VirtualBox, VMware are all Hypervisor engines that are taking the real PC (Ram, HD, CPU, etc). And makeing them virtulized in a "Simulated" mannor. Keeping them abstracted from the real hardware layer of the HOST they are running on.

If you writing code that is for the Host, the virtual machines are un-affected. Unless your tapping into the API's of the hypervisor. Say XEN or VMWare. If your code is for the running VM's that are Linux or Windows. Then it only effects them, and not the host.

Depending on the software relese of the Hypyervisor engine. Not all device drivers may be supported. Say USB Devices. Newer engines can. Older ones not so much...

You will have to expiriment on your LAB machines with the effects.

Hope this helps a bit. Cheers..

  • Thanks @David Thomson (+1) however I'm not fully understanding what you're saying here. Please see my update and screenshot, any ideas? Thanks again! – smeeb May 14 '15 at 13:12
  • smeeb, Virtual box can map up to 4 network interfaces to VM. eg. Nic1 to phys Ethernet (Nic1 on your PC) the name being the Manufacture of the Nic(this case bridging with the adapter). Virtual box is showing them in the pull down box. Xen has similar way. CLI or in Config file for VM. http://wiki.xenproject.org/wiki/Xen_Networking , http://wiki.xenproject.org/wiki/Network_Configuration_Examples_%28Xen_4.1%2B%29 The XenProject site has a lot of information that should help you out. Depending on what your trying to accomplish in the end. Cheers... – David Thomson May 16 '15 at 17:14