[libvirt] [PATCH v1 0/2] support dumping guest memory in compressed format
by Qiao Nuohan
dumping guest's memroy is introduced without compression supported, and this is
a freature regression of 'virsh dump --memory-only'. This patchset is used to
add support in libvirt side to make qemu dump guest's memory in kdump-compressed
format and please refer the following address to see implementation of the qemu
side, the lastest version of qemu side is v9(ready for being queued).
http://lists.nongnu.org/archive/html/qemu-devel/2014-02/msg03016.html
qiaonuohan (2):
make qemu dump memory in kdump-compressed format
add dump_memory_format in qemu.conf
include/libvirt/libvirt.h.in | 19 ++++++++++----
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 13 +++++++++-
src/qemu/qemu_conf.c | 3 +++
src/qemu/qemu_conf.h | 2 ++
src/qemu/qemu_driver.c | 51 +++++++++++++++++++++++++++++++++++---
src/qemu/qemu_monitor.c | 6 ++---
src/qemu/qemu_monitor.h | 3 ++-
src/qemu/qemu_monitor_json.c | 4 ++-
src/qemu/qemu_monitor_json.h | 3 ++-
src/qemu/test_libvirtd_qemu.aug.in | 1 +
tests/qemumonitorjsontest.c | 2 +-
tools/virsh-domain.c | 42 +++++++++++++++++++++++++++++++
13 files changed, 133 insertions(+), 17 deletions(-)
10 years, 9 months
[libvirt] [PATCH 0/2] virsh cleanups
by Eric Blake
Followups written based on review to my 'virsh event' addition.
Eric Blake (2):
virsh: use more compact VIR_ENUM_IMPL
virsh: kill over-engineered asprintf failure recovery
tools/virsh-domain-monitor.c | 280 +++++++++++++++-------------------
tools/virsh-domain.c | 347 ++++++++++++++++++-------------------------
tools/virsh-network.c | 36 ++---
tools/virsh-pool.c | 139 ++++++-----------
tools/virsh-volume.c | 104 ++++---------
5 files changed, 358 insertions(+), 548 deletions(-)
--
1.8.5.3
10 years, 9 months
[libvirt] [PATCH 0/4] libxl: improve domain lifecycle event support
by Jim Fehlig
This series is the result of a report from Kim Larry [1] about missing
shutdown events in the libxl driver. Kim's report revealed that the
libxl driver was ignoring the <on_*> domain lifecycle event configuration!
Patch1 adds support for the four standard actions (destroy, restart,
preserve, and rename-restart) of <on_*>. Patch2 queues the shutdown
event earlier in the shutdown handler, to avoid it being delivered
after the a start event in the case of a restart. Patches 3 and 4 add
support for the extra <on_crash> actions coredump-destroy and
coredump-restart.
[1] https://www.redhat.com/archives/libvir-list/2014-February/msg01121.html
Jim Fehlig (4):
libxl: honor domain lifecycle event configuration
libxl: queue domain event earlier in shutdown handler
libxl: add dump dir to libxlDriverConfig object
libxl: handle on_crash coredump actions
src/libxl/libxl_conf.c | 3 +
src/libxl/libxl_conf.h | 2 +
src/libxl/libxl_driver.c | 148 ++++++++++++++++++++++++++++++++++++++---------
3 files changed, 125 insertions(+), 28 deletions(-)
--
1.8.1.4
10 years, 9 months
[libvirt] [PATCH] Document the keyboard as a valid input type
by Ján Tomko
Commit bc18373 added a new input type, but didn't change the
documentation.
---
docs/formatdomain.html.in | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index ea1a97b..400de07 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3847,15 +3847,16 @@ qemu-kvm -net nic,model=? /dev/null
...
<devices>
<input type='mouse' bus='usb'/>
+ <input type='keyboard' bus='usb'/>
</devices>
...</pre>
<dl>
<dt><code>input</code></dt>
<dd>The <code>input</code> element has one mandatory attribute,
- the <code>type</code> whose value can be either 'mouse' or
- 'tablet'. The latter provides absolute
- cursor movement, while the former uses relative movement. The optional
+ the <code>type</code> whose value can be 'mouse', 'tablet' or
+ 'keyboard'. The tablet provides absolute cursor movement,
+ while the mouse uses relative movement. The optional
<code>bus</code> attribute can be used to refine the exact device type.
It takes values "xen" (paravirtualized), "ps2" and "usb".</dd>
</dl>
--
1.8.3.2
10 years, 9 months
[libvirt] [PATCH] virsh: Don't leak buffer if GetFDs fails in cmdCreate
by Ján Tomko
Change the logic of the function to return false by default
and move the freeing of the buffer to the cleanup section.
https://bugzilla.redhat.com/show_bug.cgi?id=1067338
---
tools/virsh-domain.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 00ace11..59e843f 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6518,7 +6518,7 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
const char *from = NULL;
- bool ret = true;
+ bool ret = false;
char *buffer;
#ifndef WIN32
bool console = vshCommandOptBool(cmd, "console");
@@ -6534,7 +6534,7 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd)
return false;
if (cmdStartGetFDs(ctl, cmd, &nfds, &fds) < 0)
- return false;
+ goto cleanup;
if (vshCommandOptBool(cmd, "paused"))
flags |= VIR_DOMAIN_START_PAUSED;
@@ -6545,20 +6545,23 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd)
dom = virDomainCreateXMLWithFiles(ctl->conn, buffer, nfds, fds, flags);
else
dom = virDomainCreateXML(ctl->conn, buffer, flags);
- VIR_FREE(buffer);
- if (dom != NULL) {
- vshPrint(ctl, _("Domain %s created from %s\n"),
- virDomainGetName(dom), from);
-#ifndef WIN32
- if (console)
- cmdRunConsole(ctl, dom, NULL, 0);
-#endif
- virDomainFree(dom);
- } else {
+ if (!dom) {
vshError(ctl, _("Failed to create domain from %s"), from);
- ret = false;
+ goto cleanup;
}
+
+ vshPrint(ctl, _("Domain %s created from %s\n"),
+ virDomainGetName(dom), from);
+#ifndef WIN32
+ if (console)
+ cmdRunConsole(ctl, dom, NULL, 0);
+#endif
+ virDomainFree(dom);
+ ret = true;
+
+cleanup:
+ VIR_FREE(buffer);
VIR_FREE(fds);
return ret;
}
--
1.8.3.2
10 years, 9 months
[libvirt] [PATCH] Fix memory leak when lookup pool list with invalid type option
by shyu
There will be memory leak when lookup pool list with invalid type option
https://bugzilla.redhat.com/show_bug.cgi?id=1069068
==23060== Memcheck, a memory error detector
==23060== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==23060== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==23060== Command: virsh pool-list --type invalid
==23060==
error: Invalid pool type
==23060==
==23060== HEAP SUMMARY:
==23060== in use at exit: 138,383 bytes in 1,559 blocks
==23060== total heap usage: 4,199 allocs, 2,640 frees, 21,372,544 bytes allocated
==23060==
==23060== LEAK SUMMARY:
==23060== definitely lost: 8 bytes in 1 blocks
==23060== indirectly lost: 0 bytes in 0 blocks
==23060== possibly lost: 0 bytes in 0 blocks
==23060== still reachable: 138,375 bytes in 1,558 blocks
==23060== suppressed: 0 bytes in 0 blocks
==23060== Rerun with --leak-check=full to see details of leaked memory
==23060==
==23060== For counts of detected and suppressed errors, rerun with: -v
==23060== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 8 from 6)
Signed-off-by: shyu <shyu(a)redhat.com>
---
tools/virsh-pool.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 642b078..db4d3ae 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -859,6 +859,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
for (i = 0; i < npoolTypes; i++) {
if ((poolType = virStoragePoolTypeFromString(poolTypes[i])) < 0) {
vshError(ctl, "%s", _("Invalid pool type"));
+ VIR_FREE(*poolTypes);
VIR_FREE(poolTypes);
return false;
}
--
1.7.1
10 years, 9 months
[libvirt] block pull/commit for non-local storage
by Peter Krempa
Hi,
with my recent work into snapshots with native libgfapi support I've run
into an issue with libvirt APIs used to delete snapshots by management apps.
The management apps use the APIs to do the job:
int
virDomainBlockCommit(virDomainPtr dom, const char *disk,
const char *base, const char *top,
unsigned long bandwidth, unsigned int flags)
int
virDomainBlockPull(virDomainPtr dom, const char *disk,
unsigned long bandwidth, unsigned int flags)
int
virDomainBlockRebase(virDomainPtr dom, const char *disk,
const char *base, unsigned long bandwidth,
unsigned int flags)
As you can see in the prototypes of these functions (and from the docs
for them which I'm not going to copy here) the user can provide the disk
specification in two possible options:
1) a full path if it's unambiguous - this is file centric and requires
the file to be in the local filesystem
2) a disk name "vda" - this is selected automatically by libvirt but
allows to specify only the top image.
For systems that want to use remote storage without local representation
such as gluster+libgfapi, this doesn't allow to use the APIs to start
block jobs.
To solve this issue we need a way to specify paths on remote storage in
some way. Below are two options we've discussed on IRC.
1) Use URIs along with the file path to specify disk images.
This option would add a new, possibly well documented URIs to specify
paths for disk images. These would be libvirt defined URIs (but
surprisingly "similar" to qemu URIS) so that hypervisors with different
storage specification would need a conversion.
This would allow to specify the targets as:
vda - disk name
/path/to/file - legacy way, path
file:///path/to/file - new way of file paths
block:///dev/blah - new way, block devs
gluster://server/vol/img - new way, remote images
...
Possible caveats: RBD for example allows to use multiple hosts and we'd
need to introduce a possibility to specify it if we'd add support for
this on rbd.
2) Export the image chain in the XML and allow to use indexed disk names
This option would require to export the backing chain in the XML in some
way, either the existing disk source specification in multiple elements
(which I don't like as it is a bit convoluted), or possibly again via URIs.
Then the user would be allowed to specify vda[2] for the second backing
image of the vda disk.
With this the internal representations of the backing chain would be
used without the need for the user to specify path.
A possible caveat here is that if backing chains for some reason will be
converted to backing trees, this approach will be invalid.
3) ? anyone suggesting something better? :)
Thanks in advance for suggestions and/or new ideas.
Peter
10 years, 9 months
[libvirt] [PATCH] cpu: break out when a right cpuCandidate found
by Wangyufei (James)
>From 8123c5d64f940fa0fb0de32fc5e68035980b6b01 Mon Sep 17 00:00:00 2001
From: WangYufei <james.wangyufei(a)huawei.com>
Date: Thu, 13 Feb 2014 07:17:11 +0000
Subject: [PATCH] cpu: break out when a right cpuCandidate found
In function x86Decode there's a code segment in while cycle like this:
if (cpuModel == NULL
|| cpuModel->nfeatures > cpuCandidate->nfeatures) {
virCPUDefFree(cpuModel);
cpuModel = cpuCandidate;
cpuData = candidate->data;
} else {
virCPUDefFree(cpuCandidate);
}
when it finds the right cpuCandidate, it doesn't break out the cycle, but continues
run in it, and cpuModel will never get a new value, it's meaningless. It should
break out when a right cpuCndidate found.
Signed-off-by: WangYufei <james.wangyufei(a)huawei.com>
---
src/cpu/cpu_x86.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 56080ef..546b757 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1558,6 +1558,7 @@ x86Decode(virCPUDefPtr cpu,
virCPUDefFree(cpuModel);
cpuModel = cpuCandidate;
cpuData = candidate->data;
+ break;
} else {
virCPUDefFree(cpuCandidate);
}
--
1.7.12.4
Best Regards,
-WangYufei
10 years, 9 months
[libvirt] [PATCH] bhyve: implement node information reporting
by Roman Bogorodskiy
- Implement nodeGetCPUStats using nodeGetCPUStats()
- Implement nodeGetMemoryStats using nodeGetMemoryStats()
---
src/bhyve/bhyve_driver.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 7c6500f..35171d2 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -48,6 +48,7 @@
#include "virstring.h"
#include "cpu/cpu.h"
#include "viraccessapicheck.h"
+#include "nodeinfo.h"
#include "bhyve_driver.h"
#include "bhyve_process.h"
@@ -497,6 +498,32 @@ cleanup:
}
static int
+bhyveNodeGetCPUStats(virConnectPtr conn,
+ int cpuNum,
+ virNodeCPUStatsPtr params,
+ int *nparams,
+ unsigned int flags)
+{
+ if (virNodeGetCPUStatsEnsureACL(conn) < 0)
+ return -1;
+
+ return nodeGetCPUStats(cpuNum, params, nparams, flags);
+}
+
+static int
+bhyveNodeGetMemoryStats(virConnectPtr conn,
+ int cellNum,
+ virNodeMemoryStatsPtr params,
+ int *nparams,
+ unsigned int flags)
+{
+ if (virNodeGetMemoryStatsEnsureACL(conn) < 0)
+ return -1;
+
+ return nodeGetMemoryStats(cellNum, params, nparams, flags);
+}
+
+static int
bhyveStateCleanup(void)
{
VIR_DEBUG("bhyve state cleanup");
@@ -594,6 +621,8 @@ static virDriver bhyveDriver = {
.domainLookupByName = bhyveDomainLookupByName, /* 1.2.2 */
.domainDefineXML = bhyveDomainDefineXML, /* 1.2.2 */
.domainGetXMLDesc = bhyveDomainGetXMLDesc, /* 1.2.2 */
+ .nodeGetCPUStats = bhyveNodeGetCPUStats, /* 1.2.2 */
+ .nodeGetMemoryStats = bhyveNodeGetMemoryStats, /* 1.2.2 */
};
--
1.8.4.3
10 years, 9 months