Friday, September 30, 2016

Commands to get the hardware information in Linux

RAM:

#cat /proc/meminfo
 Memory info in details
#cat /proc/meminfo | head -n 1
Only Ram
#free
Display amount of free and used memory in the system
#top
Check utilization
#lshw -short -class memory
Memory info
#hwinfo --short
probe for hardware
#dmidecode -t memory
Memory info
#vmstat -s
Memory info

CPU:
# cat /proc/cpuinfo
Display information about the CPU architecture
# lscpu
Display information about the CPU architecture
#top
Check utilization
#lshw -short -class processor
Processor info
#hwinfo --short
Probe for hardware
#nproc
Print the number of processing units available
#dmidecode -t processor
Processor info


Network info:
#lshw -class network
Network adapter information
#Ip a
Ip information
#Ifconfig -a
Ip information
#netstat
 Print network connections, routing tables, interface statistics
#ss
Utility to investigate sockets
#traceroute
Print the route packets trace to network host
#lsof -i tcp:portNumber
Check open port
#netstat -natu | grep 'ESTABLISHED'
Established Connections Only


Disk info:

#fdisk -l
Manipulate disk partition table
#lsblk
List block devices
#lshw -short -class disk -class storage -class volume
Storage info
lshw -short -class disk
Disk info
#lsscsi
list SCSI devices (or hosts) and their attributes
Use -s option to get size
#hdparm
 get/set SATA/IDE device parameters
hdparm -i /dev/sda
#mount | column -t
Mounted Filesystem info

Some more command to get info:

# cat /proc/version
Kernel version
#cat /proc/scsi/scsi
SCSI/Sata devices
#cat /proc/partitions
Partitions
#Pydf
Python df
#lshw -html > hardware.html
Generate report in html/xml format
#cat /proc/acpi/thermal_zone/THRM/temperature 
check temperature
#lspci
List pci devices
#lsusb
List usb devices

















Tuesday, September 27, 2016

Keystone cheatsheet

Command cover for below task
project/tenant - list,create,show,disable,enable,rename,delete
user -list,create,show,enable,disable,assign to a project,change password,add email address,delete
role -list,create,show,add to user,,list roles assign to a user,delete
service/endpoint -list,show,create test service and endpoint,delete
role/rule - check policy.json file
verify keystone/identity service - check keystone service ,execute command without importing rc file variable

Project
--------
openstack project list
openstack project create --description 'new project' new-project
openstack project show <project id>
openstack project set <project id> --disable
openstack project show <project id>
openstack project  set <project id> --enable
openstack project show <project id>
openstack project set <project id> --name project-new
openstack project list
openstack project delete <project id>

User
-----
openstack user list
*associate tenant id
*set password else user will not able to login without password
openstack project create --description 'new project' new -project
openstack user create --project new-project --password openstack new-user
openstack user set new-user --disable
openstack user show new-user
openstack user set new-user --enable
openstack user show new-user
openstack user set new-user --email new-user@example.com
openstack user show new-user
openstack user delete new-user

Role
----
openstack role list
openstack role create new-role
openstack role add --user new-user --project new-project new-role
openstack role show  new-role
openstack role list --user new-user --project new-project





How To Install Mirantis OpenStack


Prerequisites: A 64-bit host OS with at least 8 GB RAM and 300 GB of free space. Virtualization must be enabled in the BIOS. If you use Microsoft Windows, use Cygwin.
Note: Since virtual box usages thin provisioning 50G free disk space is enough.
1.      Install VirtualBox.
4.      Copy the Mirantis OpenStack ISO to the /iso directory.
5.      Edit the config.sh if needed.
6.      Run the launch.sh file in a console, such as Terminal on Mac OS X.
7.      Wait for the script to completely finish. When it’s completed, you’ll have a Fuel VM and 3 additional VMs running in VirtualBox.
8.      Point your web browser to http://10.20.0.2:8000/. Log in as admin:admin.

Detail Explanation:


Ø  Cygwin installation Note:
For window hosts we need to install Cygwin ,once Cygwin is installed ,install the below packages in Cygwin aswell- expect , openssh , procps.
Ø  Download and install virtual box, also install virtual box extension pack.

Ø  Download Mirantis Openstack
Releases and openstack version
Mirantis openstack 9 ------> Openstack Mitaka
Mirantis openstack 8 ------> Openstack Liberty
Mirantis openstack 7 ------> Openstack Kilo

