* Description: Provides APIs for the management of domains
* 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
* modify it under the terms of the GNU Lesser General Public
int maplen,
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:
* @cpumap: pointer to a bit map of real CPUs (in 8-bit bytes) (IN/OUT)
/*
* 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
* modify it under the terms of the GNU Lesser General Public
typedef int
(*virDrvDomainGetMaxVcpus)(virDomainPtr domain);
+typedef int
+(*virDrvDomainGetIOThreadsInfo)(virDomainPtr domain,
+ virDomainIOThreadInfoPtr **info,
+ unsigned int flags);
+
typedef int
(*virDrvDomainGetSecurityLabel)(virDomainPtr domain,
virSecurityLabelPtr seclabel);
virDrvDomainGetEmulatorPinInfo domainGetEmulatorPinInfo;
virDrvDomainGetVcpus domainGetVcpus;
virDrvDomainGetMaxVcpus domainGetMaxVcpus;
+ virDrvDomainGetIOThreadsInfo domainGetIOThreadsInfo;
virDrvDomainGetSecurityLabel domainGetSecurityLabel;
virDrvDomainGetSecurityLabelList domainGetSecurityLabelList;
virDrvNodeGetSecurityModel nodeGetSecurityModel;
/*
* 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
* modify it under the terms of the GNU Lesser General Public
}
+/**
+ * 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:
* @domain: a domain object