mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 12:41:29 +00:00
ch_driver: domainGetVcpuPinInfo and nodeGetCPUMap
Add domainGetVcpuPinInfo and nodeGetCPUMap callbacks to ch driver Signed-off-by: Vineeth Pillai <viremana@linux.microsoft.com> Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
cfe0e657e1
commit
df6d4ff4d2
@ -23,6 +23,7 @@
|
|||||||
#include "ch_conf.h"
|
#include "ch_conf.h"
|
||||||
#include "ch_monitor.h"
|
#include "ch_monitor.h"
|
||||||
#include "virchrdev.h"
|
#include "virchrdev.h"
|
||||||
|
#include "vircgroup.h"
|
||||||
|
|
||||||
/* Give up waiting for mutex after 30 seconds */
|
/* Give up waiting for mutex after 30 seconds */
|
||||||
#define CH_JOB_WAIT_TIME (1000ull * 30)
|
#define CH_JOB_WAIT_TIME (1000ull * 30)
|
||||||
@ -52,9 +53,9 @@ typedef struct _virCHDomainObjPrivate virCHDomainObjPrivate;
|
|||||||
struct _virCHDomainObjPrivate {
|
struct _virCHDomainObjPrivate {
|
||||||
struct virCHDomainJobObj job;
|
struct virCHDomainJobObj job;
|
||||||
|
|
||||||
|
virChrdevs *chrdevs;
|
||||||
virCHMonitor *monitor;
|
virCHMonitor *monitor;
|
||||||
|
virBitmap *autoCpuset;
|
||||||
virChrdevs *chrdevs;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CH_DOMAIN_PRIVATE(vm) \
|
#define CH_DOMAIN_PRIVATE(vm) \
|
||||||
|
@ -981,6 +981,57 @@ chDomainGetMaxVcpus(virDomainPtr dom)
|
|||||||
VIR_DOMAIN_VCPU_MAXIMUM));
|
VIR_DOMAIN_VCPU_MAXIMUM));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
chDomainGetVcpuPinInfo(virDomain *dom,
|
||||||
|
int ncpumaps,
|
||||||
|
unsigned char *cpumaps,
|
||||||
|
int maplen,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
virDomainObj *vm = NULL;
|
||||||
|
virDomainDef *def;
|
||||||
|
bool live;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
g_autoptr(virBitmap) hostcpus = NULL;
|
||||||
|
virBitmap *autoCpuset = NULL;
|
||||||
|
|
||||||
|
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
|
||||||
|
|
||||||
|
if (!(vm = chDomObjFromDomain(dom)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virDomainGetVcpuPinInfoEnsureACL(dom->conn, vm->def) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!(def = virDomainObjGetOneDefState(vm, flags, &live)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!(hostcpus = virHostCPUGetAvailableCPUsBitmap()))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (live)
|
||||||
|
autoCpuset = CH_DOMAIN_PRIVATE(vm)->autoCpuset;
|
||||||
|
|
||||||
|
ret = virDomainDefGetVcpuPinInfoHelper(def, maplen, ncpumaps, cpumaps,
|
||||||
|
hostcpus, autoCpuset);
|
||||||
|
cleanup:
|
||||||
|
virDomainObjEndAPI(&vm);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
chNodeGetCPUMap(virConnectPtr conn,
|
||||||
|
unsigned char **cpumap,
|
||||||
|
unsigned int *online, unsigned int flags)
|
||||||
|
{
|
||||||
|
if (virNodeGetCPUMapEnsureACL(conn) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return virHostCPUGetMap(cpumap, online, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
chDomainHelperGetVcpus(virDomainObj *vm,
|
chDomainHelperGetVcpus(virDomainObj *vm,
|
||||||
virVcpuInfoPtr info,
|
virVcpuInfoPtr info,
|
||||||
@ -1116,6 +1167,8 @@ static virHypervisorDriver chHypervisorDriver = {
|
|||||||
.domainGetVcpus = chDomainGetVcpus, /* 8.0.0 */
|
.domainGetVcpus = chDomainGetVcpus, /* 8.0.0 */
|
||||||
.domainGetVcpusFlags = chDomainGetVcpusFlags, /* 8.0.0 */
|
.domainGetVcpusFlags = chDomainGetVcpusFlags, /* 8.0.0 */
|
||||||
.domainGetMaxVcpus = chDomainGetMaxVcpus, /* 8.0.0 */
|
.domainGetMaxVcpus = chDomainGetMaxVcpus, /* 8.0.0 */
|
||||||
|
.domainGetVcpuPinInfo = chDomainGetVcpuPinInfo, /* 8.0.0 */
|
||||||
|
.nodeGetCPUMap = chNodeGetCPUMap, /* 8.0.0 */
|
||||||
};
|
};
|
||||||
|
|
||||||
static virConnectDriver chConnectDriver = {
|
static virConnectDriver chConnectDriver = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user