Ø  Download Mirantis VirtualBox script
Note: Each Mirantis openstack release has it own Virtual box script,download corresponding one.

Extract and put mirantis openstack ISO under ISO directory.



Deploy fuel node and its slave node using script.
Open Cygwin and navigate to path where you have kept mirantis virtual box script.
And run launch.sh – it will deploy fuel node and its slave node.
gyan@gyan-PC /cygdrive/c/Users/gyan/Downloads/vbox-scripts-8.0-mu-1/virtualbox
$ ./launch.sh
Prepare the host system...
Checking for 'free'... OK
Checking for 'expect'... OK
Checking for 'xxd'... OK
Checking for "VBoxManage"... OK
Checking for VirtualBox Extension Pack... OK
Checking for VirtualBox iPXE firmware...SKIP
VirtualBox iPXE firmware is not found. Used standard firmware from the VirtualBox Extension Pack.
Checking for Mirantis OpenStack ISO image... OK
Going to use Mirantis OpenStack ISO file iso/MirantisOpenStack-8.0.iso
Checking if SSH client installed... OK
Checking if ipconfig or ifconfig installed... OK
Done.

Check available memory on the host system...
Done.


Creating host-only interface...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interface VirtualBox Host-Only Ethernet Adapter was successfully created
Disabling DHCP server on interface: VirtualBox Host-Only Ethernet Adapter...
Configuring IP address 10.20.0.1 and network mask 255.255.255.0 on interface: VirtualBox Host-Only Ethernet Adapter...
Verifying interface VirtualBox Host-Only Ethernet Adapter has IP 10.20.0.1 and mask 255.255.255.0 properly set.
OK.

Creating host-only interface...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interface VirtualBox Host-Only Ethernet Adapter #2 was successfully created
Disabling DHCP server on interface: VirtualBox Host-Only Ethernet Adapter #2...
Configuring IP address 172.16.0.254 and network mask 255.255.255.0 on interface: VirtualBox Host-Only Ethernet Adapter #2...
Verifying interface VirtualBox Host-Only Ethernet Adapter #2 has IP 172.16.0.254 and mask 255.255.255.0 properly set.
OK.

Creating host-only interface...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interface VirtualBox Host-Only Ethernet Adapter #3 was successfully created
Disabling DHCP server on interface: VirtualBox Host-Only Ethernet Adapter #3...
Configuring IP address 172.16.1.1 and network mask 255.255.255.0 on interface: VirtualBox Host-Only Ethernet Adapter #3...
Verifying interface VirtualBox Host-Only Ethernet Adapter #3 has IP 172.16.1.1 and mask 255.255.255.0 properly set.
OK.

Virtual machine 'fuel-master' is created and registered.
UUID: c3b2be0f-19bd-436b-ae45-43882cafb66b
Settings file: 'E:\mirantis\fuel-master\fuel-master.vbox'
Adding hostonly adapter to fuel-master and bridging with host NIC VirtualBox Host-Only Ethernet Adapter...
Adding disk to fuel-master, with size 65535 Mb...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: 418d135c-d778-4963-88f7-03d9de42efd1
Adding serial numbers of disks to fuel-master...
Adding hostonly adapter to fuel-master and bridging with host NIC VirtualBox Host-Only Ethernet Adapter #2...
Adding NAT adapter to fuel-master for outbound network access through the host system...

Waiting for VM "fuel-master" to power on...
VM "fuel-master" has been successfully started.

Waiting for product VM to download files. Please do NOT abort the script... OK
Checking for internet connectivity on the host system... OK
Checking local DNS configuration... /etc/resolv.conf does not contain a nameserver. Using 8.8.8.8 for DNS.
Enabling outbound network/internet access for the product VM... OK
Waiting until the network services are restarted... OK
Waiting for product VM to install. Please do NOT abort the script... OK

Master node has been installed.


Virtual machine 'fuel-slave-1' is created and registered.
UUID: dd6735f9-c3e7-4905-a582-e5e14ddfa885
Settings file: 'E:\mirantis\fuel-slave-1\fuel-slave-1.vbox'
Adding hostonly adapter to fuel-slave-1 and bridging with host NIC VirtualBox Host-Only Ethernet Adapter...
Adding disk to fuel-slave-1, with size 65535 Mb...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: 1872ba40-d3af-4b73-b277-14076efd19e1
Adding serial numbers of disks to fuel-slave-1...
Adding hostonly adapter to fuel-slave-1 and bridging with host NIC VirtualBox Host-Only Ethernet Adapter #2...
Adding hostonly adapter to fuel-slave-1 and bridging with host NIC VirtualBox Host-Only Ethernet Adapter #3...

