mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
Implement public API for virDomainGetIOThreadsInfo
Add virDomainGetIOThreadInfo in order to return a list of virDomainIOThreadInfoPtr structures which list the IOThread ID and the CPU Affinity map for each IOThread for the domain. For an active domain, the live data will be returned, while for an inactive domain, the config data will be returned. The API supports either the --live or --config flag, but not both. Also added virDomainIOThreadsInfoFree in order to free the cpumap and the IOThreadInfo structure. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
cf521fc8ba
commit
11a5a0956f
@ -4,7 +4,7 @@
|
|||||||
* Description: Provides APIs for the management of domains
|
* Description: Provides APIs for the management of domains
|
||||||
* Author: Daniel Veillard <veillard@redhat.com>
|
* Author: Daniel Veillard <veillard@redhat.com>
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2014 Red Hat, Inc.
|
* Copyright (C) 2006-2015 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -1590,6 +1590,26 @@ int virDomainGetEmulatorPinInfo (virDomainPtr domain,
|
|||||||
int maplen,
|
int maplen,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virIOThreadInfo:
|
||||||
|
*
|
||||||
|
* The data structure for information about all IOThreads in a domain
|
||||||
|
*/
|
||||||
|
typedef struct _virDomainIOThreadInfo virDomainIOThreadInfo;
|
||||||
|
typedef virDomainIOThreadInfo *virDomainIOThreadInfoPtr;
|
||||||
|
struct _virDomainIOThreadInfo {
|
||||||
|
unsigned int iothread_id; /* IOThread ID */
|
||||||
|
unsigned char *cpumap; /* CPU map for thread. A pointer to an */
|
||||||
|
/* array of real CPUs (in 8-bit bytes) */
|
||||||
|
int cpumaplen; /* cpumap size */
|
||||||
|
};
|
||||||
|
|
||||||
|
void virDomainIOThreadsInfoFree(virDomainIOThreadInfoPtr info);
|
||||||
|
|
||||||
|
int virDomainGetIOThreadsInfo(virDomainPtr domain,
|
||||||
|
virDomainIOThreadInfoPtr **info,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VIR_USE_CPU:
|
* VIR_USE_CPU:
|
||||||
* @cpumap: pointer to a bit map of real CPUs (in 8-bit bytes) (IN/OUT)
|
* @cpumap: pointer to a bit map of real CPUs (in 8-bit bytes) (IN/OUT)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* driver-hypervisor.h: entry points for hypervisor drivers
|
* driver-hypervisor.h: entry points for hypervisor drivers
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2014 Red Hat, Inc.
|
* Copyright (C) 2006-2015 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -380,6 +380,11 @@ typedef int
|
|||||||
typedef int
|
typedef int
|
||||||
(*virDrvDomainGetMaxVcpus)(virDomainPtr domain);
|
(*virDrvDomainGetMaxVcpus)(virDomainPtr domain);
|
||||||
|
|
||||||
|
typedef int
|
||||||
|
(*virDrvDomainGetIOThreadsInfo)(virDomainPtr domain,
|
||||||
|
virDomainIOThreadInfoPtr **info,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
typedef int
|
typedef int
|
||||||
(*virDrvDomainGetSecurityLabel)(virDomainPtr domain,
|
(*virDrvDomainGetSecurityLabel)(virDomainPtr domain,
|
||||||
virSecurityLabelPtr seclabel);
|
virSecurityLabelPtr seclabel);
|
||||||
@ -1254,6 +1259,7 @@ struct _virHypervisorDriver {
|
|||||||
virDrvDomainGetEmulatorPinInfo domainGetEmulatorPinInfo;
|
virDrvDomainGetEmulatorPinInfo domainGetEmulatorPinInfo;
|
||||||
virDrvDomainGetVcpus domainGetVcpus;
|
virDrvDomainGetVcpus domainGetVcpus;
|
||||||
virDrvDomainGetMaxVcpus domainGetMaxVcpus;
|
virDrvDomainGetMaxVcpus domainGetMaxVcpus;
|
||||||
|
virDrvDomainGetIOThreadsInfo domainGetIOThreadsInfo;
|
||||||
virDrvDomainGetSecurityLabel domainGetSecurityLabel;
|
virDrvDomainGetSecurityLabel domainGetSecurityLabel;
|
||||||
virDrvDomainGetSecurityLabelList domainGetSecurityLabelList;
|
virDrvDomainGetSecurityLabelList domainGetSecurityLabelList;
|
||||||
virDrvNodeGetSecurityModel nodeGetSecurityModel;
|
virDrvNodeGetSecurityModel nodeGetSecurityModel;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* libvirt-domain.c: entry points for virDomainPtr APIs
|
* libvirt-domain.c: entry points for virDomainPtr APIs
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2014 Red Hat, Inc.
|
* Copyright (C) 2006-2015 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -7893,6 +7893,79 @@ virDomainGetMaxVcpus(virDomainPtr domain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virDomainGetIOThreadsInfo:
|
||||||
|
* @dom: a domain object
|
||||||
|
* @info: pointer to an array of virDomainIOThreadInfo structures (OUT)
|
||||||
|
* @flags: bitwise-OR of virDomainModificationImpact
|
||||||
|
* Must not be VIR_DOMAIN_AFFECT_LIVE and
|
||||||
|
* VIR_DOMAIN_AFFECT_CONFIG concurrently.
|
||||||
|
*
|
||||||
|
* Fetch IOThreads of an active domain including the cpumap information to
|
||||||
|
* determine on which CPU the IOThread has affinity to run.
|
||||||
|
*
|
||||||
|
* Returns the number of IOThreads or -1 in case of error.
|
||||||
|
* On success, the array of information is stored into @info. The caller is
|
||||||
|
* responsible for calling virDomainIOThreadsInfoFree() on each array element,
|
||||||
|
* then calling free() on @info. On error, @info is set to NULL.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
virDomainGetIOThreadsInfo(virDomainPtr dom,
|
||||||
|
virDomainIOThreadInfoPtr **info,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
VIR_DOMAIN_DEBUG(dom, "info=%p flags=%x", info, flags);
|
||||||
|
|
||||||
|
virResetLastError();
|
||||||
|
|
||||||
|
virCheckDomainReturn(dom, -1);
|
||||||
|
virCheckReadOnlyGoto(dom->conn->flags, error);
|
||||||
|
virCheckNonNullArgGoto(info, error);
|
||||||
|
*info = NULL;
|
||||||
|
|
||||||
|
/* At most one of these two flags should be set. */
|
||||||
|
if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
|
||||||
|
(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
||||||
|
virReportInvalidArg(flags,
|
||||||
|
_("flags 'affect live' and 'affect config' in %s "
|
||||||
|
"are mutually exclusive"),
|
||||||
|
__FUNCTION__);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dom->conn->driver->domainGetIOThreadsInfo) {
|
||||||
|
int ret;
|
||||||
|
ret = dom->conn->driver->domainGetIOThreadsInfo(dom, info, flags);
|
||||||
|
if (ret < 0)
|
||||||
|
goto error;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
virReportUnsupportedError();
|
||||||
|
|
||||||
|
error:
|
||||||
|
virDispatchError(dom->conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virDomainIOThreadsInfoFree:
|
||||||
|
* @info: pointer to a virDomainIOThreadInfo object
|
||||||
|
*
|
||||||
|
* Frees the memory used by @info.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
virDomainIOThreadsInfoFree(virDomainIOThreadInfoPtr info)
|
||||||
|
{
|
||||||
|
if (!info)
|
||||||
|
return;
|
||||||
|
|
||||||
|
VIR_FREE(info->cpumap);
|
||||||
|
VIR_FREE(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virDomainGetSecurityLabel:
|
* virDomainGetSecurityLabel:
|
||||||
* @domain: a domain object
|
* @domain: a domain object
|
||||||
|
@ -695,4 +695,10 @@ LIBVIRT_1.2.12 {
|
|||||||
virDomainDefineXMLFlags;
|
virDomainDefineXMLFlags;
|
||||||
} LIBVIRT_1.2.11;
|
} LIBVIRT_1.2.11;
|
||||||
|
|
||||||
|
LIBVIRT_1.2.14 {
|
||||||
|
global:
|
||||||
|
virDomainIOThreadsInfoFree;
|
||||||
|
virDomainGetIOThreadsInfo;
|
||||||
|
} LIBVIRT_1.2.12;
|
||||||
|
|
||||||
# .... define new API here using predicted next version number ....
|
# .... define new API here using predicted next version number ....
|
||||||
|
Loading…
Reference in New Issue
Block a user