engine: Fixed issue with gluster task cleanup

In case there are empty clusters or other clusters with
non-operational hosts, the orphan tasks
in db were not getting cleared for operational clusters
either.
Changed the logic to handle the task cleanup cluster-wise.

Change-Id: I70cc24e278d112d889dc2d08ee72fce22a457195
Bug-Url: https://bugzilla.redhat.com/1022996
Signed-off-by: Sahina Bose <sabose@redhat.com>