conf: Introduce virCPUDefCopyWithoutModel

Useful for copying a CPU definition without model related parts (i.e.,
without model name, feature list, vendor).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2016-06-17 09:44:43 +02:00
parent b27adaed37
commit bcf46ddb3f
3 changed files with 19 additions and 1 deletions

View File

@ -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,

View File

@ -126,6 +126,9 @@ virCPUDefCopyModel(virCPUDefPtr dst,
virCPUDefPtr
virCPUDefCopy(const virCPUDef *cpu);
virCPUDefPtr
virCPUDefCopyWithoutModel(const virCPUDef *cpu);
virCPUDefPtr
virCPUDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt,

View File

@ -66,6 +66,7 @@ virCapabilitiesSetNetPrefix;
virCPUDefAddFeature;
virCPUDefCopy;
virCPUDefCopyModel;
virCPUDefCopyWithoutModel;
virCPUDefFormat;
virCPUDefFormatBuf;
virCPUDefFree;