mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
conf: numatune: Extract code for requesting memory nodeset from formatting
Extract the logic to determine which nodeset has to be used for a domain from the formatting step so that it can be reused separately when the nodeset is used in a different way.
This commit is contained in:
parent
cd7702d456
commit
ea3891a0fc
@ -400,13 +400,14 @@ virDomainNumatuneFormatNodeset(virDomainNumatunePtr numatune,
|
||||
cellid));
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
virDomainNumatuneMaybeFormatNodeset(virDomainNumatunePtr numatune,
|
||||
virBitmapPtr auto_nodeset,
|
||||
char **mask,
|
||||
int cellid)
|
||||
virDomainNumatuneMaybeGetNodeset(virDomainNumatunePtr numatune,
|
||||
virBitmapPtr auto_nodeset,
|
||||
virBitmapPtr *retNodeset,
|
||||
int cellid)
|
||||
{
|
||||
*mask = NULL;
|
||||
*retNodeset = NULL;
|
||||
|
||||
if (!numatune)
|
||||
return 0;
|
||||
@ -424,8 +425,26 @@ virDomainNumatuneMaybeFormatNodeset(virDomainNumatunePtr numatune,
|
||||
return -1;
|
||||
}
|
||||
|
||||
*mask = virDomainNumatuneFormatNodeset(numatune, auto_nodeset, cellid);
|
||||
if (!*mask)
|
||||
*retNodeset = virDomainNumatuneGetNodeset(numatune, auto_nodeset, cellid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
virDomainNumatuneMaybeFormatNodeset(virDomainNumatunePtr numatune,
|
||||
virBitmapPtr auto_nodeset,
|
||||
char **mask,
|
||||
int cellid)
|
||||
{
|
||||
virBitmapPtr nodeset;
|
||||
|
||||
if (virDomainNumatuneMaybeGetNodeset(numatune, auto_nodeset, &nodeset,
|
||||
cellid) < 0)
|
||||
return -1;
|
||||
|
||||
if (nodeset &&
|
||||
!(*mask = virBitmapFormat(nodeset)))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -70,6 +70,11 @@ virBitmapPtr virDomainNumatuneGetNodeset(virDomainNumatunePtr numatune,
|
||||
virBitmapPtr auto_nodeset,
|
||||
int cellid);
|
||||
|
||||
int virDomainNumatuneMaybeGetNodeset(virDomainNumatunePtr numatune,
|
||||
virBitmapPtr auto_nodeset,
|
||||
virBitmapPtr *retNodeset,
|
||||
int cellid);
|
||||
|
||||
/*
|
||||
* Formatters
|
||||
*/
|
||||
|
@ -626,6 +626,7 @@ virDomainNumatuneGetNodeset;
|
||||
virDomainNumatuneHasPerNodeBinding;
|
||||
virDomainNumatuneHasPlacementAuto;
|
||||
virDomainNumatuneMaybeFormatNodeset;
|
||||
virDomainNumatuneMaybeGetNodeset;
|
||||
virDomainNumatuneMemModeTypeFromString;
|
||||
virDomainNumatuneMemModeTypeToString;
|
||||
virDomainNumatuneNodesetIsAvailable;
|
||||
|
Loading…
Reference in New Issue
Block a user