[libvirt] [PATCH] storage: show compile options in virsh --version=long
by Eric Blake
Adding output to 'virsh --version=long' makes it easier to
tell if a distro built with particular libraries (it doesn't
tell you what a remote libvirtd is built with, but is still
better than nothing).
* tools/virsh.c (vshShowVersion): Add gluster witness.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
tools/virsh.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/virsh.c b/tools/virsh.c
index 5559d71..9d07d3e 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3069,6 +3069,9 @@ vshShowVersion(vshControl *ctl ATTRIBUTE_UNUSED)
#ifdef WITH_STORAGE_SHEEPDOG
vshPrint(ctl, " Sheepdog");
#endif
+#ifdef WITH_STORAGE_GLUSTER
+ vshPrint(ctl, " Gluster");
+#endif
vshPrint(ctl, "\n");
vshPrint(ctl, "%s", _(" Miscellaneous:"));
--
1.8.4.2
10 years, 11 months
[libvirt] Glusterfs Libvirt issue
by Umar Draz
Hi,
I am trying to create glusterfs pool with libvirt but its working, and
following is the error
*libvirt_storagepool_define_xml(): internal error unknown storage pool type
gluster*
the Qemu has enabled glusterfs backend support. I can create the glusterfs
image using this
*qemu-img create gluster://localhost/test/umar 5G*
Would you please help what should else i need to require?
Br.
Umar
10 years, 11 months
[libvirt] [PATCH python 00/14] Finished port to Python3
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
This series finishes the initial port to Python3. The code
generator works, the C code compiles without warnings, and
the sanitytest passes.
The APIs using strings have all switched to PyUnicode
except for thos which deal with binary data which now use
PyBytes in Python 3 builds.
Daniel P. Berrange (14):
examples: Invoke print("...") instead of print "..."
examples: Ensure we write bytes to the self-pipe
override: Fix native module registration to work with Python3
sanitytest: Fix libvirtError class handling for Python 2.4
override: Replace PyString_FromString with libvirt_constcharPtrWrap
override: Replace PyString_AsString with libvirt_charPtrUnwrap
override: Replace Py{Int,Long}_FromLong with helpers
override: Replace PyInt_AsLong with helper
typewrappers: Replace use of PyString class
typewrappers: PyInt/PyLong merge for Python3
override: Conditionalize use of PyString_Check and PyInt_Check
override: Switch virStreamSend wrapper to use
libvirt_charPtrSizeUnwrap
sanitytest: Fix broken comparison between int and string
sanitytest: remove use of string.lower()
examples/consolecallback.py | 6 +-
examples/dominfo.py | 14 +-
examples/domrestore.py | 17 +--
examples/domsave.py | 15 +-
examples/domstart.py | 19 ++-
examples/esxlist.py | 14 +-
examples/event-test.py | 70 ++++-----
examples/topology.py | 14 +-
libvirt-lxc-override.c | 75 +++++++---
libvirt-override.c | 348 ++++++++++++++++++++++++++------------------
libvirt-qemu-override.c | 77 +++++++---
sanitytest.py | 10 +-
typewrappers.c | 97 +++++++++++-
typewrappers.h | 3 +
14 files changed, 500 insertions(+), 279 deletions(-)
--
1.8.3.1
10 years, 11 months
[libvirt] [python PATCH v2] Added python binding for the new network events API
by Cédric Bosdonnat
---
Changes to previous patch:
* Fixed Eric's comments
* Updated code to latest libvirt patches submitted
generator.py | 2 +
libvirt-override-virConnect.py | 34 +++++++++
libvirt-override.c | 152 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 188 insertions(+)
diff --git a/generator.py b/generator.py
index 84c7678..42f3913 100755
--- a/generator.py
+++ b/generator.py
@@ -491,6 +491,8 @@ skip_function = (
'virConnectDomainEventDeregister', # overridden in virConnect.py
'virConnectDomainEventRegisterAny', # overridden in virConnect.py
'virConnectDomainEventDeregisterAny', # overridden in virConnect.py
+ 'virConnectNetworkEventRegisterAny', # overridden in virConnect.py
+ 'virConnectNetworkEventDeregisterAny', # overridden in virConnect.py
'virSaveLastError', # We have our own python error wrapper
'virFreeError', # Only needed if we use virSaveLastError
'virConnectListAllDomains', # overridden in virConnect.py
diff --git a/libvirt-override-virConnect.py b/libvirt-override-virConnect.py
index 0beaf9c..c228eb2 100644
--- a/libvirt-override-virConnect.py
+++ b/libvirt-override-virConnect.py
@@ -198,6 +198,40 @@
except AttributeError:
pass
+ def _dispatchNetworkEventLifecycleCallback(self, net, event, detail, cbData):
+ """Dispatches events to python user network lifecycle event callbacks
+ """
+ cb = cbData["cb"]
+ opaque = cbData["opaque"]
+
+ cb(self, virNetwork(self, _obj=net), event, detail, opaque)
+ return 0
+
+ def networkEventDeregisterAny(self, callbackID):
+ """Removes a Network Event Callback. De-registering for a
+ network callback will disable delivery of this event type"""
+ try:
+ ret = libvirtmod.virConnectNetworkEventDeregisterAny(self._o, callbackID)
+ if ret == -1: raise libvirtError ('virConnectNetworkEventDeregisterAny() failed', conn=self)
+ del self.networkEventCallbackID[callbackID]
+ except AttributeError:
+ pass
+
+ def networkEventRegisterAny(self, net, eventID, cb, opaque):
+ """Adds a Network Event Callback. Registering for a network
+ callback will enable delivery of the events"""
+ if not hasattr(self, 'networkEventCallbackID'):
+ self.networkEventCallbackID = {}
+ cbData = { "cb": cb, "conn": self, "opaque": opaque }
+ if net is None:
+ ret = libvirtmod.virConnectNetworkEventRegisterAny(self._o, None, eventID, cbData)
+ else:
+ ret = libvirtmod.virConnectNetworkEventRegisterAny(self._o, net._o, eventID, cbData)
+ if ret == -1:
+ raise libvirtError ('virConnectNetworkEventRegisterAny() failed', conn=self)
+ self.networkEventCallbackID[ret] = opaque
+ return ret
+
def domainEventRegisterAny(self, dom, eventID, cb, opaque):
"""Adds a Domain Event Callback. Registering for a domain
callback will enable delivery of the events """
diff --git a/libvirt-override.c b/libvirt-override.c
index 5deb414..fbcd1c8 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -6515,6 +6515,154 @@ libvirt_virConnectDomainEventDeregisterAny(ATTRIBUTE_UNUSED PyObject * self,
return py_retval;
}
+#if LIBVIR_CHECK_VERSION(1, 2, 1)
+static void
+libvirt_virConnectNetworkEventFreeFunc(void *opaque)
+{
+ PyObject *pyobj_conn = (PyObject*)opaque;
+ LIBVIRT_ENSURE_THREAD_STATE;
+ Py_DECREF(pyobj_conn);
+ LIBVIRT_RELEASE_THREAD_STATE;
+}
+
+static int
+libvirt_virConnectNetworkEventLifecycleCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virNetworkPtr net,
+ int event,
+ int detail,
+ void *opaque)
+{
+ PyObject *pyobj_cbData = (PyObject*)opaque;
+ PyObject *pyobj_net;
+ PyObject *pyobj_ret;
+ PyObject *pyobj_conn;
+ PyObject *dictKey;
+ int ret = -1;
+
+ LIBVIRT_ENSURE_THREAD_STATE;
+
+ dictKey = libvirt_constcharPtrWrap("conn");
+ if (!dictKey)
+ return ret;
+ pyobj_conn = PyDict_GetItem(pyobj_cbData, dictKey);
+ Py_DECREF(dictKey);
+
+ /* Create a python instance of this virNetworkPtr */
+ virNetworkRef(net);
+ pyobj_net = libvirt_virNetworkPtrWrap(net);
+ Py_INCREF(pyobj_cbData);
+
+ /* Call the Callback Dispatcher */
+ pyobj_ret = PyObject_CallMethod(pyobj_conn,
+ (char*)"_dispatchNetworkEventLifecycleCallback",
+ (char*)"OiiO",
+ pyobj_net,
+ event,
+ detail,
+ pyobj_cbData);
+
+ Py_DECREF(pyobj_cbData);
+ Py_DECREF(pyobj_net);
+
+ if (!pyobj_ret) {
+ DEBUG("%s - ret:%p\n", __FUNCTION__, pyobj_ret);
+ PyErr_Print();
+ } else {
+ Py_DECREF(pyobj_ret);
+ ret = 0;
+ }
+
+ LIBVIRT_RELEASE_THREAD_STATE;
+ return ret;
+}
+
+static PyObject
+*libvirt_virConnectNetworkEventRegisterAny(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *py_retval; /* return value */
+ PyObject *pyobj_conn; /* virConnectPtr */
+ PyObject *pyobj_net;
+ PyObject *pyobj_cbData; /* hash of callback data */
+ int eventID;
+ virConnectPtr conn;
+ int ret = 0;
+ virConnectNetworkEventGenericCallback cb = NULL;
+ virNetworkPtr net;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "OOiO:virConnectNetworkEventRegisterAny",
+ &pyobj_conn, &pyobj_net, &eventID, &pyobj_cbData)) {
+ DEBUG("%s failed parsing tuple\n", __FUNCTION__);
+ return VIR_PY_INT_FAIL;
+ }
+
+ DEBUG("libvirt_virConnectNetworkEventRegister(%p %p %d %p) called\n",
+ pyobj_conn, pyobj_net, eventID, pyobj_cbData);
+ conn = PyvirConnect_Get(pyobj_conn);
+ if (pyobj_net == Py_None)
+ net = NULL;
+ else
+ net = PyvirNetwork_Get(pyobj_net);
+
+ switch ((virNetworkEventID) eventID) {
+ case VIR_NETWORK_EVENT_ID_LIFECYCLE:
+ cb = VIR_NETWORK_EVENT_CALLBACK(libvirt_virConnectNetworkEventLifecycleCallback);
+ break;
+
+ case VIR_NETWORK_EVENT_ID_LAST:
+ break;
+ }
+
+ if (!cb) {
+ return VIR_PY_INT_FAIL;
+ }
+
+ Py_INCREF(pyobj_cbData);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ ret = virConnectNetworkEventRegisterAny(conn, net, eventID,
+ cb, pyobj_cbData,
+ libvirt_virConnectNetworkEventFreeFunc);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (ret < 0) {
+ Py_DECREF(pyobj_cbData);
+ }
+
+ py_retval = libvirt_intWrap(ret);
+ return py_retval;
+}
+
+static PyObject
+*libvirt_virConnectNetworkEventDeregisterAny(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *py_retval;
+ PyObject *pyobj_conn;
+ int callbackID;
+ virConnectPtr conn;
+ int ret = 0;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "Oi:virConnectNetworkEventDeregister",
+ &pyobj_conn, &callbackID))
+ return NULL;
+
+ DEBUG("libvirt_virConnectNetworkEventDeregister(%p) called\n", pyobj_conn);
+
+ conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+
+ ret = virConnectNetworkEventDeregisterAny(conn, callbackID);
+
+ LIBVIRT_END_ALLOW_THREADS;
+ py_retval = libvirt_intWrap(ret);
+ return py_retval;
+}
+#endif /* LIBVIR_CHECK_VERSION(1, 2, 1)*/
+
#if LIBVIR_CHECK_VERSION(0, 10, 0)
static void
libvirt_virConnectCloseCallbackDispatch(virConnectPtr conn ATTRIBUTE_UNUSED,
@@ -7315,6 +7463,10 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virConnectDomainEventDeregister", libvirt_virConnectDomainEventDeregister, METH_VARARGS, NULL},
{(char *) "virConnectDomainEventRegisterAny", libvirt_virConnectDomainEventRegisterAny, METH_VARARGS, NULL},
{(char *) "virConnectDomainEventDeregisterAny", libvirt_virConnectDomainEventDeregisterAny, METH_VARARGS, NULL},
+#if LIBVIR_CHECK_VERSION(1, 2, 1)
+ {(char *) "virConnectNetworkEventRegisterAny", libvirt_virConnectNetworkEventRegisterAny, METH_VARARGS, NULL},
+ {(char *) "virConnectNetworkEventDeregisterAny", libvirt_virConnectNetworkEventDeregisterAny, METH_VARARGS, NULL},
+#endif /* LIBVIR_CHECK_VERSION(1, 2, 1) */
#if LIBVIR_CHECK_VERSION(0, 10, 0)
{(char *) "virConnectRegisterCloseCallback", libvirt_virConnectRegisterCloseCallback, METH_VARARGS, NULL},
{(char *) "virConnectUnregisterCloseCallback", libvirt_virConnectUnregisterCloseCallback, METH_VARARGS, NULL},
--
1.8.4.4
10 years, 11 months
[libvirt] ANNOUNCE: ruby-libvirt 0.5.0
by Chris Lalancette
All,
I'm pleased to announce the release of ruby-libvirt 0.5.0. ruby-libvirt
is a ruby wrapper around the libvirt API. Version 0.5.0 brings new APIs, more
documentation, and bugfixes:
* Updated Network class, implementing almost all libvirt APIs
* Updated Domain class, implementing almost all libvirt APIs
* Updated Connection class, implementing almost all libvirt APIs
* Updated DomainSnapshot class, implementing almost all libvirt APIs
* Updated NodeDevice class, implementing almost all libvirt APIs
* Updated Storage class, implementing almost all libvirt APIs
* Add constants for almost all libvirt defines
* Improved performance in the library by using alloca
Version 0.5.0 is available from http://libvirt.org/ruby:
Tarball: http://libvirt.org/ruby/download/ruby-libvirt-0.5.0.tgz
Gem: http://libvirt.org/ruby/download/ruby-libvirt-0.5.0.gem
It is also available from rubygems.org; to get the latest version, run:
$ gem install ruby-libvirt
As usual, if you run into questions, problems, or bugs, please feel free to
mail me (clalancette(a)gmail.com) and/or the libvirt mailing list.
Thanks to everyone who contributed patches and submitted bugs.
Chris Lalancette
10 years, 11 months
[libvirt] [PATCH] docs: fix a typo in libvirt.h
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
s/pausde/paused
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
include/libvirt/libvirt.h.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 29d4dce..51a02f5 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -4576,7 +4576,7 @@ typedef void (*virConnectDomainEventWatchdogCallback)(virConnectPtr conn,
*/
typedef enum {
VIR_DOMAIN_EVENT_IO_ERROR_NONE = 0, /* No action, IO error ignored */
- VIR_DOMAIN_EVENT_IO_ERROR_PAUSE, /* Guest CPUs are pausde */
+ VIR_DOMAIN_EVENT_IO_ERROR_PAUSE, /* Guest CPUs are paused */
VIR_DOMAIN_EVENT_IO_ERROR_REPORT, /* IO error reported to guest OS */
#ifdef VIR_ENUM_SENTINELS
--
1.8.2.1
10 years, 11 months
Re: [libvirt] [Qemu-devel] [PATCH V17 02/11] NUMA: check if the total numa memory size is equal to ram_size
by Eduardo Habkost
CCing libvir-list.
On Wed, Dec 04, 2013 at 03:58:50PM +0800, Wanlong Gao wrote:
> If the total number of the assigned numa nodes memory is not
> equal to the assigned ram size, it will write the wrong data
> to ACPI talb, then the guest will ignore the wrong ACPI table
> and recognize all memory to one node. It's buggy, we should
> check it to ensure that we write the right data to ACPI table.
>
> Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
This will make configurations that could be running for years (except
that the guest OS was ignoring the NUMA data) suddenly stop running. I
just want to confirm: we really want that, right?
Does libvirt allow this kind of broken configuration to be generated, or
it already ensures the total NUMA node sizes match RAM size?
> ---
> numa.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/numa.c b/numa.c
> index ce7736a..beda80e 100644
> --- a/numa.c
> +++ b/numa.c
> @@ -150,6 +150,16 @@ void set_numa_nodes(void)
> node_mem[i] = ram_size - usedmem;
> }
>
> + uint64_t numa_total = 0;
> + for (i = 0; i < nb_numa_nodes; i++) {
> + numa_total += node_mem[i];
> + }
> + if (numa_total != ram_size) {
> + fprintf(stderr, "qemu: numa nodes total memory size "
> + "should equal to ram_size\n");
> + exit(1);
> + }
> +
> for (i = 0; i < nb_numa_nodes; i++) {
> if (!bitmap_empty(node_cpumask[i], MAX_CPUMASK_BITS)) {
> break;
> --
> 1.8.5
>
>
--
Eduardo
10 years, 11 months
[libvirt] [PATCH] storage_backend_rbd: rename "stat" variable
by Michael Chapman
This variable shadows the stat(2) function, which only became visible in
this scope as of commit 9cac8639. Rename the variable so it doesn't
conflict.
Signed-off-by: Michael Chapman <mike(a)very.puzzling.org>
---
src/storage/storage_backend_rbd.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index b8a553d..4b6f18c 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -314,8 +314,8 @@ static int virStorageBackendRBDRefreshPool(virConnectPtr conn,
goto cleanup;
}
- struct rados_cluster_stat_t stat;
- if (rados_cluster_stat(ptr.cluster, &stat) < 0) {
+ struct rados_cluster_stat_t clusterstat;
+ if (rados_cluster_stat(ptr.cluster, &clusterstat) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to stat the RADOS cluster"));
goto cleanup;
@@ -329,13 +329,13 @@ static int virStorageBackendRBDRefreshPool(virConnectPtr conn,
goto cleanup;
}
- pool->def->capacity = stat.kb * 1024;
- pool->def->available = stat.kb_avail * 1024;
+ pool->def->capacity = clusterstat.kb * 1024;
+ pool->def->available = clusterstat.kb_avail * 1024;
pool->def->allocation = poolstat.num_bytes;
VIR_DEBUG("Utilization of RBD pool %s: (kb: %llu kb_avail: %llu num_bytes: %llu)",
- pool->def->source.name, (unsigned long long)stat.kb,
- (unsigned long long)stat.kb_avail,
+ pool->def->source.name, (unsigned long long)clusterstat.kb,
+ (unsigned long long)clusterstat.kb_avail,
(unsigned long long)poolstat.num_bytes);
while (true) {
--
1.8.4.2
10 years, 11 months
[libvirt] [PATCH 0/6] Some virtlockd improvements
by Michael Chapman
Hi,
This patch series fixes up a few problems encountered while testing out
virtlockd.
The biggest problem was that reloading virtlockd through systemd or its
initscript would send it a SIGHUP, not a SIGUSR1 (which causes it to re-exec
itself). This would simply kill it. Patches 1-3 clean this up by having SIGHUP
behave the same as SIGUSR1. The systemd unit and initscript have to use
SIGUSR1, though, since they may be called upon to signal an old virtlockd
binary.
When run from the initscript graceful re-exec didn't work properly anyway, as
virtlockd assumed argv[0] was a full path to its binary. The initscript didn't
provide a full path. Patches 4-5 make virtlockd use execvp() to re-exec itself,
which does a PATH lookup if necessary.
Patch 6 isn't really virtlockd-specific. It moves the reloading of virtlockd
and libvirtd via initscripts into the libvirt-daemon package's %postun
scriptlet (which is already where reloading is done with systemd). The problem
with reloading libvirt-daemon in %post is that it restarts *before* all of the
libvirt-daemon-driver-* packages have been updated in the same RPM transaction,
which means it keeps using the old libraries (or fails to load them due to
missing symbols).
Michael Chapman (6):
virtlockd: improve systemd units
virtlockd: improve initscripts
virtlockd: treat SIGHUP like SIGUSR1
virtlockd: use common exit path when out-of-memory
virtlockd: make re-exec more robust
spec: clean up libvirtd and virtlockd service mgmt
daemon/libvirtd.init.in | 2 ++
libvirt.spec.in | 43 +++++++++++-----------
src/locking/lock_daemon.c | 77 ++++++++++++++++++++++++++++++----------
src/locking/virtlockd.init.in | 11 +++---
src/locking/virtlockd.service.in | 7 ++--
src/locking/virtlockd.socket.in | 2 +-
6 files changed, 95 insertions(+), 47 deletions(-)
--
1.8.4.2
10 years, 11 months
[libvirt] [PATCH 0/9] Add throttle blkio cgroup support for libvirt
by Gao feng
Right now, libvirt only supports the cfq based blkio cgorup,
this means if the block devices doesn't use cfq scheduler, the
blkio cgroup will loss effect.
This patchset adds the throttle blkio cgroup support for libvirt,
intoduces four elements for domain configuration and extend the
virsh command blkiotune.
This patchset is a new version of Guan Qiang's patchset
://www.redhat.com/archives/libvir-list/2013-October/msg01066.html
Change form Guan Qiang's patchset:
1, split to 8 patches, make logic more clear
2, change the type of read/write iops form unsigned long long to unsigned int,
trying to set read/write iops to the value which bigger than max number of
unsigned int will fail.
3, fix some logic shortage.
Gao feng (9):
rename virDomainBlkioDeviceWeightParseXML to
virDomainBlkioDeviceParseXML
rename virBlkioDeviceWeightArrayClear to virBlkioDeviceArrayClear
rename virBlkioDeviceWeightPtr to virBlkioDevicePtr
domain: introduce xml elements for throttle blkio cgroup
blkio: Setting throttle blkio cgroup for domain
qemu: allow to setup throttle blkio cgroup through virsh
virsh: add virsh manual for setting throttle blkio cgroup
lxc: allow to setup throttle blkio cgroup through virsh
qemu: add new throttle blkio cgroup elements to the test xml
docs/schemas/domaincommon.rng | 28 +-
include/libvirt/libvirt.h.in | 45 ++
src/conf/domain_conf.c | 113 +++-
src/conf/domain_conf.h | 16 +-
src/libvirt_private.syms | 5 +-
src/lxc/lxc_cgroup.c | 12 +-
src/lxc/lxc_driver.c | 649 ++++++++++++++++++++-
src/qemu/qemu_cgroup.c | 13 +-
src/qemu/qemu_driver.c | 432 ++++++++++++--
src/util/vircgroup.c | 170 +++++-
src/util/vircgroup.h | 18 +
.../qemuxml2argv-blkiotune-device.xml | 8 +
tools/virsh-domain.c | 64 ++
tools/virsh.pod | 36 +-
14 files changed, 1485 insertions(+), 124 deletions(-)
--
1.8.3.1
10 years, 11 months