Libvirt – The Unsung Hero of Cloud Computing (2013)
vyomtech.com
vyomtech.com
cockpit-machines is available in a recent version in debian backports, installing it is trivial, no configuration, https://hostname:9090/ and just works.
RedHat announced that cockpit will be the long term successor of virt-manager:
https://www.redhat.com/en/blog/managing-virtual-machines-rhe...
https://blog.wikichoon.com/2020/06/virt-manager-deprecated-i...
cockpit has frequent releases, latest:
https://cockpit-project.org/blog/cockpit-227.html
It hasn't all the features of virt-manager, far from it, but looks promising.
Cockpit solves this issue. The feature set in slightly different but mainly it is limited as to what you can manage.
When running different types of infrastructure at the same time, e.g. KVM + AWS + Azure + ... it won't help much. In such cases it would make sense to check out Mist (https://github.com/mistio/mist-ce), which does something similar to Cockpit but for ~20 infra techs.
Red Hat obscure it a bit, presumably because there's very little difference from RHV (and might detract from sales), so the website is not so shiny. But play with it.
For RHEL, virt-manager will still be developed independently.
By whom? The vast majority of contributions are paid for by Red Hat [0].
[0]: https://github.com/virt-manager/virt-manager/graphs/contribu...
For my homelab I use proxmox on a couple of machines and it works great for managing containers (in terms of LXC containers that would be more of a traditional VM) and it works great. Most people/companies don't need the complexities that come with Kubernetes or other tools like that.
https://github.com/cockpit-project/cockpit-podman
This is the Cockpit user interface for podman containers.
It is being actively developed and has not yet reached feature parity with cockpit-docker. For now you can do basic image and container tasks for both system and user containers.
Sweet, now security bugs in the same-origin-policy can root my virtual machine!
I really wish RedHat would make a competitor to VirtualBox.
virsh snapshot-create-as ... --disk-only
borg create .... vmimage.raw
virsh blockcommit ... --active --pivot
borgbackup does compression and deduplication and has a simple command line and excellent documentation (and IRC channel :).guestfish/libguestfs is then used if you need specific files within an image instead of a complete restore.
https://libguestfs.org/guestfish.1.html
Example dump the name of all files on all filesystems:
guestfish --ro -i -a vmimage.raw find /
Can be used to check integrity post backup too, and may be we'll add some file indexing tools.From what I remember, getting VirtualBox or VMware to launch and run properly after a few months of automatic upgrades and not launching your images for a while was always kind of a gamble. With libvirt, everything just seems to work, and your images are just ready to go when you need them.
Strictly speaking, you have qemu to thank for that. libvirt is just a frontend for several hypervisors, including qemu (which is what typically used).
Libvirt does a lot more for QEMU than for other hypervisors, so much that libvirtd's initial name was qemud.
It’s also a bit misleading to characterize cloud providers as building on libvirt. Libvirt is useful as an mostly hypervisor-agnostic wrapper, which is super useful for enterprise on-prem software, but kinda of the opposite of what big providers need and build for themselves.
I wonder what we will look back on as the XML of today. Everything is schemaless JSON and YAML; surely we’ll look back and wonder WTF everyone was thinking? But alas, it’s probably not a data format at all. Only time will tell.
Hell, even INI files had support for comments and were just as expressional as JSON. I wonder why we regressed in that regard. Was it just because of the success of JavaScript and readily available JSON parsers? Because I'd argue that an INI parser is just as easy to write.
For more general data structures, remember that JSON is a true subset of YAML [1]: Switch to a YAML parser and you can start optionally adding comments to your files while still being compatible with legacy input.
[0] https://toml.io/en/ [1] https://yaml.org/
I see a lot of Rust programmers preferring RON over TOML because it is much less complex and doesn't have multiple ways to express the same thing https://crates.io/crates/ron
> For more general data structures, remember that JSON is
> a true subset of YAML [1]
This is unfortunately not true -- try the input '{"a":1e2}'.Do this with libvirt please and report back how it went :)
What I mean with "snapshots" is that you can't edit an XML file for a running VM on disk, but instead have to go through either virt-manager or virsh dump/load function. If you do edit an existing XML file on disk, it will just overwrite it for you.
And XML format is a bit more verbose simply because XML schema writers make it so. SGML could be even nicer for human writers.
As for comments in JSON, many parsers are not strict and would let you insert arbitrary elements, so you might add {"comment":"whatevah"} where you need it.
An example of terse XML would be:
<vm name="postgres">
<ram size="8gb"/>
<disk size="1tb"/>
</vm>or
<vm>
<name>postgred</name>
<ram>8gb</ram>
<disk>1tb</disk>
</vm>compared to JSON:
{
"name": "postgres",
"ram": "8gb",
"disk":"1tb"
}They are not equally descriptive, but that's because you do not need a top-level element in JSON (you could have it).
If you fire up `virsh edit <resource>` you get a live view of the resource which can be updated in place. This is great to comment out some things and uncomment things for quick and dirty modifications. (some require a VM restart though).
var config = require("settings.js");
My reasoning is that if you have access to change config or source code, all bets are off.Or you could parse the config in a separate vm and import the result as JSON.
It's really quite bad format for how ubiquitous it's become.
- "... - string
- 14, 14.5 - number (problematic)
- false, true - bool
- {... - object
- [... - array
- null
No cute abbreviations.Libvirt provides lifetime management for KVM virtual machines, including orchestration of live migration, setting up SELinux to ensure isolation between QEMU processes and cgroups to limit resource utilization, creating network interfaces and bridging them to host networking, and more. Any cloud provider that uses Openstack+KVM relies on Libvirt for all these tasks.
... that’s a laugh of bitter jealousy. I’ve dealt with XML, but I’ve never with XML that came with a schema, or which would have reliably followed one. Not saying schema-less formats are great, but at least I can eyeball them to see what is going on.
If I saw a schema, which I often didn’t, it usually didn’t say what the author thought it said. To a first order approximation, all the good ones I saw came from one tool (XMLSpy possibly?)
Namespaces ended up in a sort of uncanny valley that I can’t quite do justice to.
how about docbook? It's been a while, but I think even eclipse's project.xml used to have a schema, and would validate it if you tried modifying it yourself.
Not sure if you're claiming this or not, but it's worth clarifying:
Libvirt is a hypervisor-agnostic transport library; but it is not a hypervisor abstraction library.
That is, you can use libvirt to talk to KVM or VMWare or Xen or Hyper-V. But you cannot, in general, take a VM config from one hypervisor and use it on another hypervisor: there are too many details of the underlying hypervisor exposed to make this possible. And if you build a tool on top of libvirt for one hypervisor, you can't just flip a switch and have it work on another hypervisor -- all of the code that generates your XML configs for (say) KVM will need to be rewritten if you want to use Xen or VMWare or Hyper-V.
As an example, in the config you don't really say, "Give me a disk, and here's the disk image". You say, "Give me a virtio disk of this particular version with these particular properties." If your hypervisor doesn't provide virtio, the image simply can't be created. Which means the tool you're writing on top of libvirt needs to know the appropriate PV disk type for each different hypervisor and use the appropriate one.
(At least, this was the situation several years ago, when a team from oVirt came to a Xen hackathon to see if they could get oVirt working on Xen. It turned out to be more work than they thought.)
And not least of all, libvirt provides critical layered security for QEMU processes (i.e. VMs) through Linux Namespaces, CGroups, sVirt ('Secure Virtualization', based SELinux), and more.
(Also see user bonzini's response here for some more detail — https://news.ycombinator.com/item?id=24372499)
You can essentially use typescript to put a schema on JSON.
You could have <point><x>4</x><y>5</y></point> or you could have <point x=4 y=5 />. There is often no consistency within a single spec over how this should be done let alone between different specs.
JSON feels much more logical to me as well as being a whole lot simpler. If only it supported comments.
As far as I know, the original intention of the language designers was that attributes are for metadata and sub-elements are for data. For non-trivial schemas that form part of a data contract between systems or organisations, and/or are expected to evolve over time, I tend to stick to this approach. It results in more verbose data, but in my experience thats almost never a problem and can be an advantage if I have to drop into the data and actually read it.
For smaller-scale and internal schemas (e.g. internal tool configs) the terseness of e.g. <add key="foo" value="bar"/> definitely wins out over design purity for me. JSON would be equally good for this.
I work on enterprise integration and messaging stuff and I deal with a lot of XML data every day. JSON has its uses (particularly when you control both ends of the serialisation pipeline) but for me XML has a lot of advantages.
Of course if someone else is producing the data then they can make a mess of things but I don't think that is specific to XML.
With XML you usually end up needing custom code to convert to and from the parsed XML representation and the language's built-in data types and structures.
This is less of a concern for statically typed languages where you usually have to marshal data to and from your own structs/classes whether it's XML or JSON.
The real advantage of JSON was (IMHO) that it didn't let you do _anything else_.
ISO 8601, as used by XML Schema:
<foo>2020-09-04T00:00:00Z</foo>
or
Unix date output format (not sure this has an actual name)
<foo>Fri 04 Sep 2020 00:00:00 GMT</foo>
or
some sort of destructured date
<foo> <year>2020</year> <month>09</month> <day>04</day> <!-- ... --> </foo>
or
some sort of destructured date with 0 based months because Java
<foo> <year>2020</year> <month>08</month> <day>04</day> <!-- ... --> </foo>
Your app still needs to know what is coming in, and convert that to its internal format.
Even if you want to get everyone to agree on XML Schema's datetime format, it's not always sufficient because sometimes you need the actual time zone (e.g. America/New_York ) rather than the UTC offset especially when dealing with recurring/far off events.
It's powerful enough to represent documents, which might be too much for data structures:
<a>This is <b>valid</b> XML</a>
And let's not forget how hard it is to escape data in XML, so every value ends up as CDATA in the end. <config>
<somekey type="string"><![CDATA[4byte emojii]]></somekey>
</config>Take an XML document. Validate it.
Take all of the top level elements. Call getElementByID on each with the same value. Combine all the answers into an array, eliminating the nulls.
You might expect that array to have length one or zero on all valid documents. You’d be wrong, and dangerously so for some XML schemas. You can use the same ID on every node and I don’t know of a parser that would balk at that. And yet every implementation will return the first node that has that ID, which will then change any time you descend into the DOM.
Of course if you use only one limited tool which was never meant to be the main manipulator of xml (getElementByID), then you'll run into problems. It is like never using regexp and complaining that simple strings are a bad data structure.
And here lies the main problem of XML. As a technology, it is better than its reputation. Sadly, next to no one knows how to use it properly.
Too bad it was initially envisioned as a text markup language, with tags sparsely strewn around the text, and not as a data representation format.
So, the syntax ended up both overly cumbersome (see closing tags) and festooned with logically unnecessary shorthands like node attributes. Then, the terror of entities.
XSLT is a brilliant language, I'd say the first pure functional language widely used outside academia (in 2000s), but, based on XML syntax, it's completely unfit for human consumption.
If only the authors of XML could get rid of the shackles of SGML compatibility, and went with a simple, uniform syntax, e.g. s-expressions, we could still be gladly using it. Now we reinvent the ecosystem instead, with JSON (sigh) and YAML.
* Shameless plug: https://github.com/OnitiFR/mulch
We're using libvirt-go binding (Daniel Berrangé and his team is doing a excellent job maintaining it!), and KVM/QEMU hypervisior. For a small team like us, it's incredibly valuable to have access to such powerful tools in a such easy way.
virsh domxml-to-native qemu-argv myvm.xmlBut still, I agree that libvirt is great; I wrote about it here: http://catern.com/posts/libvirt.html
Indeed it’s 2020 and yet to see any major open source work from Amazon (which has benefited a lot from open source itself using Perl, CPAN, C, Java, Linux etc.). In this respect IBM, google, Microsoft, Facebook and Apple are far better. Here even Oracle fare better due to acuisition of MySQL and sun microsystems.
I believe the major contribution from amazon might be hiring some of the open source developers to build proprietary systems. Those developers in spare time or weekends continue their open source project, but I do not have any study or articles on it.
Based on my information in 2013, amazon built their cloud using Xen hypervisor and related tools and libraries. Libvirt is one of the key libraries providing beautiful abstractions and language bindings to manage xen on Linux node at that time.
It will be nice if you can point to code from Amazon on low level library like Libvirt for cloud computing.
Perhaps not as much as Microsoft (these days), but they are certainly giving back.
That is preventing downstream distros, like arch, from admitting these new releases into their package repos.
Critical infrastructure, indeed.
So the domain itself is a virtual machine? What makes it different from other guest virtual machinse?
The article is seven years old, so I can imagine that this was how the project once ran containers, but it doesn't anymore. Reading the documentation[1] I don't the VM is relevant anymore for containers, at least. The docs say libvirt manages LXC container directly through the kernel API, so there's no VM to speak of there. The OpenVZ docs[2] also mention that the containers run on the host, not in a VM.