项目作者: kimtth

项目描述 :
📚 Openstack intergration with Quali Cloudshell
高级语言:
项目地址: git://github.com/kimtth/openstack-dev-cloudshell.git
创建时间: 2017-12-28T07:59:22Z
项目社区:https://github.com/kimtth/openstack-dev-cloudshell

开源协议:

下载


openstack-logo-1-300x150

Openstack_dev

Openstack intergration with Quali Cloudshell

DevStack Installation

1) install

install ubuntu 16.04 LTS

install virtualbox extension >> insert guest addition CD image

Virtualbox >> Devices >> Shared .. >> bidirectional

2) add user named “devstack”

  1. sudo adduser devstack
  2. cat /etc/passwd | grep devstack
  3. su -devstack
  4. pwd
  5. exit

3) add sudo privilege to user named “devstack”, if you do not this, the openstack service could not start.

  1. ls -l /etc/sudoers
  2. sudo visudo -f /etc/sudoers
  3. devstack ALL=(ALL) NOPASSWD: ALL => add this line end of file

4) set NIC on the virtualbox

Setting for 2 NIC

Virtualbox >> settings >> network

  • adpater 1: NAT

    Port Forwarding: SSH TCP 192.168.X.X 22 192.168.Y.Y 22
  • adapter 2: Bridged Adapter

    Promiscuous Mode: Allow All


    NAT(Network Address Translation): vRouter, VM ↔ Internet, different subnet, Port forwarding OK

    Bridged: vSwitch, same subnet, VM has it’s own IP
  1. <strong>or</strong>

Setting for 1 NIC

virtualbox >> settings >> network

  • adpater 1: NAT

    Port Forwarding: SSH TCP 2022 22
    1. Dashboard TCP 2080 80 <br>
    2. Console TCP 6080 6080<br>

5) update ubuntu

  1. sudo apt-get update -y
  2. sudo apt-get upgrade -y
  3. sudo apt-get dist-upgrade -y

6) ssh & git

  1. sudo apt-get install openssh-server git -y

7) change root pass

Press ESC durling Boot

Press e on ubuntu

  1. lash $vt_handoff 1 => add num 1 end of lash $vt_handoff

Ctrl + x => save

terminal>LANG=C passwd root

8) clone from git

  1. git clone https://git.openstack.org/openstack-dev/devstack

9) change privilege & check info

  1. sudo chown -R devstack:devstack /path/devstack
  2. sudo chmod 770 /path/devstack
  3. ifconfig enp0s8 => checking host ip
  4. ex) terminal>..inet addr: 192.168.0.168

10) make local.conf

  1. cd devstack
  2. vi local.conf

11) setting of local.conf

  • Most simplest(=> Setting for 1 NIC)
  1. [[local|localrc]]
  2. ALL_PASSWORD=a
  3. ADMIN_PASSWORD=$ALL_PASSWORD
  4. DATABASE_PASSWORD=$ALL_PASSWORD
  5. RABBIT_PASSWORD=$ALL_PASSWORD
  6. SERVICE_PASSWORD=$ALL_PASSWORD
  7. HOST_IP=10.0.2.15
  1. <strong>or</strong>
  • Setting for 2 NIC

2nic_setting_diagram

  1. [[local|localrc]]
  2. # NIC information of Ubuntu on the Virtualbox
  3. # devstack@devstack-VirtualBox:~$ ifconfig
  4. # enp0s3 Link encap:Ethernet HWaddr 08:00:27:2f:07:ee
  5. # inet addr:192.168.0.168 Bcast:192.168.0.255 Mask:255.255.255.0
  6. # enp0s8 Link encap:Ethernet HWaddr 08:00:27:a2:d6:dd
  7. # inet addr:10.0.3.15 Bcast:10.0.3.255 Mask:255.255.255.0
  8. # lo Link encap:Local Loopback
  9. # inet addr:127.0.0.1 Mask:255.0.0.0
  10. # Host pc subnet, Bridged Interface
  11. HOST_IP=192.168.0.168
  12. # NAT Interface
  13. FLOATING_RANGE=10.0.3.0/24
  14. #Internal Network range in the VM
  15. FIXED_RANGE=192.168.1.0/24
  16. #Subnet mask 24 equals 256
  17. FIXED_NETWORK_SIZE=256
  18. # NAT Interface
  19. FLAT_INTERFACE=enp0s8
  • Turnoff the nova (Optional)

https://wiki.openstack.org/wiki/NeutronDevstack

neutron //support complex level network management

nova //simple network management

  1. [[local|localrc]]
  2. disable_service n-net
  3. enable_service q-svc
  4. enable_service q-agt
  5. enable_service q-dhcp
  6. enable_service q-l3
  7. enable_service q-meta
  8. # Optional, to enable tempest configuration as part of devstack
  9. enable_service tempest
  10. # For Tempest
  11. API_RATE_LIMIT=False

