On Wed, Jan 21, 2015 at 16:00:54 +0800, Zhu Guihua wrote:
This patch adds configuration support for the cpu device.
Signed-off-by: Zhu Guihua <zhugh.fnst(a)cn.fujitsu.com>
---
src/conf/domain_conf.c | 14 ++++++++++++++
src/conf/domain_conf.h | 19 +++++++++++++++++++
src/libvirt_private.syms | 1 +
src/qemu/qemu_driver.c | 6 ++++++
src/qemu/qemu_hotplug.c | 1 +
5 files changed, 41 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1631421..e036d75 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2857,6 +2861,12 @@
virDomainDeviceInfoIterateInternal(virDomainDefPtr def,
if (cb(def, &device, &def->consoles[i]->info, opaque) < 0)
return -1;
}
+ device.type = VIR_DOMAIN_DEVICE_CPU;
+ for (i = 0; i < def->ncpus; i++) {
+ device.data.cpu = def->cpus[i];
+ if (cb(def, &device, &def->cpus[i]->info, opaque) < 0)
+ return -1;
+ }
device.type = VIR_DOMAIN_DEVICE_INPUT;
for (i = 0; i < def->ninputs; i++) {
device.data.input = def->inputs[i];
@@ -16015,6 +16027,7 @@ virDomainDefCheckABIStability(virDomainDefPtr
src,
case VIR_DOMAIN_DEVICE_NONE:
case VIR_DOMAIN_DEVICE_SMARTCARD:
case VIR_DOMAIN_DEVICE_CHR:
+ case VIR_DOMAIN_DEVICE_CPU:
case VIR_DOMAIN_DEVICE_MEMBALLOON:
case VIR_DOMAIN_DEVICE_NVRAM:
case VIR_DOMAIN_DEVICE_LAST:
The ABI stability check code needs to be implemented.
@@ -21463,6 +21476,7 @@ virDomainDeviceDefCopy(virDomainDeviceDefPtr
src,
case VIR_DOMAIN_DEVICE_PANIC:
rc = virDomainPanicDefFormat(&buf, src->data.panic);
break;
+ case VIR_DOMAIN_DEVICE_CPU:
The copy function needs to be impelemnted too (I didn't check next patch
thoug yet)
case VIR_DOMAIN_DEVICE_NONE:
case VIR_DOMAIN_DEVICE_SMARTCARD:
case VIR_DOMAIN_DEVICE_MEMBALLOON:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 8869d26..618eef3 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -108,6 +108,9 @@ typedef virDomainSmartcardDef *virDomainSmartcardDefPtr;
typedef struct _virDomainChrDef virDomainChrDef;
typedef virDomainChrDef *virDomainChrDefPtr;
+typedef struct _virDomainCPUDef virDomainCPUDef;
+typedef virDomainCPUDef *virDomainCPUDefPtr;
+
typedef struct _virDomainMemballoonDef virDomainMemballoonDef;
typedef virDomainMemballoonDef *virDomainMemballoonDefPtr;
@@ -1158,6 +1163,13 @@ struct _virDomainChrDef {
virSecurityDeviceLabelDefPtr *seclabels;
};
+struct _virDomainCPUDef {
+ char *driver;
+ int apic_id;
+
+ virDomainDeviceInfo info;
I've looked through the next patch and you don't parse any device info
for the CPU type. Is it necessary to have it present at all in that
case?
+};
+
typedef enum {
VIR_DOMAIN_SMARTCARD_TYPE_HOST,
VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES,
@@ -2342,6 +2357,7 @@ void
virDomainActualNetDefFree(virDomainActualNetDefPtr def);
void virDomainNetDefFree(virDomainNetDefPtr def);
void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def);
void virDomainChrDefFree(virDomainChrDefPtr def);
+void virDomainCPUDefFree(virDomainCPUDefPtr def);
Function declarations should be along with function definitions.
void virDomainChrSourceDefFree(virDomainChrSourceDefPtr def);
int virDomainChrSourceDefCopy(virDomainChrSourceDefPtr src,
virDomainChrSourceDefPtr dest);
@@ -2387,6 +2403,8 @@ void virDomainDefFree(virDomainDefPtr vm);
virDomainChrDefPtr virDomainChrDefNew(void);
+virDomainCPUDefPtr virDomainCPUDefNew(void);
+
Same here
virDomainDefPtr virDomainDefNew(const char *name,
const unsigned char *uuid,
int id);
@@ -2805,6 +2823,7 @@ VIR_ENUM_DECL(virDomainChrChannelTarget)
VIR_ENUM_DECL(virDomainChrConsoleTarget)
VIR_ENUM_DECL(virDomainChrSerialTarget)
VIR_ENUM_DECL(virDomainSmartcard)
+VIR_ENUM_DECL(virDomainCPU)
VIR_ENUM_DECL(virDomainChr)
VIR_ENUM_DECL(virDomainChrTcpProtocol)
VIR_ENUM_DECL(virDomainChrSpicevmc)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index d08e400..9ceff71 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -166,6 +166,7 @@ virDomainChrTcpProtocolTypeFromString;
virDomainChrTcpProtocolTypeToString;
virDomainChrTypeFromString;
virDomainChrTypeToString;
+virDomainCPUDefFree;
Breaks "make syntax-check" again:
Expected symbol virDomainCPUDefFree is not in ELF library
The symbols entry can be added only when the function is defined.
virDomainClockBasisTypeToString;
virDomainClockOffsetTypeFromString;
virDomainClockOffsetTypeToString;
Peter