1. 程式人生 > >openstack安裝配置—— dnshboard安裝配置

openstack安裝配置—— dnshboard安裝配置

openstack dnshboard安裝配置 openstack實驗環境搭建 openstack vnc網面訪問

做為專業運維人員,使用命令行工具去管理雲主機是沒有問題的,但如果雲要提供給客戶使用,就不可能讓用戶命令行工具去管理自己的雲主機了,此時,就需要一個簡單易用的管理頁面提供給用戶了,openstack官方也很體貼的為我們已經準備好了,只是程序代碼方面還存在著一些小問題,不過我已經幫大家趟過一連坑了,按照如下的配置流程是可以讓大家體驗到使用鼠標管理雲主機的效果的。


安裝並修改配置文件

[[email protected] ~]# yum install -y openstack-dashboard

[[email protected] ~]# cp /etc/openstack-dashboard/local_settings{,.bak}

[[email protected] ~]# vim /etc/openstack-dashboard/local_settings

[[email protected] ~]# grep -v ^##* /etc/openstack-dashboard/local_settings | tr -s [[:space:]]


import os

from django.utils.translation import ugettext_lazy as _

from openstack_dashboard import exceptions

from openstack_dashboard.settings import HORIZON_CONFIG

DEBUG = False

TEMPLATE_DEBUG = DEBUG

WEBROOT = ‘/dashboard/‘

ALLOWED_HOSTS = [‘*‘, ]

OPENSTACK_API_VERSIONS = {

"identity": 3,

"volume": 2,

"compute": 2,

}

OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True

OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = ‘default‘

LOCAL_PATH = ‘/tmp‘

SECRET_KEY=‘aeee32ce4909dfa6ef1b‘

SESSION_ENGINE = ‘django.contrib.sessions.backends.cache‘

CACHES = {

‘default‘: {

‘BACKEND‘: ‘django.core.cache.backends.memcached.MemcachedCache‘,

‘LOCATION‘: ‘controller:11211‘,

}

}

EMAIL_BACKEND = ‘django.core.mail.backends.console.EmailBackend‘

OPENSTACK_HOST = "controller"

OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST

OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"

OPENSTACK_KEYSTONE_BACKEND = {

‘name‘: ‘native‘,

‘can_edit_user‘: True,

‘can_edit_group‘: True,

‘can_edit_project‘: True,

‘can_edit_domain‘: True,

‘can_edit_role‘: True,

}

OPENSTACK_HYPERVISOR_FEATURES = {

‘can_set_mount_point‘: False,

‘can_set_password‘: False,

‘requires_keypair‘: False,

}

OPENSTACK_CINDER_FEATURES = {

‘enable_backup‘: False,

}

OPENSTACK_NEUTRON_NETWORK = {

‘enable_router‘: False,

‘enable_quotas‘: False,

‘enable_ipv6‘: False,

‘enable_distributed_router‘: False,

‘enable_ha_router‘: False,

‘enable_lb‘: False,

‘enable_firewall‘: False,

‘enable_vpn‘: False,

‘enable_fip_topology_check‘: False,

# Neutron can be configured with a default Subnet Pool to be used for IPv4

# subnet-allocation. Specify the label you wish to display in the Address

# pool selector on the create subnet step if you want to use this feature.

‘default_ipv4_subnet_pool_label‘: None,

# Neutron can be configured with a default Subnet Pool to be used for IPv6

# subnet-allocation. Specify the label you wish to display in the Address

# pool selector on the create subnet step if you want to use this feature.

# You must set this to enable IPv6 Prefix Delegation in a PD-capable

# environment.

‘default_ipv6_subnet_pool_label‘: None,

# The profile_support option is used to detect if an external router can be

# configured via the dashboard. When using specific plugins the

# profile_support can be turned on if needed.

‘profile_support‘: None,

#‘profile_support‘: ‘cisco‘,

# Set which provider network types are supported. Only the network types

# in this list will be available to choose from when creating a network.

# Network types include local, flat, vlan, gre, and vxlan.

‘supported_provider_types‘: [‘*‘],

# Set which VNIC types are supported for port binding. Only the VNIC

# types in this list will be available to choose from when creating a

# port.

# VNIC types include ‘normal‘, ‘macvtap‘ and ‘direct‘.

# Set to empty list or None to disable VNIC type selection.

‘supported_vnic_types‘: [‘*‘],

}

