Once more stuff will be moved into the vCPU data structure it will be
necessary to get a specific one in some ocasions. Add a helper that will
simplify this task.
---
src/conf/domain_conf.c | 15 +++++++++++++++
src/conf/domain_conf.h | 4 ++++
src/libvirt_private.syms | 1 +
3 files changed, 20 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 66fc6d3..f4b4700 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1520,6 +1520,21 @@ virDomainDefGetVCpus(const virDomainDef *def)
}
+virDomainVCpuInfoPtr
+virDomainDefGetVCpu(virDomainDefPtr def,
+ unsigned int vcpu)
+{
+ if (vcpu > def->maxvcpus) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("vCPU '%u' is not present in domain
definition"),
+ vcpu);
+ return NULL;
+ }
+
+ return &def->vcpus[vcpu];
+}
+
+
virDomainDiskDefPtr
virDomainDiskDefNew(virDomainXMLOptionPtr xmlopt)
{
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 68f82c6..7c9457a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2135,6 +2135,8 @@ typedef virDomainVCpuInfo *virDomainVCpuInfoPtr;
struct _virDomainVCpuInfo {
bool online;
+
+ virBitmapPtr cpumask;
};
typedef struct _virDomainBlkiotune virDomainBlkiotune;
@@ -2338,6 +2340,8 @@ bool virDomainDefHasVCpusOffline(const virDomainDef *def);
unsigned int virDomainDefGetVCpusMax(const virDomainDef *def);
int virDomainDefSetVCpus(virDomainDefPtr def, unsigned int vcpus);
unsigned int virDomainDefGetVCpus(const virDomainDef *def);
+virDomainVCpuInfoPtr virDomainDefGetVCpu(virDomainDefPtr def, unsigned int vcpu)
+ ATTRIBUTE_RETURN_CHECK;
unsigned long long virDomainDefGetMemoryInitial(const virDomainDef *def);
void virDomainDefSetMemoryTotal(virDomainDefPtr def, unsigned long long size);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index d2c4945..449caf6 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -217,6 +217,7 @@ virDomainDefGetDefaultEmulator;
virDomainDefGetMemoryActual;
virDomainDefGetMemoryInitial;
virDomainDefGetSecurityLabelDef;
+virDomainDefGetVCpu;
virDomainDefGetVCpus;
virDomainDefGetVCpusMax;
virDomainDefHasDeviceAddress;
--
2.6.2