[libvirt] Get Info for QEMU/KVM storage and volume
by Qiang Fu
Hi all,
I am new to libvirt.
Right now I am trying to use libvirt to get statistics information (size,
free space and so on) on host storage and vm volume running on QEMU/KVM
hypervisor. However when I looked at the API support matrix:
http://libvirt.org/hvsupport.html#virStorageDriver
It seems the storage pool APIs do not support QEMU/KVM even for the latest
version of libvirt.
Can anyone suggest any workaround solution? Or will there be any plan in
the future for libvirt to support that?
Thanks in advance,
Bruce
11 years, 2 months
[libvirt] [PATCHv5 0/7] Gluster snapshot series
by Peter Krempa
New version after the recent feedback and fixing a few bugs found while testing.
Please see individual patches for changes.
Peter Krempa (7):
storage: Add APIs for internal handling of files via the storage
driver
storage: Implement file storage APIs in the default storage driver
storage: add file functions for local and block files
storage: Add storage file backends for gluster
qemu: Switch snapshot deletion to the new API functions
qemu: snapshot: Use new APIs to detect presence of existing storage
files
qemu: snapshot: Add support for external active snapshots on gluster
docs/formatsnapshot.html.in | 5 +-
docs/hvsupport.pl | 4 +-
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/check-aclrules.pl | 1 +
src/check-drivername.pl | 1 +
src/driver.h | 30 ++++-
src/libvirt_private.c | 180 ++++++++++++++++++++++++++++++
src/libvirt_private.h | 61 ++++++++++
src/libvirt_private.syms | 9 ++
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_command.h | 9 ++
src/qemu/qemu_driver.c | 204 ++++++++++++++++++++++++++--------
src/storage/storage_backend.c | 42 +++++++
src/storage/storage_backend.h | 43 +++++++
src/storage/storage_backend_fs.c | 48 ++++++++
src/storage/storage_backend_fs.h | 2 +
src/storage/storage_backend_gluster.c | 143 ++++++++++++++++++++++++
src/storage/storage_backend_gluster.h | 1 +
src/storage/storage_driver.c | 95 ++++++++++++++++
20 files changed, 829 insertions(+), 53 deletions(-)
create mode 100644 src/libvirt_private.c
create mode 100644 src/libvirt_private.h
--
1.8.5.3
11 years, 2 months
[libvirt] [PATCH] qemu driver: sync guest time via qemu-guest-agent when domain is resumed
by Marcelo Tosatti
Since QEMU commit "kvmclock: clock should count only if vm is running"
(http://lists.gnu.org/archive/html/qemu-devel/2013-06/msg01225.html),
guests have their realtime clock stopped during pause.
To correct the situation, invoke guest agent to sync time from
host time.
Signed-off-by: Marcelo Tosatti <mtosatti(a)redhat.com>
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 8bcd98e..df01244 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2695,6 +2695,40 @@ qemuProcessPrepareMonitorChr(virQEMUDriverConfigPtr cfg,
}
+
+#include <sys/time.h>
+
+static void
+qemuAgentSyncGuestTime(virDomainObjPtr vm)
+{
+ int ret;
+ struct timeval tv;
+ char *result;
+ qemuDomainObjPrivatePtr priv;
+ char buf[500];
+
+ priv = vm->privateData;
+
+ ret = gettimeofday(&tv, NULL);
+ if (ret) {
+ virReportSystemError(errno, "%s", _("gettimeofday failure"));
+ return;
+ }
+
+ memset(buf, 0, sizeof(buf));
+
+ sprintf(buf, "{ \"execute\": \"guest-set-time\","
+ "\"arguments\":{\"time\":%lld}}\" ",
+ tv.tv_usec * 1000 + (tv.tv_sec * 1000000000LL));
+
+ qemuDomainObjEnterAgent(vm);
+ ret = qemuAgentArbitraryCommand(priv->agent, buf, &result,
+ VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT);
+ qemuDomainObjExitAgent(vm);
+ if (ret < 0)
+ VIR_FREE(result);
+}
+
/*
* Precondition: vm must be locked, and a job must be active.
* This method will call {Enter,Exit}Monitor
@@ -2727,6 +2761,7 @@ qemuProcessStartCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm,
if (ret == 0) {
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, reason);
+ qemuAgentSyncGuestTime(vm);
} else {
if (virDomainLockProcessPause(driver->lockManager, vm, &priv->lockState) < 0)
VIR_WARN("Unable to release lease on %s", vm->def->name);
11 years, 2 months
[libvirt] [PATCH] spec: add missing dep of libvirt-daemon-config-nwfilter
by Eric Blake
Similar to cf76c4b, if modules are used, then nwfilter configuration
requires the nwfilter driver module.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
libvirt.spec.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 2d57c71..2b44c21 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -737,6 +737,9 @@ Summary: Network filter configuration files for the libvirtd daemon
Group: Development/Libraries
Requires: libvirt-daemon = %{version}-%{release}
+ %if %{with_driver_modules}
+Requires: libvirt-daemon-driver-nwfilter = %{version}-%{release}
+ %endif
%description daemon-config-nwfilter
Network filter configuration files for cleaning guest traffic
--
1.8.5.3
11 years, 2 months
[libvirt] [PATCH] spec: require libvirt-wireshark from libvirt metapackage
by Eric Blake
In general, the 'libvirt' metapackage should pull in all subpackages.
Fix this for the wireshark subpackage created in commit f9ada9f.
* libvirt.spec.in (Requires): Add dependency.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
libvirt.spec.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index d3e6048..2d57c71 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -428,6 +428,9 @@ Requires: libvirt-daemon-driver-storage = %{version}-%{release}
Requires: libvirt-daemon-driver-network = %{version}-%{release}
Requires: libvirt-daemon-driver-nodedev = %{version}-%{release}
%endif
+ %if %{with_wireshark}
+Requires: libvirt-wireshark = %{version}-%{release}
+ %endif
%endif
Requires: libvirt-client = %{version}-%{release}
--
1.8.5.3
11 years, 2 months
[libvirt] [PATCH] rpm: create libvirt-wireshark sub-package
by Eric Blake
On Fedora 20, with wireshark-devel installed, 'make rpm' failed
due to installed but unpackaged files related to wireshark. As
F20 is already released without wireshark, I chose to add a new
sub-package that is enabled only for F21 and later. Furthermore,
all existing wireshark plugins belong to the wireshark package,
so I got to invent behavior of how the first third-part wireshark
module will behave.
* libvirt.spec.in (with_wireshark): Add new conditional.
* configure.ac (ws-plugindir): Improve wording.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
I was tempted to push this as a build-breaker fix for 'make rpm',
but rpms are close enough to black magic that I decided a review
is safer, after all. Tested with both F20 (not built) and F21
(new subpackage built just fine), using normal build of all
subpackages and also a build with '%client_only 1' in ~/.rpmmacros
to ensure that it indeed works in a client-only setup.
configure.ac | 4 ++--
libvirt.spec.in | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 884e0e4..23e2201 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2578,8 +2578,8 @@ AM_CONDITIONAL([WITH_WIRESHARK_DISSECTOR], [test "$with_wireshark_dissector" = "
AC_ARG_WITH([ws-plugindir],
[AS_HELP_STRING([--with-ws-plugindir],
- [wireshark plugins directory that plugin will installed])],
- [ ws_plugindir=$withval ])
+ [wireshark plugins directory for use when installing wireshark plugin])],
+ [ws_plugindir=$withval])
if test "$with_wireshark_dissector" != "no" && test -z "$ws_plugindir"; then
ws_version=`$WIRESHARK -v | head -1 | cut -f 2 -d' '`
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 5229ece..e006f2b 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -129,6 +129,7 @@
%define with_numad 0%{!?_without_numad:0}
%define with_firewalld 0%{!?_without_firewalld:0}
%define with_libssh2 0%{!?_without_libssh2:0}
+%define with_wireshark 0%{!?_without_wireshark:0}
# Non-server/HV driver defaults which are always enabled
%define with_sasl 0%{!?_without_sasl:1}
@@ -269,6 +270,11 @@
%define with_libssh2 0%{!?_without_libssh2:1}
%endif
+# Enable wireshark plugins for all distros shipping libvirt 1.2.2 or newer
+%if 0%{?fedora} >= 21
+ %define with_wireshark 0%{!?_without_wireshark:1}
+%endif
+
# Disable some drivers when building without libvirt daemon.
# The logic is the same as in configure.ac
%if ! %{with_libvirtd}
@@ -631,6 +637,10 @@ BuildRequires: scrub
BuildRequires: numad
%endif
+%if %{with_wireshark}
+BuildRequires: wireshark-devel
+%endif
+
Provides: bundled(gnulib)
%description
@@ -1115,6 +1125,17 @@ Requires: cyrus-sasl-md5
Shared libraries and client binaries needed to access to the
virtualization capabilities of recent versions of Linux (and other OSes).
+%if %{with_wireshark}
+%package wireshark
+Summary: Wireshark dissector plugin for libvirt RPC transactions
+Group: Development/Libraries
+Requires: wireshark
+Requires: %{name}-client = %{version}-%{release}
+
+%description wireshark
+Wireshark dissector plugin for better analysis of libvirt RPC traffic.
+%endif
+
%if %{with_lxc}
%package login-shell
Summary: Login shell for connecting users to an LXC container
@@ -1340,6 +1361,10 @@ driver
%define _with_firewalld --with-firewalld
%endif
+%if ! %{with_wireshark}
+ %define _without_wireshark --without-wireshark-dissector
+%endif
+
%define when %(date +"%%F-%%T")
%define where %(hostname)
%define who %{?packager}%{!?packager:Unknown}
@@ -1412,6 +1437,7 @@ driver
%{?_without_dtrace} \
%{?_without_driver_modules} \
%{?_with_firewalld} \
+ %{?_without_wireshark} \
%{with_packager} \
%{with_packager_version} \
--with-qemu-user=%{qemu_user} \
@@ -1442,6 +1468,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/lock-driver/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/connection-driver/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/connection-driver/*.a
%endif
+%if %{with_wireshark}
+rm -f $RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/*/libvirt.la
+%endif
%if %{with_network}
install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/lib/libvirt/dnsmasq/
@@ -2117,6 +2146,11 @@ exit 0
%config(noreplace) %{_sysconfdir}/sasl2/libvirt.conf
%endif
+%if %{with_wireshark}
+%files wireshark
+%{_libdir}/wireshark/plugins/*/libvirt.so
+%endif
+
%if %{with_lxc}
%files login-shell
%attr(4750, root, virtlogin) %{_bindir}/virt-login-shell
--
1.8.5.3
11 years, 2 months
[libvirt] [PATCH] lxc from native: removed now remaining useless line
by Cédric Bosdonnat
---
src/lxc/lxc_native.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index ee07635..2cf479d 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -900,7 +900,6 @@ lxcParseConfigString(const char *config)
}
/* Loop over lxc.mount.entry to add filesystem devices for them */
- value = virConfGetValue(properties, "lxc.mount.entry");
if (virConfWalk(properties, lxcFstabWalkCallback, vmdef) < 0)
goto error;
--
1.8.5.2
11 years, 2 months
[libvirt] [PATCH] Fix stream related spelling mistakes
by Philipp Hahn
Consistent spelling of all-uppercase I/O.
Signed-off-by: Philipp Hahn <hahn(a)univention.de>
---
libvirt-override-virStream.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libvirt-override-virStream.py b/libvirt-override-virStream.py
index 53000da..e9dd09a 100644
--- a/libvirt-override-virStream.py
+++ b/libvirt-override-virStream.py
@@ -28,7 +28,7 @@
def recvAll(self, handler, opaque):
"""Receive the entire data stream, sending the data to the
requested data sink. This is simply a convenient alternative
- to virStreamRecv, for apps that do blocking-I/o.
+ to virStreamRecv, for apps that do blocking-I/O.
A hypothetical handler function looks like:
@@ -61,7 +61,7 @@
"""
Send the entire data stream, reading the data from the
requested data source. This is simply a convenient alternative
- to virStreamSend, for apps that do blocking-I/o.
+ to virStreamSend, for apps that do blocking-I/O.
A hypothetical handler function looks like:
--
1.8.5.3
11 years, 2 months
[libvirt] [PATCH] Fix stream related spelling mistakes
by Philipp Hahn
Remove double "is".
Consistent spelling of all-uppercase I/O.
Signed-off-by: Philipp Hahn <hahn(a)univention.de>
---
src/libvirt.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 9cc5b1c..666ab1e 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -15890,7 +15890,7 @@ error:
*
* Send the entire data stream, reading the data from the
* requested data source. This is simply a convenient alternative
- * to virStreamSend, for apps that do blocking-I/o.
+ * to virStreamSend, for apps that do blocking-I/O.
*
* An example using this with a hypothetical file upload
* API looks like
@@ -15983,7 +15983,7 @@ cleanup:
*
* Receive the entire data stream, sending the data to the
* requested data sink. This is simply a convenient alternative
- * to virStreamRecv, for apps that do blocking-I/o.
+ * to virStreamRecv, for apps that do blocking-I/O.
*
* An example using this with a hypothetical file download
* API looks like
@@ -16192,7 +16192,7 @@ error:
* virStreamFinish:
* @stream: pointer to the stream object
*
- * Indicate that there is no further data is to be transmitted
+ * Indicate that there is no further data to be transmitted
* on the stream. For output streams this should be called once
* all data has been written. For input streams this should be
* called once virStreamRecv returns end-of-file.
--
1.8.5.3
11 years, 2 months
[libvirt] [Question] Is it a bug about cpu model Westmere?
by Wangyufei (James)
Hello,
I find that the cpu model Westmere defined in recently qemu has the cupid CPUID_EXT_PCLMULQDQ,
but the cpu model Westmere defined in libvirt doesn't have it, SandyBridge defined in libvirt has it. In my opinion,
the same cpu model defined in qemu and libvirt should have the same cpuids, or there'll be some problem happened.
First, am I right? Second, if I'm right, whose bug it is? Libvirt or qemu?
Thanks for your attention.
Best Regards,
-WangYufei
11 years, 2 months