OPENSTACK_HEAT_STACK = {

‘enable_user_pass‘: True,

}

IMAGE_CUSTOM_PROPERTY_TITLES = {

"architecture": _("Architecture"),

"kernel_id": _("Kernel ID"),

"ramdisk_id": _("Ramdisk ID"),

"image_state": _("Euca2ools state"),

"project_id": _("Project ID"),

"image_type": _("Image Type"),

}

IMAGE_RESERVED_CUSTOM_PROPERTIES = []

API_RESULT_LIMIT = 1000

API_RESULT_PAGE_SIZE = 20

SWIFT_FILE_TRANSFER_CHUNK_SIZE = 512 * 1024

DROPDOWN_MAX_ITEMS = 30

TIME_ZONE = "Asia/Shanghai"

POLICY_FILES_PATH = ‘/etc/openstack-dashboard‘

LOGGING = {

‘version‘: 1,

# When set to True this will disable all logging except

# for loggers specified in this configuration dictionary. Note that

# if nothing is specified here and disable_existing_loggers is True,

# django.db.backends will still log unless it is disabled explicitly.

‘disable_existing_loggers‘: False,

‘handlers‘: {

‘null‘: {

‘level‘: ‘DEBUG‘,

‘class‘: ‘logging.NullHandler‘,

},

‘console‘: {

# Set the level to "DEBUG" for verbose output logging.

‘level‘: ‘INFO‘,

‘class‘: ‘logging.StreamHandler‘,

},

},

‘loggers‘: {

# Logging from django.db.backends is VERY verbose, send to null

# by default.

‘django.db.backends‘: {

‘handlers‘: [‘null‘],

‘propagate‘: False,

},

‘requests‘: {

‘handlers‘: [‘null‘],

‘propagate‘: False,

},

‘horizon‘: {

‘handlers‘: [‘console‘],

‘level‘: ‘DEBUG‘,

‘propagate‘: False,

},

‘openstack_dashboard‘: {

‘handlers‘: [‘console‘],

‘level‘: ‘DEBUG‘,

‘propagate‘: False,

},

‘novaclient‘: {

‘handlers‘: [‘console‘],

‘level‘: ‘DEBUG‘,

‘propagate‘: False,

},

‘cinderclient‘: {

‘handlers‘: [‘console‘],

‘level‘: ‘DEBUG‘,

‘propagate‘: False,

},

‘keystoneclient‘: {

‘handlers‘: [‘console‘],

‘level‘: ‘DEBUG‘,

‘propagate‘: False,

},

‘glanceclient‘: {

‘handlers‘: [‘console‘],

‘level‘: ‘DEBUG‘,

‘propagate‘: False,

},

‘neutronclient‘: {

‘handlers‘: [‘console‘],

‘level‘: ‘DEBUG‘,

‘propagate‘: False,

},

‘heatclient‘: {

‘handlers‘: [‘console‘],

‘level‘: ‘DEBUG‘,

‘propagate‘: False,

},

‘ceilometerclient‘: {

‘handlers‘: [‘console‘],

‘level‘: ‘DEBUG‘,

‘propagate‘: False,

},

‘swiftclient‘: {

‘handlers‘: [‘console‘],

‘level‘: ‘DEBUG‘,

‘propagate‘: False,

},

‘openstack_auth‘: {

‘handlers‘: [‘console‘],

‘level‘: ‘DEBUG‘,

‘propagate‘: False,

},

‘nose.plugins.manager‘: {

‘handlers‘: [‘console‘],

‘level‘: ‘DEBUG‘,

‘propagate‘: False,

},

‘django‘: {

‘handlers‘: [‘console‘],

‘level‘: ‘DEBUG‘,

‘propagate‘: False,

},

‘iso8601‘: {

‘handlers‘: [‘null‘],

‘propagate‘: False,

},

‘scss‘: {

‘handlers‘: [‘null‘],

‘propagate‘: False,

},

},

}

