Eric Blake | 22 Nov 07:03 2014

[libvirt] ideas on virDomainListBlockStats for allocation numbers

Based on Dan's recommendation [1], I'm looking at enhancing
virDomainListBlockStats to report the allocation numbers of a backing
file during a virDomainBlockCommit operation.  Getting the information
from qemu is not difficult, but the question is how should it be
represented to the end user.  See below for my ideas, and I'm open to


Some background - highest allocation is mainly applicable to using a
qcow2 format on top of a raw block device (that's the only time that
libvirt reports a different number based on querying qemu, other file
formats just go off of stat information), so even setting this up to
test can be interesting.  Also, while qemu reports wr_highest_offset
during 'query-blockstats', a disk has to actually have write activity
performed during that given qemu process before the offset will be
accurate.  It took me a while to figure this out; when I set up a dummy
guest with no OS (and therefore no writes), the offset being reported
was 0 even when I had used qemu-io to poke data into the file prior to
starting qemu.  I finally figured out that metadata writes also count as
part of the highest offset visited; so using
'blockdev-snapshot-internal-sync' followed by
'blockdev-snapshot-delete-internal-sync' is sufficient to cause qemu to
write metadata and therefore reveal the highest offset.

So I set up a playground to test things, where I first created two 1G
partitions, then use this script to re-create a guest each time I want
to reset things:

(Continue reading)

Tomoki Sekiyama | 22 Nov 02:28 2014

[libvirt] [libvirt-python PATCH v2] override: Implement bindings for virDomainGetFSInfo as domain.fsInfo

Implement the function which returns a list of tuples, that contains members
of virDomainFSInfo struct.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama <at>>
---             |    5 +++
 libvirt-override-api.xml |    6 ++++
 libvirt-override.c       |   70 ++++++++++++++++++++++++++++++++++++++++++++++            |    5 +++
 4 files changed, 85 insertions(+), 1 deletion(-)

