[libvirt] [test-API][PATCH] Add new case for listAllVolumes and update releated conf
by codong
listAllVolumes is a new API in RHEL7, so add a new case for it.
And add the case to releated conf to check the volumes list.
modified: cases/storage_dir.conf
modified: cases/storage_dir_vol_resize_delta.conf
modified: cases/storage_logical.conf
modified: cases/storage_netfs.conf
new file: repos/storage/list_volumes.py
---
cases/storage_dir.conf | 16 +++++
cases/storage_dir_vol_resize_delta.conf | 8 +++
cases/storage_logical.conf | 16 +++++
cases/storage_netfs.conf | 16 +++++
repos/storage/list_volumes.py | 97 +++++++++++++++++++++++++++++++
5 files changed, 153 insertions(+), 0 deletions(-)
create mode 100644 repos/storage/list_volumes.py
diff --git a/cases/storage_dir.conf b/cases/storage_dir.conf
index 38b349d..393d34f 100644
--- a/cases/storage_dir.conf
+++ b/cases/storage_dir.conf
@@ -20,6 +20,10 @@ storage:create_dir_volume
capacity
$defaultvolumesize
+storage:list_volumes
+ poolname
+ $defaultpoolname
+
storage:vol_clone
poolname
$defaultpoolname
@@ -28,18 +32,30 @@ storage:vol_clone
clonevolname
$defaultvolclonename
+storage:list_volumes
+ poolname
+ $defaultpoolname
+
storage:delete_dir_volume
poolname
$defaultpoolname
volname
$defaultvolclonename
+storage:list_volumes
+ poolname
+ $defaultpoolname
+
storage:delete_dir_volume
poolname
$defaultpoolname
volname
$defaultvolumename
+storage:list_volumes
+ poolname
+ $defaultpoolname
+
storage:destroy_pool
poolname
$defaultpoolname
diff --git a/cases/storage_dir_vol_resize_delta.conf b/cases/storage_dir_vol_resize_delta.conf
index 58e15bf..22d3b47 100644
--- a/cases/storage_dir_vol_resize_delta.conf
+++ b/cases/storage_dir_vol_resize_delta.conf
@@ -12,6 +12,10 @@ storage:create_dir_volume
capacity
$defaultvolumesize
+storage:list_volumes
+ poolname
+ $defaultpoolname
+
storage:vol_resize_delta
poolname
$defaultpoolname
@@ -42,6 +46,10 @@ storage:delete_dir_volume
volname
$defaultvolumename
+storage:list_volumes
+ poolname
+ $defaultpoolname
+
storage:destroy_pool
poolname
$defaultpoolname
diff --git a/cases/storage_logical.conf b/cases/storage_logical.conf
index d374dfa..a0fdad6 100644
--- a/cases/storage_logical.conf
+++ b/cases/storage_logical.conf
@@ -22,6 +22,10 @@ storage:create_logical_volume
capacity
$defaultvolumesize
+storage:list_volumes
+ poolname
+ $defaultpoolname
+
storage:vol_clone
poolname
$defaultpoolname
@@ -30,18 +34,30 @@ storage:vol_clone
clonevolname
$defaultvolclonename
+storage:list_volumes
+ poolname
+ $defaultpoolname
+
storage:delete_logical_volume
poolname
$defaultpoolname
volname
$defaultvolclonename
+storage:list_volumes
+ poolname
+ $defaultpoolname
+
storage:delete_logical_volume
poolname
$defaultpoolname
volname
$defaultvolumename
+storage:list_volumes
+ poolname
+ $defaultpoolname
+
storage:destroy_pool
poolname
$defaultpoolname
diff --git a/cases/storage_netfs.conf b/cases/storage_netfs.conf
index f486ff4..6880763 100644
--- a/cases/storage_netfs.conf
+++ b/cases/storage_netfs.conf
@@ -24,6 +24,10 @@ storage:create_netfs_volume
capacity
$defaultvolumesize
+storage:list_volumes
+ poolname
+ $defaultpoolname
+
storage:vol_clone
poolname
$defaultpoolname
@@ -32,18 +36,30 @@ storage:vol_clone
clonevolname
$defaultvolclonename
+storage:list_volumes
+ poolname
+ $defaultpoolname
+
storage:delete_netfs_volume
poolname
$defaultpoolname
volname
$defaultvolclonename
+storage:list_volumes
+ poolname
+ $defaultpoolname
+
storage:delete_netfs_volume
poolname
$defaultpoolname
volname
$defaultvolumename
+storage:list_volumes
+ poolname
+ $defaultpoolname
+
storage:destroy_pool
poolname
$defaultpoolname
diff --git a/repos/storage/list_volumes.py b/repos/storage/list_volumes.py
new file mode 100644
index 0000000..9555720
--- /dev/null
+++ b/repos/storage/list_volumes.py
@@ -0,0 +1,97 @@
+#!/usr/bin/evn python
+
+import libvirt
+from libvirt import libvirtError
+from xml.dom import minidom
+
+from utils import utils
+
+from src import sharedmod
+
+required_params = ('poolname',)
+optional_params = {}
+
+
+def get_pool_path(pool_obj):
+ """
+ Get the pool path
+ """
+ poolxml = pool_obj.XMLDesc(0)
+ logger.debug("the xml description of pool is %s" % poolxml)
+
+ doc = minidom.parseString(poolxml)
+ path_element = doc.getElementsByTagName('path')[0]
+ textnode = path_element.childNodes[0]
+ path_value = textnode.data
+
+ return path_value
+
+
+def check_list_volumes(pool_obj, vol_name_list):
+ """
+ Check the result of listAllVolumes
+ """
+
+ vol_poolobj_list = pool_obj.listVolumes()
+ logger.debug("get volumes from listVolumes is %s" % vol_poolobj_list)
+
+ poolpath = get_pool_path(pool_obj)
+ logger.info("the pool path is %s" % poolpath)
+ vol_ls_cmd = "ls -a " + poolpath
+
+ (status, vol_cmd_list) = utils.exec_cmd(vol_ls_cmd, shell=True)
+ if status:
+ logger.error("Executing " + vol_ls_cmd + " failed")
+ logger.error(vol_ls_cmd)
+ return False
+ else:
+ logger.debug("get volumes from poolpath is %s" % vol_cmd_list)
+ logger.info("compare the volume list under poolpath and list from API")
+ vol_cmd_list = vol_cmd_list[2:]
+ vol_name_list.sort()
+ vol_poolobj_list.sort()
+ vol_cmd_list.sort()
+ if (cmp(vol_poolobj_list, vol_name_list) == 0) and \
+ (cmp(vol_name_list, vol_cmd_list) == 0):
+
+ return True
+ else:
+ return False
+
+
+def list_volumes(params):
+ """List all the volumes of a storage pool
+ """
+ global logger
+ logger = params['logger']
+ poolname = params['poolname']
+ vol_name_list = []
+
+ logger.info("the poolname is %s" % (poolname))
+ conn = sharedmod.libvirtobj['conn']
+ storage_pool_list = conn.listStoragePools()
+
+ if poolname not in storage_pool_list:
+ logger.error("pool %s doesn't exist or not running" % poolname)
+ return 1
+
+ pool_obj = conn.storagePoolLookupByName(poolname)
+
+ try:
+ vol_obj_list = pool_obj.listAllVolumes()
+ for vol_obj in vol_obj_list:
+ vol_name_list.append(vol_obj.name())
+ logger.info("the volume list is %s" % vol_name_list)
+
+ if check_list_volumes(pool_obj, vol_name_list):
+ logger.info("get the right volumes list successfully")
+ else:
+ logger.error("fail to get the right volumes list")
+ return 1
+
+ except libvirtError as e:
+ logger.error("API error message: %s, error code is %s"
+ % (e.message, e.get_error_code()))
+ return 1
+
+ return 0
--
1.7.1
11 years, 5 months
[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
11 years, 5 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
11 years, 5 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
11 years, 5 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
11 years, 5 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
11 years, 5 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
11 years, 5 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
11 years, 5 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
11 years, 5 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
11 years, 5 months