SECURITY_GROUP_RULES = {

‘all_tcp‘: {

‘name‘: _(‘All TCP‘),

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘1‘,

‘to_port‘: ‘65535‘,

},

‘all_udp‘: {

‘name‘: _(‘All UDP‘),

‘ip_protocol‘: ‘udp‘,

‘from_port‘: ‘1‘,

‘to_port‘: ‘65535‘,

},

‘all_icmp‘: {

‘name‘: _(‘All ICMP‘),

‘ip_protocol‘: ‘icmp‘,

‘from_port‘: ‘-1‘,

‘to_port‘: ‘-1‘,

},

‘ssh‘: {

‘name‘: ‘SSH‘,

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘22‘,

‘to_port‘: ‘22‘,

},

‘smtp‘: {

‘name‘: ‘SMTP‘,

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘25‘,

‘to_port‘: ‘25‘,

},

‘dns‘: {

‘name‘: ‘DNS‘,

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘53‘,

‘to_port‘: ‘53‘,

},

‘http‘: {

‘name‘: ‘HTTP‘,

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘80‘,

‘to_port‘: ‘80‘,

},

‘pop3‘: {

‘name‘: ‘POP3‘,

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘110‘,

‘to_port‘: ‘110‘,

},

‘imap‘: {

‘name‘: ‘IMAP‘,

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘143‘,

‘to_port‘: ‘143‘,

},

‘ldap‘: {

‘name‘: ‘LDAP‘,

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘389‘,

‘to_port‘: ‘389‘,

},

‘https‘: {

‘name‘: ‘HTTPS‘,

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘443‘,

‘to_port‘: ‘443‘,

},

‘smtps‘: {

‘name‘: ‘SMTPS‘,

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘465‘,

‘to_port‘: ‘465‘,

},

‘imaps‘: {

‘name‘: ‘IMAPS‘,

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘993‘,

‘to_port‘: ‘993‘,

},

‘pop3s‘: {

‘name‘: ‘POP3S‘,

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘995‘,

‘to_port‘: ‘995‘,

},

‘ms_sql‘: {

‘name‘: ‘MS SQL‘,

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘1433‘,

‘to_port‘: ‘1433‘,

},

‘mysql‘: {

‘name‘: ‘MYSQL‘,

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘3306‘,

‘to_port‘: ‘3306‘,

},

‘rdp‘: {

‘name‘: ‘RDP‘,

‘ip_protocol‘: ‘tcp‘,

‘from_port‘: ‘3389‘,

‘to_port‘: ‘3389‘,

},

}

REST_API_REQUIRED_SETTINGS = [‘OPENSTACK_HYPERVISOR_FEATURES‘,

‘LAUNCH_INSTANCE_DEFAULTS‘]

[[email protected] ~]# systemctl restart httpd.service memcached.service


按上術官方配置後瀏覽器輸入 http://controller/dashboard 訪問儀表盤無法登陸

提示“出錯啦!遇到異常情況,請刷新。如需幫助請聯系管理員。”


查看httpd錯誤日誌如下

[[email protected] ~]# tail -20f /var/log/httpd/error_log

[Tue Jul 18 22:45:26.459408 2017] [:error] [pid 8293] Login successful for user "admin".

[Tue Jul 18 22:45:30.604355 2017] [:error] [pid 8293] Internal Server Error: /dashboard/auth/login/

[Tue Jul 18 22:45:30.604412 2017] [:error] [pid 8293] Traceback (most recent call last):

[Tue Jul 18 22:45:30.604416 2017] [:error] [pid 8293] File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response

[Tue Jul 18 22:45:30.604419 2017] [:error] [pid 8293] response = wrapped_callback(request, *callback_args, **callback_kwargs)

[Tue Jul 18 22:45:30.604422 2017] [:error] [pid 8293] File "/usr/lib/python2.7/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper

