mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-01 18:45:29 +00:00
c63ef0452b
This is a reaction to Michal's fix [1] for non-NUMA systems that also splits out conf/ out of util/ because libvirt_util shouldn't require libvirt_conf if it is the other way around. This particular use case worked, but we're trying to avoid it as mentioned [2], many times. The only functions from virnuma.c that needed numatune_conf were virDomainNumatuneNodesetIsAvailable() and virNumaSetupMemoryPolicy(). The first one should be in numatune_conf as it works with virDomainNumatune, the second one just needs nodeset and mode, both of which can be passed without the need of numatune_conf. Apart from fixing that, this patch also fixes recently added code (between commits d2460f85^..5c8515620) that doesn't support non-contiguous nodesets. It uses new function virNumaNodesetIsAvailable(), which doesn't need a stub as it doesn't use any libnuma functions, to check if every specified nodeset is available. [1] https://www.redhat.com/archives/libvir-list/2014-November/msg00118.html [2] http://www.redhat.com/archives/libvir-list/2011-June/msg01040.html Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
110 lines
3.4 KiB
C
110 lines
3.4 KiB
C
/*
|
|
* numatune_conf.h
|
|
*
|
|
* Copyright (C) 2014 Red Hat, Inc.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*
|
|
* Author: Martin Kletzander <mkletzan@redhat.com>
|
|
*/
|
|
|
|
#ifndef __NUMATUNE_CONF_H__
|
|
# define __NUMATUNE_CONF_H__
|
|
|
|
# include <libxml/xpath.h>
|
|
|
|
# include "internal.h"
|
|
# include "virutil.h"
|
|
# include "virbitmap.h"
|
|
# include "virbuffer.h"
|
|
|
|
|
|
typedef struct _virDomainNumatune virDomainNumatune;
|
|
typedef virDomainNumatune *virDomainNumatunePtr;
|
|
|
|
typedef enum {
|
|
VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT = 0,
|
|
VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC,
|
|
VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO,
|
|
|
|
VIR_DOMAIN_NUMATUNE_PLACEMENT_LAST
|
|
} virDomainNumatunePlacement;
|
|
|
|
VIR_ENUM_DECL(virDomainNumatunePlacement)
|
|
VIR_ENUM_DECL(virDomainNumatuneMemMode)
|
|
|
|
|
|
void virDomainNumatuneFree(virDomainNumatunePtr numatune);
|
|
|
|
/*
|
|
* XML Parse/Format functions
|
|
*/
|
|
int virDomainNumatuneParseXML(virDomainNumatunePtr *numatunePtr,
|
|
bool placement_static,
|
|
size_t ncells,
|
|
xmlXPathContextPtr ctxt)
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
|
|
|
|
int virDomainNumatuneFormatXML(virBufferPtr buf, virDomainNumatunePtr numatune)
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
/*
|
|
* Getters
|
|
*/
|
|
virDomainNumatuneMemMode virDomainNumatuneGetMode(virDomainNumatunePtr numatune,
|
|
int cellid);
|
|
|
|
virBitmapPtr virDomainNumatuneGetNodeset(virDomainNumatunePtr numatune,
|
|
virBitmapPtr auto_nodeset,
|
|
int cellid);
|
|
|
|
/*
|
|
* Formatters
|
|
*/
|
|
char *virDomainNumatuneFormatNodeset(virDomainNumatunePtr numatune,
|
|
virBitmapPtr auto_nodeset,
|
|
int cellid);
|
|
|
|
int virDomainNumatuneMaybeFormatNodeset(virDomainNumatunePtr numatune,
|
|
virBitmapPtr auto_nodeset,
|
|
char **mask,
|
|
int cellid);
|
|
|
|
/*
|
|
* Setters
|
|
*/
|
|
int virDomainNumatuneSet(virDomainNumatunePtr *numatunePtr,
|
|
bool placement_static,
|
|
int placement,
|
|
int mode,
|
|
virBitmapPtr nodeset)
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
/*
|
|
* Other accessors
|
|
*/
|
|
bool virDomainNumatuneEquals(virDomainNumatunePtr n1,
|
|
virDomainNumatunePtr n2);
|
|
|
|
bool virDomainNumatuneHasPlacementAuto(virDomainNumatunePtr numatune);
|
|
|
|
bool virDomainNumatuneHasPerNodeBinding(virDomainNumatunePtr numatune);
|
|
|
|
int virDomainNumatuneSpecifiedMaxNode(virDomainNumatunePtr numatune);
|
|
|
|
bool virDomainNumatuneNodesetIsAvailable(virDomainNumatunePtr numatune,
|
|
virBitmapPtr auto_nodeset);
|
|
#endif /* __NUMATUNE_CONF_H__ */
|