diff --git a/ b/
index c66c6d4..20df54f 100755
--- a/
+++ b/
 <at>  <at>  -476,6 +476,7  <at>  <at>  skip_impl = (
+    'virDomainGetFSInfo',

 lxc_skip_impl = (
 <at>  <at>  -586,6 +587,7  <at>  <at>  skip_function = (

     'virNetworkDHCPLeaseFree', # only useful in C, python code uses list
     'virDomainStatsRecordListFree', # only useful in C, python uses dict
+    'virDomainFSInfoFree', # only useful in C, python code uses list

(Continue reading)

Tomoki Sekiyama | 22 Nov 02:27 2014

[libvirt] [PATCH v3 0/5] Guest filesystem information API


This is v3 of patchset to add virDomainGetFSInfo API.

* changes in v2->v3:
 -[all] squashed fixup patches by John Ferlan (thanks!)
 -[all] added 'ndevAlias' filed instead of NULL-termination of devAlias
 -[all] renamed 'type' field to 'fstype' to avoid wireshark error
 -[2/5] use  <at> acl: domain:fs_freeze
 (v2: )

* changes in v1->v2:
 -[all] removed redundant NULL element at the last of returned info array
 -[3/5] make error messages in qemu_agent.c consistent with other commands
 -[4/5] added a test case for 2 items in info->devAliases
 -[5/5] added a pod document for virsh domfsinfo command
 (v1: )

* summary
  This series implements a new virDomainGetFSInfo API, that returns a list of
  mounted filesystems information in the guest, collected via the guest agent.

  The returned info contains mountpoints and disk device alias named in
  libvirt, so we can know which mountpoints should be frozen by
  virDomainFSFreeze to take snapshots of a part of disks.

Tomoki Sekiyama (5):
      Implement public API for virDomainGetFSInfo
      remote: Implement the remote protocol for virDomainGetFSInfo
(Continue reading)

Eric Blake | 22 Nov 01:12 2014

[libvirt] [PATCH] dbus: fix arrays of bools

Commit 2aa167ca tried to fix the DBus interaction code to allow
callers to use native types instead of 4-byte bools.  But in
fixing the issue, I missed the case of an arrayref; Conrad Meyer
shows the following valid complaint issued by clang:

  CC       util/libvirt_util_la-virdbus.lo
util/virdbus.c:956:13: error: cast from 'bool *' to 'dbus_bool_t *' (aka 'unsigned int *') increases
required alignment from 1 to 4 [-Werror,-Wcast-align]
            GET_NEXT_VAL(dbus_bool_t, bool_val, bool, "%d");
util/virdbus.c:858:17: note: expanded from macro 'GET_NEXT_VAL'
            x = (dbustype *)(*xptrptr + (*narrayptr - 1));              \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.

But fixing that points out that we have NEVER supported arrayrefs
of sub-int types (byte, i16, u16, and now bool).  Again, while raw
types promote, arrays do not; so the macros HAVE to deal with both
size possibilities rather than assuming that an arrayref uses the
same sizing as the promoted raw type.

Obviously, our testsuite wasn't covering as much as it should have.

* src/util/virdbus.c (GET_NEXT_VAL): Also fix array cases.
(SET_NEXT_VAL): Fix uses of sub-int arrays.
* tests/virdbustest.c (testMessageArray, testMessageArrayRef):
Test it.

Signed-off-by: Eric Blake <eblake <at>>

(Continue reading)

Jiri Denemark | 21 Nov 18:20 2014

[libvirt] [PATCH] spec: Automatically apply all patches with git

With this change, any patch declared in libvirt.spec with Patch[0-9]* is
automatically applied in %prep. Unlike with the standard %patch[0-9]*,
patches are applied with "git am" to avoid some unexpected results.
However, as a result of this, all patches must be in the right format
for "git am" to be able to apply them; they should ideally be generated
from git using "git format-patch".

Signed-off-by: Jiri Denemark <jdenemar <at>>
--- | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/ b/
index 6fcaa3e..0959483 100644
--- a/
+++ b/
 <at>  <at>  -425,6 +425,7  <at>  <at>  BuildRequires: gettext-devel
 BuildRequires: libtool
 BuildRequires: /usr/bin/pod2man
+BuildRequires: git
 BuildRequires: perl
 BuildRequires: python
 %if %{with_systemd}
 <at>  <at>  -1198,6 +1199,41  <at>  <at>  driver
 %setup -q

+# Patches have to be stored in a temporary file because RPM has
+# a limit on the length of the result of any macro expansion;
(Continue reading)

Peter Krempa | 21 Nov 16:29 2014

[libvirt] [PATCHv2 0/5] Add agent lifecycle event

I'll post the promised channel state event later in a separate series.

Peter Krempa (5):
  qemu: chardev: Extract more information about character devices
  qemu: process: Refresh virtio channel guest state when connecting to
  event: Add guest agent lifecycle event
  examples: Add support for the guest agent lifecycle event
  qemu: Emit the guest agent lifecycle event

 daemon/remote.c                     | 36 +++++++++++++++
 examples/object-events/event-test.c | 67 ++++++++++++++++++++++++++-
 include/libvirt/libvirt-domain.h    | 41 +++++++++++++++++
 src/conf/domain_event.c             | 78 ++++++++++++++++++++++++++++++++
 src/conf/domain_event.h             |  9 ++++
 src/libvirt_private.syms            |  2 +
 src/qemu/qemu_driver.c              |  6 +++
 src/qemu/qemu_monitor.c             | 13 +++++-
 src/qemu/qemu_monitor.h             |  6 +++
 src/qemu/qemu_monitor_json.c        | 51 ++++++++++++++-------
 src/qemu/qemu_monitor_text.c        | 17 ++++---
 src/qemu/qemu_process.c             | 90 ++++++++++++++++++++++++++++++++++---
 src/remote/remote_driver.c          | 31 +++++++++++++
 src/remote/remote_protocol.x        | 16 ++++++-
 src/remote_protocol-structs         |  7 +++
 tests/qemumonitorjsontest.c         | 41 ++++++++++++++---
 tools/virsh-domain.c                | 39 ++++++++++++++++
 17 files changed, 513 insertions(+), 37 deletions(-)


(Continue reading)

Zeeshan Ali (Khattak | 21 Nov 16:11 2014

[libvirt] [libvirt-glib PATCHv2] Add gvir_domain_open_graphics_fd()

Add binding for virDomainOpenGraphicsFD. If virDomainOpenGraphicsFD is
not available, it means we are dealing with older libvirt so we create
the socket pair ourselves if that is the case.
---                             |  4 ++
 libvirt-gobject/libvirt-gobject-domain.c | 72 ++++++++++++++++++++++++++++++++
 libvirt-gobject/libvirt-gobject-domain.h |  4 ++
 libvirt-gobject/libvirt-gobject.sym      |  5 +++
 4 files changed, 85 insertions(+)

diff --git a/ b/
index 8cc3fca..bcb5cda 100644
--- a/
+++ b/
 <at>  <at>  -93,6 +93,10  <at>  <at>  m4_if(m4_version_compare([2.61a.100],

+# virDomainOpenGraphicsFD was introduced in libvirt 1.2.8
+             [virDomainOpenGraphicsFD],
+             [AC_DEFINE([HAVE_VIR_DOMAIN_OPEN_GRAPHICS_FD], 1, [Have virDomainOpenGraphicsFD?])])
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index 8df30d7..d41dadd 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
 <at>  <at>  -25,6 +25,7  <at>  <at> 
(Continue reading)

Cedric Bosdonnat | 21 Nov 11:24 2014

[libvirt] lxcContainerResolveSymlinks failing on cascading FS

Hi all,

As an example, the following command

    virt-sandbox-service create --network dhcp,source=default --unitfile sshd.service mysshd -i 512

generates a container definition containing these filesystems (in the
same order):

    <filesystem type='file' accessmode='passthrough'>
      <source file='/var/lib/libvirt/images/mysshd.raw'/>
      <target dir='/var/lib/libvirt/filesystems/mysshd'/>
    <filesystem type='bind' accessmode='passthrough'>
      <source dir='/var/lib/libvirt/filesystems/mysshd/var'/>
      <target dir='/var'/>

Since /var/lib/libvirt/filesystems/mysshd contains nothing, the second
FS needs the first one to be mounted for the source directory to exist.

The problem comes with lxcContainerResolveSymlinks() being run before
any file system is actually mounted. So the container can't be started
and we get the following error:

    Failed to access '/var/lib/libvirt/filesystems/mysshd/var': No such file or directory

This would work if the symlinks were resolved right before mounting the
FS instead of before mounting any of them. Any strong opinion against
(Continue reading)

Martin Kletzander | 21 Nov 11:10 2014

[libvirt] [PATCH] virsh: sync domdisplay help and manual

Signed-off-by: Martin Kletzander <mkletzan <at>>
 tools/virsh-domain.c | 2 +-
 tools/virsh.pod      | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index cf45a88..0572275 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
 <at>  <at>  -9915,7 +9915,7  <at>  <at>  static const vshCmdOptDef opts_domdisplay[] = {
     {.name = "type",
      .type = VSH_OT_DATA,
-     .help = N_("select particular graphics display "
+     .help = N_("select particular graphical display "
                 "(e.g. \"vnc\", \"spice\", \"rdp\")")
     {.name = NULL}
diff --git a/tools/virsh.pod b/tools/virsh.pod
index d5608cc..5a577f6 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
 <at>  <at>  -1138,11 +1138,13  <at>  <at>  I<size> is a scaled integer (see B<NOTES> above) which defaults to KiB
 "B" to get bytes (note that for historical reasons, this differs from
 B<vol-resize> which defaults to bytes without a suffix).

-=item B<domdisplay> I<domain> [I<--include-password>]
+=item B<domdisplay> I<domain> [I<--include-password>] [[I<--type>] B<type>]

(Continue reading)

Chen Fan | 21 Nov 06:39 2014

[libvirt] [PATCH] docs: fix a typo in formatdomain.html

Signed-off-by: Chen Fan < <at>>
 docs/ | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/ b/docs/
index 9364eb5..6a15074 100644
--- a/docs/
+++ b/docs/
 <at>  <at>  -3413,7 +3413,7  <at>  <at> 
       setting for the attribute is <code>no</code> for security
       reasons and support depends on the guest network device model as
       well as the type of connection on the host - currently it is
-      only supported for the virtio ddevice model and for macvtap
+      only supported for the virtio device model and for macvtap
       connections on the host.


Josh Stone | 21 Nov 03:46 2014

[libvirt] [PATCH] network: Let domains be restricted to local DNS

This adds a new "localOnly" attribute on the domain element of the
network xml.  With this set to "yes", DNS requests under that domain
will only be resolved by libvirt's dnsmasq, never forwarded upstream.

This was how it worked before commit f69a6b987d616, and I found that
functionality useful.  For example, I have my host's NetworkManager
dnsmasq configured to forward that domain to libvirt's dnsmasq, so I can
easily resolve guest names from outside.  But if libvirt's dnsmasq
doesn't know a name and forwards it to the host, I'd get an endless
forwarding loop.  Now I can set localOnly="yes" to prevent the loop.

Signed-off-by: Josh Stone <jistone <at>>
Cc: Laine Stump <laine <at>>
 docs/                                 | 12 +++++++++++-
 docs/schemas/network.rng                                   |  3 +++
 src/conf/network_conf.c                                    |  5 +++++
 src/conf/network_conf.h                                    |  1 +
 src/network/bridge_driver.c                                |  5 +++++
 .../networkxml2confdata/nat-network-dns-local-domain.conf  | 14 ++++++++++++++
 tests/networkxml2confdata/nat-network-dns-local-domain.xml |  9 +++++++++
 tests/networkxml2conftest.c                                |  1 +
 8 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 tests/networkxml2confdata/nat-network-dns-local-domain.conf
 create mode 100644 tests/networkxml2confdata/nat-network-dns-local-domain.xml

diff --git a/docs/ b/docs/
index dc438aee8622..defcdba00930 100644
--- a/docs/
+++ b/docs/
(Continue reading)