On 09/26/2014 04:43 AM, Martin Kletzander wrote:
This patch adds parsing/formatting code as well as documentation for
shared memory devices. This will currently be only accessible in QEMU
using it's ivshmem device, but is designed as generic as possible to
allow future expansion for other hypervisors.
static int
+virDomainShmemDefFormat(virBufferPtr buf,
+ virDomainShmemDefPtr def,
+ unsigned int flags)
+{
+ virBufferAsprintf(buf, "<shmem name='%s'", def->name);
+
Need to use virBufferEscape, to protect against the user naming their
memory something that conflicts with XML.
+
+ if (def->size)
+ virBufferAsprintf(buf, "<size
unit='M'>%llu</size>\n",
+ VIR_DIV_UP(def->size, 1024 * 1024));
I thought the docs said this already had to be a multiple of a megabyte.
If that's true, then it might be simpler to just report 'def->size >>
20', rather than having me scratch my head at why we need to round the
result to the next higher boundary.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org