精华内容
下载资源
问答
  • devstack

    千次阅读 2015-03-26 22:48:09
    1 快速安装 1 系统版本:Ubuntu 14.04 (Trusty) stack@ubuntu:~$ cat /etc/issue Ubuntu 14.04.2 LTS \n \l ...2 下载devstack git clone https://git.openstack.org/openstack-dev/devstack 3 配置

    1 快速安装

    1 系统硬件

    系统版本:Ubuntu 14.04 (Trusty),安装版本的minimal version

    stack@ubuntu:~$cat /etc/issue
    Ubuntu 14.04.2 LTS \n \l

    查看硬件是否支持虚拟化

    命令:grep --color vmx /proc/cpuinfo    #Intel (Intel-VT)
    命令:grep --color svm /proc/cpuinfo    #AMD (AMD-V)

    localadmin@testopenstack:~/devstack$ grep --color vmx /proc/cpuinfo
    flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
    nopl xtopology nonstop_tsc aperfmperf pni ds_cpl vmx smx 
    

    服务器个数

    单结点服务器,双网卡

    2 下载devstack

    下载:git clone https://git.openstack.org/openstack-dev/devstack

    stack@ubuntu:~$ git clone  https://git.openstack.org/openstack-dev/devstack
    The program 'git' is currently not installed. You can install it by typing:
    sudo apt-get install git
    stack@ubuntu:~$ sudo apt-get install git
    [sudo] password for stack:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package git

    无法找到git时,使用命令sudo apt-get update更新

    stack@ubuntu:~$ sudo apt-get update

    3 配置local.conf

    stack@ubuntu:~$ cd devstack/
    stack@ubuntu:~/devstack$ cp samples/local.conf .
    stack@ubuntu:~/devstack$ cat local.conf
    # Sample ``local.conf`` for user-configurable variables in ``stack.sh``
    
    # NOTE: Copy this file to the root ``devstack`` directory for it to
    # work properly.
    
    # ``local.conf`` is a user-maintained settings file that is sourced from ``stackrc``.
    # This gives it the ability to override any variables set in ``stackrc``.
    # Also, most of the settings in ``stack.sh`` are written to only be set if no
    # value has already been set; this lets ``local.conf`` effectively override the
    # default values.
    
    # This is a collection of some of the settings we have found to be useful
    # in our DevStack development environments. Additional settings are described
    # in http://devstack.org/local.conf.html
    # These should be considered as samples and are unsupported DevStack code.
    
    # The ``localrc`` section replaces the old ``localrc`` configuration file.
    # Note that if ``localrc`` is present it will be used in favor of this section.
    [[local|localrc]]
    
    # Minimal Contents
    # ----------------
    FLOATING_RANGE=192.168.1.224/27
    FIXED_RANGE=10.11.12.0/24
    FIXED_NETWORK_SIZE=256
    FLAT_INTERFACE=eth0
    
    # While ``stack.sh`` is happy to run without ``localrc``, devlife is better when
    # there are a few minimal variables set:
    
    # If the ``SERVICE_TOKEN`` and ``*_PASSWORD`` variables are not set
    # here you will be prompted to enter values for them by ``stack.sh``
    # and they will be added to ``local.conf``.
    SERVICE_TOKEN=azertytokenzhf
    ADMIN_PASSWORD=123456
    MYSQL_PASSWORD=$ADMIN_PASSWORD
    RABBIT_PASSWORD=$ADMIN_PASSWORD
    SERVICE_PASSWORD=$ADMIN_PASSWORD
    
    # ``HOST_IP`` should be set manually for best results if the NIC configuration
    # of the host is unusual, i.e. ``eth1`` has the default route but ``eth0`` is the
    # public interface.  It is auto-detected in ``stack.sh`` but often is indeterminate
    # on later runs due to the IP moving from an Ethernet interface to a bridge on
    # the host. Setting it here also makes it available for ``openrc`` to include
    # when setting ``OS_AUTH_URL``.
    # ``HOST_IP`` is not set by default.
    #HOST_IP=w.x.y.z
    
    
    # Logging
    # -------
    
    # By default ``stack.sh`` output only goes to the terminal where it runs.  It can
    # be configured to additionally log to a file by setting ``LOGFILE`` to the full
    # path of the destination log file.  A timestamp will be appended to the given name.
    LOGFILE=$DEST/logs/stack.sh.log
    
    # Old log files are automatically removed after 7 days to keep things neat.  Change
    # the number of days by setting ``LOGDAYS``.
    LOGDAYS=2
    
    # Nova logs will be colorized if ``SYSLOG`` is not set; turn this off by setting
    # ``LOG_COLOR`` false.
    #LOG_COLOR=False
    
    
    # Using milestone-proposed branches
    # ---------------------------------
    
    # Uncomment these to grab the milestone-proposed branches from the repos:
    #CINDER_BRANCH=milestone-proposed
    #GLANCE_BRANCH=milestone-proposed
    #HORIZON_BRANCH=milestone-proposed
    #KEYSTONE_BRANCH=milestone-proposed
    #KEYSTONECLIENT_BRANCH=milestone-proposed
    #NOVA_BRANCH=milestone-proposed
    #NOVACLIENT_BRANCH=milestone-proposed
    #NEUTRON_BRANCH=milestone-proposed
    #SWIFT_BRANCH=milestone-proposed
    
    
    # Swift
    # -----
    
    # Swift is now used as the back-end for the S3-like object store. If Nova's
    # objectstore (``n-obj`` in ``ENABLED_SERVICES``) is enabled, it will NOT
    # run if Swift is enabled. Setting the hash value is required and you will
    # be prompted for it if Swift is enabled so just set it to something already:
    #SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
    
    # For development purposes the default of 3 replicas is usually not required.
    # Set this to 1 to save some resources:
    #SWIFT_REPLICAS=1
    
    # The data for Swift is stored by default in (``$DEST/data/swift``),
    # or (``$DATA_DIR/swift``) if ``DATA_DIR`` has been set, and can be
    # moved by setting ``SWIFT_DATA_DIR``. The directory will be created
    # if it does not exist.
    #SWIFT_DATA_DIR=$DEST/data
    
    # Tempest
    # -------
    
    # Install the tempest test suite
    #enable_service tempest

    4 安装:./stack.sh

    localadmin@ubuntu:~/devstack$ ./stack.sh
    ...
    Horizon is now available at http://192.168.100.128/
    Keystone is serving at http://192.168.100.128:5000/v2.0/
    Examples on using novaclient command line is in exercise.sh
    The default users are: admin and demo
    The password: 123456
    This is your host ip: 192.168.100.128
    localadmin@ubuntu:~/devstack$ source openrc admin demo
    localadmin@ubuntu:~/devstack$ nova list
    +----+------+--------+------------+-------------+----------+
    | ID | Name | Status | Task State | Power State | Networks |
    +----+------+--------+------------+-------------+----------+
    +----+------+--------+------------+-------------+----------+
    localadmin@ubuntu:~/devstack$ nova image-list
    +--------------------------------------+---------------------------------+--------+--------+
    | ID                                   | Name                            | Status | Server |
    +--------------------------------------+---------------------------------+--------+--------+
    | a49458fd-96b0-48a5-b939-4efd7c105532 | Fedora-x86_64-20-20140618-sda   | ACTIVE |        |
    | 550e397e-afae-4281-8439-c7ad2fcae173 | cirros-0.3.2-x86_64-uec         | ACTIVE |        |
    | c7dd445a-439a-4432-8725-41b1914db8d0 | cirros-0.3.2-x86_64-uec-kernel  | ACTIVE |        |
    | 4786e267-2648-4616-966b-ab385094bc26 | cirros-0.3.2-x86_64-uec-ramdisk | ACTIVE |        |
    +--------------------------------------+---------------------------------+--------+--------+
    localadmin@ubuntu:~/devstack$ nova net-list
    +--------------------------------------+---------+---------------+
    | ID                                   | Label   | CIDR          |
    +--------------------------------------+---------+---------------+
    | d638872f-ac21-4e6d-807e-59d2ffb6dbd3 | private | 10.11.12.0/24 |
    +--------------------------------------+---------+---------------+
    localadmin@ubuntu:~/devstack$ nova host-list
    +-----------+-------------+----------+
    | host_name | service     | zone     |
    +-----------+-------------+----------+
    | ubuntu    | conductor   | internal |
    | ubuntu    | cert        | internal |
    | ubuntu    | network     | internal |
    | ubuntu    | scheduler   | internal |
    | ubuntu    | consoleauth | internal |
    | ubuntu    | compute     | nova     |
    +-----------+-------------+----------+

    使用默认用户demo:

    localadmin@ubuntu:~/devstack$ source openrc
    localadmin@ubuntu:~/devstack$ source openrc demo demo
    

    使用默认用户admin:

    localadmin@ubuntu:~/devstack$ source openrc admin admin
    

    5 重启后执行stack.sh脚本重新部署OpenStack环境

    由于采用源码安装,没有开机启动脚本,所以需要手工启动相关的服务,最简单的方式,就是再运行stack.sh脚本.
    缺点就是所有的设置,数据都清空。在local.conf配置文件中设置OFFLINE(stackrc文件中)以使stack.sh运行时不联网:
    OFFLINE = true

    6 重新安装

    安装失败后,调用unstack.sh和clean.sh清理相关服务。

    要重新安装时,在local.conf配置文件中设置RECLONE(functions-common中),以更新每个repo:

    RECLONE=yes    #A clean install every time

    2 与openstack服务交互

    devstack使用screen来运行各个服务,默认screen名是stack,在stackrc文件中配置:

    # Whether to use 'dev mode' for screen windows. Dev mode works by
    # stuffing text into the screen windows so that a developer can use
    # ctrl-c, up-arrow, enter to restart the service. Starting services
    # this way is slightly unreliable, and a bit slower, so this can
    # be disabled for automated testing by setting this value to False.
    USE_SCREEN=True
    SCREEN_NAME=${SCREEN_NAME:-stack}
    

     
    

    screen中的openstack服务运行在单一模式(standalone mode)

    访问:

    localadmin@ubuntu:~/devstack$ screen -x stack

    rejoin:

    localadmin@ubuntu:~/devstack$ ./rejoin-stack.sh

    重启screen中的各服务

        1 用ctrl + a + "选择相应的服务,并进入;

        2 用ctrl + c取消选中的服务,再重新运行。

    销毁screen: $ ./unstack.sh

    3 Neutron网络

    https://wiki.openstack.org/wiki/NeutronDevstack
    单结点,在local.conf中配置如下:

    [[local|localrc]]
    disable_service n-net
    enable_service q-svc
    enable_service q-agt
    enable_service q-dhcp
    enable_service q-l3
    enable_service q-meta
    # Optional, to enable tempest configuration as part of devstack
    enable_service tempest
    

    多结点:

    controller node中的localrc:

    disable_service n-net
    enable_service q-svc
    enable_service q-agt
    enable_service q-dhcp
    enable_service q-l3
    enable_service q-meta
    enable_service neutron

    compute nodes中的localrc:

    ENABLED_SERVICES=n-cpu,rabbit,neutron,q-agt
    SERVICE_HOST=[IP of controller node]
    MYSQL_HOST=$SERVICE_HOST
    RABBIT_HOST=$SERVICE_HOST
    Q_HOST=$SERVICE_HOST

    4 Best Localrc

    # Misc
    DATABASE_PASSWORD=password
    ADMIN_PASSWORD=password
    SERVICE_PASSWORD=password
    SERVICE_TOKEN=password
    RABBIT_PASSWORD=password
    
    # Reclone each time
    RECLONE=yes
    
    ## For Keystone
    KEYSTONE_TOKEN_FORMAT=PKI
    
    ## For Swift
    SWIFT_REPLICAS=1
    SWIFT_HASH=011688b44136573e209e
    
    ## For Ceph
    ENABLED_SERVICES+=,ceph
    CEPH_LOOPBACK_DISK_SIZE=10G
    CEPH_CONF=/etc/ceph/ceph.conf
    CEPH_REPLICAS=1
    GLANCE_CEPH_USER=glancy
    GLANCE_CEPH_POOL=imajeez
    CINDER_DRIVER=ceph
    CINDER_CEPH_USER=cindy
    CINDER_CEPH_POOL=volumeuh
    CINDER_CEPH_UUID=6d52eb95-12f3-47e3-9eb9-0c1fe4142426
    CINDER_BAK_CEPH_POOL=backeups
    CINDER_BAK_CEPH_USER=cind-backeups
    CINDER_ENABLED_BACKENDS=ceph,lvm
    NOVA_CEPH_POOL=vmz
    
    # Enable Logging
    LOGFILE=/opt/stack/logs/stack.sh.log
    VERBOSE=True
    LOG_COLOR=True
    SCREEN_LOGDIR=/opt/stack/logs
    
    # Pre-requisite
    ENABLED_SERVICES=rabbit,mysql,key
    
    ## If you want ZeroMQ instead of RabbitMQ (don't forget to un-declare 'rabbit' from the pre-requesite)
    ENABLED_SERVICES+=,-rabbit,-qpid,zeromq
    
    ## If you want Qpid instead of RabbitMQ (don't forget to un-declare 'rabbit' from the pre-requesite)
    ENABLED_SERVICES+=,-rabbit,-zeromq,qpid
    
    # Horizon (Dashboard UI) - (always use the trunk)
    ENABLED_SERVICES+=,horizon
    HORIZON_REPO=https://github.com/openstack/horizon
    HORIZON_BRANCH=master
    
    # Nova - Compute Service
    ENABLED_SERVICES+=,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch
    IMAGE_URLS+=",https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"
    
    # Nova Network - If you don't want to use Neutron and need a simple network setup (old good stuff!)
    ENABLED_SERVICES+=,n-net
    
    ## Nova Cells
    ENABLED_SERVICES+=,n-cell
    
    # Glance - Image Service
    ENABLED_SERVICES+=,g-api,g-reg
    
    # Swift - Object Storage
    ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account
    
    # Neutron - Networking Service
    # If Neutron is not declared the old good nova-network will be used
    ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta,neutron
    
    ## Neutron - Load Balancing
    ENABLED_SERVICES+=,q-lbaas
    
    ## Neutron - VPN as a Service
    ENABLED_SERVICES+=,q-vpn
    
    ## Neutron - Firewall as a Service
    ENABLED_SERVICES+=,q-fwaas
    
    # VLAN configuration
    Q_PLUGIN=ml2
    ENABLE_TENANT_VLANS=True
    
    # GRE tunnel configuration
    Q_PLUGIN=ml2
    ENABLE_TENANT_TUNNELS=True
    
    # VXLAN tunnel configuration
    Q_PLUGIN=ml2
    Q_ML2_TENANT_NETWORK_TYPE=vxlan   
    
    # Cinder - Block Device Service
    ENABLED_SERVICES+=,cinder,c-api,c-vol,c-sch,c-bak
    
    # Heat - Orchestration Service
    ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng
    IMAGE_URLS+=",http://fedorapeople.org/groups/heat/prebuilt-jeos-images/F17-x86_64-cfntools.qcow2"
    
    # Ceilometer - Metering Service (metering + alarming)
    ENABLED_SERVICES+=,ceilometer-acompute,ceilometer-acentral,ceilometer-collector,ceilometer-api
    ENABLED_SERVICES+=,ceilometer-alarm-notify,ceilometer-alarm-eval
    
    # Apache fronted for WSGI
    APACHE_ENABLED_SERVICES+=keystone,swift

    5 devstack结构

    5.1 local.conf

    local.conf不随devstack发布,devstack更新时不会被覆盖。
    local.conf改进的INI格式的用户维护的配置文件,在stackrc文件中被source

    1 格式

    节头:[[ <phase> | <config-file-name> ]]
        1 <phase> is one of a set of phase names defined by stack.sh

    stack@ubuntu:~/devstack$ cat stack.sh | grep "# Phase"
    # Phase: local
    # Phase: source
    # Phase: pre-install
    # Phase: install
    # Phase: post-config
    # Phase: post-config
    # Phase: extra
    # Phase: extra
    # Phase: post-extra
    

    ?local - extracts localrc from local.conf before stackrc is sourced
    ?pre-install - runs after the system packages are installed but before any of the source repositories are installed
    ?install - runs immediately after the repo installations are complete
    ?post-config - runs after the layer 2 services are configured and before they are started
    ?extra - runs after services are started and before any files in extra.d are executed

         2 <config-file-name> is the configuration filename
    在stack.sh上下文中,shell命令eval执行配置文件名,因此所有的环境变量可用。
    文件按顺序处理。文件路径不存在时,忽略此配置文件。
    强烈建议使用工程配置文件名,如:NOVA_CONF

    [[post-config|$NOVA_CONF]]
    [DEFAULT]
    use_syslog = True
    
    [osapi_v3]
    enabled = False
    
    #Q_PLUGIN_CONF_FILE NOT start with a / (slash) character. 
    #A slash will need to be added
    [[post-config|/$Q_PLUGIN_CONF_FILE]]
    [agent]
    tunnel_type=vxlan
    vxlan_udp_port=8472
    
    [[post-config|$NEUTRON_CONF]]
    [DEFAULT]
    tenant_network_type=vxlan

    meta-section:[[local|localrc]],
    其中的localrc配置文件如果存在,优先使用; 如果不存在,会生成.localrc.auto配置文件。


    在初次运行stack.sh时,文件stackrc中调用get_default_host_ip函数来检测HOST_IP的值,
    但是在IP从网口移动到网桥时,HOST_IP的值不确定,所以应该手工设置一下HOST_IP,以设置
    openrc文件中的KEYSTONE_AUTH_HOST变量。
    HOST_IP=192.168.128.50

    openstack中的客户VMs有两种IP地址类型:
    1 fixed IPs:在vms启动时,分配给instances。实例终止时,分配的IP回收。
    2 floating IPs:用户来决定与哪个instance关联,用来为私有云中的实例提供公共IP,以便外部访问。
    两种类型的IP地地址都可以是公用的或专用的IP.
    不设floating IPs,只设fixed IPs时可以运行openstack.
    FLOATING_RANGE设置成不使用的local network的一部分,以从本地访问instance。For example, if the IPs given out on your network by DHCP are 192.168.1.X - where X is between 100 and 200 you will be able to use IPs 201-254 for floating ips.
    FIXED_RANGE设置instances使用的内部地址空间。
    FLAT_INTERFACE连接主机和本地网的网口。两种使用情况:
        1 单结点时,设置FLAT_INTERFACE,以阻止nova桥接任何网口到FLAT_NETWORK_BRIDGE
        2 多结点主机且使用FlatDHCP网络时。要保证此网口没有IP。

    FLOATING_RANGE=192.168.1.224/27  
    FIXED_RANGE=10.11.12.0/24  
    FIXED_NETWORK_SIZE=256  
    FLAT_INTERFACE=eth0  

    FIXED_RANGE和FLOATING_RANGE网络范围不能与主机上已使用的网络重叠。
    RFC-1918 ‘private’ ranges经常被用于the local networking和Nova’s fixed and floating ranges。
    RFC-1918:Internet Assigned Numbers Authority (IANA)保留的专用网IP地址空间块:

    24-bit block:     10.0.0.0        -   10.255.255.255  (10/8 prefix)
    20-bit block:     172.16.0.0      -   172.31.255.255  (172.16/12 prefix)
    16-bit block:     192.168.0.0     -   192.168.255.255 (192.168/16 prefix)
    

    如果不设置FIXED_RANGE,FLOATING_RANGE和HOST_IP,stackrc会设置默认值:

    FLOATING_RANGE=${FLOATING_RANGE:-172.24.4.0/24}
    FIXED_RANGE=${FIXED_RANGE:-10.0.0.0/24}
    FIXED_NETWORK_SIZE=${FIXED_NETWORK_SIZE:-256}
    HOST_IP_IFACE=${HOST_IP_IFACE:-}
    HOST_IP=${HOST_IP:-}
    
    HOST_IP=$(get_default_host_ip $FIXED_RANGE $FLOATING_RANGE "$HOST_IP_IFACE" "$HOST_IP")

    参考:http://docs.openstack.org/developer/devstack/configuration.html

    5.2 stackrc

    stackrc包含locations for the OpenStack repositories, branches to configure和其它默认配置.
    stackrc sources the ``localrc`` section of ``local.conf``,以覆盖环境变量设置。
    1 ENABLED_SERVICES:指定启动的服务,一个服务对应screen的一个tab。
    默认启动的服务:

    # Keystone - nothing works without keystone
    ENABLED_SERVICES=key
    # Nova - services to support libvirt based openstack clouds
    ENABLED_SERVICES+=,n-api,n-cpu,n-net,n-cond,n-sch,n-novnc
    # Glance services needed for Nova
    ENABLED_SERVICES+=,g-api,g-reg
    # Cinder
    ENABLED_SERVICES+=,c-sch,c-api,c-vol
    # Dashboard
    ENABLED_SERVICES+=,horizon
    # Additional services
    ENABLED_SERVICES+=,rabbit,tempest,mysql,dstat
    

    在local.conf文件中,使用``enable_service``和``disable_service``函数来启停相关服务。

    2 Service Repos

    # compute service
    NOVA_REPO=${NOVA_REPO:-${GIT_BASE}/openstack/nova.git}
    NOVA_BRANCH=${NOVA_BRANCH:-master}
    

    5.3 stack.sh

    stack.sh是主脚本,用于安装和配置不同组合的openstack服务。
    默认的变量位于stackrc文件,

    设置合适的环境变量来改变脚本的选项。
    1 export命令设置临时变量:

     export DATABASE_PASSWORD=anothersecret
     ./stack.sh

    2 命令行上设置:

    DATABASE_PASSWORD=simple ./stack.sh
    3 在local.conf中设置永久变量
    [[local|localrc]]
    DATABASE_PASSWORD=anothersecret
    DATABASE_USER=hellaroot

    可以不设置任何环境变量,直接运行整个脚本,这会提示输入账户密码和service token。这会在当前目录生成localrc文件,以保存设置(read_password函数)。

    因为Horizon中的Apache不服务于root用户,stack.sh必须以非root用户运行,执行$TOP_DIR/tools/create-stack-user.sh创建帐户stack。
    过程的输出信息大致总结出了它的执行过程:
    1.下载并安装 OpenStack 运行所需要的系统软件,大概包括一些 Python 的组件、MySQL、rabbitmq-server 等。
    2.下载 OpenStack 组件,包括 nova 、keystone、glance、noVNC、horizon 等。
    3.下载并安装 OpenStack 源码所依赖的 Python 库和框架 。
    4.安装 OpenStack 各组件。
    5.启动各项服务。

    参考:http://blog.csdn.net/zhaihaifei/article/details/40893823

    5.4 openrc

    openrc配置登录认证信息,以使用命令行工具,如nova, glance等。
    执行:source openrc [username] [tenantname]

    # Configure a set of credentials for $TENANT/$USERNAME:
    #   Set OS_TENANT_NAME to override the default tenant 'demo'
    #   Set OS_USERNAME to override the default user name 'demo'
    #   Set ADMIN_PASSWORD to set the password for 'admin' and 'demo'


    参考:

    官网:http://docs.openstack.org/developer/devstack/
    DevStack in 1 Minute:http://www.sebastien-han.fr/blog/2013/08/08/devstack-in-1-minute/
    nova-network安装: http://networkstatic.net/installing-openstack-grizzly-with-devstack/
    Quantum Devstack:http://networkstatic.net/openstack-folsom-quantum-devstack-installation-tutorial/
    http://packetpushers.net/openstack-quantum-network-implementation-in-linux/


    
    展开全文
  • devStack

    2014-09-11 13:54:00
    devStack 1,devstack shell 脚本开源官网 http://devstack.org/ 脚本功能快速搭建 OpenStack 的运行和开发环境 [Note tips by Ruiy devstack 不适合用在生产环境] devstack not appropriate for ...

    1,devstack shell 脚本开源官网

    http://devstack.org/

    脚本功能快速搭建 OpenStack 的运行和开发环境

    [Note tips by Ruiy devstack 不适合用在生产环境]

    devstack not appropriate for production deployments [根据官网相关说明,devstack目前仅仅在ubuntu11版本上测试,别的linux 衍生版本支持待测及shell完善及跟进]

    2,ins

    安装 git,然后下载 devstack 代码到本地,运行 stack.sh 脚本依次设定 MySQL, RabbitMQ, OpenStack Dashboard 和 Keystone 的密码,密码输入后 stack.sh 脚本会自动开始安装必要的软件包和库并下载最新的 OpenStack 及其组件代码,整个过程自动完成无需干预

    sudo apt-get install git
    
    $ git clone git://github.com/openstack-dev/devstack.git
    $ cd devstack/
    $ ./stack.sh 

    <一,一个ubuntu image register options>
    instance image optionS(提供一个ubuntu image选择)
    如果对默认的 tty.tgz 镜像不满意,想用 ubuntu 11.10 镜像的话编辑 stack.sh 脚本,在 for image_url in ${IMAGE_URLS//,/ }; do 一行上面加入
    IMAGE_URLS=http://uec-images.ubuntu.com/oneiric/current/oneiric-server-cloudimg-amd64.tar.gz 这行,然后重新运行 stack.sh 脚本:

    vi stack.sh ... IMAGE_URLS=http://uec-images.ubuntu.com/oneiric/current/oneiric-server-cloudimg-amd64.tar.gz for image_url in ${IMAGE_URLS//,/ }; do #
    Downloads the image (uec ami+aki style), then extracts it. IMAGE_FNAME=`basename "$image_url"` if [ ! -f $FILES/$IMAGE_FNAME ];
    then wget -c $image_url -O $FILES/$IMAGE_FNAME fi KERNEL="" RAMDISK="" ... $ ./stack.sh
    <二,floating ip configure>
    还有一点值得注意的地方,如果想使用现有的网络,比如安装 devstack 的这台服务器地址是 192.168.2.240,想让所有运行在上面的 instance 的地址为 192.168.2.241-192.168.2.247 的话,
    需要修改 stack.sh 里面的 TEST_FLOATING_RANGE,然后重新运行 stack.sh 脚本:
    $ vi stack.sh ... #TEST_FLOATING_RANGE=${TEST_FLOATING_RANGE:-192.168.253.0/29} TEST_FLOATING_RANGE=${TEST_FLOATING_RANGE:-192.168.2.240/29} ... $ ./stack.sh
    上面的ip子网地址根据你的网络环境;
    DevStack 安装结束后打开浏览器访问 http://192.168.2.240/ 就可以看到 OpenStack Dashboard 界面,用户名是 admin,密码是刚才设定的密码,输入正确后就会进入 Dashboard,
    最新的 OpenStack Dashboard 已经有了很大改善,可以创建或导入 keypairs,
    启动或终止 instance,
    分配和注射 IP 给 instance,创建和分配 volume 等,还可以添加和管理用户等
    posted on 2014-09-11 13:54 秦瑞It行程实录 阅读( ...) 评论( ...) 编辑 收藏

    转载于:https://www.cnblogs.com/ruiy/p/devstavkShell.html

    展开全文
  • DevStack

    千次阅读 2015-01-02 11:27:15
    目前Devstack脚本已经支持Centos 6.5,那么你可以选择是在Ubuntu 12.04或者CentOS 6.5下来安装,步骤基本都是一样。就是一个git命令安装的区别. 最小化安装CentOS 6.5,我是关闭了selinux,不关闭应该也是可以的...

    采用豆瓣的pypi进行安装。

    目前Devstack脚本已经支持Centos 6.5,那么你可以选择是在Ubuntu 12.04或者CentOS 6.5下来安装,步骤基本都是一样。就是一个git命令安装的区别.

    最小化安装CentOS 6.5,我是关闭了selinux,不关闭应该也是可以的。,用root账号登陆。

    对于CentOS6.5来说,devstack脚本会添加EPEL和RDO源。

    2014年6月6日:文档更新,已经可以支持siwft和trove。不过安装过程,你可能会遇到cliff的bughttps://review.openstack.org/#/c/95916/,如果你遇到horizon无法启动,那么你就去 /etc/httpd/conf.d/ 里把那个配置文件后缀disable去掉就ok。还有就是安装过程,由于启用了heat,会下载一个heat的镜像,会导致安装过程很慢,可以考虑修改stackrc文件,不让下载。另外csdn的git源,也应该没法使用,因为项目太多没有同步了。

    修复cilff的bug,估计上游很快就会merge

    cd /opt/stack/cliff/
    git fetch https://review.openstack.org/openstack/cliff refs/changes/16/95916/4 && git checkout FETCH_HEAD

    准备环境

    设置使用豆瓣pypi源

    mkdir $HOME/.pip
    vi $HOME/.pip/pip.conf

    输入下面内容

    [global]
    index-url = http://pypi.douban.com/simple/

    简单的做法

    mkdir /root/.pip
    cat >/root/.pip/pip.conf <<EOF
    [global]
    index-url = http://pypi.douban.com/simple/
    EOF

    安装git

    yum -y install git

    设置iptables

    我发现目前版本,devstack不会去打开iptables的80端口,所以在运行脚本前,我设置一下iptables,编辑 /etc/sysconfig/iptables,添加一行,打开80端口。

    准备Devstack

    下载代码

    cd /home
    git clone https://github.com/openstack-dev/devstack.git

    目前Devstack脚本已经不支持直接使用root身份运行,你需要创建stack用户运行

    cd /home/devstack/tools/
    ./create-stack-user.sh

    修改devstack目录权限,让stack用户可以运行

    chown -R stack:stack /home/devstack

    切换的stack用户下

    su stack
    cd /home/devstack

    devstack运行时候,检测到操作系统是CentOS,会额外添加RDO和EPEL源,由于我的os已经配置好,我需要把添加的步骤注释掉,修改一下 stack.sh 脚本就可以。

    进入devstack目录下,创建localrc 文件,默认devstack会创建一个stack-volumes,用文件来模拟,我修改成cinder-volumes。

    你还需要修改你的host ip. 我的localrc

    # Misc
    HOST_IP=172.28.1.132
    DATABASE_PASSWORD=password
    ADMIN_PASSWORD=password
    SERVICE_PASSWORD=password
    SERVICE_TOKEN=password
    RABBIT_PASSWORD=password
    
    
    #change from github to csdn
    #GIT_BASE=https://code.csdn.net
    
    
    ## vnc
    
    #enable_service n-spice
    #enable_service n-novnc
    #enable_service n-xvnc
    
    
    # Reclone each time
    #RECLONE=yes
    RECLONE=no
    
    ## For Keystone
    KEYSTONE_TOKEN_FORMAT=PKI
    
    ## For Swift
    SWIFT_REPLICAS=1
    SWIFT_HASH=011688b44136573e209e
    
    # Enable Logging
    LOGFILE=/opt/stack/logs/stack.sh.log
    VERBOSE=True
    LOG_COLOR=True
    SCREEN_LOGDIR=/opt/stack/logs
    
    # Pre-requisite
    ENABLED_SERVICES=rabbit,mysql,key
    
    ## If you want ZeroMQ instead of RabbitMQ (don't forget to un-declare 'rabbit' from the pre-requesite)
    #ENABLED_SERVICES+=,-rabbit,-qpid,zeromq
    
    ## If you want Qpid instead of RabbitMQ (don't forget to un-declare 'rabbit' from the pre-requesite)
    #ENABLED_SERVICES+=,-rabbit,-zeromq,qpid
    
    # Horizon (Dashboard UI) - (always use the trunk)
    ENABLED_SERVICES+=,horizon
    HORIZON_REPO=https://github.com/openstack/horizon
    HORIZON_BRANCH=master
    
    # Nova - Compute Service
    ENABLED_SERVICES+=,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch
    
    ######vnc
    ENABLED_SERVICES+=,n-novnc,n-xvnc
    
    
    IMAGE_URLS+=",https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"
    #IMAGE_URLS+=",http://172.28.0.1/image/cirros-0.3.0-x86_64-disk.img"
    
    
    # Nova Network - If you don't want to use Neutron and need a simple network setup (old good stuff!)
    #ENABLED_SERVICES+=,n-net
    
    ## Nova Cells
    ENABLED_SERVICES+=,n-cell
    
    # Glance - Image Service
    ENABLED_SERVICES+=,g-api,g-reg
    
    # Swift - Object Storage
    ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account
    
    # Neutron - Networking Service
    # If Neutron is not declared the old good nova-network will be used
    ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta,neutron
    
    ## Neutron - Load Balancing
    ENABLED_SERVICES+=,q-lbaas
    
    ## Neutron - VPN as a Service
    ENABLED_SERVICES+=,q-vpn
    
    ## Neutron - Firewall as a Service
    ENABLED_SERVICES+=,q-fwaas
    
    # VLAN configuration
    #Q_PLUGIN=ml2
    #ENABLE_TENANT_VLANS=True
    
    # GRE tunnel configuration
    Q_PLUGIN=ml2
    ENABLE_TENANT_TUNNELS=True
    
    # VXLAN tunnel configuration
    #Q_PLUGIN=ml2
    #Q_ML2_TENANT_NETWORK_TYPE=vxlan   
    
    # Cinder - Block Device Service
    VOLUME_GROUP="cinder-volumes"
    ENABLED_SERVICES+=,cinder,c-api,c-vol,c-sch,c-bak
    
    # Heat - Orchestration Service
    ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng
    #IMAGE_URLS+=",http://fedorapeople.org/groups/heat/prebuilt-jeos-images/F17-x86_64-cfntools.qcow2"
    
    # Ceilometer - Metering Service (metering + alarming)
    ENABLED_SERVICES+=,ceilometer-acompute,ceilometer-acentral,ceilometer-collector,ceilometer-api
    ENABLED_SERVICES+=,ceilometer-alarm-notify,ceilometer-alarm-eval
    
    ENABLED_SERVICES+=,trove,tr-api,tr-tmgr,tr-cond
    
    
    # Apache fronted for WSGI
    APACHE_ENABLED_SERVICES+=keystone,swift
    #APACHE_ENABLED_SERVICES+=keystone
    

     

    运行Devstack

    记住,我们是使用stack用户运行的。

    cd /home/devstack
    ./stack.sh

    默认Devstack创建 admin和demo两个用户,通过设置环境变量可以进行操作

    admin

    source openrc admin admin

    demo

    source openrc demo demo
    展开全文
  • devstack教程,devstack 书籍 devstack-for-beginners
  • DevStack is a set of scripts and utilities to quickly deploy an OpenStack cloud from git source trees. Goals To quickly build dev OpenStack environments in a clean Ubuntu or Fedora environment To ...
  • 部署devstack

    千次阅读 2019-02-20 11:17:29
    OpenStack是一堆云计算平台组件(诸如存储、...为此OpenStack为入门者和开发者推出了一个OpenStack开发环境:devstack。通过devstack,你可以在一个主机节点上部署一个“五脏俱全”的OpenStack Cloud。 一、安装...

    OpenStack是一堆云计算平台组件(诸如存储、网络、镜像管理等)的合称,十分庞大且十分复杂,入门门槛不低,即便是为开发目的而进行的OpenStack部署也会让你折腾许久,甚至始终无法搭建成功。为此OpenStack为入门者和开发者推出了一个OpenStack开发环境:devstack。通过devstack,你可以在一个主机节点上部署一个“五脏俱全”的OpenStack Cloud。

    一、安装devstack

    建议将devstack部署在物理机上,这样可以屏蔽掉许多在虚拟机上部署devstack的问题(具体不详,很多书籍都推荐这么做^_^)。这里讲devstack部署在一台ubuntu 14.04.1的刀片服务器上。

    1、下载devstack源码

    $ git clone https://github.com/openstack-dev/devstack.git ./devstack
    Cloning into './devstack'...
    remote: Counting objects: 33686, done.
    remote: Compressing objects: 100% (10/10), done.
    Receiving objects:   1% (337/33686), 92.01 KiB | 35.00 KiB/s
    Receiving objects:   4% (1457/33686), 452.01 KiB | 62.00 KiB/s
    ... ...
    

    这里直接用trunk上的最新revision:

    devstack版本 revision:
    commit 96ffde28b6e2f55f95997464aec47ae2c6cf91d3
    Merge: c4a0d21 e3a04dd
    Author: Jenkins <jenkins@review.openstack.org>
    Date:   Tue Apr 26 10:21:16 2016 +0000
    

    2、创建stack账户

    $cd devstack/tools
    ~/devstack/tools$ sudo ./create-stack-user.sh
    [sudo] password for baiming:
    Creating a group called stack
    Creating a user called stack
    Giving stack user passwordless sudo privileges
    
    $ cat /etc/passwd|grep stack
    stack:x:1006:1006::/opt/stack:/bin/bash
    

    修改devstack目录的owner和group权限:

    $ sudo chown -R stack:stack ./devstack/
    

    切换到stack用户下:

    baiming@baiming:~$ sudo -i -u stack
    stack@baiming:~$ cd /home/baiming/devstack
    stack@baiming:/home/baiming/devstack$ ls
    clean.sh  exerciserc   extras.d   functions-common  HACKING.rst  LICENSE          openrc     run_tests.sh  setup.py  tests    unstack.sh
    data      exercises    files      FUTURE.rst        inc          MAINTAINERS.rst  pkg        samples       stackrc   tools
    doc       exercise.sh  functions  gate              lib          Makefile         README.md  setup.cfg     stack.sh  tox.ini
    

    二、启动devstack

    我们在devstack目录下创建配置文件:local.conf

    # Credentials
    ADMIN_PASSWORD=devstack
    MYSQL_PASSWORD=devstack
    RABBIT_PASSWORD=devstack
    SERVICE_PASSWORD=devstack
    SERVICE_TOKEN=token
    #Enable/Disable Services
    disable_service n-net
    enable_service q-svc
    enable_service q-agt
    enable_service q-dhcp
    enable_service q-l3
    enable_service q-meta
    enable_service neutron
    enable_service tempest
    HOST_IP=10.10.105.71
    
    #NEUTRON CONFIG
    #Q_USE_DEBUG_COMMAND=True
    #CINDER CONFIG
    VOLUME_BACKING_FILE_SIZE=102400M
    #GENERAL CONFIG
    API_RATE_LIMIT=False
    # Output
    LOGFILE=/home/baiming/devstack/logs/stack.sh.log
    VERBOSE=True
    LOG_COLOR=False
    SCREEN_LOGDIR=/home/baiming/devstack/logs
    

    执行devstack下的stack.sh来启动各OpenStack组件,stack.sh是devstack“一键安装”的总控脚本,stack.sh执行ok了,devstack也就部署OK了:

    $>./stack.sh
    

    但问题接踵而至!

    三、问题与解决方法

    stack.sh的执行过程是漫长的,且问题也是多多。

    1、git协议 or https协议

    stack.sh执行后会去openstack官方库下载一些东西,于是遇到了第一个错误:

    +functions-common:git_timed:599            timeout -s SIGINT 0 git clone git://git.openstack.org/openstack/requirements.git /opt/stack/requirements
    Cloning into '/opt/stack/requirements'...
    fatal: unable to connect to git.openstack.org:
    git.openstack.org[0: 104.130.246.128]: errno=Connection timed out
    git.openstack.org[1: 2001:4800:7819:103:be76:4eff:fe06:63c]: errno=Network is unreachable
    
    +functions-common:git_timed:602            [[ 128 -ne 124 ]]
    +functions-common:git_timed:603            die 603 'git call failed: [git clone' git://git.openstack.org/openstack/requirements.git '/opt/stack/requirements]'
    +functions-common:die:186                  local exitcode=0
    +functions-common:die:187                  set +o xtrace
    [Call Trace]
    ./stack.sh:708:git_clone
    /home/baiming/devstack/functions-common:536:git_timed
    /home/baiming/devstack/functions-common:603:die
    [ERROR] /home/baiming/devstack/functions-common:603 git call failed: [git clone git://git.openstack.org/openstack/requirements.git /opt/stack/requirements]
    Error on exit
    ./stack.sh: line 488: generate-subunit: command not found
    

    stack.sh尝试用git clone git://xxxx,但由于我的主机在代理后面,因此git协议不能被支持,需要改为支持的协议类型,比如https。

    解决方法:修改stackrc,更换git_base协议,并且增加http和https代理变量:

    # Base GIT Repo URL
    # Another option is https://git.openstack.org
    GIT_BASE=${GIT_BASE:-https://git.openstack.org}
    
    export http_proxy='http://10.10.126.187:3129'
    export https_proxy='http://10.10.126.187:3129'
    

    stackrc之于stack.sh类似.bashrc之于bash,在stack.sh执行时会对stackrc进行source,使其中的export环境变量生效。http_proxy等环境变量添加到stackrc中的效果就是:在stack.sh执行过程中会有类似如下语句出现:

    sudo -H http_proxy=http://10.10.126.187:3129 https_proxy=http://10.10.126.187:3129 no_proxy= PIP_FIND_LINKS= /usr/local/bin/pip2.7 install -c /opt/stack/requirements/upper-constraints.txt -U virtualenv
    

    2、重启stack.sh

    解决完上述问题后,如果直接重新执行stack.sh,那么会收到“有另外一个stack.sh session在执行的”错误信息。

    为此,每次重启stack.sh之前都要先执行:./unstack.sh,清理一下环境。

    3、apt包下载错误

    在stack.sh执行过程中,会更新ubuntu apt repository,并下载许多第三方包或工具:

    Preconfiguring packages ...
    (Reading database ... 123098 files and directories currently installed.)
    Preparing to unpack .../libitm1_4.8.4-2ubuntu1~14.04.1_amd64.deb ...
    Unpacking libitm1:amd64 (4.8.4-2ubuntu1~14.04.1) over (4.8.4-2ubuntu1~14.04) ...
    Preparing to unpack .../libgomp1_4.8.4-2ubuntu1~14.04.1_amd64.deb ...
    Unpacking libgomp1:amd64 (4.8.4-2ubuntu1~14.04.1) over (4.8.4-2ubuntu1~14.04) ...
    Preparing to unpack .../libasan0_4.8.4-2ubuntu1~14.04.1_amd64.deb ...
    Unpacking libasan0:amd64 (4.8.4-2ubuntu1~14.04.1) over (4.8.4-2ubuntu1~14.04) ...
    Preparing to unpack .../libatomic1_4.8.4-2ubuntu1~14.04.1_amd64.deb ...
    Unpacking libatomic1:amd64 (4.8.4-2ubuntu1~14.04.1) over (4.8.4-2ubuntu1~14.04) ...
    Preparing to unpack .../libtsan0_4.8.4-2ubuntu1~14.04.1_amd64.deb ...
    Unpacking libtsan0:amd64 (4.8.4-2ubuntu1~14.04.1) over (4.8.4-2ubuntu1~14.04) ...
    Preparing to unpack .../libquadmath0_4.8.4-2ubuntu1~14.04.1_amd64.deb ...
    Unpacking libquadmath0:amd64 (4.8.4-2ubuntu1~14.04.1) over (4.8.4-2ubuntu1~14.04) ...
    Preparing to unpack .../libstdc++-4.8-dev_4.8.4-2ubuntu1~14.04.1_amd64.deb ...
    
    .... ..... ....
    
    Setting up libitm1:amd64 (4.8.4-2ubuntu1~14.04.1) ...
    Setting up libgomp1:amd64 (4.8.4-2ubuntu1~14.04.1) ...
    Setting up libasan0:amd64 (4.8.4-2ubuntu1~14.04.1) ...
    Setting up libatomic1:amd64 (4.8.4-2ubuntu1~14.04.1) ...
    Setting up libtsan0:amd64 (4.8.4-2ubuntu1~14.04.1) ...
    .... .....
    
     * Setting sysfs variables...                  [ OK ]
    Setting up vlan (1.9-3ubuntu10) ...
    Processing triggers for libc-bin (2.19-0ubuntu6) ...
    Processing triggers for ureadahead (0.100.0-16) ...
    Processing triggers for initramfs-tools (0.103ubuntu4.2) ...
    update-initramfs: Generating /boot/initrd.img-3.16.0-57-generic
    .... ....
    

    如果你的source.list中添加了一些不稳定的源,那么这个包更新过程很可能会失败,从而导致stack.sh执行失败。解决方法就是识别出哪些源导致的失败,将之注释掉!

    4、MySQL access denied

    继续执行stack.sh,我们遇到了如下MySQL访问错误:

    +lib/databases/mysql:configure_database_mysql:91  sudo mysql -u root -p devstack -h 127.0.0.1 -e 'GRANT ALL PRIVILEGES ON *.* TO '\''root'\''@'\''%'\'' identified by '\''devstack'\'';'
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
    +lib/databases/mysql:configure_database_mysql:1  exit_trap
    +./stack.sh:exit_trap:474                  local r=1
    ++./stack.sh:exit_trap:475                  jobs -p
    +./stack.sh:exit_trap:475                  jobs=
    +./stack.sh:exit_trap:478                  [[ -n '' ]]
    +./stack.sh:exit_trap:484                  kill_spinner
    +./stack.sh:kill_spinner:370               '[' '!' -z '' ']'
    +./stack.sh:exit_trap:486                  [[ 1 -ne 0 ]]
    +./stack.sh:exit_trap:487                  echo 'Error on exit'
    Error on exit
    +./stack.sh:exit_trap:488                  generate-subunit 1461911655 5243 fail
    +./stack.sh:exit_trap:489                  [[ -z /opt/stack/logs ]]
    +./stack.sh:exit_trap:492                  /home/baiming/devstack/tools/worlddump.py -d /opt/stack/logs
    World dumping... see /opt/stack/logs/worlddump-2016-04-29-080139.txt for details
    

    这个问题浪费了我不少时间,遍历了许多网上资料,最终下面这个方法解决了问题:

    查看/etc/mysql/debian.cnf文件:

    # Automatically generated for Debian scripts. DO NOT TOUCH!
    [client]
    host     = localhost
    user     = debian-sys-maint
    password = WY9OFagMxMb4YmyV
    socket   = /var/run/mysqld/mysqld.sock
    [mysql_upgrade]
    host     = localhost
    user     = debian-sys-maint
    password = WY9OFagMxMb4YmyV
    socket   = /var/run/mysqld/mysqld.sock
    basedir  = /usr
    

    修改mysql root密码:

    $ [root@localhost ~]# mysql -u debian-sys-maint - p
    
    输入密码: WY9OFagMxMb4YmyV  ,进入到mysql数据库
    
    mysql>use mysql  ;
    mysql>update user set password=password("你的新密码") where user="root";
    mysql>flush privileges;
    mysql>exit
    

    然后尝试使用新密码登录,如果登录成功,说明密码修改ok。再执行stack.sh就不会出现MySQL相关错误了。

    5、openvswitch/db.sock权限问题

    接下来我们遇到的问题是openvswitch/db.sock权限问题,错误日志如下:

    +lib/keystone:create_keystone_accounts:368  local admin_project
    ++lib/keystone:create_keystone_accounts:369  openstack project show admin -f value -c id
    Discovering versions from the identity service failed when creating the password plugin. Attempting to determine version from URL.
    Could not determine a suitable URL for the plugin
    +lib/keystone:create_keystone_accounts:369  admin_project=
    +lib/keystone:create_keystone_accounts:1   exit_trap
    +./stack.sh:exit_trap:474                  local r=1
    ++./stack.sh:exit_trap:475                  jobs -p
    +./stack.sh:exit_trap:475                  jobs=
    +./stack.sh:exit_trap:478                  [[ -n '' ]]
    +./stack.sh:exit_trap:484                  kill_spinner
    +./stack.sh:kill_spinner:370               '[' '!' -z '' ']'
    +./stack.sh:exit_trap:486                  [[ 1 -ne 0 ]]
    +./stack.sh:exit_trap:487                  echo 'Error on exit'
    Error on exit
    +./stack.sh:exit_trap:488                  generate-subunit 1461920296 413 fail
    +./stack.sh:exit_trap:489                  [[ -z /opt/stack/logs ]]
    +./stack.sh:exit_trap:492                  /home/baiming/devstack/tools/worlddump.py -d /opt/stack/logs
    World dumping... see /opt/stack/logs/worlddump-2016-04-29-090510.txt for details
    2016-04-29T09:05:10Z|00001|reconnect|WARN|unix:/var/run/openvswitch/db.sock: connection attempt failed (Permission denied)
    ovs-vsctl: unix:/var/run/openvswitch/db.sock: database connection failed (Permission denied)
    +./stack.sh:exit_trap:498                  exit 1
    

    我们手工执行ovs-vsctl命令:

    $ sudo service openvswitch-switch status
    openvswitch-switch start/running
    
     $ ovs-vsctl show
    2016-04-29T09:44:19Z|00001|reconnect|WARN|unix:/var/run/openvswitch/db.sock: connection attempt failed (Permission denied)
    ovs-vsctl: unix:/var/run/openvswitch/db.sock: database connection failed (Permission denied)
    

    同样的错误。这个问题在网上似乎也没有很好的答案,这里做了一个权限更改处理:

    $>chmod 777 /var/run/openvswitch/db.sock
    

    问题解决了!

    6、http proxy问题

    我们接下来停在了这里:

    ++lib/keystone:create_keystone_accounts:369  openstack project show admin -f value -c id
    Discovering versions from the identity service failed when creating the password plugin. Attempting to determine version from URL.
    Could not determine a suitable URL for the plugin
    

    还是停在这里,但这回不是/var/run/openvswitch /db.sock权限问题了。似乎是stack.sh想访问某个url获得一些version信息,但没有获取到。我开始怀疑是代理设置的问题:这个环境是有代理设置的,一旦走代理访问自己,那么肯定什么信息都得不到。但代理还不能去掉,因此很多组件下载都需要使用到代理访问外网。为此我们需要在stackrc中加上no_proxy环境变量:

    export no_proxy='10.10.105.71'
    

    再执行stack.sh,至少这个问题是pass了。

    四、devstack部署ok

    在经过很不耐烦的漫长等待后,devstack终于算是部署成功了!stack.sh打印出了下面信息后成功退出了:

    =========================
    DevStack Component Timing
    =========================
    Total runtime         2574
    
    run_process            57
    apt-get-update        120
    pip_install           859
    restart_apache_server  11
    wait_for_service       32
    apt-get                14
    =========================
    This is your host IP address: 10.10.105.71
    This is your host IPv6 address: ::1
    Horizon is now available at http://10.10.105.71/dashboard
    Keystone is serving at http://10.10.105.71:5000/
    The default users are: admin and demo
    The password: devstack
    2016-05-03 08:01:03.667 | stack.sh completed in 2574 seconds.
    
    

    我们看devstack究竟运行了哪些组件:

    $ ps -ef|grep python
    stack     1464  1461  0 15:24 pts/5    00:00:14 /usr/bin/python /usr/bin/dstat -tcmndrylpg --output /opt/stack/logs/dstat-csv.log
    stack     1465  1461  6 15:24 pts/5    00:03:01 /usr/bin/python /usr/bin/dstat -tcmndrylpg --top-cpu-adv --top-io-adv --swap
    stack    11641 11490  0 15:48 pts/10   00:00:03 /usr/bin/python /usr/local/bin/glance-registry --config-file=/etc/glance/glance-registry.conf
    stack    11899 11641  0 15:48 pts/10   00:00:00 /usr/bin/python /usr/local/bin/glance-registry --config-file=/etc/glance/glance-registry.conf
    stack    11900 11641  0 15:48 pts/10   00:00:00 /usr/bin/python /usr/local/bin/glance-registry --config-file=/etc/glance/glance-registry.conf
    stack    11978 11821  1 15:48 pts/11   00:00:24 /usr/bin/python /usr/local/bin/glance-api --config-file=/etc/glance/glance-api.conf
    stack    12105 11978  1 15:48 pts/11   00:00:30 /usr/bin/python /usr/local/bin/glance-api --config-file=/etc/glance/glance-api.conf
    stack    12106 11978  1 15:48 pts/11   00:00:30 /usr/bin/python /usr/local/bin/glance-api --config-file=/etc/glance/glance-api.conf
    stack    13411 13262  2 15:51 pts/12   00:00:29 /usr/bin/python /usr/local/bin/nova-api
    stack    13551 13411  0 15:52 pts/12   00:00:03 /usr/bin/python /usr/local/bin/nova-api
    stack    13552 13411  0 15:52 pts/12   00:00:03 /usr/bin/python /usr/local/bin/nova-api
    stack    13823 13411  0 15:52 pts/12   00:00:00 /usr/bin/python /usr/local/bin/nova-api
    stack    13824 13411  0 15:52 pts/12   00:00:00 /usr/bin/python /usr/local/bin/nova-api
    stack    14309 14159  1 15:52 pts/13   00:00:25 /usr/bin/python /usr/local/bin/nova-conductor --config-file /etc/nova/nova.conf
    stack    15092 14941  3 15:52 pts/14   00:00:39 /usr/bin/python /usr/local/bin/nova-network --config-file /etc/nova/nova.conf
    stack    15352 14309  2 15:52 pts/13   00:00:38 /usr/bin/python /usr/local/bin/nova-conductor --config-file /etc/nova/nova.conf
    stack    15353 14309  2 15:52 pts/13   00:00:38 /usr/bin/python /usr/local/bin/nova-conductor --config-file /etc/nova/nova.conf
    stack    15432 15274  1 15:52 pts/15   00:00:14 /usr/bin/python /usr/local/bin/nova-scheduler --config-file /etc/nova/nova.conf
    stack    15920 15768  0 15:52 pts/16   00:00:05 /usr/bin/python /usr/local/bin/nova-novncproxy --config-file /etc/nova/nova.conf --web /opt/stack/noVNC
    stack    16571 16415  1 15:52 pts/17   00:00:13 /usr/bin/python /usr/local/bin/nova-consoleauth --config-file /etc/nova/nova.conf
    stack    17134 17131  3 15:53 pts/18   00:00:46 /usr/bin/python /usr/local/bin/nova-compute --config-file /etc/nova/nova.conf
    stack    17890 17740  1 15:54 pts/19   00:00:23 /usr/bin/python /usr/local/bin/cinder-api --config-file /etc/cinder/cinder.conf
    stack    18027 17890  0 15:54 pts/19   00:00:00 /usr/bin/python /usr/local/bin/cinder-api --config-file /etc/cinder/cinder.conf
    stack    18028 17890  0 15:54 pts/19   00:00:01 /usr/bin/python /usr/local/bin/cinder-api --config-file /etc/cinder/cinder.conf
    stack    18363 18212  2 15:54 pts/20   00:00:33 /usr/bin/python /usr/local/bin/cinder-scheduler --config-file /etc/cinder/cinder.conf
    stack    18853 18699  1 15:54 pts/21   00:00:22 /usr/bin/python /usr/local/bin/cinder-volume --config-file /etc/cinder/cinder.conf
    stack    19060 18853  2 15:54 pts/21   00:00:28 /usr/bin/python /usr/local/bin/cinder-volume --config-file /etc/cinder/cinder.conf
    

    果然很复杂。devstack的安装体验比OpenStack似乎也好不到那里去。stack.sh执行的时间足够编译10次linux os内核了。好多依赖,好多download。

    在devstack目录下,我们还可以执行一下devstack的测试,./exercise.sh会执行这些测试:

    *********************************************************************
    SUCCESS: End DevStack Exercise: /home/baiming/devstack/exercises/volumes.sh
    *********************************************************************
    =====================================================================
    SKIP neutron-adv-test
    SKIP swift
    PASS aggregates
    PASS client-args
    PASS client-env
    PASS sec_groups
    PASS volumes
    FAILED boot_from_volume
    FAILED floating_ips
    =====================================================================
    

    此刻访问 http://10.10.105.71/dashboard,我们可以看到devstack horizon的首页:

    img{512x368}

    不过由于是通过SecureCRT端口映射访问到的主页,不知为何,登录后始终无法显示dashboard的页面。但通过后台horizon的日志来看,登录(admin/devstack)是成功的。我们仅能探索cli操作devstack的方式了。

    五、CLI方式操作devstack

    devstack提供了CLI方式对虚拟机、存储和网络等组件进行操作,其功能还要超过GUI所能提供的。在使用cli工具前,我们需要设置一些cli所需的用户变量,放在shell文件中(比如.bashrc):

    export OS_USERNAME=admin
    export OS_PASSWORD=devstack
    export OS_TENANT_NAME=admin
    export OS_AUTH_URL=http://10.10.105.71:5000/v2.0
    

    上述变量生效后,我们就可以通过cli来hack devstack了:

    nova位置和nova版本:

    $ which nova
    /usr/local/bin/nova
    
    $ nova --version
    4.0.0
    

    当前image列表:

    $ nova image-list
    WARNING: Command image-list is deprecated and will be removed after Nova 15.0.0 is released. Use python-glanceclient or openstackclient instead.
    +--------------------------------------+---------------------------------+--------+--------+
    | ID                                   | Name                            | Status | Server |
    +--------------------------------------+---------------------------------+--------+--------+
    | b3f25af2-b5e1-43fe-8648-842fe48ed380 | cirros-0.3.4-x86_64-uec         | ACTIVE |        |
    | d6bcc064-e2aa-4550-89e7-fd2f6a454758 | cirros-0.3.4-x86_64-uec-kernel  | ACTIVE |        |
    | 788dec66-8989-4e84-8722-d9f4c9ee5ab0 | cirros-0.3.4-x86_64-uec-ramdisk | ACTIVE |        |
    +--------------------------------------+---------------------------------+--------+--------+
    

    虚拟机规格列表:

    $ nova flavor-list
    +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
    | ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
    +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
    | 1  | m1.tiny   | 512       | 1    | 0         |      | 1     | 1.0         | True      |
    | 2  | m1.small  | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
    | 3  | m1.medium | 4096      | 40   | 0         |      | 2     | 1.0         | True      |
    | 4  | m1.large  | 8192      | 80   | 0         |      | 4     | 1.0         | True      |
    | 42 | m1.nano   | 64        | 0    | 0         |      | 1     | 1.0         | True      |
    | 5  | m1.xlarge | 16384     | 160  | 0         |      | 8     | 1.0         | True      |
    | 84 | m1.micro  | 128       | 0    | 0         |      | 1     | 1.0         | True      |
    | c1 | cirros256 | 256       | 0    | 0         |      | 1     | 1.0         | True      |
    | d1 | ds512M    | 512       | 5    | 0         |      | 1     | 1.0         | True      |
    | d2 | ds1G      | 1024      | 10   | 0         |      | 1     | 1.0         | True      |
    | d3 | ds2G      | 2048      | 10   | 0         |      | 2     | 1.0         | True      |
    | d4 | ds4G      | 4096      | 20   | 0         |      | 4     | 1.0         | True      |
    +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
    

    启动一个虚拟机:

    $ nova boot --flavor 1 --image b3f25af2-b5e1-43fe-8648-842fe48ed380 devstack_instance_1
    +--------------------------------------+----------------------------------------------------------------+
    | Property                             | Value                                                          |
    +--------------------------------------+----------------------------------------------------------------+
    | OS-DCF:diskConfig                    | MANUAL                                                         |
    | OS-EXT-AZ:availability_zone          |                                                                |
    | OS-EXT-SRV-ATTR:host                 | -                                                              |
    | OS-EXT-SRV-ATTR:hostname             | devstack-instance-1                                            |
    | OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                                              |
    | OS-EXT-SRV-ATTR:instance_name        | instance-00000005                                              |
    | OS-EXT-SRV-ATTR:kernel_id            | d6bcc064-e2aa-4550-89e7-fd2f6a454758                           |
    | OS-EXT-SRV-ATTR:launch_index         | 0                                                              |
    | OS-EXT-SRV-ATTR:ramdisk_id           | 788dec66-8989-4e84-8722-d9f4c9ee5ab0                           |
    | OS-EXT-SRV-ATTR:reservation_id       | r-3rpqat0r                                                     |
    | OS-EXT-SRV-ATTR:root_device_name     | -                                                              |
    | OS-EXT-SRV-ATTR:user_data            | -                                                              |
    | OS-EXT-STS:power_state               | 0                                                              |
    | OS-EXT-STS:task_state                | scheduling                                                     |
    | OS-EXT-STS:vm_state                  | building                                                       |
    | OS-SRV-USG:launched_at               | -                                                              |
    | OS-SRV-USG:terminated_at             | -                                                              |
    | accessIPv4                           |                                                                |
    | accessIPv6                           |                                                                |
    | adminPass                            | dGBd6vj55vP2                                                   |
    | config_drive                         |                                                                |
    | created                              | 2016-05-03T09:00:33Z                                           |
    | description                          | -                                                              |
    | flavor                               | m1.tiny (1)                                                    |
    | hostId                               |                                                                |
    | host_status                          |                                                                |
    | id                                   | bdb93a06-0c4f-434f-a1b5-ae2ca9293c58                           |
    | image                                | cirros-0.3.4-x86_64-uec (b3f25af2-b5e1-43fe-8648-842fe48ed380) |
    | key_name                             | -                                                              |
    | locked                               | False                                                          |
    | metadata                             | {}                                                             |
    | name                                 | devstack_instance_1                                            |
    | os-extended-volumes:volumes_attached | []                                                             |
    | progress                             | 0                                                              |
    | security_groups                      | default                                                        |
    | status                               | BUILD                                                          |
    | tenant_id                            | ce19134da8774d509bfa15daaca83665                               |
    | updated                              | 2016-05-03T09:00:34Z                                           |
    | user_id                              | 45436c9a744b4f41921edb3c368ce5f7                               |
    +--------------------------------------+----------------------------------------------------------------+
    

    通过nova list可以查看到当前主机上的虚拟机详情:

    $ nova list
    +--------------------------------------+---------------------+--------+------------+-------------+------------------+
    | ID                                   | Name                | Status | Task State | Power State | Networks         |
    +--------------------------------------+---------------------+--------+------------+-------------+------------------+
    | bdb93a06-0c4f-434f-a1b5-ae2ca9293c58 | devstack_instance_1 | ACTIVE | -          | Running     | private=10.0.0.5 |
    +--------------------------------------+---------------------+--------+------------+-------------+------------------+
    

    在host上ping该虚拟机实例,可以ping通:

    $ ping 10.0.0.5
    PING 10.0.0.5 (10.0.0.5) 56(84) bytes of data.
    64 bytes from 10.0.0.5: icmp_seq=1 ttl=64 time=0.935 ms
    64 bytes from 10.0.0.5: icmp_seq=2 ttl=64 time=0.982 ms
    ^C
    --- 10.0.0.5 ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 1000ms
    rtt min/avg/max/mdev = 0.935/0.958/0.982/0.038 ms
    

    通过网桥工具查看网桥设备,看到多出一个br100的网桥,eth0、vnet0~vnet2均连接在该网桥上:

    $ brctl show
    bridge name    bridge id        STP enabled    interfaces
    br100        8000.0017a447a8a9    no        eth0
                                vnet0
                                vnet1
                                vnet2
    

    挂起虚拟机:

    $ nova suspend bdb93a06-0c4f-434f-a1b5-ae2ca9293c58
    $ nova list
    +--------------------------------------+---------------------+-----------+------------+-------------+------------------+
    | ID                                   | Name                | Status    | Task State | Power State | Networks         |
    +--------------------------------------+---------------------+-----------+------------+-------------+------------------+
    | bdb93a06-0c4f-434f-a1b5-ae2ca9293c58 | devstack_instance_1 | SUSPENDED | -          | Shutdown    | private=10.0.0.5 |
    +--------------------------------------+---------------------+-----------+------------+-------------+------------------+
    

    问题:SyntaxError: '<' operator not allowed in environment markers

    在部署测试环境时,pip install XXX或者python setup.py install时,出现了如下问题:

    “File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 738, in comparison
    raise SyntaxError(repr(cop)+” operator not allowed in environment markers”)
    SyntaxError: ‘<' operator not allowed in environment markers
    error in setup command: Error parsing /opt/stack/cinder/setup.cfg: SyntaxError: '<' operator not allowed in environment markers"

    出现这个问题,应该是setuptools版本太旧,需要更新升级,可以执行如下命令来进行升级:

    pip install --upgrade pip

    pip install --upgrade setuptools
     

    六、小结

    devstack号称是为开发准备的,已经“一键化”,但从实际效果来看,体验依旧不佳。由此也可以估计出OpenStack的部署难度和坎坷度了:)。

    © 2016, bigwhite. 版权所有.

    Related posts:

    1. 关于Python Package下的Module import方式
    2. buildc 0.1.7版本发布
    3. Review Board安装和配置札记
    4. docker容器内服务程序的优雅退出
    5. Hello,Sublime Text 2

     

    原文:https://tonybai.com/2016/05/04/deploy-devstack/

    此处遇到的一些问题,提供的解决方案,很值得借鉴。

    展开全文
  • devstack部署openstack,并分析源码结构 devstack 下载 2.devstack源码结构 stack.sh 自动化部署的入口->.exe 文件 locarc 配置文件 传入stack.sh 的参数 (Nova部署在那个节点,用户名密码是啥) openrc:环境...
  • Vagrant VM 中的 DevStack 这个库包含Vagrantfile和伴随Ansible剧本,设置了能安装的VirtualBox虚拟机 。 Ansible 生成一个local.conf文件,默认为: 使用 Neutron 进行网络连接 为对象存储安装 Swift 安装 ...
  • 使用devstack

    2019-09-20 18:55:17
    devstack获取 git clone git://github.com/openstack-dev/devstack.git 新建一个配置文件 localrc 进入到 devstack目录新建一个localrc文件,内容如下 MYSQL_PASSWORD=stack ADMIN_PASSWORD=stack SERVICE_...
  • DevStack Deployment

    2017-01-02 12:45:06
    Problems Encountered in DevStack Deployment.
  • 安装devstack.docx

    2019-12-26 15:24:14
    在虚拟机Ubuntu16.04以上的环境下,安装devstack,然后可以打开Openstack,具体操作步骤看文档。
  • devstack-plugin-oidc Devstack插件,可自动设置OpenID Connect Federation
  • ODL Devstack工具 此仓库提供了一些有用的工具,用于配置和运行 (edX的基于Docker的解决方案,用于运行Open edX服务)。 特征 创建一个自定义的docker映像(这只是edX的devstack映像之上的一层),其中已经安装了...
  • devstack初探

    千次阅读 2016-08-11 21:41:46
    devstack初探
  • devstack keystone

    2019-10-02 13:02:50
    Sep 17 18:11:40 zuul devstack@keystone.service[8085]: [uWSGI] getting INI configuration from /etc/keystone/keystone-uwsgi-public.iniSep 17 18:11:40 zuul devstack@keystone.service[8085]: open("./p...
  • 流浪者-devstack 我需要以最小的麻烦Swift地在虚拟机中架起openstack。 这是几个小时后我想到的。 这将在同时使用Vagrant和Ansible进行配置的Ubuntu 18.04 VM中安装OpenStack stable/victoria版。 拉动请求受到...
  • vmwfusion-vagrant-devstack 基于vmware-fusion+vagrant构建本地devstack实例的秘诀
  • devstack安装

    2016-08-19 09:27:17
    在安装devstack之前要确保已经安装了git。 1.下载$cd /home/projects这里通过github下载比较快,因为有时候从gerrit上下载会无法响应,从其他库下载也是可以的,但是要保证devstack是最新版本。$git cl
  • 让 packer 在 OpenStack 中创建 DevStack 的虚拟机映像。 这将在 Glance 中获取 Ubuntu Trusty 映像,并使用它在 Nova 中启动虚拟机。 以此为基础,在虚拟机上安装DevStack,设置local.conf为OFFLINE=true,上传...
  • 部署 DevStack

    2017-05-05 10:04:00
    本节按照以下步骤部署 DevStack 实验环境,包括控制节点和计算节点 创建虚拟机 按照物理资源需求创建 devstack-controller 和 devstak-compute 虚拟机 安装操作系统 安装 Ubuntu 14.04,并配置 eth0 的 IP ...
  • devstack-tempest-源码

    2021-05-11 15:19:03
    流浪者+ DevStack +暴风雨 该项目自动在本地计算机上设置DevStack环境。 在控制器节点中也配置了Tempest。 要求 至少8GB的RAM。 DevStack环境将结合使用约6GB。 VirtualBox。 从安装 OSX。可以在其他* NIX平台上...
  • devstack-osx-vagrant:我将向您介绍一些在我的Vagrant和VirtualBox的Mac OS X计算机上使用DevStack的经验。 我需要在DevStack中安装Neutron,因此,主要重点是如何设置网络以与操作系统配合使用
  • devstack搭建OpenStack手册,是很方便易用的实践方法。
  • Devstack-环境 由 Vagrant 和 Ansible 驱动的单节点或多节点 DevStack 部署。 这使您只需一个命令即可启动完整的单节点或多节点 DevStack 部署。 您可以通过 Vagrant 部署虚拟环境,也可以单独使用 Ansible ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 3,958
精华内容 1,583
关键字:

devstack