[libvirt] RFC: <memory units=...> [was: libvirt doesn't boot kVM, hangs, qemu on 100% CPU]

Eric Blake eblake at redhat.com
Wed Feb 22 23:42:59 UTC 2012

On 02/21/2012 03:46 PM, Igor Galić wrote:
> Hi folks,
> it's been adventurous.
> Yesterday night I've started debugging this particular
> issue of why my KVMs don't boot on Ubuntu 11.10.

On IRC, we identified the culprit:

> <uuid>8cfcb7b0-10ee-7d08-9b64-9f39c154292a</uuid>
> <memory>2048</memory>
> <currentMemory>2048</currentMemory>

There ain't no way on earth you're going to boot a kernel in 2 megabytes
of memory!

I propose enhancing the XML; on output, libvirt should produce:

<memory units='k'>2048</memory> => 2048 * kibibyte

the output unit must remain the same as it has always been, but the new
attribute will make it easier for humans reading the XML to spot
blunders like what spawned this thread.

On input, the optional attribute is more useful - we can use it to
provide a multiplier (of course, the result will be rounded up to k, and
again rounded up to any higher granularity per the hypervisor):
b => bytes
k, KiB => kibibyte (1024)
KB => kilobyte (1000)
M, MiB => mebibyte (1024*1024)
MB => megabyte (1000000)
and so on for at least G and T (do we need P, E, Z, or Y? and I'm
jealous if you have a machine with 1Y memory).

Thoughts before I propose such a patch?

Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120222/bfe1475a/attachment-0001.sig>

More information about the libvir-list mailing list