Re: PATCH: pyblock: Stop confusing raiddevs and raidsets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



looks good
On Tue, Feb 17, 2009 at 04:47:32PM +0100, Hans de Goede wrote:
> pydmraid_ctx_discover_raidsets() was confusing raiddevices with raidsets, and
> thus calling group_set multiple times while it should be called only once.
>
> This caused us to hang on dmraid10 on nvidia raid controllers. This patch also
> fixes the "Only on argument allowed" error we've been seeing with isw setups
> ---
>  dmraid.c |   63 +++----------------------------------------------------------
>  1 files changed, 4 insertions(+), 59 deletions(-)
>
> diff --git a/dmraid.c b/dmraid.c
> index 3b2f3c7..f2f8d9e 100644
> --- a/dmraid.c
> +++ b/dmraid.c
> @@ -1218,71 +1218,16 @@ static PyObject *
>  pydmraid_ctx_discover_raidsets(PyObject *self)
>  {
>  	PydmraidContextObject *ctx = (PydmraidContextObject *)self;
> -	struct raid_dev *rd;
>  	int n;
> +	char *argv[] = { NULL };
>
>  	if (!count_devices(ctx->lc, RAID)) {
>  		return PyLong_FromLong(0);
>  	}
>
> -	for_each_raiddev(ctx->lc, rd) {
> -		PyObject *name = NULL, *dict = NULL;
> -		struct raid_set *rs;
> -
> -		dict = PyDict_New();
> -		if (!dict)
> -			return NULL;
> -
> -		for_each_raidset(ctx->lc, rs) {
> -			struct raid_set *subset;
> -
> -			if (T_GROUP(rs)) {
> -				for_each_subset(rs, subset) {
> -					if (PyDict_SetItemString(dict, rs->name,
> -							Py_None) < 0) {
> -						Py_DECREF(dict);
> -						return NULL;
> -					}
> -				}
> -			} else if (PyDict_SetItemString(dict, rs->name,
> -					Py_None) < 0) {
> -				Py_DECREF(dict);
> -				return NULL;
> -			}
> -		}
> -
> -		name = PyString_FromString(rd->name);
> -		if (!name) {
> -			Py_DECREF(dict);
> -			return NULL;
> -		}
> -
> -		if (PyDict_Contains(dict, name)) {
> -			Py_DECREF(name);
> -			continue;
> -		}
> -
> -		if (PyDict_SetItem(dict, name, Py_None) < 0) {
> -			Py_DECREF(name);
> -			Py_DECREF(dict);
> -			return NULL;
> -		}
> -
> -		Py_DECREF(name);
> -		if (!group_set(ctx->lc, &rd->name)) {
> -			/*
> -			 * This means that whatever was in name did not
> -			 * play well with current context.  lest try
> -			 * a NULL list.
> -			 */
> -			char *temp[] = {NULL};
> -			if (!group_set(ctx->lc, temp)){
> -				pyblock_PyErr_Format(GroupingError, "%s", rd->name);
> -				Py_DECREF(dict);
> -				return NULL;
> -			}
> -		}
> -		Py_DECREF(dict);
> +	if (!group_set(ctx->lc, argv)) {
> +		pyblock_PyErr_Format(GroupingError, "group_set failed");
> +		return NULL;
>  	}
>  	n = count_devices(ctx->lc, SETS);
>  	return PyLong_FromUnsignedLong(n);
> -- 
> 1.6.1.3
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

-- 
Joel Andres Granados
Brno, Czech Republic, Red Hat.

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux