Merge "Fix recoverable error at volume group create"
This commit is contained in:
commit
782cb2f22d
|
@ -17,7 +17,6 @@ from django.utils.translation import ugettext_lazy as _
|
|||
from horizon import exceptions
|
||||
from horizon import tables
|
||||
|
||||
from openstack_dashboard.api import cinder
|
||||
from openstack_dashboard.api import keystone
|
||||
from openstack_dashboard.dashboards.project.volume_groups \
|
||||
import tables as project_tables
|
||||
|
@ -31,20 +30,20 @@ class RemoveAllVolumes(project_tables.RemoveAllVolumes):
|
|||
url = "horizon:admin:volume_groups:remove_volumes"
|
||||
|
||||
|
||||
class UpdateRow(tables.Row):
|
||||
class UpdateRow(project_tables.UpdateRow):
|
||||
ajax = True
|
||||
|
||||
def get_data(self, request, group_id):
|
||||
groups = cinder.group_list_with_vol_type_names(request, group_id)
|
||||
tenant_id = getattr(groups, 'project_id')
|
||||
group = super(UpdateRow, self).get_data(request, group_id)
|
||||
tenant_id = getattr(group, 'project_id')
|
||||
try:
|
||||
tenant = keystone.tenant_get(request, tenant_id)
|
||||
groups.tenant_name = getattr(tenant, "name")
|
||||
group.tenant_name = getattr(tenant, "name")
|
||||
except Exception:
|
||||
msg = _('Unable to retrieve volume group project information.')
|
||||
exceptions.handle(request, msg)
|
||||
|
||||
return groups
|
||||
return group
|
||||
|
||||
|
||||
class ManageVolumes(project_tables.ManageVolumes):
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from cinderclient import exceptions as cinder_exc
|
||||
|
||||
from django.template import defaultfilters as filters
|
||||
from django.utils.translation import pgettext_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
@ -107,13 +105,16 @@ class UpdateRow(tables.Row):
|
|||
ajax = True
|
||||
|
||||
def get_data(self, request, group_id):
|
||||
group = cinder.group_get_with_vol_type_names(request, group_id)
|
||||
search_opts = {'group_id': group_id}
|
||||
try:
|
||||
return cinder.group_get_with_vol_type_names(request, group_id)
|
||||
except cinder_exc.NotFound:
|
||||
# NotFound error must be raised to make ajax UpdateRow work.
|
||||
raise
|
||||
group_snapshots = cinder.group_snapshot_list(
|
||||
request, search_opts=search_opts)
|
||||
group.has_snapshots = bool(group_snapshots)
|
||||
except Exception:
|
||||
exceptions.handle(request, _('Unable to display group.'))
|
||||
exceptions.handle(request, _('Unable to retrieve group details.'))
|
||||
group.has_snapshots = False
|
||||
return group
|
||||
|
||||
|
||||
class GroupsFilterAction(tables.FilterAction):
|
||||
|
|
Loading…
Reference in New Issue