mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
qemu: Add @nodemaskRet argument to qemuBuildMemoryBackendProps()
While it's true that anybody who's interested in getting .host-nodes attribute value can just use virJSONValueObjectGetArray() (and that's exactly what qemuBuildThreadContextProps() is doing, btw), if somebody is interested in getting the actual virBitmap, they would have to parse the JSON array. Instead, introduce an argument to qemuBuildMemoryBackendProps() which is set to corresponding value used when formatting the attribute. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
450d932cd9
commit
9f26f6cc4b
@ -3240,6 +3240,7 @@ qemuBuildMemoryGetPagesize(virQEMUDriverConfig *cfg,
|
|||||||
* @def: domain definition object
|
* @def: domain definition object
|
||||||
* @mem: memory definition object
|
* @mem: memory definition object
|
||||||
* @force: forcibly use one of the backends
|
* @force: forcibly use one of the backends
|
||||||
|
* @nodemaskRet: [out] bitmap used to format .host-nodes attribute
|
||||||
*
|
*
|
||||||
* Creates a configuration object that represents memory backend of given guest
|
* Creates a configuration object that represents memory backend of given guest
|
||||||
* NUMA node (domain @def and @mem). Use @priv->autoNodeset to fine tune the
|
* NUMA node (domain @def and @mem). Use @priv->autoNodeset to fine tune the
|
||||||
@ -3264,7 +3265,8 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps,
|
|||||||
const virDomainDef *def,
|
const virDomainDef *def,
|
||||||
const virDomainMemoryDef *mem,
|
const virDomainMemoryDef *mem,
|
||||||
bool force,
|
bool force,
|
||||||
bool systemMemory)
|
bool systemMemory,
|
||||||
|
virBitmap **nodemaskRet)
|
||||||
{
|
{
|
||||||
const char *backendType = "memory-backend-file";
|
const char *backendType = "memory-backend-file";
|
||||||
virDomainNumatuneMemMode mode;
|
virDomainNumatuneMemMode mode;
|
||||||
@ -3451,6 +3453,9 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps,
|
|||||||
"S:policy", qemuNumaPolicyTypeToString(mode),
|
"S:policy", qemuNumaPolicyTypeToString(mode),
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (nodemaskRet)
|
||||||
|
*nodemaskRet = nodemask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3504,7 +3509,8 @@ qemuBuildMemoryCellBackendProps(virDomainDef *def,
|
|||||||
mem.targetNode = cell;
|
mem.targetNode = cell;
|
||||||
mem.info.alias = alias;
|
mem.info.alias = alias;
|
||||||
|
|
||||||
return qemuBuildMemoryBackendProps(props, alias, cfg, priv, def, &mem, false, false);
|
return qemuBuildMemoryBackendProps(props, alias, cfg, priv,
|
||||||
|
def, &mem, false, false, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3528,7 +3534,7 @@ qemuBuildMemoryDimmBackendStr(virCommand *cmd,
|
|||||||
alias = g_strdup_printf("mem%s", mem->info.alias);
|
alias = g_strdup_printf("mem%s", mem->info.alias);
|
||||||
|
|
||||||
if (qemuBuildMemoryBackendProps(&props, alias, cfg,
|
if (qemuBuildMemoryBackendProps(&props, alias, cfg,
|
||||||
priv, def, mem, true, false) < 0)
|
priv, def, mem, true, false, NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0)
|
if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0)
|
||||||
@ -7179,7 +7185,7 @@ qemuBuildMemCommandLineMemoryDefaultBackend(virCommand *cmd,
|
|||||||
mem.info.alias = (char *) defaultRAMid;
|
mem.info.alias = (char *) defaultRAMid;
|
||||||
|
|
||||||
if (qemuBuildMemoryBackendProps(&props, defaultRAMid, cfg,
|
if (qemuBuildMemoryBackendProps(&props, defaultRAMid, cfg,
|
||||||
priv, def, &mem, false, true) < 0)
|
priv, def, &mem, false, true, NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0)
|
if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0)
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "domain_conf.h"
|
#include "domain_conf.h"
|
||||||
|
#include "virbitmap.h"
|
||||||
#include "vircommand.h"
|
#include "vircommand.h"
|
||||||
#include "virenum.h"
|
#include "virenum.h"
|
||||||
#include "qemu_block.h"
|
#include "qemu_block.h"
|
||||||
@ -140,7 +141,8 @@ int qemuBuildMemoryBackendProps(virJSONValue **backendProps,
|
|||||||
const virDomainDef *def,
|
const virDomainDef *def,
|
||||||
const virDomainMemoryDef *mem,
|
const virDomainMemoryDef *mem,
|
||||||
bool force,
|
bool force,
|
||||||
bool systemMemory);
|
bool systemMemory,
|
||||||
|
virBitmap **nodemaskRet);
|
||||||
|
|
||||||
virJSONValue *
|
virJSONValue *
|
||||||
qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
|
qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
|
||||||
|
@ -2280,7 +2280,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuBuildMemoryBackendProps(&props, objalias, cfg,
|
if (qemuBuildMemoryBackendProps(&props, objalias, cfg,
|
||||||
priv, vm->def, mem, true, false) < 0)
|
priv, vm->def, mem, true, false, NULL) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuProcessBuildDestroyMemoryPaths(driver, vm, mem, true) < 0)
|
if (qemuProcessBuildDestroyMemoryPaths(driver, vm, mem, true) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user