Useful for copying a CPU definition without model related parts (i.e.,
without model name, feature list, vendor).
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/conf/cpu_conf.c | 16 +++++++++++++++-
src/conf/cpu_conf.h | 3 +++
src/libvirt_private.syms | 1 +
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index b71528e..c6e847a 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -114,8 +114,9 @@ virCPUDefCopyModel(virCPUDefPtr dst,
return 0;
}
+
virCPUDefPtr
-virCPUDefCopy(const virCPUDef *cpu)
+virCPUDefCopyWithoutModel(const virCPUDef *cpu)
{
virCPUDefPtr copy;
@@ -131,6 +132,18 @@ virCPUDefCopy(const virCPUDef *cpu)
copy->threads = cpu->threads;
copy->arch = cpu->arch;
+ return copy;
+}
+
+
+virCPUDefPtr
+virCPUDefCopy(const virCPUDef *cpu)
+{
+ virCPUDefPtr copy;
+
+ if (!(copy = virCPUDefCopyWithoutModel(cpu)))
+ return NULL;
+
if (virCPUDefCopyModel(copy, cpu, false) < 0)
goto error;
@@ -141,6 +154,7 @@ virCPUDefCopy(const virCPUDef *cpu)
return NULL;
}
+
virCPUDefPtr
virCPUDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt,
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
index 705ba6d..2bbab9e 100644
--- a/src/conf/cpu_conf.h
+++ b/src/conf/cpu_conf.h
@@ -127,6 +127,9 @@ virCPUDefPtr
virCPUDefCopy(const virCPUDef *cpu);
virCPUDefPtr
+virCPUDefCopyWithoutModel(const virCPUDef *cpu);
+
+virCPUDefPtr
virCPUDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt,
virCPUType mode);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 53d4e7f..26f5bc8 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -66,6 +66,7 @@ virCapabilitiesSetNetPrefix;
virCPUDefAddFeature;
virCPUDefCopy;
virCPUDefCopyModel;
+virCPUDefCopyWithoutModel;
virCPUDefFormat;
virCPUDefFormatBuf;
virCPUDefFree;
--
2.9.2