2. TRYSTACK.CN
Who am I?
: @ben_杜
玉杰
www.linkedin.com
/in/duyujie
Website: www.du
yu
http://about.me/Y jie.org
ujie.Du
3. TRYSTACK.CN
Agenda
How to set up your TryStack Lab
What's OpenStack?
Why we are here?
Devstack in 5 min
First contact with OpenStack
Write a template for Heat
9. TRYSTACK.CN
3. Set up Vagrant
$ mkdir trystack
$ cd trystack
$ vagrant init
$ vim Vagrantfile
# -*- mode: ruby -*# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "Trystack"
config.vm.box_url = "Centos64-x86_64-20131030"
config.vm.network :private_network, ip: " 172.16.0.2"
config.vm.synced_folder "../devstack", "/vagrant_data"
config.vm.provider :virtualbox do |vbox|
vbox.customize ["modifyvm", :id, "--memory", "2048"]
end
end
10. TRYSTACK.CN
4. PIP
Devstack will install EPEL and RDO repo for CentOS6.4, Set up pypi :
$mkdir $HOME/.pip
$vi $HOME/.pip/pip.conf
[global]
index-url = http://pypi.douban.com/simple/
-------------------exit, reboot to update env.
12. TRYSTACK.CN
常用的vagrant命令
$ vagrant box add NAME URL
$ vagrant box list
#添加一个box
#查看本地已添加的box
$ vagrant box remove NAME virtualbox #删除本地已添加的box,如若是版本1.0.x,执行$ vagrant box remove NAME
$ vagrant init NAME
#初始化,实质应是创建Vagrantfile文件
$ vagrant up
#启动虚拟机
$ vagrant halt
#关闭虚拟机
$ vagrant destroy
#销毁虚拟机
$ vagrant reload
#重启虚拟机
$ vagrant package
#当前正在运行的VirtualBox虚拟环境打包成一个可重复使用的box
$ vagrant ssh
#进入虚拟环境
https://github.com/astaxie/Go-in-Action/blob/master/ebook/zh/01.0.md
13. TRYSTACK.CN
5. Install DevStack
Home pages: http://devstack.org
Three steps:
$ git clone https://github.com/openstack-dev/devstack.git
$ cd devstack
$ ./stack.sh
exercise.sh: setting up the env for running the sample exercise cmds
exercises/ folder: contains a small set of exercise file for achieving different
functionalities
14. TRYSTACK.CN
Files
localrc:
● localrc is a user-maintained settings file that is sourced from stackrc. This gives
it the ability to override any variables set in stackrc. Samples: http://devstack.
org/localrc.html
stackrc:
● git repo and branch information, image download location. This file shouldn't be
modified, only localrc should be modified.
stack.sh:
● stack.sh is an opinionated OpenStack developer installation. It installs and
configures various combinations of Glance, Horizon, Keystone, Nova, Neutron,
Swift and some other projects.
17. TRYSTACK.CN
Continue
# Enables all the Heat services
echo ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng >> localrc
## It would also be useful to automatically download and register VM images that Heat can launch.
# 64bit image (~660MB)
echo IMAGE_URLS+=",http://fedorapeople.org/groups/heat/prebuilt-jeos-images/F17-x86_64-cfntools.qcow2" >> localrc
echo IMAGE_URLS+=",http://fedorapeople.org/groups/heat/prebuilt-jeos-images/F18-x86_64-cfntools.qcow2" >> localrc
# 32bit image (~640MB)
echo IMAGE_URLS+=",http://fedorapeople.org/groups/heat/prebuilt-jeos-images/F17-i386-cfntools.qcow2" >> localrc
echo IMAGE_URLS+=",http://fedorapeople.org/groups/heat/prebuilt-jeos-images/F18-i386-cfntools.qcow2" >> localrc
source localrc
echo VORBOSE=True >> stackrc
echo LOGFILE=stacklog.txt >> stackrc
source stackrc
18. TRYSTACK.CN
Wait …
./stack.sh
# Devstack is now installed.
# If all is well, you will see the following output :
# Horizon is now available at http://IP_ADDRESS/
# Heat has replaced the default flavors. View by running: nova flavor-list
# Keystone is serving at http://IP_ADDRESS:5000/v2.0/
# Examples on using novaclient command line is in exercise.sh
# The default users are: admin and demo
# The password: trystack
# This is your host ip: IP_ADDRESS
# stack.sh completed in 1065 seconds.
23. TRYSTACK.CN
Linux Kernel Similarities
●
●
●
●
●
Open Source
Released early
OpenStack Foundation is very similar to the Linux Foundation
Replaced the proprietary incumbents
One could consider the abstractions quite similar too:
28. TRYSTACK.CN
Development
Development done on always open trunk
Releases done to a stable branch
Standardized tools across all projects
− Git
− Gerrit
● Standalone patch review server
● Created by Google for Android development
− Jenkins
● Continuous integration
● Gates commits on unit tests
29. TRYSTACK.CN
Commit process
● git branch; git commit
− Commit hook inserts Change-Id: for gerrit tracking
● ./run_tests.sh [subset]
− Unit tests within a virtualenv
− Nose used to extend unittest
− Pep8 enforced https://github.com/jcrocholl/pep8
● git-review python tool used to submit to gerrit
− Developed for OpenStack but not specific to it
30. TRYSTACK.CN
Review Process
Gated trunk
− Reviewers
●
Anyone can ±1
●
Only project core members can approve
− Automated tests
●
Through Jenkins
●
Using OpenStack infrastructure itself
●
Sets up test systems and runs gerrit branch
●
− Libvirt, Xen, python 2.6, python 2.7, ...
If OK, merges gerrit branch to trunk
●
Ancillary jobs like doc builds, pylint reports, more tests, ...
32. TRYSTACK.CN
Release History
● 6 monthly, design summit after each, monthly milestones
● Austin Oct 2010
Nova + Swift
● Cactus Apr 2011
Glance
● Diablo Sep 2011
First “production ready” release
● Essex Apr 2012
Horizon + Keystone
● Folsom Sep 2012 Quantum + Cinder
● Grizzly Apr 2013
Neutron
● Havana Oct 2013 Heat +Ceilometer
33. TRYSTACK.CN
Openstack is the community
• Interact via:
– Mailing lists: general, development, documentation, operators …
– Ask Openstack (ask.openstack.org)
– Launchpad
■
Home to all openstack integrated projects
– IRC (#openstack-101, #openstack, #openstack-dev, …)
– Local User Groups (like today!)
– Summit & Conference (twice a year)
34. TRYSTACK.CN
See Openstack evolving, everyday
• http://status.openstack.org
– Release status
– Active Reviews
• https://github.com/openstack
– Grab the code
40. TRYSTACK.CN
Related python projects
●
OZ
−
Generate guest images from install ISOs
●
Optional customization
−
−
Install packages, run script, ...
List of OZ built images from RackSpace
●
https://github.com/rackerjoe/oz-image-build
−
ISO -> image -> glance -> nova -> libvirt -> KVM
−
http://aeolusproject.org/oz.html
41. TRYSTACK.CN
Related python projects
●
Heat API
−
AWS Cloudformation type service
−
V6 just released
−
Provisions apps in the cloud
−
And keeps them provisioned
●
−
Leverages cloud attributes to provide HA
https://github.com/heat-api
43. TRYSTACK.CN
Ryu Plugin for Neutron
Ryu is a component-based software defined networking framework. Ryu
provides software components with well defined API that make it easy for
developers to create new network management and control applications. Ryu
supports various protocols for managing network devices, such as OpenFlow,
Netconf, OF-config, etc. About OpenFlow, Ryu supports fully 1.0, 1.2, 1.3 and
Nicira Extensions.
Home Pages:http://osrg.github.io/ryu/
44. TRYSTACK.CN
Similar non python projects
● oVirt - java
− More aligned with private datacenters
● Eucalyptus - C
− Less general, Closed editions.
● CloudStack - java
− Started closed (cloud.com). Closed addons.
● OpenNebula - C++
− Again focusing on datacenters
45. TRYSTACK.CN
Trying it out
●
http://trystack.org/ Or http://cloud.trystack.cn
−
●
http://devstack.org/
−
●
Register to try out a test public OpenStack cloud
Script to setup simple/developer installs
fedoraproject.org/wiki/Getting_started_with_OpenStack
−
Basic setup instructions for machine or VM
46. TRYSTACK.CN
What's trystack.cn
●
Biggest OpenStack testbed in China
−
−
Opened OpenStack API
−
●
Non-profit project
Provide best practices for administrator, operators and developers.
Reference Architecture
−
−
OpenStack deployment architecutre
−
●
Hardware devices from different vendors
Using the newest OpenStack code
Contribute code to the community
−
−
●
Bug fixes
New features
Promote OpenStack implementation and productization in China With partners, vendors
47. TRYSTACK.CN
More info
● http://docs.openstack.org/
− The compute admin guide is a good overview
● http://ci.openstack.org/
− OpenStack Continuous Integration info
● http://review.openstack.org/
− OpenStack gerrit interface
● http://jenkins.openstack.org/
− OpenStack Continuous Integration interface
56. TRYSTACK.CN
Heat Overview
●
Orchestration of Openstack deployments
●
Integrates with all Openstack core projects
●
Converts a JSON template into a cloud application
●
Implements well known template and API (AWS
Cloudformation, also YAML, ReST)
●
Version your cloud applications like your software
●
Repeatable deployments, fully automated
58. TRYSTACK.CN
Heat Stack lifecycle
● Base OS image stored in glance
● Deploy instances & configure services based on template contents
(resources)
● Deployment-time configuration/customization
● Very flexible, but much reduced complexity
● Cloud-init (nova user/metadata), plus cfn-init
● Puppet/Chef can still be used if you want!
● Fully integrated single-service solution
61. TRYSTACK.CN
Why Heat/orchestration?
●
Orchestration makes things repeatable
●
Much easier to provide “on demand” infrastructure
●
Much less scripting, single template system
●
Leverage the power of openstack without learning fine detail of every service (learn one set of
APIs/tools)
●
Portability/migration
●
Version/tag/branch your infrastructure like code!
●
Composed templates/modularity
●
Pluggable, user-modifiable resource implementations
●
Open(stack) community project :)
67. TRYSTACK.CN
In Closing
●
Users and developers wanted!
−
−
Check out the repository:
−
●
Connect with the community via IRC on #heat@freenode
https://github.com/openstack/heat
Read the Documentation:
http://wiki.openstack.org/Heat/
Heat simple but powerful method for orchestrating OpenStack
environments