On Wed, Mar 24, 2010 at 03:52:56PM +0100, Jiri Denemark wrote:
---
src/cpu/cpu.c | 46 ++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index be0f15e..183862a 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -23,6 +23,7 @@
#include <config.h>
+#include "logging.h"
#include "memory.h"
#include "xml.h"
#include "cpu.h"
@@ -73,6 +74,8 @@ cpuCompareXML(virCPUDefPtr host,
virCPUDefPtr cpu = NULL;
virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR;
+ VIR_DEBUG("host=%p, xml=%s", host, NULLSTR(xml));
+
if (!(doc = virXMLParseString(xml, "cpu.xml")))
goto cleanup;
@@ -104,6 +107,8 @@ cpuCompare(virCPUDefPtr host,
{
struct cpuArchDriver *driver;
+ VIR_DEBUG("host=%p, cpu=%p", host, cpu);
+
if ((driver = cpuGetSubDriver(host->arch)) == NULL)
return VIR_CPU_COMPARE_ERROR;
@@ -126,6 +131,13 @@ cpuDecode(virCPUDefPtr cpu,
{
struct cpuArchDriver *driver;
+ VIR_DEBUG("cpu=%p, data=%p, nmodels=%u", cpu, data, nmodels);
+ if (models) {
+ unsigned int i;
+ for (i = 0; i < nmodels; i++)
+ VIR_DEBUG("models[%u]=%s", i, NULLSTR(models[i]));
+ }
+
if (models == NULL && nmodels != 0) {
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("nonzero nmodels doesn't match with NULL
models"));
@@ -163,6 +175,11 @@ cpuEncode(const char *arch,
{
struct cpuArchDriver *driver;
+ VIR_DEBUG("arch=%s, cpu=%p, forced=%p, required=%p, "
+ "optional=%p, disabled=%p, forbidden=%p",
+ NULLSTR(arch), cpu, forced, required,
+ optional, disabled, forbidden);
+
if ((driver = cpuGetSubDriver(arch)) == NULL)
return -1;
@@ -184,6 +201,8 @@ cpuDataFree(const char *arch,
{
struct cpuArchDriver *driver;
+ VIR_DEBUG("arch=%s, data=%p", NULLSTR(arch), data);
+
if (data == NULL)
return;
@@ -206,6 +225,8 @@ cpuNodeData(const char *arch)
{
struct cpuArchDriver *driver;
+ VIR_DEBUG("arch=%s", NULLSTR(arch));
+
if ((driver = cpuGetSubDriver(arch)) == NULL)
return NULL;
@@ -227,6 +248,8 @@ cpuGuestData(virCPUDefPtr host,
{
struct cpuArchDriver *driver;
+ VIR_DEBUG("host=%p, guest=%p, data=%p", host, guest, data);
+
if ((driver = cpuGetSubDriver(host->arch)) == NULL)
return VIR_CPU_COMPARE_ERROR;
@@ -254,6 +277,16 @@ cpuBaselineXML(const char **xmlCPUs,
char *cpustr;
unsigned int i;
+ VIR_DEBUG("ncpus=%u, nmodels=%u", ncpus, nmodels);
+ if (xmlCPUs) {
+ for (i = 0; i < ncpus; i++)
+ VIR_DEBUG("xmlCPUs[%u]=%s", i, NULLSTR(xmlCPUs[i]));
+ }
+ if (models) {
+ for (i = 0; i < nmodels; i++)
+ VIR_DEBUG("models[%u]=%s", i, NULLSTR(models[i]));
+ }
+
if (xmlCPUs == NULL && ncpus != 0) {
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("nonzero ncpus doesn't match with NULL
xmlCPUs"));
@@ -320,6 +353,17 @@ cpuBaseline(virCPUDefPtr *cpus,
{
struct cpuArchDriver *driver;
virCPUDefPtr cpu;
+ unsigned int i;
+
+ VIR_DEBUG("ncpus=%u, nmodels=%u", ncpus, nmodels);
+ if (cpus) {
+ for (i = 0; i < ncpus; i++)
+ VIR_DEBUG("cpus[%u]=%p", i, cpus[i]);
+ }
+ if (models) {
+ for (i = 0; i < nmodels; i++)
+ VIR_DEBUG("models[%u]=%s", i, NULLSTR(models[i]));
+ }
if (cpus == NULL && ncpus != 0) {
virCPUReportError(VIR_ERR_INTERNAL_ERROR,
@@ -349,8 +393,6 @@ cpuBaseline(virCPUDefPtr *cpus,
}
if ((cpu = driver->baseline(cpus, ncpus, models, nmodels))) {
- int i;
-
cpu->type = VIR_CPU_TYPE_GUEST;
cpu->match = VIR_CPU_MATCH_EXACT;
VIR_FREE(cpu->arch);
ACK,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/