kimtth / openstack-dev-cloudshell

πŸ“š Openstack intergration with Quali Cloudshell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. add user named "devstack"
sudo adduser devstack
cat /etc/passwd | grep devstack
su -devstack
pwd
exit
  1. add sudo privilege to user named "devstack", if you do not this, the openstack service could not start.
ls -l /etc/sudoers
sudo visudo -f /etc/sudoers
devstack ALL=(ALL) NOPASSWD: ALL => add this line end of file
  1. 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

            or

Setting for 1 NIC
virtualbox >> settings >> network

  • adpater 1: NAT
       Port Forwarding: SSH TCP 2022 22
                Dashboard TCP 2080 80
                Console TCP 6080 6080
  1. update ubuntu
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
  1. ssh & git
sudo apt-get install openssh-server git -y
  1. change root pass

Press ESC durling Boot
Press e on ubuntu

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

Ctrl + x => save
terminal>LANG=C passwd root

  1. clone from git
git clone https://git.openstack.org/openstack-dev/devstack
  1. change privilege & check info
sudo chown -R devstack:devstack /path/devstack
sudo chmod 770 /path/devstack
ifconfig enp0s8 => checking host ip
ex) terminal>..inet addr: 192.168.0.168
  1. make local.conf
cd devstack
vi local.conf
  1. setting of local.conf
  • Most simplest(=> Setting for 1 NIC)
[[local|localrc]]
ALL_PASSWORD=a
ADMIN_PASSWORD=$ALL_PASSWORD
DATABASE_PASSWORD=$ALL_PASSWORD
RABBIT_PASSWORD=$ALL_PASSWORD
SERVICE_PASSWORD=$ALL_PASSWORD
HOST_IP=10.0.2.15

            or

  • Setting for 2 NIC

2nic_setting_diagram

[[local|localrc]]
# NIC information of Ubuntu on the Virtualbox
# devstack@devstack-VirtualBox:~$ ifconfig
# enp0s3    Link encap:Ethernet  HWaddr 08:00:27:2f:07:ee  
#           inet addr:192.168.0.168  Bcast:192.168.0.255  Mask:255.255.255.0
# enp0s8    Link encap:Ethernet  HWaddr 08:00:27:a2:d6:dd  
#          inet addr:10.0.3.15  Bcast:10.0.3.255  Mask:255.255.255.0
# lo        Link encap:Local Loopback  
#          inet addr:127.0.0.1  Mask:255.0.0.0

# Host pc subnet, Bridged Interface
HOST_IP=192.168.0.168 

# NAT Interface
FLOATING_RANGE=10.0.3.0/24

#Internal Network range in the VM 
FIXED_RANGE=192.168.1.0/24

#Subnet mask 24 equals 256
FIXED_NETWORK_SIZE=256

# NAT Interface
FLAT_INTERFACE=enp0s8 
  • Turnoff the nova (Optional)

https://wiki.openstack.org/wiki/NeutronDevstack
neutron //support complex level network management
nova //simple network management

[[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

# For Tempest
API_RATE_LIMIT=False 
  1. run shell script
./stack.sh > setup_log_stack.log
  1. login dashboard
http://192.168.0.168/dashboard

or

http://127.0.0.1/dashboard
  1. setting for CLI command (openstack compute (nova) β€œerror”)

download openrc file from WEB UI

cd devstack
source [project_name]-openrc.sh [user_id]
ex) >>source alt-demo-openrc.sh admin
  1. *** Don't reboot devstack ***

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

complete message

=========================
DevStack Component Timing
 (times are in seconds)  
=========================
run_process          156
test_with_retry       13
apt-get-update        57
pip_install          937
osc                  691
wait_for_service     153
git_timed            324
dbsync               145
apt-get              310
-------------------------
Unaccounted time     2105
=========================
Total runtime        4891

This is your host IP address: 192.168.0.168
This is your host IPv6 address: ::1
Horizon is now available at http://192.168.0.168/dashboard
Keystone is serving at http://192.168.0.168/identity/
The default users are: admin and demo
The password: a

WARNING: 
Using lib/neutron-legacy is deprecated, and it will be removed in the future

Services are running under systemd unit files.
For more information see: 
https://docs.openstack.org/devstack/latest/systemd.html

DevStack Version: queens
Change: c5c7d8f37eff14f2943c88cbce3c835b14237507 Merge "Switch to consolidated fetch-subunit-output role" 2018-01-17 20:31:33 +0000
OS Version: Ubuntu 16.04 xenial

Remove DevStack and dependancies

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

Tip

  1. change mode in Ubuntu

ctrl + alt + f1 : cmd mode
ctrl + alt + f7 : gui mode

  1. setting for fixed ip
sudo vi /etc/network/interfaces
  • The primary network interface
auto enp0s3
iface enp0s3 inet static
  address 192.168.0.19
  netmask 255.255.255.0
  gateway 192.168.0.1
  dns-nameservers 8.8.8.8
  • restart NIC
sudo ip addr flush dev enp0s3
sudo ifdown enp0s3
sudo ifup enp0s3

            or

sudo systemctl restart networking
  1. Vi Editor
  • input mode
i on cursor
a after cursor
  • delete
delete one char
x
-delete line
dd
  • arrow key
h
j
k
l
  1. basic command
ll
ls -l
rm -r mydir
rm -f sample.txt //delete file without asking. η’Ίθͺγͺγ—γ§ε‰Šι™€γ™γ‚‹ε ΄εˆγ€‚
mv /home/user/oldname /home/user/newname
cp -rp /home/user/oldname /home/user/newname
  => r: recursive / p: keep properties
ifconfig
cd 
pwd
chmod 777 mydir
mkdir myfolder
df -h  => disk usages

# remove repository
sudo add-apt-repository -r ppa:<ppa to remove>

# recursive mkdir : 
mkdir -p /opt/stack/logs
  1. network command
nmcli dev status
nmcli dev show enp0s8 => check for gateway
ifconfig
  1. find as a file name
find . -name "foo*"
  1. scroll in cli
ls -l | more
  1. Q: Virtualbox shared folder permissions?
    A: Try this (on the guest machine. i.e. the OS running in the Virtual box):
 sudo adduser your-user vboxsf

Now reboot the OS running in the virtual box.

  1. Lightweight Browser Midori
    Open terminal by pressing Ctrl+Alt+T and run the following commands,
sudo apt-add-repository ppa:midori/ppa
sudo apt-get update
sudo apt-get install midori

or

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

or launch midori-xxx.deb on the gui

Sample Topology Configuration in Openstack

1) add 2 private network
 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
 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