[Tue Jul 18 22:45:30.604424 2017] [:error] [pid 8293] return view(request, *args, **kwargs)

[Tue Jul 18 22:45:30.604427 2017] [:error] [pid 8293] File "/usr/lib/python2.7/site-packages/django/utils/decorators.py", line 110, in _wrapped_view

[Tue Jul 18 22:45:30.604429 2017] [:error] [pid 8293] response = view_func(request, *args, **kwargs)

[Tue Jul 18 22:45:30.604448 2017] [:error] [pid 8293] File "/usr/lib/python2.7/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func

[Tue Jul 18 22:45:30.604452 2017] [:error] [pid 8293] response = view_func(request, *args, **kwargs)

[Tue Jul 18 22:45:30.604454 2017] [:error] [pid 8293] File "/usr/lib/python2.7/site-packages/openstack_auth/views.py", line 103, in login

[Tue Jul 18 22:45:30.604457 2017] [:error] [pid 8293] **kwargs)

[Tue Jul 18 22:45:30.604460 2017] [:error] [pid 8293] File "/usr/lib/python2.7/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper

[Tue Jul 18 22:45:30.604463 2017] [:error] [pid 8293] return view(request, *args, **kwargs)

[Tue Jul 18 22:45:30.604465 2017] [:error] [pid 8293] File "/usr/lib/python2.7/site-packages/django/utils/decorators.py", line 110, in _wrapped_view

[Tue Jul 18 22:45:30.604484 2017] [:error] [pid 8293] response = view_func(request, *args, **kwargs)

[Tue Jul 18 22:45:30.604487 2017] [:error] [pid 8293] File "/usr/lib/python2.7/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func

[Tue Jul 18 22:45:30.604489 2017] [:error] [pid 8293] response = view_func(request, *args, **kwargs)

[Tue Jul 18 22:45:30.604492 2017] [:error] [pid 8293] File "/usr/lib/python2.7/site-packages/django/contrib/auth/views.py", line 51, in login

[Tue Jul 18 22:45:30.604494 2017] [:error] [pid 8293] auth_login(request, form.get_user())

[Tue Jul 18 22:45:30.604496 2017] [:error] [pid 8293] File "/usr/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 110, in login

[Tue Jul 18 22:45:30.604499 2017] [:error] [pid 8293] request.session.cycle_key()

[Tue Jul 18 22:45:30.604501 2017] [:error] [pid 8293] File "/usr/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py", line 285, in cycle_key

[Tue Jul 18 22:45:30.604503 2017] [:error] [pid 8293] self.create()

[Tue Jul 18 22:45:30.604505 2017] [:error] [pid 8293] File "/usr/lib/python2.7/site-packages/django/contrib/sessions/backends/cache.py", line 48, in create

[Tue Jul 18 22:45:30.604508 2017] [:error] [pid 8293] "Unable to create a new session key. "

[Tue Jul 18 22:45:30.604510 2017] [:error] [pid 8293] RuntimeError: Unable to create a new session key. It is likely that the cache is unavailable.


修正方法:

修改dashboard配置文件的SESSION_ENGINE方式


SESSION_ENGINE = ‘django.contrib.sessions.backends.file‘


官方配置是用memcached來保存會話,但代碼有誤,所以只能先改用file保存侍會話

登錄頁面

技術分享

成功登錄頁面

技術分享

實例詳情頁面

技術分享映像文件列表頁面

技術分享

網絡拓撲頁面

技術分享網絡模型查看頁面

技術分享

安全組管理頁面

技術分享技術分享admin用戶身份登錄後查看到的項目

技術分享使用網頁上的vnc遠程管理接口登錄後的效果

技術分享

技術分享技術分享

技術分享

至此,一套簡單的openstack實驗環境搭建完成,不足之處,還望大牛指點。與此同時,也非常希望有正在學習openstack的同仁能夠相互交流,如有留言告之或者直接添加公告上聯系方式。

本文出自 “愛情防火墻” 博客,請務必保留此出處http://183530300.blog.51cto.com/894387/1957863

openstack安裝配置—— dnshboard安裝配置