12) run shell script

  1. ./stack.sh > setup_log_stack.log

13) login dashboard

  1. http://192.168.0.168/dashboard

or

  1. http://127.0.0.1/dashboard

14) setting for CLI command (openstack compute (nova) “error”)

download openrc file from WEB UI

  1. cd devstack
  2. source [project_name]-openrc.sh [user_id]
  3. ex) >>source alt-demo-openrc.sh admin

15) Don’t reboot devstack

After every reboot you need to run ./stack.sh.

complete message

  1. =========================
  2. DevStack Component Timing
  3. (times are in seconds)
  4. =========================
  5. run_process 156
  6. test_with_retry 13
  7. apt-get-update 57
  8. pip_install 937
  9. osc 691
  10. wait_for_service 153
  11. git_timed 324
  12. dbsync 145
  13. apt-get 310
  14. -------------------------
  15. Unaccounted time 2105
  16. =========================
  17. Total runtime 4891
  18. This is your host IP address: 192.168.0.168
  19. This is your host IPv6 address: ::1
  20. Horizon is now available at http://192.168.0.168/dashboard
  21. Keystone is serving at http://192.168.0.168/identity/
  22. The default users are: admin and demo
  23. The password: a
  24. WARNING:
  25. Using lib/neutron-legacy is deprecated, and it will be removed in the future
  26. Services are running under systemd unit files.
  27. For more information see:
  28. https://docs.openstack.org/devstack/latest/systemd.html
  29. DevStack Version: queens
  30. Change: c5c7d8f37eff14f2943c88cbce3c835b14237507 Merge "Switch to consolidated fetch-subunit-output role" 2018-01-17 20:31:33 +0000
  31. OS Version: Ubuntu 16.04 xenial

Remove DevStack and dependancies

  1. ./clean.sh
  2. rm -rf /opt/stack
  3. rm -rf /usr/local/bin

Tip

1) change mode in Ubuntu

ctrl + alt + f1 : cmd mode

ctrl + alt + f7 : gui mode

2) setting for fixed ip

  1. sudo vi /etc/network/interfaces
  • The primary network interface
    1. auto enp0s3
    2. iface enp0s3 inet static
    3. address 192.168.0.19
    4. netmask 255.255.255.0
    5. gateway 192.168.0.1
    6. dns-nameservers 8.8.8.8
  • restart NIC
    1. sudo ip addr flush dev enp0s3
    2. sudo ifdown enp0s3
    3. sudo ifup enp0s3
    1. <strong>or</strong>
    1. sudo systemctl restart networking
    3) Vi Editor
  • input mode
    1. i on cursor
    2. a after cursor
  • delete
    1. delete one char
    2. x
    3. -delete line
    4. dd
  • arrow key
    1. h
    2. j
    3. k
    4. l

4) basic command

  1. ll
  2. ls -l
  3. rm -r mydir
  4. rm -f sample.txt //delete file without asking. 確認なしで削除する場合。
  5. mv /home/user/oldname /home/user/newname
  6. cp -rp /home/user/oldname /home/user/newname
  7. => r: recursive / p: keep properties
  8. ifconfig
  9. cd
  10. pwd
  11. chmod 777 mydir
  12. mkdir myfolder
  13. df -h => disk usages
  14. # remove repository
  15. sudo add-apt-repository -r ppa:<ppa to remove>
  16. # recursive mkdir :
  17. mkdir -p /opt/stack/logs

5) network command

  1. nmcli dev status
  2. nmcli dev show enp0s8 => check for gateway
  3. ifconfig

6) find as a file name

  1. find . -name "foo*"

7) scroll in cli

  1. ls -l | more

8) Q: Virtualbox shared folder permissions?

A: Try this (on the guest machine. i.e. the OS running in the Virtual box):

  1. sudo adduser your-user vboxsf

Now reboot the OS running in the virtual box.

9) Lightweight Browser Midori

Open terminal by pressing Ctrl+Alt+T and run the following commands,

  1. sudo apt-add-repository ppa:midori/ppa
  2. sudo apt-get update
  3. sudo apt-get install midori

or

  1. sudo apt-get -f install
  2. sudo dpkg -i midori-xxx.deb

or launch midori-xxx.deb on the gui