2) add 2 router
 Network >> Create rouer >> Router Name: router1 >> External Network: public
 Network >> Create rouer >> Router Name: router2 >> External Network: public

3) add security group
 Network >> Security Groups >> default >> Manage Rules >> Rule : All ICMP 
 Network >> Security Groups >> Add Rule >> Rule : SSH

4) Set a Floating IP Pool
 Login to admin account
 Network >> Floating IPs >> Allocate IP to Project >> Pool : public >> Allocate IP 

5) Create Instance & Allocate Floating IP to Instance
 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

6) Connect Instance from SSH
 For Japanese Layout Keyboard, Need to change Keyboard Layout to EN
  1)Windows Control Panel >> Add Keyboard >> English(US) 
  2)Compute >> Instance >> select demo1 >> Console
  3)demo1 login: cirros / Password: cubswin:) 
  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
Controller URL: http://192.168.0.168/identity/v3 
OpenStack Domain Name: default
OpenStack Project Name: demo
OpenStack Management Network ID: fdda07aa-6ff4-4d3a-92bf-b7190336362e (shared, not external, id not subnet id)
OpenStack Reserved Networks : skip setting
VLAN Type: VXLAN
Floating IP Subnet ID: 26f3523c-92c4-4fc4-ac3e-c53c3e090240 (subnet id using in openstack dashboard >> network >> floating ips)
  1. Managing Apps (Add Apps), maybe public or private's subnet id
    Portal >> Manage >> Apps >> Add >> Openstack Deploy From Glance Image >> Create
 http://help.quali.com/Online%20Help/8.1.0.4291/Rm/Content/CSP/MNG/Mng-Apps.htm#Adding
 
 DEPLOYMENT
  CLOUD PROVIDER: select one from drop-down list
  IMAGE ID: Select one from Openstack dashboard >> Project >> compute >> Images
  INSTANCE FLAVOR: m1.tiny 
  ADD FLOATING IP: True or False => I choose False. It can choose on the openstack.
  FLOATING IP SUBNET ID: 26f3523c-92c4-4fc4-ac3e-c53c3e090240
- Project Management Network	
A network needs to be created to store instances deployed by CloudShell Apps:

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.
  • CloudShell >> Cloud Provider >> Floating IP Subnet ID & OpenStack Management Network ID

cloudshell_provider_mapping

Trouble Shooting

1) Set a Enviroment variable
> Download RC file from the Dashboard, And Run a [project_name]-openrc.sh

2) Permission denied on the Root privilege
 bash -x demo-openrc.sh //this command is not working

3) Missing value auth-url required for auth plugin password
 source demo-openrc.sh
 
# Setup endpoint URL (not necessary)

cat /etc/keystone/keystone.conf
- admin_endpoint = http://192.168.0.157/identity

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

=> https://superuser.com/questions/227505/what-is-the-difference-between-nat-bridged-host-only-networking
   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.
   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.
   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.

=> https://serverfault.com/questions/490043/differences-between-bridged-and-nat-networking
   Bridged connections are just that, essentially a virtual switch is connected between the VM and your physical network connection.
   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?

=> The Internet Assigned Numbers Authority (IANA) has reserved thefollowing three blocks of the IP address space for private internets:

10.0.0.0 - 10.255.255.255 (10/8 prefix)
172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
192.168.0.0 - 192.168.255.255 (192.168/16 prefix)

About

πŸ“š Openstack intergration with Quali Cloudshell