[libvirt] [PATCH] Allow for CPU topology specification without model
by Jiri Denemark
Currently CPU topology may only be specified together with CPU model:
<cpu match='exact'>
<model>name</model>
<topology sockets='1' cores='2' threads='3'/>
</cpu>
This patch allows for CPU topology specification without the need for
also specifying CPU model:
<cpu>
<topology sockets='1' cores='2' threads='3'/>
</cpu>
'match' attribute and 'model' element are made optional with the
restriction that 'match' attribute has to be set when 'model' is
present.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
docs/schemas/domain.rng | 24 ++++++++++++--------
src/conf/cpu_conf.c | 55 ++++++++++++++++++++++++++++++++--------------
2 files changed, 52 insertions(+), 27 deletions(-)
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index 566b117..137bbc6 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -1242,17 +1242,21 @@
-->
<define name="cpu">
<element name="cpu">
- <attribute name="match">
- <choice>
- <value>minimum</value>
- <value>exact</value>
- <value>strict</value>
- </choice>
- </attribute>
+ <optional>
+ <attribute name="match">
+ <choice>
+ <value>minimum</value>
+ <value>exact</value>
+ <value>strict</value>
+ </choice>
+ </attribute>
+ </optional>
<interleave>
- <element name="model">
- <text/>
- </element>
+ <optional>
+ <element name="model">
+ <text/>
+ </element>
+ </optional>
<optional>
<element name="topology">
<attribute name="sockets">
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index bbe2cc2..e7924c1 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -1,7 +1,7 @@
/*
* cpu_conf.h: CPU XML handling
*
- * Copyright (C) 2009 Red Hat, Inc.
+ * Copyright (C) 2009, 2010 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -76,7 +76,6 @@ virCPUDefParseXML(virConnectPtr conn,
{
virCPUDefPtr def;
xmlNodePtr *nodes = NULL;
- char *match;
int n;
unsigned int i;
@@ -85,18 +84,33 @@ virCPUDefParseXML(virConnectPtr conn,
return NULL;
}
- match = virXMLPropString(node, "match");
-
- if (mode == VIR_CPU_TYPE_AUTO)
- def->type = (match == NULL) ? VIR_CPU_TYPE_HOST : VIR_CPU_TYPE_GUEST;
- else
+ if (mode == VIR_CPU_TYPE_AUTO) {
+ if (virXPathBoolean(conn, "boolean(./arch)", ctxt))
+ def->type = VIR_CPU_TYPE_HOST;
+ else
+ def->type = VIR_CPU_TYPE_GUEST;
+ } else
def->type = mode;
if (def->type == VIR_CPU_TYPE_GUEST) {
- if ((def->match = virCPUMatchTypeFromString(match)) < 0) {
- virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Invalid match attribute for CPU specification"));
- goto error;
+ char *match = virXMLPropString(node, "match");
+
+ if (!match) {
+ if (virXPathBoolean(conn, "boolean(./model)", ctxt)) {
+ virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Missing match attribute for CPU specification"));
+ goto error;
+ }
+ def->match = -1;
+ } else {
+ def->match = virCPUMatchTypeFromString(match);
+ VIR_FREE(match);
+
+ if (def->match < 0) {
+ virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Invalid match attribute for CPU specification"));
+ goto error;
+ }
}
}
@@ -109,7 +123,8 @@ virCPUDefParseXML(virConnectPtr conn,
}
}
- if (!(def->model = virXPathString(conn, "string(./model[1])", ctxt))) {
+ if (!(def->model = virXPathString(conn, "string(./model[1])", ctxt)) &&
+ def->type == VIR_CPU_TYPE_HOST) {
virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("Missing CPU model name"));
goto error;
@@ -158,6 +173,12 @@ virCPUDefParseXML(virConnectPtr conn,
goto error;
if (n > 0) {
+ if (!def->model) {
+ virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Non-empty feature list specified without CPU model"));
+ goto error;
+ }
+
if (VIR_ALLOC_N(def->features, n) < 0)
goto no_memory;
def->nfeatures = n;
@@ -206,7 +227,6 @@ virCPUDefParseXML(virConnectPtr conn,
}
cleanup:
- VIR_FREE(match);
VIR_FREE(nodes);
return def;
@@ -263,14 +283,14 @@ virCPUDefFormatBuf(virConnectPtr conn,
if (indent == NULL)
indent = "";
- if (!def->model) {
+ if (!def->model && def->nfeatures) {
virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Missing CPU model"));
+ "%s", _("Non-empty feature list specified without CPU model"));
return -1;
}
if (!(flags & VIR_CPU_FORMAT_EMBEDED)) {
- if (def->type == VIR_CPU_TYPE_GUEST) {
+ if (def->type == VIR_CPU_TYPE_GUEST && def->model) {
const char *match;
if (!(match = virCPUMatchTypeToString(def->match))) {
virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
@@ -287,7 +307,8 @@ virCPUDefFormatBuf(virConnectPtr conn,
virBufferVSprintf(buf, "%s <arch>%s</arch>\n", indent, def->arch);
}
- virBufferVSprintf(buf, "%s <model>%s</model>\n", indent, def->model);
+ if (def->model)
+ virBufferVSprintf(buf, "%s <model>%s</model>\n", indent, def->model);
if (def->sockets && def->cores && def->threads) {
virBufferVSprintf(buf, "%s <topology", indent);
--
1.6.6
14 years, 10 months
[libvirt] [PATCH v2] Implement CPU topology support for QEMU driver
by Jiri Denemark
QEMU's command line equivalent for the following domain XML fragment
<vcpus>2</vcpus>
<cpu ...>
...
<topology sockets='1' cores='2', threads='1'/>
</cpu>
is
-smp 2,sockets=1,cores=2,threads=1
This syntax was introduced in QEMU-0.12.
Version 2 changes:
- -smp argument build split into a separate function
- always add ",sockets=S,cores=C,threads=T" to -smp if qemu supports it
- use qemuParseCommandLineKeywords for command line parsing
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_conf.c | 159 +++++++++++++++++++++++++++++++++++++++++++++-----
src/qemu/qemu_conf.h | 3 +-
2 files changed, 145 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 9f35217..09bbf7a 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1,7 +1,7 @@
/*
* qemu_conf.c: QEMU configuration management
*
- * Copyright (C) 2006, 2007, 2008, 2009 Red Hat, Inc.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -1115,6 +1115,10 @@ static unsigned int qemudComputeCmdFlags(const char *help,
flags |= QEMUD_CMD_FLAG_CHARDEV;
if (strstr(help, "-balloon"))
flags |= QEMUD_CMD_FLAG_BALLOON;
+ if (strstr(help, "cores=") &&
+ strstr(help, "threads=") &&
+ strstr(help, "sockets="))
+ flags |= QEMUD_CMD_FLAG_SMP_TOPOLOGY;
if (version >= 9000)
flags |= QEMUD_CMD_FLAG_VNC_COLON;
@@ -1865,6 +1869,39 @@ no_memory:
goto cleanup;
}
+static char *
+qemudBuildCommandLineSmp(virConnectPtr conn,
+ const virDomainDefPtr def,
+ int qemuCmdFlags)
+{
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+
+ virBufferVSprintf(&buf, "%lu", def->vcpus);
+
+ if ((qemuCmdFlags & QEMUD_CMD_FLAG_SMP_TOPOLOGY)) {
+ /* sockets, cores, and threads are either all zero
+ * or all non-zero, thus checking one of them is enough */
+ if (def->cpu && def->cpu->sockets) {
+ virBufferVSprintf(&buf, ",sockets=%u", def->cpu->sockets);
+ virBufferVSprintf(&buf, ",cores=%u", def->cpu->cores);
+ virBufferVSprintf(&buf, ",threads=%u", def->cpu->threads);
+ }
+ else {
+ virBufferVSprintf(&buf, ",sockets=%lu", def->vcpus);
+ virBufferVSprintf(&buf, ",cores=%u", 1);
+ virBufferVSprintf(&buf, ",threads=%u", 1);
+ }
+ }
+
+ if (virBufferError(&buf)) {
+ virBufferFreeAndReset(&buf);
+ virReportOOMError(conn);
+ return NULL;
+ }
+
+ return virBufferContentAndReset(&buf);
+}
+
#define QEMU_SERIAL_PARAM_ACCEPTED_CHARS \
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
@@ -1900,7 +1937,6 @@ int qemudBuildCommandLine(virConnectPtr conn,
const char *migrateFrom) {
int i;
char memory[50];
- char vcpus[50];
char boot[VIR_DOMAIN_BOOT_LAST];
struct utsname ut;
int disableKQEMU = 0;
@@ -1914,6 +1950,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
char uuid[VIR_UUID_STRING_BUFLEN];
char domid[50];
char *cpu;
+ char *smp;
uname_normalize(&ut);
@@ -2049,7 +2086,6 @@ int qemudBuildCommandLine(virConnectPtr conn,
* is not supported, then they're out of luck anyway
*/
snprintf(memory, sizeof(memory), "%lu", def->maxmem/1024);
- snprintf(vcpus, sizeof(vcpus), "%lu", def->vcpus);
snprintf(domid, sizeof(domid), "%d", def->id);
ADD_ENV_LIT("LC_ALL=C");
@@ -2112,8 +2148,13 @@ int qemudBuildCommandLine(virConnectPtr conn,
ADD_ARG_LIT("-mem-path");
ADD_ARG_LIT(driver->hugepage_path);
}
+
+ if (!(smp = qemudBuildCommandLineSmp(conn, def, qemuCmdFlags)))
+ goto error;
+
ADD_ARG_LIT("-smp");
- ADD_ARG_LIT(vcpus);
+ ADD_ARG_LIT(smp);
+ VIR_FREE(smp);
if (qemuCmdFlags & QEMUD_CMD_FLAG_NAME) {
ADD_ARG_LIT("-name");
@@ -3740,6 +3781,27 @@ error:
}
+static virCPUDefPtr
+qemuInitGuestCPU(virConnectPtr conn,
+ virDomainDefPtr dom)
+{
+ if (!dom->cpu) {
+ virCPUDefPtr cpu;
+
+ if (VIR_ALLOC(cpu) < 0) {
+ virReportOOMError(conn);
+ return NULL;
+ }
+
+ cpu->type = VIR_CPU_TYPE_GUEST;
+ cpu->match = VIR_CPU_MATCH_EXACT;
+ dom->cpu = cpu;
+ }
+
+ return dom->cpu;
+}
+
+
static int
qemuParseCommandLineCPU(virConnectPtr conn,
virDomainDefPtr dom,
@@ -3749,10 +3811,8 @@ qemuParseCommandLineCPU(virConnectPtr conn,
const char *p = val;
const char *next;
- if (VIR_ALLOC(cpu) < 0)
- goto no_memory;
-
- cpu->type = VIR_CPU_TYPE_GUEST;
+ if (!(cpu = qemuInitGuestCPU(conn, dom)))
+ goto error;
do {
if (*p == '\0' || *p == ',')
@@ -3796,7 +3856,6 @@ qemuParseCommandLineCPU(virConnectPtr conn,
}
} while ((p = next));
- dom->cpu = cpu;
return 0;
syntax:
@@ -3807,11 +3866,84 @@ syntax:
no_memory:
virReportOOMError(conn);
error:
- virCPUDefFree(cpu);
return -1;
}
+static int
+qemuParseCommandLineSmp(virConnectPtr conn,
+ virDomainDefPtr dom,
+ const char *val)
+{
+ unsigned int sockets = 0;
+ unsigned int cores = 0;
+ unsigned int threads = 0;
+ int i;
+ int nkws;
+ char **kws;
+ char **vals;
+ int n;
+ char *end;
+ int ret;
+
+ nkws = qemuParseCommandLineKeywords(conn, val, &kws, &vals, 1);
+ if (nkws < 0)
+ return -1;
+
+ for (i = 0; i < nkws; i++) {
+ if (vals[i] == NULL) {
+ if (i > 0 ||
+ virStrToLong_i(kws[i], &end, 10, &n) < 0 ||
+ !end || *end != '\0')
+ goto syntax;
+ dom->vcpus = n;
+ } else {
+ if (virStrToLong_i(vals[i], &end, 10, &n) < 0 ||
+ !end || *end != '\0')
+ goto syntax;
+ if (STREQ(kws[i], "sockets"))
+ sockets = n;
+ else if (STREQ(kws[i], "cores"))
+ cores = n;
+ else if (STREQ(kws[i], "threads"))
+ threads = n;
+ else
+ goto syntax;
+ }
+ }
+
+ if (sockets && cores && threads) {
+ virCPUDefPtr cpu;
+
+ if (!(cpu = qemuInitGuestCPU(conn, dom)))
+ goto error;
+ cpu->sockets = sockets;
+ cpu->cores = cores;
+ cpu->threads = threads;
+ } else if (sockets || cores || threads)
+ goto syntax;
+
+ ret = 0;
+
+cleanup:
+ for (i = 0; i < nkws; i++) {
+ VIR_FREE(kws[i]);
+ VIR_FREE(vals[i]);
+ }
+ VIR_FREE(kws);
+ VIR_FREE(vals);
+
+ return ret;
+
+syntax:
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse CPU topology '%s'"), val);
+error:
+ ret = -1;
+ goto cleanup;
+}
+
+
/*
* Analyse the env and argv settings and reconstruct a
* virDomainDefPtr representing these settings as closely
@@ -3959,14 +4091,9 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
}
def->memory = def->maxmem = mem * 1024;
} else if (STREQ(arg, "-smp")) {
- int vcpus;
WANT_VALUE();
- if (virStrToLong_i(val, NULL, 10, &vcpus) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, \
- _("cannot parse CPU count '%s'"), val);
+ if (qemuParseCommandLineSmp(conn, def, val) < 0)
goto error;
- }
- def->vcpus = vcpus;
} else if (STREQ(arg, "-uuid")) {
WANT_VALUE();
if (virUUIDParse(val, def->uuid) < 0) {
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 82254ca..3f74cc9 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -1,7 +1,7 @@
/*
* qemu_conf.h: QEMU configuration management
*
- * Copyright (C) 2006, 2007, 2009 Red Hat, Inc.
+ * Copyright (C) 2006, 2007, 2009, 2010 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -78,6 +78,7 @@ enum qemud_cmd_flags {
QEMUD_CMD_FLAG_ENABLE_KVM = (1 << 23), /* Is the -enable-kvm flag available to "enable KVM full virtualization support" */
QEMUD_CMD_FLAG_MONITOR_JSON = (1 << 24), /* JSON mode for monitor */
QEMUD_CMD_FLAG_BALLOON = (1 << 25), /* -balloon available */
+ QEMUD_CMD_FLAG_SMP_TOPOLOGY = (1 << 26), /* Is sockets=s,cores=c,threads=t available for -smp? */
};
/* Main driver state */
--
1.6.6
14 years, 10 months
[libvirt] [PATCH] Enhance qemuParseCommandLineKeywords
by Jiri Denemark
Current version expects name=value,... list and when an incorrect string
such as "a,b,c=d" would be parsed as "a,b,c" keyword with "d" value
without reporting any error, which is probably not the expected
behavior.
This patch adds an extra argument called allowEmptyValue, which if
non-zero will permit keywords with no value; "a,b=c,,d=" will be parsed
as follows:
keyword value
"a" NULL
"b" "c"
"" NULL
"d" ""
In case allowEmptyValue is zero, the string is required to contain
name=value pairs only; retvalues is guaranteed to contain non-NULL
pointers. Now, "a,b,c=d" will result in an error.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_conf.c | 51 ++++++++++++++++++++++++++++++-------------------
1 files changed, 31 insertions(+), 20 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index d3da776..9f35217 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -3066,47 +3066,58 @@ static const char *qemuFindEnv(const char **progenv,
/*
* Takes a string containing a set of key=value,key=value,key...
* parameters and splits them up, returning two arrays with
- * the individual keys and values
+ * the individual keys and values. If allowEmptyValue is nonzero,
+ * the "=value" part is optional and if a key with no value is found,
+ * NULL is be placed into corresponding place in retvalues.
*/
static int
qemuParseCommandLineKeywords(virConnectPtr conn,
const char *str,
char ***retkeywords,
- char ***retvalues)
+ char ***retvalues,
+ int allowEmptyValue)
{
int keywordCount = 0;
int keywordAlloc = 0;
char **keywords = NULL;
char **values = NULL;
const char *start = str;
+ const char *end;
int i;
*retkeywords = NULL;
*retvalues = NULL;
+ end = start + strlen(str);
while (start) {
const char *separator;
const char *endmark;
char *keyword;
- char *value;
+ char *value = NULL;
- if (!(separator = strchr(start, '='))) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("malformed keyword arguments in '%s'"), str);
- goto error;
+ if (!(endmark = strchr(start, ',')))
+ endmark = end;
+ if (!(separator = strchr(start, '=')))
+ separator = end;
+
+ if (separator >= endmark) {
+ if (!allowEmptyValue) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("malformed keyword arguments in '%s'"), str);
+ goto error;
+ }
+ separator = endmark;
}
+
if (!(keyword = strndup(start, separator - start)))
goto no_memory;
- separator++;
- endmark = strchr(separator, ',');
-
- value = endmark ?
- strndup(separator, endmark - separator) :
- strdup(separator);
- if (!value) {
- VIR_FREE(keyword);
- goto no_memory;
+ if (separator < endmark) {
+ separator++;
+ if (!(value = strndup(separator, endmark - separator))) {
+ VIR_FREE(keyword);
+ goto no_memory;
+ }
}
if (keywordAlloc == keywordCount) {
@@ -3123,7 +3134,7 @@ qemuParseCommandLineKeywords(virConnectPtr conn,
values[keywordCount] = value;
keywordCount++;
- start = endmark ? endmark + 1 : NULL;
+ start = endmark < end ? endmark + 1 : NULL;
}
*retkeywords = keywords;
@@ -3163,7 +3174,7 @@ qemuParseCommandLineDisk(virConnectPtr conn,
if ((nkeywords = qemuParseCommandLineKeywords(conn, val,
&keywords,
- &values)) < 0)
+ &values, 0)) < 0)
return NULL;
if (VIR_ALLOC(def) < 0) {
@@ -3347,7 +3358,7 @@ qemuParseCommandLineNet(virConnectPtr conn,
if ((nkeywords = qemuParseCommandLineKeywords(conn,
tmp+1,
&keywords,
- &values)) < 0)
+ &values, 0)) < 0)
return NULL;
} else {
nkeywords = 0;
@@ -3420,7 +3431,7 @@ qemuParseCommandLineNet(virConnectPtr conn,
if ((nkeywords = qemuParseCommandLineKeywords(conn,
nic + strlen("nic,"),
&keywords,
- &values)) < 0) {
+ &values, 0)) < 0) {
virDomainNetDefFree(def);
def = NULL;
goto cleanup;
--
1.6.6
14 years, 10 months
[libvirt] [PATCH] storage_conf: plug a leak on OOM error path
by Jim Meyering
Obvious, for a change...
>From 964f24e0724eda6bf12d115318ea9576bbd91f10 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 18 Jan 2010 18:40:13 +0100
Subject: [PATCH] storage_conf: plug a leak on OOM error path
* src/conf/storage_conf.c (virStoragePoolSourceListNewSource):
Free just-allocated "source" upon VIR_REALLOC_N failure.
---
src/conf/storage_conf.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 0aefa06..ea49531 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1,7 +1,7 @@
/*
* storage_conf.c: config handling for storage driver
*
- * Copyright (C) 2006-2009 Red Hat, Inc.
+ * Copyright (C) 2006-2010 Red Hat, Inc.
* Copyright (C) 2006-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -1695,6 +1695,7 @@ virStoragePoolSourceListNewSource(virConnectPtr conn,
}
if (VIR_REALLOC_N(list->sources, list->nsources+1) < 0) {
+ VIR_FREE(source);
virReportOOMError(conn);
return NULL;
}
--
1.6.6.638.g2bc54
14 years, 10 months
[libvirt] Cannot use console with 0.7.5, error: internal error no assigned pty for device serial0
by Marc Haber
[my apologies for this re-post. I stupidly managed to hide the first
instance of this mail away in an unrelated patch-thread and am thus
afraid that the people who could have answered didn't see it]
Hi,
I have one test host running Debian unstable (kernel 2.6.32.3), and I
would like to virtualize on it using KVM and virsh. Debian unstable
has libvirt 0.7.5.
On this host, I cannot start any KVM domain using console with these
XML parts:
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target port='0'/>
</console>
When I try virsh start $domain, I get the error message:
error: internal error no assigned pty for device serial0
When I remove the serial and console stanza, the machine starts up.
This is the configuration documented everywhere. At first, I suspected
a change in the configuration syntax and filed Debian bug #565145, But
on the #virt IRC channel, people suggested that there was a change in
libvirt parsing KVM's output, which may be a genuine bug breaking the
console.
Is this already a known issue? Can I do anything to help debugging?
Greetings
Marc
--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature | How to make an American Quilt | Fax: *49 3221 2323190
14 years, 10 months
[libvirt] virsh list after libvirt restart "forgets" existing guests (0.7.5)
by Thomas Sjolshagen
After the upgrade to 0.7.5 from the preview repository, I've noticed that a restart of libvirt does not appear to "re-acquire" any guests already running on the system.
# virsh list
Compiled against library: libvir 0.7.5
Using library: libvir 0.7.5
Using API: QEMU 0.7.5
Running hypervisor: QEMU 0.12.1
# ps -ef | grep qemu-kvm
qemu 1445 1 0 Jan17 ? 00:03:32 /usr/bin/qemu-kvm -S -M pc-0.11 -enable-kvm -m 512 -smp 1 -name imap [SNIP]
qemu 1516 1 0 Jan17 ? 00:04:11 /usr/bin/qemu-kvm -S -M pc-0.11 -cpu qemu32 -enable-kvm -m 512 -smp 1 -name mail [SNIP]
qemu 21409 1 16 Jan16 ? 07:29:32 /usr/bin/qemu-kvm -S -M pc-0.11 -enable-kvm -m 1640 -smp 1 -name imap2-cluster [SNIP]
# virsh list
Id Name State
----------------------------------
1 imap running
2 mail running
Additionally, something doesn't appear to be getting either parsed right or set correctly when the guest is started as the /var/log/libvirt/qemu/<guestname>.log file contains:
"Option 'ipv4: Use 'on' or 'off'"
"Failed to parse "yes" for "dummy.ipv4"
14 years, 10 months
[libvirt] [PATCH] xen_driver: don't leak a parsed-config buffer
by Jim Meyering
Another leak:
>From 10a428a2ed1ddbe4da2b4fbd7690da5a0fe0420b Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 18 Jan 2010 18:02:17 +0100
Subject: [PATCH] xen_driver: don't leak a parsed-config buffer
* src/xen/xen_driver.c (xenUnifiedDomainXMLFromNative): Also
free "conf" before returning.
---
src/xen/xen_driver.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 4911c9e..72f56ae 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1,7 +1,7 @@
/*
* xen_driver.c: Unified Xen driver.
*
- * Copyright (C) 2007, 2008, 2009 Red Hat, Inc.
+ * Copyright (C) 2007-2010 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
@@ -1199,6 +1199,8 @@ xenUnifiedDomainXMLFromNative(virConnectPtr conn,
cleanup:
virDomainDefFree(def);
+ if (conf)
+ virConfFree(conf);
return ret;
}
--
1.6.6.638.g2bc54
14 years, 10 months
[libvirt] [PATCH] qemu_driver: don't leak a virDomainDeviceDef buffer
by Jim Meyering
At first I was going to call virDomainDeviceDefFree only "if (dev)",
but saw that it handles a NULL "dev" just fine, so it's better to skip
the test altogether, just as we do for many other free-like functions.
>From ea8511d709492f5cdc152a1eaccbccd05f036648 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 18 Jan 2010 16:55:36 +0100
Subject: [PATCH] qemu_driver: don't leak a virDomainDeviceDef buffer
* src/qemu/qemu_driver.c (qemudDomainAttachDevice): Don't leak "dev".
---
src/qemu/qemu_driver.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 365921f..1aa8af6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6062,11 +6062,11 @@ cleanup:
if (cgroup)
virCgroupFree(&cgroup);
- if (ret < 0 && dev != NULL) {
+ if (ret < 0 && dev != NULL)
if (qemuDomainSetDeviceOwnership(dom->conn, driver, dev, 1) < 0)
VIR_WARN0("Fail to restore disk device ownership");
- virDomainDeviceDefFree(dev);
- }
+ virDomainDeviceDefFree(dev);
+
if (vm)
virDomainObjUnlock(vm);
qemuDriverUnlock(driver);
--
1.6.6.638.g2bc54
14 years, 10 months
[libvirt] 0.7.5 errors in configure script
by Avi Weit
Hi,
I am using Ubuntu 9.10 and downloaded and extracted libvirt.0.7.5. I have
issued:
./configure --prefix=$HOME/usr --without-xen
but I get: You must install device-mapper-devel/libdevmapper >= 1.0.0 to
compile libvirt
Below is a snippet of the final configure output:
checking for showmount... no
checking for pvcreate... no
checking for vgcreate... no
checking for lvcreate... no
checking for pvremove... no
checking for vgremove... no
checking for lvremove... no
checking for vgchange... no
checking for vgscan... no
checking for pvs... no
checking for vgs... no
checking for lvs... no
checking for iscsiadm... no
checking for DEVMAPPER... no
checking libdevmapper.h usability... no
checking libdevmapper.h presence... no
checking for libdevmapper.h... no
checking for dm_task_run in -ldevmapper... no
configure: error: You must install device-mapper-devel/libdevmapper >=
1.0.0 to compile libvirt
/dev/mapper exists on the system.
Any help is appreciated.
Thanks,
- Avi
14 years, 10 months