[libvirt] [PATCHv2 08/13] qemu: Extract code to setup memory backing objects

Ján Tomko jtomko at redhat.com
Fri Jan 30 14:07:10 UTC 2015


On Fri, Jan 30, 2015 at 11:34:31AM +0100, Peter Krempa wrote:
> Extract the memory backend device code into a separate function so that
> it can be later easily refactored and reused.
> 
> Few small changes for future reusability, namely:
> - new (currently unused) parameter for user specified page size
> - size of the memory is specified in kibibytes, divided up in the
> function
> - new (currently unused) parameter for user specifed source nodeset
> - option to enforce capability check
> ---
>  src/qemu/qemu_command.c | 382 +++++++++++++++++++++++++++++++-----------------
>  1 file changed, 250 insertions(+), 132 deletions(-)
> 

> +
> +    if (virBufferCheckError(&buf) < 0)
> +        goto cleanup;
> +
> +    *backendStr = virBufferContentAndReset(&buf);
> +
> +    if (!hugepage) {
> +        if ((nodemask || force) &&
> +            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM)) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("this qemu doesn't support the "
> +                             "memory-backend-ram object"));
> +                goto cleanup;
> +        }

This check wasn't present in the old function. It would be nicer to do
code movement from new code.

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150130/c74b9d61/attachment-0001.sig>


More information about the libvir-list mailing list