[libvirt] [PATCH] leaseshelper: avoid mem leak after storing lease entries
by Nehal J Wani
Contents of existing lease file were being stored in a variable
which was never freed.
---
src/network/leaseshelper.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
index e4b5283..c8543a2 100644
--- a/src/network/leaseshelper.c
+++ b/src/network/leaseshelper.c
@@ -361,6 +361,7 @@ main(int argc, char **argv)
VIR_FREE(pid_file);
VIR_FREE(exptime);
+ VIR_FREE(lease_entries);
VIR_FREE(custom_lease_file);
virJSONValueFree(lease_new);
virJSONValueFree(leases_array);
--
1.9.3
10 years, 4 months
[libvirt] libvirt log format
by Yuanzhen Gu
Hello folks,
Does any one know how to read the libvirt log information?
For example,
2014-07-22 17:25:22.984+0000: 18571: debug : qemuMonitorIOProcess:356 :
QEMU_MONITOR_IO_PROCESS: mon=0x7f733c000a40 buf={"timestamp": {"seconds":
1406049922, "microseconds": 983916}, "event": "STOP"}
is there anyway to find the qemuMonitorIOProcess() function in the source
code? and what does "356" after that means? Thanks!
Best,
Yuanzhen
10 years, 4 months
[libvirt] [PATCH] maint: simplify some syntax check exemptions
by Eric Blake
Commit 5028160 accidentally weakened the strtol prohibitions to
skip ALL files under src/util instead of the former situation of
just protecting util/virsexpr.c; even though NONE of the files
in that directory need any protection.
Shorten some long lines while at it.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_strtol): No need
to exclude all of util.
(exclude_file_name_regexp--sc_prohibit_sprintf): Reduce long line.
(exclude_file_name_regexp--sc_prohibit_raw_allocation): Likewise.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
cfg.mk | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 0559edd..10dd79b 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1065,7 +1065,7 @@ exclude_file_name_regexp--sc_prohibit_nonreentrant = \
^((po|tests)/|docs/.*(py|html\.in)|run.in$$|tools/wireshark/util/genxdrstub\.pl$$)
exclude_file_name_regexp--sc_prohibit_raw_allocation = \
- ^(docs/hacking\.html\.in)|(src/util/viralloc\.[ch]|examples/.*|tests/securityselinuxhelper\.c|tests/vircgroupmock\.c|tools/wireshark/src/packet-libvirt.c)$$
+ ^(docs/hacking\.html\.in|src/util/viralloc\.[ch]|examples/.*|tests/(securityselinuxhelper|vircgroupmock)\.c|tools/wireshark/src/packet-libvirt\.c)$$
exclude_file_name_regexp--sc_prohibit_readlink = \
^src/(util/virutil|lxc/lxc_container)\.c$$
@@ -1073,12 +1073,11 @@ exclude_file_name_regexp--sc_prohibit_readlink = \
exclude_file_name_regexp--sc_prohibit_setuid = ^src/util/virutil\.c$$
exclude_file_name_regexp--sc_prohibit_sprintf = \
- ^(docs/hacking\.html\.in)|(examples/systemtap/.*stp)|(src/dtrace2systemtap\.pl)|(src/rpc/gensystemtap\.pl)|(tools/wireshark/util/genxdrstub\.pl)$$
+ ^(docs/hacking\.html\.in|.*stp|.pl)$$
exclude_file_name_regexp--sc_prohibit_strncpy = ^src/util/virstring\.c$$
-exclude_file_name_regexp--sc_prohibit_strtol = \
- ^(src/util/.*|examples/dom.*/.*)\.c$$
+exclude_file_name_regexp--sc_prohibit_strtol = ^examples/dom.*/.*\.c$$
exclude_file_name_regexp--sc_prohibit_xmlGetProp = ^src/util/virxml\.c$$
--
1.9.3
10 years, 4 months
[libvirt] [PATCH] conf: avoid memory leaks while parsing seclabel
by Eric Blake
Our seclabel parsing was repeatedly assigning malloc'd data into a
temporary variable, without first freeing the previous use. Among
other leaks flagged by valgrind:
==9312== 8 bytes in 1 blocks are definitely lost in loss record 88 of 821
==9312== at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==9312== by 0x8C40369: strdup (strdup.c:42)
==9312== by 0x50EA799: virStrdup (virstring.c:676)
==9312== by 0x50FAEB9: virXPathString (virxml.c:90)
==9312== by 0x50FAF1E: virXPathStringLimit (virxml.c:112)
==9312== by 0x510F516: virSecurityLabelDefParseXML (domain_conf.c:4571)
==9312== by 0x510FB20: virSecurityLabelDefsParseXML (domain_conf.c:4720)
While it was multiple problems, it looks like commit da78351 was
to blame for all of them.
* src/conf/domain_conf.c (virSecurityLabelDefParseXML): Plug leaks
detected by valgrind.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/conf/domain_conf.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6ed6155..077e035 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4573,6 +4573,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
if (!(seclabel = virSecurityLabelDefNew(p)))
goto error;
+ VIR_FREE(p);
/* set default value */
seclabel->type = VIR_DOMAIN_SECLABEL_DYNAMIC;
@@ -4606,6 +4607,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
goto error;
}
}
+ VIR_FREE(p);
if (seclabel->type == VIR_DOMAIN_SECLABEL_DYNAMIC &&
!seclabel->relabel) {
@@ -4656,6 +4658,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
}
seclabel->label = p;
+ p = NULL;
}
/* Only parse imagelabel, if requested live XML with relabeling */
@@ -4670,6 +4673,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
goto error;
}
seclabel->imagelabel = p;
+ p = NULL;
}
/* Only parse baselabel for dynamic label type */
@@ -4677,6 +4681,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
p = virXPathStringLimit("string(./baselabel[1])",
VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
seclabel->baselabel = p;
+ p = NULL;
}
return seclabel;
--
1.9.3
10 years, 4 months
[libvirt] [PATCH] nwfilter: plub memory leak with firewall
by Eric Blake
Introduced in commit 70571ccc. Caught by valgrind:
==9816== 170 (32 direct, 138 indirect) bytes in 1 blocks are definitely lost in loss record 646 of 821
==9816== at 0x4A081D4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==9816== by 0x50836FB: virAlloc (viralloc.c:144)
==9816== by 0x50AEC2B: virFirewallNew (virfirewall.c:204)
==9816== by 0x1E2308ED: ebiptablesDriverProbeStateMatch (nwfilter_ebiptables_driver.c:3715)
==9816== by 0x1E2309AD: ebiptablesDriverInit (nwfilter_ebiptables_driver.c:3742)
* src/nwfilter/nwfilter_ebiptables_driver.c
(ebiptablesDriverProbeStateMatch): Properly clean up.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/nwfilter/nwfilter_ebiptables_driver.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 1701d62..d41133c 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -3713,6 +3713,7 @@ ebiptablesDriverProbeStateMatch(void)
{
unsigned long version;
virFirewallPtr fw = virFirewallNew();
+ int ret = -1;
virFirewallStartTransaction(fw, 0);
virFirewallAddRuleFull(fw, VIR_FIREWALL_LAYER_IPV4,
@@ -3720,7 +3721,7 @@ ebiptablesDriverProbeStateMatch(void)
"--version", NULL);
if (virFirewallApply(fw) < 0)
- return -1;
+ goto cleanup;
/*
* since version 1.4.16 '-m state --state ...' will be converted to
@@ -3729,7 +3730,10 @@ ebiptablesDriverProbeStateMatch(void)
if (version >= 1 * 1000000 + 4 * 1000 + 16)
newMatchState = true;
- return 0;
+ ret = 0;
+ cleanup:
+ virFirewallFree(fw);
+ return ret;
}
static int
--
1.9.3
10 years, 4 months
[libvirt] [PATCH] numatune: finish the split from domain_conf and remove all dependencies
by Martin Kletzander
This patch adds back the virDomainDef typedef into domain_conf and
makes all the numatune_conf functions independent of any virDomainDef
definitions.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/conf/domain_conf.c | 9 +++++-
src/conf/domain_conf.h | 2 ++
src/conf/numatune_conf.c | 78 +++++++++++++++++++++++++-----------------------
src/conf/numatune_conf.h | 23 +++++++-------
src/lxc/lxc_native.c | 8 +++--
src/qemu/qemu_driver.c | 10 +++++--
6 files changed, 75 insertions(+), 55 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1e27165..9f20a3a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11809,9 +11809,16 @@ virDomainDefParseXML(xmlDocPtr xml,
}
}
- if (virDomainNumatuneParseXML(def, ctxt) < 0)
+ if (virDomainNumatuneParseXML(&def->numatune,
+ def->placement_mode ==
+ VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
+ def->cpu ? def->cpu->ncells : 0,
+ ctxt) < 0)
goto error;
+ if (virDomainNumatuneHasPlacementAuto(def->numatune) && !def->cpumask)
+ def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO;
+
if ((n = virXPathNodeSet("./resource", ctxt, &nodes)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract resource nodes"));
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index cd3293b..1429568 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1853,6 +1853,8 @@ struct _virDomainResourceDef {
* NB: if adding to this struct, virDomainDefCheckABIStability
* may well need an update
*/
+typedef struct _virDomainDef virDomainDef;
+typedef virDomainDef *virDomainDefPtr;
struct _virDomainDef {
int virtType;
int id;
diff --git a/src/conf/numatune_conf.c b/src/conf/numatune_conf.c
index 82418aa..48d1d04 100644
--- a/src/conf/numatune_conf.c
+++ b/src/conf/numatune_conf.c
@@ -76,13 +76,15 @@ virDomainNumatuneNodeSpecified(virDomainNumatunePtr numatune,
}
static int
-virDomainNumatuneNodeParseXML(virDomainDefPtr def,
+virDomainNumatuneNodeParseXML(virDomainNumatunePtr *numatunePtr,
+ size_t ncells,
xmlXPathContextPtr ctxt)
{
char *tmp = NULL;
int n = 0;;
int ret = -1;
size_t i = 0;
+ virDomainNumatunePtr numatune = *numatunePtr;
xmlNodePtr *nodes = NULL;
if ((n = virXPathNodeSet("./numatune/memnode", ctxt, &nodes)) < 0) {
@@ -94,29 +96,31 @@ virDomainNumatuneNodeParseXML(virDomainDefPtr def,
if (!n)
return 0;
- if (def->numatune && def->numatune->memory.specified &&
- def->numatune->memory.placement == VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO) {
+ if (numatune && numatune->memory.specified &&
+ numatune->memory.placement == VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Per-node binding is not compatible with "
"automatic NUMA placement."));
goto cleanup;
}
- if (!def->cpu || !def->cpu->ncells) {
+ if (!ncells) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("Element 'memnode' is invalid without "
"any guest NUMA cells"));
goto cleanup;
}
- if (!def->numatune && VIR_ALLOC(def->numatune) < 0)
+ if (!numatune && VIR_ALLOC(numatune) < 0)
goto cleanup;
- VIR_FREE(def->numatune->mem_nodes);
- if (VIR_ALLOC_N(def->numatune->mem_nodes, def->cpu->ncells) < 0)
+ *numatunePtr = numatune;
+
+ VIR_FREE(numatune->mem_nodes);
+ if (VIR_ALLOC_N(numatune->mem_nodes, ncells) < 0)
goto cleanup;
- def->numatune->nmem_nodes = def->cpu->ncells;
+ numatune->nmem_nodes = ncells;
for (i = 0; i < n; i++) {
int mode = 0;
@@ -139,14 +143,14 @@ virDomainNumatuneNodeParseXML(virDomainDefPtr def,
}
VIR_FREE(tmp);
- if (cellid >= def->numatune->nmem_nodes) {
+ if (cellid >= numatune->nmem_nodes) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("Argument 'cellid' in memnode element must "
"correspond to existing guest's NUMA cell"));
goto cleanup;
}
- mem_node = &def->numatune->mem_nodes[cellid];
+ mem_node = &numatune->mem_nodes[cellid];
if (mem_node->nodeset) {
virReportError(VIR_ERR_XML_ERROR,
@@ -189,7 +193,9 @@ virDomainNumatuneNodeParseXML(virDomainDefPtr def,
}
int
-virDomainNumatuneParseXML(virDomainDefPtr def,
+virDomainNumatuneParseXML(virDomainNumatunePtr *numatunePtr,
+ bool placement_static,
+ size_t ncells,
xmlXPathContextPtr ctxt)
{
char *tmp = NULL;
@@ -212,23 +218,25 @@ virDomainNumatuneParseXML(virDomainDefPtr def,
node = virXPathNode("./numatune/memory[1]", ctxt);
- if (def->numatune) {
- virDomainNumatuneFree(def->numatune);
- def->numatune = NULL;
+ if (*numatunePtr) {
+ virDomainNumatuneFree(*numatunePtr);
+ *numatunePtr = NULL;
}
- if (!node && def->placement_mode != VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
- if (virDomainNumatuneNodeParseXML(def, ctxt) < 0)
+ if (!node && placement_static) {
+ if (virDomainNumatuneNodeParseXML(numatunePtr, ncells, ctxt) < 0)
goto cleanup;
return 0;
}
if (!node) {
- /* We know that def->placement_mode is "auto" if we're here */
- if (virDomainNumatuneSet(def, VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO,
- -1, NULL) < 0)
- goto cleanup;
- return 0;
+ /* We know that placement_mode is "auto" if we're here */
+ ret = virDomainNumatuneSet(numatunePtr,
+ placement_static,
+ VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO,
+ -1,
+ NULL);
+ goto cleanup;
}
tmp = virXMLPropString(node, "mode");
@@ -260,13 +268,16 @@ virDomainNumatuneParseXML(virDomainDefPtr def,
goto cleanup;
VIR_FREE(tmp);
- if (virDomainNumatuneSet(def, placement, mode, nodeset) < 0)
+ if (virDomainNumatuneSet(numatunePtr,
+ placement_static,
+ placement,
+ mode,
+ nodeset) < 0)
goto cleanup;
- if (virDomainNumatuneNodeParseXML(def, ctxt) < 0)
+ if (virDomainNumatuneNodeParseXML(numatunePtr, ncells, ctxt) < 0)
goto cleanup;
-
ret = 0;
cleanup:
virBitmapFree(nodeset);
@@ -420,12 +431,13 @@ virDomainNumatuneMaybeFormatNodeset(virDomainNumatunePtr numatune,
}
int
-virDomainNumatuneSet(virDomainDefPtr def,
+virDomainNumatuneSet(virDomainNumatunePtr *numatunePtr,
+ bool placement_static,
int placement,
int mode,
virBitmapPtr nodeset)
{
- bool create = !def->numatune; /* Whether we are creating new struct */
+ bool create = !*numatunePtr; /* Whether we are creating new struct */
int ret = -1;
virDomainNumatunePtr numatune = NULL;
@@ -449,9 +461,9 @@ virDomainNumatuneSet(virDomainDefPtr def,
goto cleanup;
}
- if (create && VIR_ALLOC(def->numatune) < 0)
+ if (create && VIR_ALLOC(*numatunePtr) < 0)
goto cleanup;
- numatune = def->numatune;
+ numatune = *numatunePtr;
if (create) {
/* Defaults for new struct */
@@ -474,8 +486,7 @@ virDomainNumatuneSet(virDomainDefPtr def,
}
if (placement == VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT) {
- if (numatune->memory.nodeset ||
- def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC)
+ if (numatune->memory.nodeset || placement_static)
placement = VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
else
placement = VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO;
@@ -489,13 +500,6 @@ virDomainNumatuneSet(virDomainDefPtr def,
goto cleanup;
}
- if (placement == VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO) {
- virBitmapFree(numatune->memory.nodeset);
- numatune->memory.nodeset = NULL;
- if (!def->cpumask)
- def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO;
- }
-
if (placement != -1)
numatune->memory.placement = placement;
diff --git a/src/conf/numatune_conf.h b/src/conf/numatune_conf.h
index c86118f..5254629 100644
--- a/src/conf/numatune_conf.h
+++ b/src/conf/numatune_conf.h
@@ -30,15 +30,6 @@
# include "virbitmap.h"
# include "virbuffer.h"
-/*
- * Since numatune configuration is closely bound to the whole config,
- * and because we don't have separate domain_conf headers for
- * typedefs, structs and functions, we need to have a forward
- * declaration here for virDomainDef due to circular dependencies.
- */
-typedef struct _virDomainDef virDomainDef;
-typedef virDomainDef *virDomainDefPtr;
-
typedef struct _virDomainNumatune virDomainNumatune;
typedef virDomainNumatune *virDomainNumatunePtr;
@@ -60,8 +51,11 @@ void virDomainNumatuneFree(virDomainNumatunePtr numatune);
/*
* XML Parse/Format functions
*/
-int virDomainNumatuneParseXML(virDomainDefPtr def, xmlXPathContextPtr ctxt)
- ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+int virDomainNumatuneParseXML(virDomainNumatunePtr *numatunePtr,
+ bool placement_static,
+ size_t ncells,
+ xmlXPathContextPtr ctxt)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
int virDomainNumatuneFormatXML(virBufferPtr buf, virDomainNumatunePtr numatune)
ATTRIBUTE_NONNULL(1);
@@ -91,8 +85,11 @@ int virDomainNumatuneMaybeFormatNodeset(virDomainNumatunePtr numatune,
/*
* Setters
*/
-int virDomainNumatuneSet(virDomainDefPtr def, int placement,
- int mode, virBitmapPtr nodeset)
+int virDomainNumatuneSet(virDomainNumatunePtr *numatunePtr,
+ bool placement_static,
+ int placement,
+ int mode,
+ virBitmapPtr nodeset)
ATTRIBUTE_NONNULL(1);
/*
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index 2fbc262..d32cb27 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -734,8 +734,12 @@ lxcSetCpusetTune(virDomainDefPtr def, virConfPtr properties)
value->str) {
if (virBitmapParse(value->str, 0, &nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
return -1;
- if (virDomainNumatuneSet(def, VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC,
- VIR_DOMAIN_NUMATUNE_MEM_STRICT, nodeset) < 0) {
+ if (virDomainNumatuneSet(&def->numatune,
+ def->placement_mode ==
+ VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
+ VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC,
+ VIR_DOMAIN_NUMATUNE_MEM_STRICT,
+ nodeset) < 0) {
virBitmapFree(nodeset);
return -1;
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1782913..b49dd2e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8788,12 +8788,18 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
qemuDomainSetNumaParamsLive(vm, caps, nodeset) < 0)
goto cleanup;
- if (virDomainNumatuneSet(vm->def, -1, mode, nodeset) < 0)
+ if (virDomainNumatuneSet(&vm->def->numatune,
+ vm->def->placement_mode ==
+ VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
+ -1, mode, nodeset) < 0)
goto cleanup;
}
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
- if (virDomainNumatuneSet(persistentDef, -1, mode, nodeset) < 0)
+ if (virDomainNumatuneSet(&persistentDef->numatune,
+ persistentDef->placement_mode ==
+ VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
+ -1, mode, nodeset) < 0)
goto cleanup;
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0)
--
2.0.1
10 years, 4 months
[libvirt] [PATCH v2] qemuConnectGetDomainCapabilities: Use wiser defaults
by Michal Privoznik
Up to now, users have to pass two arguments at least: domain virt type
('qemu' vs 'kvm') and one of emulatorbin or architecture. This is not
much user friendly. Nowadays users mostly use KVM and share the host
architecture with the guest. So now, the API (and subsequently virsh
command) can be called with all NULLs (without any arguments).
Before this patch:
# virsh domcapabilities
error: failed to get emulator capabilities
error: virttype_str in qemuConnectGetDomainCapabilities must not be NULL
# virsh domcapabilities kvm
error: failed to get emulator capabilities
error: invalid argument: at least one of emulatorbin or architecture fields must be present
After:
# virsh domcapabilities
<domainCapabilities>
<path>/usr/bin/qemu-system-x86_64</path>
<domain>kvm</domain>
<machine>pc-i440fx-2.1</machine>
<arch>x86_64</arch>
<vcpu max='255'/>
</domainCapabilities>
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Notes:
It would be nice to have this in the same release as the new API it's fixing.
So please, review.
src/qemu/qemu_driver.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b85d909..008f101 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16893,15 +16893,20 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
virQEMUCapsPtr qemuCaps = NULL;
int virttype; /* virDomainVirtType */
virDomainCapsPtr domCaps = NULL;
- int arch = VIR_ARCH_NONE; /* virArch */
+ int arch = virArchFromHost(); /* virArch */
virCheckFlags(0, ret);
- virCheckNonNullArgReturn(virttype_str, ret);
if (virConnectGetDomainCapabilitiesEnsureACL(conn) < 0)
return ret;
- if ((virttype = virDomainVirtTypeFromString(virttype_str)) < 0) {
+ if (qemuHostdevHostSupportsPassthroughLegacy())
+ virttype = VIR_DOMAIN_VIRT_KVM;
+ else
+ virttype = VIR_DOMAIN_VIRT_QEMU;
+
+ if (virttype_str &&
+ (virttype = virDomainVirtTypeFromString(virttype_str)) < 0) {
virReportError(VIR_ERR_INVALID_ARG,
_("unknown virttype: %s"),
virttype_str);
@@ -16924,9 +16929,6 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
arch_from_caps = virQEMUCapsGetArch(qemuCaps);
- if (arch == VIR_ARCH_NONE)
- arch = arch_from_caps;
-
if (arch_from_caps != arch) {
virReportError(VIR_ERR_INVALID_ARG,
_("architecture from emulator '%s' doesn't "
@@ -16935,21 +16937,12 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
virArchToString(arch));
goto cleanup;
}
- } else if (arch_str) {
+ } else {
if (!(qemuCaps = virQEMUCapsCacheLookupByArch(driver->qemuCapsCache,
arch)))
goto cleanup;
- if (!emulatorbin)
- emulatorbin = virQEMUCapsGetBinary(qemuCaps);
- /* Deliberately not checking if provided @emulatorbin matches @arch,
- * since if @emulatorbin was specified the match has been checked a few
- * lines above. */
- } else {
- virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("at least one of emulatorbin or "
- "architecture fields must be present"));
- goto cleanup;
+ emulatorbin = virQEMUCapsGetBinary(qemuCaps);
}
if (machine) {
--
1.8.5.5
10 years, 4 months
[libvirt] [PATCH] spec: Enable sanlock on qemu_kvm_arches for RHEL
by Jiri Denemark
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
libvirt.spec.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 76e57aa..c035c68 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -260,12 +260,12 @@
%endif
# Enable sanlock library for lock management with QEMU
-# Sanlock is available only on x86_64 for RHEL
+# Sanlock is available only on arches where kvm is available for RHEL
%if 0%{?fedora} >= 16
%define with_sanlock 0%{!?_without_sanlock:%{server_drivers}}
%endif
-%if 0%{?rhel} >= 6
- %ifarch x86_64
+%if 0%{?rhel}
+ %ifarch %{qemu_kvm_arches}
%define with_sanlock 0%{!?_without_sanlock:%{server_drivers}}
%endif
%endif
--
2.0.2
10 years, 4 months
[libvirt] [PATCH libvirt-tck] docs: typo fixes
by Roman Bogorodskiy
Fix a few typos in docs/intro.pod.
---
docs/intro.pod | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/docs/intro.pod b/docs/intro.pod
index 3684d51..09227ae 100644
--- a/docs/intro.pod
+++ b/docs/intro.pod
@@ -47,7 +47,7 @@ hypervisor and libvirt release is configured correctly
=back
Thus the libvirt TCK will allow developers, administrators and users
-to determine the level of compatability of their platform, and
+to determine the level of compatibility of their platform, and
evaluate whether it will meet their needs, and get awareness of any
regressions that may have occurred since a previous test run
@@ -249,7 +249,7 @@ running domain, replacing it with -1.
=item *
-QEMU refuseed to boot kernel+initrd unless at least one disk
+QEMU refused to boot kernel+initrd unless at least one disk
image is provided
=back
@@ -261,7 +261,7 @@ The libvirt-tck tool outputs results in a number of formats. The
default format is a simple plain test summary listing each test
case, and the pass/fail state, and details of each check failure
-A more verbose text format otputs the full Perl TAP (Test Anything
+A more verbose text format outputs the full Perl TAP (Test Anything
Protocol) format results as described in 'man 3 TAP' or
'man 3 Test::Harness::TAP'.
@@ -301,7 +301,7 @@ flag
The code as it stands is the bare minimum to get a proof of concept working
for testing of domain APIs for Xen and QEMU drivers. The test suite though
-is intended to be independant of any driver, and also allow for coverage of
+is intended to be independent of any driver, and also allow for coverage of
all the libvirt APIs.
Of the top of my head, some important things that need doing
@@ -389,7 +389,7 @@ Fix up all the horribly broken areas of libvirt that this
uncovers. This will entail deciding that the semantics for
various edge cases are with each API. Deciding what errors
codes need to be formally defined for each API. Figuring
-out how to implement/fix the neccessary semantics in the
+out how to implement/fix the necessary semantics in the
drivers.
=item Failure recording
--
1.9.0
10 years, 4 months
[libvirt] [PATCH] docs: Point to list of valid pool target volume formats
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1092886
Rather than point off to some nefarious "pool-specific docs" page when
describing the "format" field for the target pool provide a link to the
storage driver page which describes the various valid formats for each
pool type. Also make it a bit more clear that if a valid format isn't
specified, then the type field is ignored.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
docs/formatstorage.html.in | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/docs/formatstorage.html.in b/docs/formatstorage.html.in
index e264985..e25bba7 100644
--- a/docs/formatstorage.html.in
+++ b/docs/formatstorage.html.in
@@ -508,8 +508,12 @@
or directory pools it will provide the file format type, eg cow,
qcow, vmdk, raw. If omitted when creating a volume, the pool's
default format will be used. The actual format is specified via
- the <code>type</code> attribute. Consult the pool-specific docs for
- the list of valid values. <span class="since">Since 0.4.1</span></dd>
+ the <code>type</code> attribute. Consult the
+ <a href="storage.html">storage driver page</a> for the list of valid
+ volume format type values for each specific pool. The
+ <code>format</code> will be ignored on input for pools without a
+ volume format type value and the default pool format will be used.
+ <span class="since">Since 0.4.1</span></dd>
<dt><code>permissions</code></dt>
<dd>Provides information about the default permissions to use
when creating volumes. This is currently only useful for directory
--
1.9.3
10 years, 4 months