[libvirt] [PATCH] docs: don't ignore virEvent API
by Eric Blake
Commit 6094ad7b (0.9.3 release) promoted several functions from
internal to public, but forgot to fix the documentation generator
to provide details about those functions.
For an example of what this fixes, look at:
file:///path/to/libvirt/docs/html/libvirt-libvirt.html#virEventAddHandle
before and after the patch.
* docs/apibuild.py (ignored_functions): Don't ignore functions
that were turned into official API.
* src/util/virevent.c: Fix comments to pass through parser.
---
In response to my concerns raised on one of Claudio's patches:
https://www.redhat.com/archives/libvir-list/2013-February/msg00048.html
docs/apibuild.py | 6 -----
src/util/virevent.c | 78 +++++++++++++++++++++++++++++++++++------------------
2 files changed, 52 insertions(+), 32 deletions(-)
diff --git a/docs/apibuild.py b/docs/apibuild.py
index e5cbbe8..2bdbf2d 100755
--- a/docs/apibuild.py
+++ b/docs/apibuild.py
@@ -64,12 +64,6 @@ ignored_functions = {
"virDomainMigratePrepareTunnel3": "private function for tunnelled migration",
"virDrvSupportsFeature": "private function for remote access",
"DllMain": "specific function for Win32",
- "virEventAddHandle": "internal function in virevent.c",
- "virEventUpdateHandle": "internal function in virevent.c",
- "virEventRemoveHandle": "internal function in virevent.c",
- "virEventAddTimeout": "internal function in virevent.c",
- "virEventUpdateTimeout": "internal function in virevent.c",
- "virEventRemoveTimeout": "internal function in virevent.c",
"virTypedParameterArrayValidate": "internal function in virtypedparam.c",
"virTypedParameterAssign": "internal function in virtypedparam.c",
"virTypedParameterAssignFromStr": "internal function in virtypedparam.c",
diff --git a/src/util/virevent.c b/src/util/virevent.c
index 6900011..886cb6d 100644
--- a/src/util/virevent.c
+++ b/src/util/virevent.c
@@ -1,7 +1,7 @@
/*
* virevent.c: event loop for monitoring file handles
*
- * Copyright (C) 2007, 2011 Red Hat, Inc.
+ * Copyright (C) 2007, 2011, 2013 Red Hat, Inc.
* Copyright (C) 2007 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -38,20 +38,25 @@ static virEventUpdateTimeoutFunc updateTimeoutImpl = NULL;
static virEventRemoveTimeoutFunc removeTimeoutImpl = NULL;
/**
- * virEventAddHandle: register a callback for monitoring file handle events
+ * virEventAddHandle:
*
* @fd: file handle to monitor for events
* @events: bitset of events to watch from virEventHandleType constants
* @cb: callback to invoke when an event occurs
* @opaque: user data to pass to callback
+ * @ff: callback to free opaque when handle is removed
*
- * returns -1 if the file handle cannot be registered, 0 upon success
+ * Register a callback for monitoring file handle events.
+ *
+ * Returns -1 if the file handle cannot be registered, 0 upon success
*/
-int virEventAddHandle(int fd,
- int events,
- virEventHandleCallback cb,
- void *opaque,
- virFreeCallback ff) {
+int
+virEventAddHandle(int fd,
+ int events,
+ virEventHandleCallback cb,
+ void *opaque,
+ virFreeCallback ff)
+{
if (!addHandleImpl)
return -1;
@@ -59,25 +64,33 @@ int virEventAddHandle(int fd,
}
/**
- * virEventUpdateHandle: change event set for a monitored file handle
+ * virEventUpdateHandle:
*
* @watch: watch whose file handle to update
* @events: bitset of events to watch from virEventHandleType constants
*
+ * Change event set for a monitored file handle.
+ *
* Will not fail if fd exists
*/
-void virEventUpdateHandle(int watch, int events) {
+void
+virEventUpdateHandle(int watch, int events)
+{
updateHandleImpl(watch, events);
}
/**
- * virEventRemoveHandle: unregister a callback from a file handle
+ * virEventRemoveHandle:
*
* @watch: watch whose file handle to remove
*
- * returns -1 if the file handle was not registered, 0 upon success
+ * Unregister a callback from a file handle.
+ *
+ * Returns -1 if the file handle was not registered, 0 upon success.
*/
-int virEventRemoveHandle(int watch) {
+int
+virEventRemoveHandle(int watch)
+{
if (!removeHandleImpl)
return -1;
@@ -85,22 +98,27 @@ int virEventRemoveHandle(int watch) {
}
/**
- * virEventAddTimeout: register a callback for a timer event
+ * virEventAddTimeout:
*
* @timeout: time between events in milliseconds
* @cb: callback to invoke when an event occurs
* @opaque: user data to pass to callback
+ * @ff: callback to free opaque when timeout is removed
+ *
+ * Register a callback for a timer event.
*
* Setting timeout to -1 will disable the timer. Setting the timeout
* to zero will cause it to fire on every event loop iteration.
*
- * returns -1 if the timer cannot be registered, a positive
- * integer timer id upon success
+ * Returns -1 if the timer cannot be registered, a positive
+ * integer timer id upon success.
*/
-int virEventAddTimeout(int timeout,
- virEventTimeoutCallback cb,
- void *opaque,
- virFreeCallback ff) {
+int
+virEventAddTimeout(int timeout,
+ virEventTimeoutCallback cb,
+ void *opaque,
+ virFreeCallback ff)
+{
if (!addTimeoutImpl)
return -1;
@@ -108,28 +126,36 @@ int virEventAddTimeout(int timeout,
}
/**
- * virEventUpdateTimeoutImpl: change frequency for a timer
+ * virEventUpdateTimeout:
*
* @timer: timer id to change
- * @frequency: time between events in milliseconds
+ * @timeout: time between events in milliseconds
+ *
+ * Change frequency for a timer.
*
* Setting frequency to -1 will disable the timer. Setting the frequency
* to zero will cause it to fire on every event loop iteration.
*
* Will not fail if timer exists
*/
-void virEventUpdateTimeout(int timer, int timeout) {
+void
+virEventUpdateTimeout(int timer, int timeout)
+{
updateTimeoutImpl(timer, timeout);
}
/**
- * virEventRemoveTimeout: unregister a callback for a timer
+ * virEventRemoveTimeout:
*
* @timer: the timer id to remove
*
- * returns -1 if the timer was not registered, 0 upon success
+ * Unregister a callback for a timer.
+ *
+ * Returns -1 if the timer was not registered, 0 upon success.
*/
-int virEventRemoveTimeout(int timer) {
+int
+virEventRemoveTimeout(int timer)
+{
if (!removeTimeoutImpl)
return -1;
--
1.8.1
11 years, 9 months
[libvirt] [Sheepdog][Libvirt]Boot VMs from sheepdog volumes error
by harryxiyou
Hi all,
I wanna boot VMs from sheepdog volumes so i do according to
https://github.com/collie/sheepdog/wiki/Libvirt
However, some errors happened to me like following.
$ ./virsh create os.xml
error:create domain from os.xml failure
error:(domain_definition):14: Premature end of data in tag domain line 1
(null)
^
$ cat os.xml
<domain type='qemu'>
<name>testvm</name>
<memory>1048576</memory>
<os>
<type arch='x86_64'>hvm</type>
</os>
<devices>
<disk type='network'>
<source protocol="sheepdog" name="testvdi"/>
<target dev='hda' bus='ide'/>
</disk>
<graphics type='vnc' port='-1' autoport='yes'/>
</devices>
Could anyone give me some help? Thanks.
--
Thanks
Harry Wei
11 years, 9 months
[libvirt] [PATCH] maint: update to latest gnulib
by Eric Blake
CVE-2013-0242 in glibc's regex() can cause a DoS in any daemon
that runs a regex search on user input while in a multibyte locale.
I'm not sure how hard it would be to trigger such a setup for
libvirtd, but rather than risk things, we can avoid the issue:
gnulib has worked around the problem, and by updating to the latest
gnulib, we can avoid the bug even on platforms where glibc has yet
to be patched.
* .gnulib: Update to latest, for various fixes, including regex.
* bootstrap: Resync from upstream.
---
* .gnulib 61c7b1e...a0b25da (45):
> regex: avoid infinite configure test
> openpty: fix bug where HAVE_OPENPTY wasn't defined
> sys_time: port to Solaris 2.6
> regex: test for buffer overrun
> regex: fix buffer overrun in regexp matcher
> mountlist: don't consider "devtmpfs" as dummy
> futimens-tests, utimens-tests: Depend on gettext.
> test-getpeername: fix typo
> bootstrap: remove the need for a sorted .gitignore
> readlinkat: don't depend on gl_FUNC_OPENAT
> statat: new module, split out from fstatat
> autoupdate
> Fix typo in previous change, by including <unistd.h>.
> tests: don't assume fd 99 is closed
> Fix ChangeLog typo.
> stpncpy: port to OS X 10.8
> In intro, say only latest mingw is tested.
> unistd: port to recent mingw
> Fix typo in comment.
> largefile: port better to Mac OS X 10.5
> doc: clarify -Werror
> stdint: fix build with Android's Bionic fox x86
> net_if-tests: port to Solaris 7 + GCC 3.4.6
> net_if-tests: port to older Solaris
> system-quote-tests: port to older Solaris
> c-xvasprintf etc.: fix link errors on older Solaris
> locale: port to Solaris 2.6 and 7 + GNU gettext
> autoupdate
> stdlib: port to Solaris 2.6
> Fix misspellings of "occurred".
> autoupdate
> autoupdate
> doc: update main copyright year
> doc: improve ISO 8601 discussion
> doc: avoid small caps
> regex: conform to strict C
> gnulib-tool: fix incompatibility with autopoint 0.18.2
> autoupdate
> fprintftime: bring back and reword fwrite comment
> autoupdate
> stdio: remove now-unnecessary stdio.c
> unicodeio: depend on stdio, not ignore-value
> fprintftime: depend on stdio, not ignore-value
> stdint-tests: Fix expanded-before-required-warning. * modules/stdint-tests (Depends-on): Use AC_REQUIRE.
> fwrite: silence __wur only for older glibc versions
.gnulib | 2 +-
bootstrap | 44 ++++++++++++++++++++++----------------------
2 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/.gnulib b/.gnulib
index 61c7b1e..a0b25da 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 61c7b1e32e11e9e40b4d59ab888a807620befcd3
+Subproject commit a0b25daf001cb1a0352f329e2b5e1640acc88541
diff --git a/bootstrap b/bootstrap
index 012907a..bee7765 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
-scriptversion=2012-12-28.10; # UTC
+scriptversion=2013-01-20.16; # UTC
# Bootstrap this package from checked-out sources.
@@ -306,34 +306,34 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
die "Bootstrapping from a non-checked-out distribution is risky."
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//
- }' | sed '/^$/d'
+# Strip blank and comment lines to leave significant entries.
+gitignore_entries() {
+ sed '/^#/d; /^$/d' "$@"
}
-# 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() {
+# If $STR is not already on a line by itself in $FILE, insert it at the start.
+# Entries are inserted at the start of the ignore list to ensure existing
+# entries starting with ! are not overridden. Such entries support
+# whitelisting exceptions after a more generic blacklist pattern.
+insert_if_absent() {
file=$1
str=$2
test -f $file || touch $file
- echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \
- || { echo "$str" | sort_patterns - $file > $file.bak \
- && mv $file.bak $file; } \
- || die "insert_sorted_if_absent $file $str: failed"
+ test -r $file || die "Error: failed to read ignore file: $file"
+ duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
+ if [ "$duplicate_entries" ] ; then
+ die "Error: Duplicate entries in $file: " $duplicate_entries
+ fi
+ linesold=$(gitignore_entries $file | wc -l)
+ linesnew=$(echo "$str" | gitignore_entries - $file | sort -u | wc -l)
+ if [ $linesold != $linesnew ] ; then
+ { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
+ || die "insert_if_absent $file $str: failed"
+ fi
}
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
-# insert_sorted_if_absent.
+# insert_if_absent.
insert_vc_ignore() {
vc_ignore_file="$1"
pattern="$2"
@@ -344,7 +344,7 @@ insert_vc_ignore() {
# .gitignore entry.
pattern=$(echo "$pattern" | sed s,^,/,);;
esac
- insert_sorted_if_absent "$vc_ignore_file" "$pattern"
+ insert_if_absent "$vc_ignore_file" "$pattern"
}
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
--
1.8.1
11 years, 9 months
[libvirt] These patches needed to mount the securityfs in containers.
by Daniel J Walsh
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Simple patch to make sure /sys/kernel/security is mounted inside the
container. Systemd attempts to use/mount this file system if it is not present.
One of these days I will figure out how to merge patches.
securityfs has to be mounted after /sys...
Also want to mount it readonly.
(Sent patches to wrong list, originally)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlEL6yUACgkQrlYvE4MpobOTuwCfWkrq/wiPQKPG4y69fIhjDqqr
riQAnis3qdRKzRJIpB4PbPGXTgR3nrKt
=D+T5
-----END PGP SIGNATURE-----
11 years, 9 months
[libvirt] This patch adds the label to lxc-enter-namespace
by Daniel J Walsh
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
(2nd pass)
lxc-enter-namespace allows a process from outside a container to start a
process inside a container. One problem with the current code is the process
running within the container would run with the label of the process that
created it.
For example if the admin process is running as unconfined_t and executes the
following command
# virsh -c lxc:/// lxc-enter-namespace --nolabel dan -- /bin/ps -eZ
LABEL PID TTY TIME CMD
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 1 pts/0 00:00:00 systemd
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 3 pts/1 00:00:00 sh
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 24 ? 00:00:00 systemd-journal
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 29 ? 00:00:00 dhclient
staff_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 47 ? 00:00:00 ps
Note the ps command is running as unconfined_t, After this patch,
virsh -c lxc:/// lxc-enter-namespace dan -- /bin/ps -eZ
LABEL PID TTY TIME CMD
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 1 pts/0 00:00:00 systemd
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 3 pts/1 00:00:00 sh
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 24 ? 00:00:00 systemd-journal
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 32 ? 00:00:00 dhclient
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 38 ? 00:00:00 ps
I also add a --nolabel command to virsh, which can go back to the original
behaviour.
virsh -c lxc:/// lxc-enter-namespace --nolabel dan -- /bin/ps -eZ
LABEL PID TTY TIME CMD
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 1 pts/0 00:00:00 systemd
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 3 pts/1 00:00:00 sh
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 24 ? 00:00:00 systemd-journal
system_u:system_r:svirt_lxc_net_t:s0:c0.c1023 32 ? 00:00:00 dhclient
staff_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 37 ? 00:00:00 ps
Everything seems to be working perfectly now.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlEC320ACgkQrlYvE4MpobPDjwCfTLjGarwDOLA333vE+XVp0Zj2
LYkAn3WGX3h309/kJejbE3uvXnIUCKJV
=rwfM
-----END PGP SIGNATURE-----
11 years, 9 months
[libvirt] [PATCH] spec: Fix minor changelog issues
by Jiri Denemark
When a changelog entry references an RPM macro, % needs to be escaped so
that it does not appear expanded in package changelog.
Wed Jul 5 2011 is incorrect since Jul 5 was Tuesday. Let's suppose it
was a result of incomplete update (Tue -> Wed) and change Jul 5 to Jul 6.
---
libvirt.spec.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 8df908d..8b2458d 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -2309,7 +2309,7 @@ fi
* Fri Apr 3 2009 Daniel Veillard <veillard(a)redhat.com> - 0.6.2-1
- release of 0.6.2
-* Fri Mar 4 2009 Daniel Veillard <veillard(a)redhat.com> - 0.6.1-1
+* Fri Mar 6 2009 Daniel Veillard <veillard(a)redhat.com> - 0.6.1-1
- release of 0.6.1
* Sat Jan 31 2009 Daniel Veillard <veillard(a)redhat.com> - 0.6.0-1
@@ -2448,7 +2448,7 @@ fi
- it's pkgconfig not pgkconfig !
* Mon Nov 6 2006 Daniel Veillard <veillard(a)redhat.com> 0.1.8-2
-- fixing spec file, added %dist, -devel requires pkgconfig and xen-devel
+- fixing spec file, added %%dist, -devel requires pkgconfig and xen-devel
- Resolves: rhbz#202320
* Mon Oct 16 2006 Daniel Veillard <veillard(a)redhat.com> 0.1.8-1
--
1.8.1.2
11 years, 9 months
[libvirt] [PATCH 0/7] documentation improvements - again
by Claudio Bley
Hi.
The first two patches are aimed at avoiding generation of empty
argument description lists, which might happen if a function has
no documentation for some argument or its return type.
This was happening with virTypedParams* functions (see
https://www.redhat.com/archives/libvir-list/2013-January/msg01428.html)
Patch #3 is just a small cleanup, since a table is not the right thing
to use and it looks better in some circumstances.
Patch #4 sports processing of code blocks embedded into comments.
Basically, it is similar to markdown syntax, except that you only need
to indent your code with 2 spaces.
Patch #5 prepares for the later patches being able to distinguish
between different <pre> blocks.
Patch #6 and #7 are pretty much self explanatory, I guess.
Note, that SHJS's license is GPLv3.
Claudio Bley (7):
docs: don't write out empty info attributes for function arguments
docs: only generate function argument info for args with a
description
docs: use a div instead of a 3 column table for undisclosed notices
docs: process code blocks similar to markdown
docs: add class "description" to div's containing descriptions
docs: define style of code blocks inside descriptions
docs: syntax highlight code blocks using SHJS
docs/apibuild.py | 8 +-
docs/libvirt.css | 8 ++
docs/newapi.xsl | 209 +++++++++++++++++++++++++++++--------------------
docs/page.xsl | 5 +-
docs/sh_c.min.js | 1 +
docs/sh_emacs.min.css | 1 +
docs/sh_main.min.js | 4 +
7 files changed, 148 insertions(+), 88 deletions(-)
create mode 100644 docs/sh_c.min.js
create mode 100644 docs/sh_emacs.min.css
create mode 100644 docs/sh_main.min.js
--
1.7.9.5
11 years, 9 months
[libvirt] Canonical citation for Libvirt
by Lempereur, Brett
Hi,
Is there a canonical paper I can cite for Libvirt in academic publications? The best I've found so far is
Bolt, M., Birkenheuer, G., Niehörster, O., & Brinkmann, A. (2010). Non-Intrusive Virtualization Management using Libvirt. Proceedings of the 2nd Design, Automation, and Test in Europe Conference (DATE'10) (pp. 1-6). Dresden, Germany: IEEE. Retrieved from http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=5457142&isnumber=...
A lot of frameworks used in academic work have sort of "standard" citations, people that use the framework tend to cite that paper. The authors get citations, we get cool frameworks, everyone wins.
Brett
________________________________
Important Notice: the information in this email and any attachments is for the sole use of the intended recipient(s). If you are not an intended recipient, or a person responsible for delivering it to an intended recipient, you should delete it from your system immediately without disclosing its contents elsewhere and advise the sender by returning the email or by telephoning a number contained in the body of the email. No responsibility is accepted for loss or damage arising from viruses or changes made to this message after it was sent. The views contained in this email are those of the author and not necessarily those of Liverpool John Moores University.
11 years, 9 months
[libvirt] [Libvirt][Sheepdog]Sheepdog pool/volume storage driver for libvirt problem
by harryxiyou
Hi Sebastian, Morita and other developers,
I have studied Sheepdog pool/volume storage driver for libvirt and i have
following questions. Please give me some suggestions. Thanks in advance ;-)
1, In libvirt/src/storage/storage_backend_sheepdog.c, i just find we realized
create/delete/resize volume(send these parameters to let libvirtd receive and
execute them). I cannot find the operations about snapshot, such as
creating/deleting
snapshot. I cannot also find the operations about opening/closing cache.
2, In the func create/delete/resize volume, we call func
'virCommandRun(cmd, NULL);'
to run these commands, which i think the func send these parameters to daemon
libvirtd and libvirtd send these parameters to Sheepdog, then Sheepdog
executes them, right?
3, In func "virStorageBackendSheepdogCreateVol", it composes cmd like this
"virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "create",
vol->name, NULL);"
then send create parameters. When Sheepdog receive these parameters,
how Sheepdog
create this volume? I find Sheepdog create a volume like this.
$ qemu-img create sheepdog:Alice 256G
4, What are the essences of func "virStorageBackendSheepdogRefreshPool" and
"virStorageBackendSheepdogRefreshVol"? In func
"virStorageBackendSheepdogCreateVol",
after craete volume operations, we call
"virStorageBackendSheepdogRefreshVol". But in func
"virStorageBackendSheepdogDeleteVol" and
"virStorageBackendSheepdogResizeVol", we
do not call "virStorageBackendSheepdogRefreshVol", why?
5, Actually, i am not clear about how QEMU receive these parameters
(like create/delete/snapshot,
etc) and execute the real jobs?
Thanks for anyone's suggestions ;-)
--
Thanks
Harry Wei
11 years, 9 months