[BUG] Dashboard报错:if usages['subnets']['available'] <= 0: KeyError: 'available'

Openstack版本号:Liberty

系统平台:CentOS 7.2 64bit

###############################################################

1.现象:

管理员登陆Dasgboard,查看项目》网络》网络》选择一个网络》选择一个子网》查看网络ID,例如以下:

查看httpd日志报错例如以下:

tail -f /etc/httpd/logs/error_log
[Tue Apr 12 10:24:08.830778 2016] [:error] [pid 94866] Error while checking action permissions.
[Tue Apr 12 10:24:08.830848 2016] [:error] [pid 94866] Traceback (most recent call last):
[Tue Apr 12 10:24:08.830854 2016] [:error] [pid 94866]   File "/usr/lib/python2.7/site-packages/horizon/tables/base.py", line 1270, in _filter_action
[Tue Apr 12 10:24:08.830859 2016] [:error] [pid 94866]     return action._allowed(request, datum) and row_matched
[Tue Apr 12 10:24:08.830862 2016] [:error] [pid 94866]   File "/usr/lib/python2.7/site-packages/horizon/tables/actions.py", line 135, in _allowed
[Tue Apr 12 10:24:08.830866 2016] [:error] [pid 94866]     self.allowed(request, datum))
[Tue Apr 12 10:24:08.830873 2016] [:error] [pid 94866]   File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/project/networks/subnets/tables.py", line 103, in allowed
[Tue Apr 12 10:24:08.830883 2016] [:error] [pid 94866]     if usages[‘subnets‘][‘available‘] <= 0:
[Tue Apr 12 10:24:08.830899 2016] [:error] [pid 94866] KeyError: ‘available‘

################################################################

2.问题解决:

改动/usr/share/openstack-dashboard/openstack_dashboard/dashboards/project/networks/subnets/tables.py源码例如以下:

class CreateSubnet(SubnetPolicyTargetMixin, CheckNetworkEditable,
                   tables.LinkAction):
    name = "create"
    verbose_name = _("Create Subnet")
    url = "horizon:project:networks:addsubnet"
    classes = ("ajax-modal",)
    icon = "plus"
    policy_rules = (("network", "create_subnet"),)

    def get_link_url(self, datum=None):
        network_id = self.table.kwargs[‘network_id‘]
        return reverse(self.url, args=(network_id,))

    def allowed(self, request, datum=None):
        usages = quotas.tenant_quota_usages(request)
        if usages[‘subnets‘].get(‘available‘, 1) <= 0:
            if ‘disabled‘ not in self.classes:
                self.classes = [c for c in self.classes] + [‘disabled‘]
                self.verbose_name = _(‘Create Subnet (Quota exceeded)‘)
        else:
            self.verbose_name = _(‘Create Subnet‘)
            self.classes = [c for c in self.classes if c != ‘disabled‘]

        return True

[BUG] Dashboard报错:if usages['subnets']['available'] &lt;= 0: KeyError: 'available'

原文地址:https://www.cnblogs.com/zhchoutai/p/8901089.html

时间: 2024-11-12 09:33:39

[BUG] Dashboard报错:if usages['subnets']['available'] &lt;= 0: KeyError: 'available'的相关文章

(转)Windows下pip安装包报错:Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat

刚在机器上windows环境下装上pip方便以后安装包的时候使用,谁知道第一次使用pip安装asyncio的时候就报错. 在Windows7x64下使用pip安装包的时候提示报错:Microsoft Visual C++ 9.0 is required  (Unable to find vcvarsall.bat) 环境:windows7 x64 ,python2.7 ,VS2012 原因:windows下使用pip安装包的时候需要机器装有vs2008,VS2012还不行,如果不想装VS2008

应用部署weblogic 报错Unsupported major.minor version 51.0的解决过程

应用部署weblogic 报错Unsupported major.minor version 51.0的解决过程 ? ? 1.部署提示错误:Unsupported major.minor version 51.0 1.1 错误现象如下图所示: 1.2 原因分析 类似错误均属于Java版本问题,即JDK版本过低,只要选择相对应的JDK版本编译即可.48,49,50.51.52是Java编译器内部的版本号:Unsupported major.minor version 52.0 对应于 JDK1.8

报错: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

描述:使用Hibernate登陆验证时故意输入没有的用户名,所产生的错误. 错误代码: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 /*      * 根据客户的用户名查找客户信息      */     @Override     public User getUserByUserName(String userName) {         String hql="from User where userName=?";         Session s

yum报错setup has installed conflicts filesystem &lt; (&#39;0&#39;, &#39;3&#39;, None): filesystem

yum安装出现以下错误: Error: Depsolving loop limit reached. Error: Package: cloog-ppl-0.15.7-1.2.el6.x86_64 (@anaconda-CentOS-201508042137.x86_64/6.7) Requires: libgmp.so.3()(64bit) Removing: gmp-4.3.1-7.el6_2.2.x86_64 (@anaconda-CentOS-201508042137.x86_64/6.

Windows下pip安装包报错:Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat(转载)

Windows下pip安装包报错:Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat 刚在机器上windows环境下装上pip方便以后安装包的时候使用,谁知道第一次使用pip安装asyncio的时候就报错. 在Windows7x64下使用pip安装包的时候提示报错:Microsoft Visual C++ 9.0 is required  (Unable to find vcvarsall.bat) 环境:windo

【python】 Windows下pip安装包报错:Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat

刚在机器上windows环境下装上pip方便以后安装包的时候使用,谁知道第一次使用pip安装asyncio的时候就报错. 在Windows7x64下使用pip安装包的时候提示报错:Microsoft Visual C++ 9.0 is required  (Unable to find vcvarsall.bat) 环境:windows7 x64 ,python2.7 ,VS2012 原因:windows下使用pip安装包的时候需要机器装有vs2008,VS2012还不行,如果不想装VS2008

安装Scrapy报错 error: Microsoft Visual C++ 14.0 is required解决方法

[问题背景]:在Windows 10系统,pip install Scrapy,报错error: Microsoft Visual C++ 14.0 is required,还有提示Twisted需要安装. [解决方法步骤] 1.根据提示,去https://landinghub.visualstudio.com/visual-cpp-build-tools下载C++编译工具.但是,页面已经打不开,无法下载.  2.之前因需要安装uwsgi,在Windows 10 安装过MinGW,通过可以Min

HTTP Status 500:报错Unsupported major.minor version 51.0(unable to load class XXX)

这个是jdk版本和JRE不匹配导致的. 报错信息: 问题详解:(待填) 处理: 1.检查jdk和jre版本是否匹配 --打开命令行界面(cmd),分别输入java -version 和javac -version 对比查看版本信息 如果不匹配,则自行下载对应的JRE或者JDK版本 如果像我这样是匹配的,就接下去看: 2.既然是匹配的,那么就是jdk版本的问题了.可以自行选择调整jdk的版本(原先是1.7),最后 apply-->ok 再重启服务器,问题就解决了.

python3 pip 安装Scrapy在win10 安装报错error: Microsoft Visual C++ 14.0 is required. Get it with &quot;Microsoft Visual C++ Build Tools&quot;: http://landinghub.visualstudio.com/visual-cpp-build-tools

问题描述 当前环境win10,python_3.6.1,64位. 在windows下,在dos中运行pip install Scrapy报错: building 'twisted.test.raiser' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/vis