Sample Topology Configuration in Openstack

  1. 1) add 2 private network
  2. Network >> Create subnet >> Subnet Name: private1_subnet >> Network Address Source :: Enter Network Address manually >> Network Address :: 10.0.0.0/24 >> IP Version :: IPv4 >> Enable DHCP
  3. Network >> Create subnet >> Subnet Name: private2_subnet >> Network Address Source :: Enter Network Address manually >> Network Address :: 10.0.1.0/24 >> IP Version :: IPv4 >> Enable DHCP
  4. 2) add 2 router
  5. Network >> Create rouer >> Router Name: router1 >> External Network: public
  6. Network >> Create rouer >> Router Name: router2 >> External Network: public
  7. 3) add security group
  8. Network >> Security Groups >> default >> Manage Rules >> Rule : All ICMP
  9. Network >> Security Groups >> Add Rule >> Rule : SSH
  10. 4) Set a Floating IP Pool
  11. Login to admin account
  12. Network >> Floating IPs >> Allocate IP to Project >> Pool : public >> Allocate IP
  13. 5) Create Instance & Allocate Floating IP to Instance
  14. Compute >> Instances >> Launch Instance >> Instance Name: demo1 / cirros-0.3.5-x86_64-disk / m1.tiny / private_1 or private_2 >> Actions : Associate Floating IP
  15. 6) Connect Instance from SSH
  16. For Japanese Layout Keyboard, Need to change Keyboard Layout to EN
  17. 1)Windows Control Panel >> Add Keyboard >> English(US)
  18. 2)Compute >> Instance >> select demo1 >> Console
  19. 3)demo1 login: cirros / Password: cubswin:)
  20. 4)Change Keyboard Layout to EN => For Input : Shift + ; / For Input ) Shift + 0

Intergration with Quali CloudShell

Openstack Guide Add OpenStack Cloud Provider Resource

First Register Cloud controller and then Add App which wants to add.

1) Portal >> Inventory >> Add New >> Select Shell >> Openstack

  1. Controller URL: http://192.168.0.168/identity/v3
  2. OpenStack Domain Name: default
  3. OpenStack Project Name: demo
  4. OpenStack Management Network ID: fdda07aa-6ff4-4d3a-92bf-b7190336362e (shared, not external, id not subnet id)
  5. OpenStack Reserved Networks : skip setting
  6. VLAN Type: VXLAN
  7. Floating IP Subnet ID: 26f3523c-92c4-4fc4-ac3e-c53c3e090240 (subnet id using in openstack dashboard >> network >> floating ips)

2) Managing Apps (Add Apps), maybe public or private’s subnet id

Portal >> Manage >> Apps >> Add >> Openstack Deploy From Glance Image >> Create

  1. http://help.quali.com/Online%20Help/8.1.0.4291/Rm/Content/CSP/MNG/Mng-Apps.htm#Adding
  2. DEPLOYMENT
  3. CLOUD PROVIDER: select one from drop-down list
  4. IMAGE ID: Select one from Openstack dashboard >> Project >> compute >> Images
  5. INSTANCE FLAVOR: m1.tiny
  6. ADD FLOATING IP: True or False => I choose False. It can choose on the openstack.
  7. FLOATING IP SUBNET ID: 26f3523c-92c4-4fc4-ac3e-c53c3e090240

1) Assign a subnet to the network.
2) Make sure the network is not external. Every instance will have a network port on the management network.
3) Set the network’s shared flag to True. The network will be shared by instances.
4) Make sure QualiX Server has a floating IP and is part of this network so that it can be accessed from external networks.

  1. - CloudShell >> Cloud Provider >> Floating IP Subnet ID & OpenStack Management Network ID
  2. ![cloudshell_provider_mapping](https://user-images.githubusercontent.com/13846660/37954473-d957a622-31e0-11e8-81da-682570d9bae9.png)
  3. # Trouble Shooting
  4. ```sh
  5. 1) Set a Enviroment variable
  6. > Download RC file from the Dashboard, And Run a [project_name]-openrc.sh
  7. 2) Permission denied on the Root privilege
  8. bash -x demo-openrc.sh //this command is not working
  9. 3) Missing value auth-url required for auth plugin password
  10. source demo-openrc.sh
  11. # Setup endpoint URL (not necessary)
  12. cat /etc/keystone/keystone.conf
  13. - admin_endpoint = http://192.168.0.157/identity

the difference between NAT / Bridged / Host-Only networking?

  1. => https://superuser.com/questions/227505/what-is-the-difference-between-nat-bridged-host-only-networking
  2. Host-Only: The VM will be assigned one IP, but it's only accessible by the box VM is running on. No other computers can access it.
  3. NAT: Just like your home network with a wireless router, the VM will be assigned in a separate subnet, like 192.168.6.1 is your host computer, and VM is 192.168.6.3, then your VM can access outside network like your host, but no outside access to your VM directly, it's protected.
  4. Bridged: Your VM will be in the same network as your host, if your host IP is 172.16.120.45 then your VM will be like 172.16.120.50. It can be accessed by all computers in your host network.
  5. => https://serverfault.com/questions/490043/differences-between-bridged-and-nat-networking
  6. Bridged connections are just that, essentially a virtual switch is connected between the VM and your physical network connection.
  7. NAT'd connections are also just that, instead of a switch a NAT router is between the VM and your physical network connection.

What IP address starts with 10?

  1. => The Internet Assigned Numbers Authority (IANA) has reserved thefollowing three blocks of the IP address space for private internets:
  2. 10.0.0.0 - 10.255.255.255 (10/8 prefix)
  3. 172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
  4. 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)