Adding disk to fuel-slave-1, with size 65535 Mb...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: 5b0d751c-04e6-4897-88d3-87e3a9c126d0
Adding serial numbers of disks to fuel-slave-1...
Adding disk to fuel-slave-1, with size 65535 Mb...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: 27ccf1b9-8331-4049-ab3b-c8664d688401
Adding serial numbers of disks to fuel-slave-1...
Waiting for VM "fuel-slave-1" to power on...
VM "fuel-slave-1" has been successfully started.


Virtual machine 'fuel-slave-2' is created and registered.
UUID: cc762cc6-cc58-4263-84cb-262e47a7ae0b
Settings file: 'E:\mirantis\fuel-slave-2\fuel-slave-2.vbox'
Adding hostonly adapter to fuel-slave-2 and bridging with host NIC VirtualBox Host-Only Ethernet Adapter...
Adding disk to fuel-slave-2, with size 65535 Mb...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: f6b21f73-009a-417b-a06b-0c26f11b3e6b
Adding serial numbers of disks to fuel-slave-2...
Adding hostonly adapter to fuel-slave-2 and bridging with host NIC VirtualBox Host-Only Ethernet Adapter #2...
Adding hostonly adapter to fuel-slave-2 and bridging with host NIC VirtualBox Host-Only Ethernet Adapter #3...

Adding disk to fuel-slave-2, with size 65535 Mb...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: 0005c15c-2fe7-4121-9df1-3de07d868741
Adding serial numbers of disks to fuel-slave-2...
Adding disk to fuel-slave-2, with size 65535 Mb...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: 0e4690d1-7319-4546-b33e-cfdd50b7005f
Adding serial numbers of disks to fuel-slave-2...
Waiting for VM "fuel-slave-2" to power on...
VM "fuel-slave-2" has been successfully started.


Virtual machine 'fuel-slave-3' is created and registered.
UUID: 351c7aba-8e76-4352-b8b4-33873888db0e
Settings file: 'E:\mirantis\fuel-slave-3\fuel-slave-3.vbox'
Adding hostonly adapter to fuel-slave-3 and bridging with host NIC VirtualBox Host-Only Ethernet Adapter...
Adding disk to fuel-slave-3, with size 65535 Mb...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: a0779ecb-2796-4846-b307-7c45a2ee5c4e
Adding serial numbers of disks to fuel-slave-3...
Adding hostonly adapter to fuel-slave-3 and bridging with host NIC VirtualBox Host-Only Ethernet Adapter #2...
Adding hostonly adapter to fuel-slave-3 and bridging with host NIC VirtualBox Host-Only Ethernet Adapter #3...

Adding disk to fuel-slave-3, with size 65535 Mb...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: fa056a8f-1be6-4004-b63f-633f1d4590d8
Adding serial numbers of disks to fuel-slave-3...
Adding disk to fuel-slave-3, with size 65535 Mb...
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: 5457665c-4044-4e14-87d2-3b6bcc80e22d
Adding serial numbers of disks to fuel-slave-3...
Waiting for VM "fuel-slave-3" to power on...
VM "fuel-slave-3" has been successfully started.

Slave nodes have been created. They will boot over PXE and get discovered by the master node.
To access master node, please point your browser to:
    http://10.20.0.2:8000/
The default username and password is admin:admin

Fuel node console message will show all the info to login to fuel node.


Now open fuel ip https://10.20.0.2:8443  using web browser and create openstack environment and deploy your openstack ,please note you need internet connection and it will download Ubuntu and some openstack packages from internet. You can create local repository also.















It will take approx. 2 hrs. Once it is successful, you will get dashboard IP of openstack in fuel node UI – dashboard tab. 
For user name password of openstack dashboard check fuel UI setting(Home-->Environments--><env name>-->Settings)- default is username-admin, password admin.
Also you can login to all the Ubuntu node from fuel node using root user.




Monday, February 8, 2016

Adding a compute node with Packstack


On compute node:
  • Stop network Manager.
# systemctl disable NetworkManager.service
#systemctl stop NetworkManager.service
#systemctl start network.service
#systemctl enable network.service

  • Configure local repo from RHEL7 DVD
  • Configure RDO repo:
yum install rdo-release-kilo-1.noarch.rpm
  • Configure epel repo
