[libvirt] [PATCH v2 0/8] Add support for taking screenshots
by Michal Privoznik
Diff to v1:
- filename argument replaced with stream
- returning file mime-type
This patch series implements screenshots taking feature,
which is accessible via new virDomainScreenshot API and
'screenshot' command in virsh. By now, 'flags' argument
is not used, but can be later when specifying say image
output format, etc. Talking of - output is hypervisor
specific. QEMU output images in PPM, VirtualBox in PNG.
Michal Privoznik (8):
screenshot: Defining the public API
screenshot: Defining the internal API
screenshot: Implementing the public API
screenshot: Implementing the remote protocol
screenshot: Expose the new API in virsh
virFDStream: Add option for delete file after it's opening
qemu: Implement the driver methods
vbox: Implement the driver methods
daemon/remote.c | 61 +++++++++++++++++++
daemon/remote_dispatch_args.h | 1 +
daemon/remote_dispatch_prototypes.h | 8 +++
daemon/remote_dispatch_ret.h | 1 +
daemon/remote_dispatch_table.h | 5 ++
include/libvirt/libvirt.h.in | 7 ++
src/driver.h | 5 ++
src/esx/esx_driver.c | 1 +
src/fdstream.c | 25 ++++++--
src/fdstream.h | 6 +-
src/libvirt.c | 56 +++++++++++++++++
src/libvirt_public.syms | 5 ++
src/libxl/libxl_driver.c | 1 +
src/lxc/lxc_driver.c | 4 +-
src/openvz/openvz_driver.c | 1 +
src/phyp/phyp_driver.c | 1 +
src/qemu/qemu_driver.c | 82 +++++++++++++++++++++++++-
src/qemu/qemu_monitor.c | 20 ++++++
src/qemu/qemu_monitor.h | 3 +
src/qemu/qemu_monitor_json.c | 23 +++++++
src/qemu/qemu_monitor_json.h | 4 +
src/qemu/qemu_monitor_text.c | 31 ++++++++++
src/qemu/qemu_monitor_text.h | 2 +
src/remote/remote_driver.c | 38 ++++++++++++
src/remote/remote_protocol.c | 20 ++++++
src/remote/remote_protocol.h | 16 +++++
src/remote/remote_protocol.x | 12 ++++-
src/storage/storage_driver.c | 4 +-
src/test/test_driver.c | 1 +
src/uml/uml_driver.c | 4 +-
src/util/iohelper.c | 12 +++-
src/vbox/vbox_tmpl.c | 114 +++++++++++++++++++++++++++++++++++
src/vmware/vmware_driver.c | 1 +
src/xen/xen_driver.c | 4 +-
src/xen/xen_driver.h | 1 +
src/xen/xen_hypervisor.c | 1 +
src/xen/xen_inotify.c | 1 +
src/xen/xend_internal.c | 1 +
src/xen/xm_internal.c | 1 +
src/xen/xs_internal.c | 1 +
src/xenapi/xenapi_driver.c | 1 +
tools/virsh.c | 90 +++++++++++++++++++++++++++
tools/virsh.pod | 4 +
43 files changed, 664 insertions(+), 16 deletions(-)
--
1.7.4
13 years, 7 months
[libvirt] [PATCH] build: fix gitignore sorting
by Eric Blake
Make it so we don't have to 'git add -f' particular files like
po/POTFILES.in all the time (tested by fixing one of our
special-case files as part of the patch).
* .gnulib: Update to latest.
* bootstrap: Resync from coreutils.
* .gitignore: Sort whitelist entries correctly, including ignoring
files rather than directories.
* m4/virt-compile-warnings.m4: Convert tabs to space.
---
* .gnulib dec3475...f796520 (7):
> bootstrap: compute gnulib_extra_files after updating build_aux
> bootstrap: preserve git whitelist item sorting
> maint.mk: Don't trigger sc_space_tab check.
> areadlink, areadlinkat: rewrite in terms of careadlinkat
> autoupdate
> wmemchr, wcschr, wcsrchr, wcspbrk, wcsstr: Avoid errors in C++ mode.
> wcpcpy, wcpncpy: Ensure declaration on glibc >= 2.13 systems.
I'm also trying to patch 'man gitignore' with things I've learned
from this exercise: http://marc.info/?t=130203248100003&r=1&w=2
.gitignore | 12 +++++-----
.gnulib | 2 +-
bootstrap | 46 +++++++++++++++++++++++++++++--------------
m4/virt-compile-warnings.m4 | 8 +++---
4 files changed, 42 insertions(+), 26 deletions(-)
diff --git a/.gitignore b/.gitignore
index 24c96b5..35dbdde 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,3 @@
-!/m4/virt-*.m4
-!/po/*.po
-!/po/POTFILES.in
-!/po/libvirt.pot
*#*#
*.#*#
*.a
@@ -46,11 +42,11 @@
/libvirt.spec
/ltconfig
/ltmain.sh
-/m4/
+/m4/*
/maint.mk
/mingw32-libvirt.spec
/mkinstalldirs
-/po/
+/po/*
/proxy/
/src/libvirt_iohelper
/tests/*.log
@@ -67,3 +63,7 @@ results.log
stamp-h
stamp-h.in
stamp-h1
+!/m4/virt-*.m4
+!/po/*.po
+!/po/POTFILES.in
+!/po/libvirt.pot
diff --git a/.gnulib b/.gnulib
index dec3475..f796520 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit dec3475763be252103922a887920012eeb32dc26
+Subproject commit f79652003534e496bca1e49922ca521f12ca8051
diff --git a/bootstrap b/bootstrap
index f004ad3..7cbb5dc 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
-scriptversion=2011-03-03.12; # UTC
+scriptversion=2011-04-05.18; # UTC
# Bootstrap this package from checked-out sources.
@@ -130,18 +130,7 @@ source_base=lib
m4_base=m4
doc_base=doc
tests_base=tests
-
-# Extra files from gnulib, which override files from other sources.
-gnulib_extra_files="
- $build_aux/install-sh
- $build_aux/missing
- $build_aux/mdate-sh
- $build_aux/texinfo.tex
- $build_aux/depcomp
- $build_aux/config.guess
- $build_aux/config.sub
- doc/INSTALL
-"
+gnulib_extra_files=''
# Additional gnulib-tool options to use. Use "\newline" to break lines.
gnulib_tool_option_extras=
@@ -229,6 +218,18 @@ case "$0" in
*) test -r "$0.conf" && . ./"$0.conf" ;;
esac
+# Extra files from gnulib, which override files from other sources.
+test -z "${gnulib_extra_files}" && \
+ gnulib_extra_files="
+ $build_aux/install-sh
+ $build_aux/missing
+ $build_aux/mdate-sh
+ $build_aux/texinfo.tex
+ $build_aux/depcomp
+ $build_aux/config.guess
+ $build_aux/config.sub
+ doc/INSTALL
+"
if test "$vc_ignore" = auto; then
vc_ignore=
@@ -278,14 +279,29 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
exit 1
fi
+# Ensure that lines starting with ! sort last, per gitignore conventions
+# for whitelisting exceptions after a more generic blacklist pattern.
+sort_patterns() {
+ sort -u "$@" | sed '/^!/ {
+ H
+ d
+ }
+ $ {
+ P
+ x
+ s/^\n//
+ }'
+}
+
# If $STR is not already on a line by itself in $FILE, insert it,
# sorting the new contents of the file and replacing $FILE with the result.
insert_sorted_if_absent() {
file=$1
str=$2
test -f $file || touch $file
- echo "$str" | sort -u - $file | cmp - $file > /dev/null \
- || echo "$str" | sort -u - $file -o $file \
+ echo "$str" | sort_patterns - $file | cmp - $file > /dev/null \
+ || { echo "$str" | sort_patterns - $file > $file.bak \
+ && mv $file.bak $file; } \
|| exit 1
}
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 819da8f..3ca0346 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -15,7 +15,7 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
case "$enable_compile_warnings" in
no)
try_compiler_flags=""
- ;;
+ ;;
yes|minimum|maximum|error)
# List of warnings that are not relevant / wanted
@@ -117,10 +117,10 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
then
gl_WARN_ADD([-Werror])
fi
- ;;
+ ;;
*)
- AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
- ;;
+ AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
+ ;;
esac
WARN_LDFLAGS=$WARN_CFLAGS
--
1.7.4
13 years, 7 months
[libvirt] [PATCH] docs: add an IPv6 address to network XML examples
by Laine Stump
It was just pointed out that, although I added documentation for the
IPv6 additions to the network XML, I neglected to use those additions
in the xamples. This patch adds an IPv6 address to each of the
examples except for the "default" network, since that is a faithful
reproduction of the default network config that's automatically
installed, which doesn't include any IPv6 address (for good reason -
because there is no such thing as IPv6 NAT, there is no one IPv6
address that would work for all installations).
---
docs/formatnetwork.html.in | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in
index c6969eb..589aaff 100644
--- a/docs/formatnetwork.html.in
+++ b/docs/formatnetwork.html.in
@@ -121,6 +121,7 @@
<host mac="00:16:3e:3e:a9:1a" name="bar.example.com" ip="192.168.122.11" />
</dhcp>
</ip>
+ <ip family="ipv6" address="2001:8794:ca2:2::1" prefix="64" />
</network></pre>
<dl>
@@ -226,6 +227,7 @@
<range start="192.168.122.2" end="192.168.122.254" />
</dhcp>
</ip>
+ <ip family="ipv6" address="2001:8794:ca2:2::1" prefix="64" />
</network></pre>
<h3><a name="examplesRoute">Routed network config</a></h3>
@@ -249,6 +251,7 @@
<range start="192.168.122.2" end="192.168.122.254" />
</dhcp>
</ip>
+ <ip family="ipv6" address="2001:8794:ca2:2::1" prefix="64" />
</network></pre>
<h3><a name="examplesPrivate">Isolated network config</a></h3>
@@ -270,6 +273,7 @@
<range start="192.168.152.2" end="192.168.152.254" />
</dhcp>
</ip>
+ <ip family="ipv6" address="2001:8794:ca2:3::1" prefix="64" />
</network></pre>
</body>
--
1.7.3.4
13 years, 7 months
[libvirt] [PATCH] [RFC] PPC Linux: Fix some problems
by Stefan Berger
The following patch fixes some problems on powerpc Linux machines when
trying to start an x86-based VM using qemu.
In the order as the hunks appear the fix the following problems:
- Qemu on (my) powerpc machine for some reason takes a long time for it
to create its UnixIO socket. It's like 9 seconds or so and probably more
once on a busy system. So increase the timeout for waiting for that
socket to appear.
- VM saved images written on an x86 host have a header in little endian
format. So, when checking the 32 bit int for the header version and if
the version is out-of-range swap the endianess of the header and try
again and only then fail. This also then works when the big endian host
has written the header in big endian format and now the VM is supposed
to resume on a little endina host.
- Setting the CPU affinity doesn't seem to work at all on (my) PPC host.
So rather than failing the start of a VM when nodeGetInfo/virNodeGetInfo
fail, make the setting of the CPU affinity pass on powerpc machines so
the VM at least starts.
Signed-off-by: Stefan Berger <stefanb(a)linux.vnet.ibm.com>
---
src/qemu/qemu_driver.c | 15 +++++++++++++++
src/qemu/qemu_monitor.c | 4 ++++
src/qemu/qemu_process.c | 10 +++++++++-
3 files changed, 28 insertions(+), 1 deletion(-)
Index: libvirt/src/qemu/qemu_monitor.c
===================================================================
--- libvirt.orig/src/qemu/qemu_monitor.c
+++ libvirt/src/qemu/qemu_monitor.c
@@ -249,7 +249,11 @@ qemuMonitorOpenUnix(const char *monitor)
{
struct sockaddr_un addr;
int monfd;
+#if defined(__powerpc64__) || defined(__powerpc__)
+ int timeout = 30; /* In seconds */
+#else
int timeout = 3; /* In seconds */
+#endif
int ret, i = 0;
if ((monfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
Index: libvirt/src/qemu/qemu_driver.c
===================================================================
--- libvirt.orig/src/qemu/qemu_driver.c
+++ libvirt/src/qemu/qemu_driver.c
@@ -43,6 +43,7 @@
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <sys/un.h>
+#include <byteswap.h>
#include "qemu_driver.h"
@@ -1882,6 +1883,15 @@ struct qemud_save_header {
int unused[15];
};
+static inline void
+bswap_header(struct qemud_save_header *hdr) {
+ hdr->version = bswap_32(hdr->version);
+ hdr->xml_len = bswap_32(hdr->xml_len);
+ hdr->was_running = bswap_32(hdr->was_running);
+ hdr->compressed = bswap_32(hdr->compressed);
+}
+
+
/* return -errno on failure, or 0 on success */
static int
qemuDomainSaveHeader(int fd, const char *path, char *xml,
@@ -3091,6 +3101,11 @@ qemuDomainSaveImageOpen(struct qemud_dri
}
if (header.version > QEMUD_SAVE_VERSION) {
+ /* try to convert endianess */
+ bswap_header(&header);
+ }
+
+ if (header.version > QEMUD_SAVE_VERSION) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("image version is not supported (%d > %d)"),
header.version, QEMUD_SAVE_VERSION);
Index: libvirt/src/qemu/qemu_process.c
===================================================================
--- libvirt.orig/src/qemu/qemu_process.c
+++ libvirt/src/qemu/qemu_process.c
@@ -1239,7 +1239,11 @@ qemuProcessInitCpuAffinity(virDomainObjP
VIR_DEBUG0("Setting CPU affinity");
if (nodeGetInfo(NULL, &nodeinfo) < 0)
+#if defined (__powerpc64__) || defined (__powerpc__)
+ return 0;
+#else
return -1;
+#endif
/* setaffinity fails if you set bits for CPUs which
* aren't present, so we have to limit ourselves */
@@ -1295,7 +1299,11 @@ qemuProcessSetVcpuAffinites(virConnectPt
int vcpu, cpumaplen, hostcpus, maxcpu;
if (virNodeGetInfo(conn, &nodeinfo) != 0) {
- return -1;
+#if defined (__powerpc64__) || defined (__powerpc__)
+ return 0;
+#else
+ return -1;
+#endif
}
if (!def->cputune.nvcpupin)
13 years, 7 months
[libvirt] qemu: Add timeout for monitor to avoid virsh getting stuck when monitor gets die.
by Mark Wu
Hello Guys,
When the qemu process becomes hung, virsh will get stuck on the hung
guest and can't move forward. It can be reproduced by the following steps:
1. setup a virt guest with qemu-kvm, and start it
2. stop qemu process with following:
kill -STOP `ps aux | grep qemu | grep -v grep | awk '{print $2}'`
3. run the following command:
virsh list
I think we can add a timeout for qemu monitor to resolve this problem:
using virCondWaitUntil instead of virCondWait in qemuMonitorSend. What's
your opinions?
Thanks!
13 years, 7 months
[libvirt] ESX network functionality
by James Barkley
Greetings:
I've added code to the ESX driver to support some basic network
functionality. I'm pretty new to this list, so please tell me how to proceed
with code review and patch submission (yes I've read the contributor
guidelines on the wiki). It seems like people are emailing a patch file for
every file they've changed, each in separate emails with [1 of N] in the
subject, is that right? Or is it better to paste in code, get some feedback,
and eventually attach the patch to the bug tracker item?
I've updated the code for the ESX driver to be able to handle the following
functions :
- virNetworkLookupByName
- virConnectNumOfDefinedNetworks
- virConnectNumOfNetworks
- virConnectListNetworks
I basically mapped the VMware Managed Object Reference for networks into a
few data structures and added the following functions to the internal driver
API:
- esxNumOfNetworks
- esxListNetworks
- esxNumOfDefinedNetworks
- esxNetworkLookupByName
- esxVI_LookupNetworkList
- esxVI_LookupNetworkByName
These functions were modeled after existing functions from the domain and
storage libraries. The following files were touched:
- esx_network_driver.c
- esx_vi.c
- esx_vi.h
- esx_vi_generator.input
thanks,
-jb
13 years, 7 months
[libvirt] virsh: Can't create .vmdk virtual disk over vCenter while over ESX it works well
by computernews@rambler.ru
Hello,
I am trying to create the virtual disk over "virsh". My target is the
ESX server that is a part of the vCenter. That is why I connect to it
using the vpx://-like URL. The connection itself is being established
correctly. Commands like "list --all", "dumpxml <machine>" "vol-dumpxml
<volume>" work perfectly well. What doesn't work for me at the moment is
"vol-create --file <xml_file> --pool <my_pool>". I would suspect that I
am passing some parameters incorrectly and would be digging more into a
documentation but I am getting the following response from the server:
|
virsh # vol-create --file vadp4.xml --pool "iscsi-esx4-1"
error: Failed to create vol from vadp4.xml
error: internal error Could not create volume: NotImplemented - Der
angeforderte
Vorgang wird vom Server nicht implementiert.|
I have to admit that the very same command worked if I connect to ESX
server directly (using esx://-like URL).
My question is if it is planned to implement the virtual disk creation
in case of vCentere is involved ?
Reagrds
13 years, 7 months
[libvirt] [PATCH 0/3] reattach pci devices when qemuPrepareHostdevPCIDevices() failed
by Wen Congyang
When I try to attach a pci device to guest OS, libvirtd resets the pci failed.
But I can not use this pci device after attaching pci device failed. I must
rollback the operation by hand.
I think libvirtd should auto rollback the operation when it failed.
Wen Congyang (3):
remove devices from driver->activePciHostdevs when
qemuPrepareHostdevPCIDevices() failed
reattach pci device when pciBindDeviceToStub() failed
reattach pci devices when qemuPrepareHostdevPCIDevices() failed
src/qemu/qemu_hostdev.c | 33 ++++++++++++++---
src/util/pci.c | 90 +++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 107 insertions(+), 16 deletions(-)
13 years, 7 months
[libvirt] [PATCH] init path to NULL
by Wen Congyang
This bug was introduce by commit 57162db8, and it will cause libvirtd crashed.
---
src/util/pci.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/util/pci.c b/src/util/pci.c
index 6ed96f4..a7b8caa 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -1180,7 +1180,7 @@ pciWaitForDeviceCleanup(pciDevice *dev, const char *matcher)
static char *
pciReadDeviceID(pciDevice *dev, const char *id_name)
{
- char *path;
+ char *path = NULL;
char *id_str;
if (pciDeviceFile(&path, dev->name, id_name) < 0) {
--
1.7.1
13 years, 7 months