Difference between revisions of "Infrastructure Virtualization Project"

From Amahi Wiki
Jump to: navigation, search
Line 1: Line 1:
{{NeedsUpdate}}
 
 
{{WorkInProgress}}
 
{{WorkInProgress}}
 
=Objective=
 
=Objective=

Revision as of 03:56, 26 June 2016

Msgbox-WOPr.png Work In Progress
This article is currently undergoing major expansion or restructuring. You are welcome to assist by editing it as well. If this article has not been edited in several days, please remove this template.


Objective

This is a project to update and modernize the infrastructure that keeps the Amahi web sites and services running.

The idea is to provide easier and more sustainable management of the infrastructure to leave more time for the team to devote to moving the project forward.

NOTE: this project is not about running Amahi platform software on virtual servers, etc. For that there is a separate page on Virtualization.

Goals

We have multiple goals:

  • run some of internal build machines in a reliable, efficient way, so that we have consistent and updated builds/releases
  • have consistent and recent backups making things recoverable
  • run some testing of Amahi apps more easily and efficiently
  • test new features in an isolated manner

Known Issues

None

Hardware

Dell Rack Server

  • Dual Xeon E5450 3.0 GHz Processors
  • 32GB PC2-5300 RAM (8x4)
  • Two Gigabit Network Interfaces
  • KVM Network Interface
  • RAID Controller
  • Four Quick Swap Drive Bays
    • 1 - 850GB (OS and Backup)
    • 2 - 2 TB (Images and Backup)
    • 3 - 120GB SSD (VMs)
    • 4 - Empty

Software

  • CentOS 7.2 x86_64 (Minimal)
  • OpenStack Mitaka Release

Setup

sudo systemctl disable firewalld
sudo systemctl stop firewalld
sudo systemctl disable NetworkManager
sudo systemctl stop NetworkManager
sudo systemctl enable network
sudo systemctl start network
  • Add users and private keys for SSH login
  • Disable SSH password and root login
  • Install Open Stack Mitaka Repo
sudo yum install -y centos-release-openstack-mitaka
  • Perform OS update
yum -y update
  • Install Packstack Installer
sudo yum install -y openstack-packstack
  • Run Packstack to install OpenStack (as root):
packstack --allinone --provision-demo=n --os-neutron-ovs-bridge-mappings=extnet:br-ex \
--os-neutron-ml2-type-drivers=vxlan,flat
  • After completion, configure network bridging. Make /etc/sysconfig/network-scripts/ifcfg-br-ex resemble:
DEVICE=br-ex
DEVICETYPE=ovs
TYPE=OVSBridge
BOOTPROTO=static
IPADDR=192.168.122.212 # Old eth0 IP since we want the network restart to not 
                       # kill the connection, otherwise pick something outside your dhcp range
NETMASK=255.255.255.0  # your netmask
GATEWAY=192.168.122.1  # your gateway
DNS1=192.168.122.1     # your nameserver
ONBOOT=yes

Make /etc/sysconfig/network-scripts/ifcfg-enp2s0 resemble (no BOOTPROTO!):

DEVICE=enp2s0
TYPE=OVSPort
DEVICETYPE=ovs
OVS_BRIDGE=br-ex
ONBOOT=yes
  • Restart network:
systemctl restart network
  • Extend cinder-volumes past 20GB to allow for creating additional volumes to attach to instances.
#!/bin/bash
/usr/sbin/losetup -f /var/lib/cinder/cinder-volumes-ext
/usr/sbin/vgchange --activationmode partial -a y cinder-volumes
/usr/bin/systemctl restart openstack-cinder-volume
/usr/bin/systemctl restart openstack-cinder-api
/usr/bin/systemctl restart openstack-cinder-scheduler
    • Add to root crontab:
@reboot /usr/bin/ext-cinder-vol
    • Created 130Gb additional space for volumes (/mnt/backup/stack-volumes).
    • Total volume space available is now 150GB.

Build Images

This will outline how to build OpenStack images using Proxmox VE.

  • Log into Proxmox VE web UI
  • Create a VM or clone an existing one
    1. If creating a VM, install the OS
    2. If using a clone, start the VM
  • Open a console window for the VM
    1. Log in and as root do the following
      • dd if=/dev/zero of=/mytempfile bs=1M (zero out any unused space)
      • rm -f /mytempfile
    2. Shutdown VM
    3. Log into Proxmox VE via SSH and execute the following from command line
      • Navigate to /var/lib/vz/images/### (number of VM)
      • mv original_image.qcow2 original_image.qcow2_backup (rename original image)
      • qemu-img convert -O qcow2 original_image.qcow2_backup original_image.qcow2
      • Copy new .qcow2 image to a safe location for uploading into OpenStack
      • Remove .backup file
      • Delete the VM from Proxmox VE web UI
  • Use WINScp or similar program to copy the .qcow2 image to client machine
  • Upload into OpenStack via the web UI


REF: Reclaim disk space from .qcow2 or .vmdk image

Create Instance

This is a nice straight forward tutorial on Creating an instance.

Notes

None

Tips

Network Issues

If the DNS server is changed or networking appears inoperable, check the following to ensure the DNS is correct:

  • /etc/sysconfig/network-scripts/ifcfg-br-ex
  • /etc/resolve


Next restart neutron network services:

service neutron-server restart
service neutron-dhcp-agent restart
service neutron-l3-agent restart
service neutron-metadata-agent restart
service neutron-openvswitch-agent restart

Volume Issues

When a volume becomes detached and/or shows in error, the state can be reset:

source keystonerc_admin
cinder reset-state volume_id

or use web UI.

Also refer to Amahi Bug #2051.

Update/Reboot/Shutdown Process

  • Shutdown/Disconnect
    • Stop all instances via SSH
    • Detach volumes from instances (not needed in Mitaka)
    • Verify all volumes detached and instances stopped
    • Perform Update/Reboot
  • Once system rebooted:
    • Verify cinder_volumes (LVM) is operational
    • Reattach volumes to instances (not needed in Mitaka)
    • Start all needed instances
    • Verify all instances are operational

Create Static IP for Instance

Setting a static IP for instances will ensure the internal IP address remains the same through it's life cycle. The floating IP address can be easily added afterwards.

  • As root user, execute source keystonerc_admin
  • Use the following to reserve the IP address:
neutron port-create internal --fixed-ip subnet_id=internal_subnet,ip_address=x.x.x.x
  • Create the instance and boot via command-line vs the web UI:
nova boot --image NAME_OF_IMAGE --flavor amahi.small --nic port-id=ID_FOR NETWORK_FROM_ABOVE_COMMAND_RESULTS VM_NAME
NOTE: If image name has spaces, enclose it in double quotes.

Ref: Add Multiple Specific IPs to Instance

Fedora Cloud Images

See Launch Fedora Cloud images for guidance.

Miscellaneous

Refer to Amahi Bug #2050 for some OpenStack Command-Line syntax.