gluster: proper check in gfapi.py to avoid segfault in libgfapi

This patch adds proper checks in gfapi.py to avoid
segmentation fault in libgfapi.

Change-Id: Ie32cdc723a78a30a4efc0c2e75e1b308fc756bf3
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1162640
Signed-off-by: ndarshan <dnarayan@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35256
Reviewed-by: Bala.FA <barumuga@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>