Yum install epel-release-latest-7.noarch.rpm

  • Install below required packages which are not present in repository:
 dnsmasq-utils-2.66-14.el7_1.x86_64.rpm
 python-cheetah-2.4.4-4.el7.x86_64.rpm
 python-markdown-2.4.1-1.el7.noarch.rpm
 python-pyasn1-modules-0.1.6-2.el7.noarch.rpm
 python-pygments-1.4-9.el7.noarch.rpm
 python-webob-1.2.3-8.el7.noarch.rpm
 python-werkzeug-0.9.1-1.el7.noarch.rpm

#Yum install pkg1 pkg2 etc.

ON CONTROLER NODE:

  • Add ip of compute server - in my case 192.168.140.134 in answer-file file
CONFIG_COMPUTE_HOSTS=192.168.140.133,192.168.140.134

[root@controller ~]# packstack --answer-file /root/answer.txt
Welcome to the Packstack setup utility

The installation log file is available at: /var/tmp/packstack/20160208-113001-2vehaw/openstack-setup.log

Installing:
Clean Up                                             [ DONE ]
Discovering ip protocol version                      [ DONE ]
Setting up ssh keys                                  [ DONE ]
Preparing servers                                    [ DONE ]
Pre installing Puppet and discovering hosts' details [ DONE ]
Adding pre install manifest entries                  [ DONE ]
Installing time synchronization via NTP              [ DONE ]
Setting up CACERT                                    [ DONE ]
Adding AMQP manifest entries                         [ DONE ]
Adding MariaDB manifest entries                      [ DONE ]
Fixing Keystone LDAP config parameters to be undef if empty[ DONE ]
Adding Keystone manifest entries                     [ DONE ]
Adding Glance Keystone manifest entries              [ DONE ]
Adding Glance manifest entries                       [ DONE ]
Adding Cinder Keystone manifest entries              [ DONE ]
Checking if the Cinder server has a cinder-volumes vg[ DONE ]
Adding Cinder manifest entries                       [ DONE ]
Adding Nova API manifest entries                     [ DONE ]
Adding Nova Keystone manifest entries                [ DONE ]
Adding Nova Cert manifest entries                    [ DONE ]
Adding Nova Conductor manifest entries               [ DONE ]
Creating ssh keys for Nova migration                 [ DONE ]
Gathering ssh host keys for Nova migration           [ DONE ]
Adding Nova Compute manifest entries                 [ DONE ]
Adding Nova Scheduler manifest entries               [ DONE ]
Adding Nova VNC Proxy manifest entries               [ DONE ]
Adding OpenStack Network-related Nova manifest entries[ DONE ]
Adding Nova Common manifest entries                  [ DONE ]
Adding Neutron FWaaS Agent manifest entries          [ DONE ]
Adding Neutron LBaaS Agent manifest entries          [ DONE ]
Adding Neutron API manifest entries                  [ DONE ]
Adding Neutron Keystone manifest entries             [ DONE ]
Adding Neutron L3 manifest entries                   [ DONE ]
Adding Neutron L2 Agent manifest entries             [ DONE ]
Adding Neutron DHCP Agent manifest entries           [ DONE ]
Adding Neutron Metering Agent manifest entries       [ DONE ]
Adding Neutron Metadata Agent manifest entries       [ DONE ]
Checking if NetworkManager is enabled and running    [ DONE ]
Adding OpenStack Client manifest entries             [ DONE ]
Adding Horizon manifest entries                      [ DONE ]
Adding Heat manifest entries                         [ DONE ]
Adding Heat CloudFormation API manifest entries      [ DONE ]
Adding MongoDB manifest entries                      [ DONE ]
Adding Redis manifest entries                        [ DONE ]
Adding Ceilometer manifest entries                   [ DONE ]
Adding Ceilometer Keystone manifest entries          [ DONE ]
Adding Nagios server manifest entries                [ DONE ]
Adding Nagios host manifest entries                  [ DONE ]
Adding post install manifest entries                 [ DONE ]
Copying Puppet modules and manifests                 [ DONE ]
Applying 192.168.140.134_prescript.pp
Applying 192.168.140.133_prescript.pp
192.168.140.134_prescript.pp:                        [ DONE ]
192.168.140.133_prescript.pp:                        [ DONE ]
Applying 192.168.140.134_chrony.pp
Applying 192.168.140.133_chrony.pp
192.168.140.134_chrony.pp:                           [ DONE ]
192.168.140.133_chrony.pp:                           [ DONE ]
Applying 192.168.140.133_amqp.pp
Applying 192.168.140.133_mariadb.pp
192.168.140.133_amqp.pp:                             [ DONE ]
192.168.140.133_mariadb.pp:                          [ DONE ]
Applying 192.168.140.133_keystone.pp
Applying 192.168.140.133_glance.pp
Applying 192.168.140.133_cinder.pp
192.168.140.133_keystone.pp:                         [ DONE ]
192.168.140.133_glance.pp:                           [ DONE ]
192.168.140.133_cinder.pp:                           [ DONE ]
Applying 192.168.140.133_api_nova.pp
192.168.140.133_api_nova.pp:                         [ DONE ]
Applying 192.168.140.133_nova.pp
Applying 192.168.140.134_nova.pp
Applying 192.168.140.133_neutron.pp
192.168.140.134_nova.pp:                             [ DONE ]
192.168.140.133_nova.pp:                             [ DONE ]
192.168.140.133_neutron.pp:                          [ DONE ]
Applying 192.168.140.134_neutron.pp
192.168.140.134_neutron.pp:                          [ DONE ]
Applying 192.168.140.133_osclient.pp
Applying 192.168.140.133_horizon.pp
192.168.140.133_osclient.pp:                         [ DONE ]
192.168.140.133_horizon.pp:                          [ DONE ]
Applying 192.168.140.133_heat.pp
Applying 192.168.140.133_heatcnf.pp
192.168.140.133_heat.pp:                             [ DONE ]
192.168.140.133_heatcnf.pp:                          [ DONE ]
Applying 192.168.140.133_mongodb.pp
Applying 192.168.140.133_redis.pp
192.168.140.133_mongodb.pp:                          [ DONE ]
192.168.140.133_redis.pp:                            [ DONE ]
Applying 192.168.140.133_ceilometer.pp
192.168.140.133_ceilometer.pp:                       [ DONE ]
Applying 192.168.140.133_nagios.pp
Applying 192.168.140.134_nagios_nrpe.pp
Applying 192.168.140.133_nagios_nrpe.pp
192.168.140.134_nagios_nrpe.pp:                      [ DONE ]
192.168.140.133_nagios.pp:                           [ DONE ]
192.168.140.133_nagios_nrpe.pp:                      [ DONE ]
Applying 192.168.140.134_postscript.pp
Applying 192.168.140.133_postscript.pp
192.168.140.134_postscript.pp:                       [ DONE ]
192.168.140.133_postscript.pp:                       [ DONE ]
Applying Puppet manifests                            [ DONE ]
Finalizing                                           [ DONE ]

 **** Installation completed successfully ******

