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