# Host with LXD and KVM support

**URL:** <https://forum.opennebula.io/t/host-with-lxd-and-kvm-support/8294>\
**Category:** Product Support\
**Created:** [April 6, 2020, 7:55am UTC](https://forum.opennebula.io/t/host-with-lxd-and-kvm-support/8294 "2020-04-06T07:55:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![darkfader](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/darkfader/32/4769_2.png) [@darkfader](https://forum.opennebula.io/u/darkfader)\
**Post date:** [April 6, 2020, 7:55am UTC](https://forum.opennebula.io/t/host-with-lxd-and-kvm-support/8294/1 "2020-04-06T07:55:07Z")

</div>

Hi,

I’m testing a standalone OpenNebula setup at the moment, one hypervisor node, one high-end ScaleFlux SSD. I’ve got one large ext4 filesystem as the datastore here.

I’d like to use be able to use the same physical box with both LXD and KVM.  
That’s mostly because it makes sense to have the choice, but also because I want to be able to compare the IO performance of virtual and non-virtual in a nice automated way.

But I’m a bit confused at the moment how to proceed…

Should I add the server under two names with two different drivers?  
Do I need to think about reservations?

I know I could run a VM for the LXD containers, but that would take away a lot of the benefit in terms of performance & footprint.

* * *

**Versions of the related components and OS (frontend, hypervisors, VMs):**  
CentOS 8 / ONE 5.10.1

**Steps to reproduce:**

**Current results:**  
LXD support much improved but question like this can be found only unanswered in forum search

**Expected results:**  
advice how to proceed 🙂

---

<div class="post-metadata">

**Author:** ![ruben](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ruben/32/19_2.png) [@ruben](https://forum.opennebula.io/u/ruben)\
**Post date:** [April 6, 2020, 8:19am UTC](https://forum.opennebula.io/t/host-with-lxd-and-kvm-support/8294/2 "2020-04-06T08:19:17Z")

</div>

Maybe you can find some hints here:

[https://opennebula.io/using-lxd-and-kvm-on-the-same-host/](https://opennebula.io/using-lxd-and-kvm-on-the-same-host/)

---

<div class="post-metadata">

**Author:** ![darkfader](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/darkfader/32/4769_2.png) [@darkfader](https://forum.opennebula.io/u/darkfader)\
**Post date:** [April 6, 2020, 8:48am UTC](https://forum.opennebula.io/t/host-with-lxd-and-kvm-support/8294/3 "2020-04-06T08:48:41Z")

</div>

Thank you! I think that’ll be enough to get started.

Not a straight-forward thing it seems.  
The post lists quite a lot of little problems with the coexistence in ONE that could all be solved but currently create the typical drag (toil in Google’s terms) that makes it unpleasant to use. I hope I’ll not hit all of them.  
Also it’s not encouraging to see the status of the issue mentioned in the blog post. Do I extrapolate this is not gonna disappear any time soon or should I keep hope?

---

<div class="post-metadata">

**Author:** ![dclavijo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/dclavijo/32/5265_2.png) [@dclavijo](https://forum.opennebula.io/u/dclavijo)\
**Post date:** [April 6, 2020, 2:48pm UTC](https://forum.opennebula.io/t/host-with-lxd-and-kvm-support/8294/4 "2020-04-06T14:48:28Z")

</div>

Hi @darkfader, if you [sort the issues by emojis](https://github.com/OpenNebula/one/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc) you’ll see there is some interest on the [issue](https://github.com/OpenNebula/one/issues/3259), however doing it requries significant changes in a lot of OpenNebula’s internals. We will implement it if we see a lot of interest on the issue.

---

<div class="post-metadata">

**Author:** ![darkfader](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/darkfader/32/4769_2.png) [@darkfader](https://forum.opennebula.io/u/darkfader)\
**Post date:** [April 6, 2020, 2:55pm UTC](https://forum.opennebula.io/t/host-with-lxd-and-kvm-support/8294/5 "2020-04-06T14:55:40Z")

</div>

Reminds me of the Xen strategy.  
It does not work and we know what it does to a product.

---

<div class="post-metadata">

**Author:** ![darkfader](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/darkfader/32/4769_2.png) [@darkfader](https://forum.opennebula.io/u/darkfader)\
**Post date:** [April 7, 2020, 1:59pm UTC](https://forum.opennebula.io/t/host-with-lxd-and-kvm-support/8294/6 "2020-04-07T13:59:30Z")

</div>

**tl;dr:** it seems there is safe no way to combine KVM and LXD on one host at the moment.

edit; it should work if you just put had placement policies for all LXD and all KVM templates.  
edit2: you can also try to use clusters to imply a 50% (given in kb) memory reservation. I ended up with a host wih 700TB RAM instead of 64GB RAM.

If you attempt to try this. only do it if you have the time to set up cgroups shielding the base OS from all the containers since you will hit OOM issues and random crap. Containers that are out of memory sometimes won’t shut down etc.  
Honestly, just don’t try this at all.

_I got a test setup up and running, can schedule KVM and LXD instances, have qcow2 support etc._  
_the mis-scheduling does in fact happen._  
_i was missing a clear info that this causes the instances to be unbootable, they’ll have an invalid disk attachment._

_so what do we learn:_

_1) on CentOS8, LXD is a no-go for OpenNebula at the moment, since it relies on the ubuntu snap packages which require the users home to be under /home (/var/lib/one is not there). I’m sure it could be adjusted with some amount of effort, but by default the two default assumptions are incompatible._

_2) LXD and KVM co-existence is not possible, since the resulting system does not just have cosmetic or scalability errors, but in fact is not reliable._

_3) as a user I would request that it is made more clear in such blog posts if they have resulted in something that just has rough edges and cosmetic errors, or is unreliable at it’s core, and the post itself is more exploratory, i.e. to gauge user interest._

\*4) this is a common problem with the ONE blog. i would suggest that maybe two people work on these posts, one makes the content and a second one tests stuff and writes the summary. that way the reader can check if they can use 5 hours to make it work, or 20 hours to do an exercise left for the reader, or if they should actually just spend 0 hours and simply take note that it doens’t work yet. \*

_in the end that’ll mean people will end up with more time to invest in contribs._

---

<div class="post-metadata">

**Author:** ![bmullan](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/bmullan/32/6292_2.png) [@bmullan](https://forum.opennebula.io/u/bmullan)\
**Post date:** [April 7, 2020, 4:58pm UTC](https://forum.opennebula.io/t/host-with-lxd-and-kvm-support/8294/7 "2020-04-07T16:58:31Z")

</div>

I don’t think OpenNebula supports the just Released LXD v4.0 LTS yet but fyi:

> **[LXD 4.0 LTS has been released](https://discuss.linuxcontainers.org/t/lxd-4-0-lts-has-been-released/7231)**
>
> Introduction The LXD team is very excited to announce the release of LXD 4.0 LTS! This is the 3rd LTS release for LXD and a very busy and exciting one! The changelog below is split so that both users of LXD 3.23 and LXD 3.0 can see what we have in...

LXD v3.19 and LXD v4.0 LTS introduced a major new feature where _LXD now supports both LXC containers and Virtual Machines_ without using KVM, VirtualBox etc.

> **[Trying LXD virtual machines](https://discuss.linuxcontainers.org/t/trying-lxd-virtual-machines/6182)**
>
> Introduction LXD 3.19 will ship with virtual machine support. This effectively lets you mix and match containers and virtual machines on the same system based on the workloads you want to run. Those virtual machines use the same profiles, networks...

This is another writeup:

> **[LXD 4.0 quick recipe: LXC and KVM coexisting](https://discourse.ubuntu.com/t/lxd-4-0-quick-recipe-lxc-and-kvm-coexisting/15222)**
>
> LXD 4.0 quick recipe: LXC and KVM coexisting A quick guide to show how to setup LXD to manage KVM guests and LXC containers Before I begin… I’m NOT an engineer from the LXD/LXC development team. I am an Ubuntu Core Developer and I am mainly focused...

brian

---

<div class="post-metadata">

**Author:** ![dclavijo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/dclavijo/32/5265_2.png) [@dclavijo](https://forum.opennebula.io/u/dclavijo)\
**Post date:** [April 7, 2020, 5:08pm UTC](https://forum.opennebula.io/t/host-with-lxd-and-kvm-support/8294/8 "2020-04-07T17:08:09Z")

</div>

Hello @bmullan, thanks for the update!! 🤓 --\> A new [Issue](https://github.com/OpenNebula/one/issues/4499) has been opened.