Additional information:
 * File /root/keystonerc_admin has been created on OpenStack client host 192.168.140.133. To use the command line tools you need to source the file.
 * NOTE : A certificate was generated to be used for ssl, You should change the ssl certificate configured in /etc/httpd/conf.d/ssl.conf on 192.168.140.133 to use a CA signed cert.
 * To access the OpenStack Dashboard browse to https://192.168.140.133/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
 * To use Nagios, browse to http://192.168.140.133/nagios username: nagiosadmin, password: e365d58566e5482e
 * The installation log file is available at: /var/tmp/packstack/20160208-113001-2vehaw/openstack-setup.log
 * The generated manifests are available at: /var/tmp/packstack/20160208-113001-2vehaw/manifests
[root@controller ~]#

On compute node:

[root@computenode ~]# openstack-status
== Nova services ==
openstack-nova-api:                     inactive  (disabled on boot)
openstack-nova-compute:                 active
openstack-nova-network:                 inactive  (disabled on boot)
openstack-nova-scheduler:               inactive  (disabled on boot)
== neutron services ==
neutron-server:                         inactive  (disabled on boot)
neutron-dhcp-agent:                     inactive  (disabled on boot)
neutron-l3-agent:                       inactive  (disabled on boot)
neutron-metadata-agent:                 inactive  (disabled on boot)
neutron-lbaas-agent:                    inactive  (disabled on boot)
neutron-openvswitch-agent:              active
== Ceilometer services ==
openstack-ceilometer-api:               inactive  (disabled on boot)
openstack-ceilometer-central:           inactive  (disabled on boot)
openstack-ceilometer-compute:           active
openstack-ceilometer-collector:         inactive  (disabled on boot)
== Support services ==
openvswitch:                            active
dbus:                                   active
Warning novarc not sourced
[root@computenode ~]#

Check in Dashboard.