diff --git a/.gitignore b/.gitignore index 8790fbf..be3bf4c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ facter puppet bashrc .vagrant +graphs/* diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..d71b0a7 --- /dev/null +++ b/Rakefile @@ -0,0 +1,77 @@ +require 'vagrant' + +env=Vagrant::Environment.new(:cwd => File.dirname(__FILE__)) +# this captures the regular output to stdout +env.ui = Vagrant::UI::Shell.new(env, Thor::Base.shell.new) +env.load! + +# all of the instance to build out for multi-node +instances = [ + :db, + :rabbitmq, + :glance, + :controller, + :compute +] + +namespace :build do + desc 'build out 5 node openstack cluster' + task :multi do + instance.each do |instance| + build(instance, env) + end + end + desc 'build out openstack on one node' + task :all do + build(:all, env) + end +end + +# bring vagrant vm with image name up +def build(instance, env) + unless vm = env.vms[instance] + puts "invalid VM: #{instance}" + else + if vm.created? + puts "VM: #{instance} was already created" + else + # be very fault tolerant :) + begin + # this will always fail + vm.up(:provision => true) + rescue Exception => e + puts e.class + puts e + end + end + end +end + +namespace :test do + desc 'test multi-node installation' + task :multi do + {:glance => ['sudo /vagrant/ext/glance.sh'], + :controller => ['sudo /vagrant/ext/nova.sh'], + }.each do |instance, commands| + test(instance, commands, env) + end + end + desc 'test single node installation' + task :all do + test(:all, ['sudo /vagrant/ext/glance.sh', 'sudo /vagrant/ext/nova.sh'], env) + end +end + +def test(instance, commands, env) + unless vm = env.vms[instance] + puts "invalid VM: #{instance}" + else + puts "testing :#{instance}" + vm.ssh.execute do |ssh| + commands.each do |c| + #puts ssh.methods - Object.methods + puts ssh.exec!(c) + end + end + end +end diff --git a/Vagrantfile b/Vagrantfile index 74468c0..8bc41c5 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -27,10 +27,10 @@ Vagrant::Config.run do |config| pm.vm.forward_port('ssh', 22, ssh_forward, :auto => true) # hard-coding this b/c it is important pm.vm.network("#{net_base}.10") - pm.vm.provision :puppet do |puppet| - puppet.manifest_file = "master.pp" - puppet.options = ["--certname","puppetmaster", '--modulepath', '/vagrant/modules'] - end + #pm.vm.provision :puppet do |puppet| + # puppet.manifest_file = "master.pp" + # puppet.options = ["--certname","puppetmaster", '--modulepath', '/vagrant/modules'] + #end end config.vm.define :all do |all| diff --git a/ext/test.sh b/ext/glance.sh old mode 100644 new mode 100755 similarity index 51% rename from ext/test.sh rename to ext/glance.sh index eb01323..b315a81 --- a/ext/test.sh +++ b/ext/glance.sh @@ -1,24 +1,7 @@ +#!/bin/bash # Extract creds -cd ~ -sudo nova-manage project zipfile nova novaadmin -unzip nova.zip -source novarc -euca-add-keypair openstack > ~/cert.pem - # Add images to glance and index glance add name=ramdisk disk_format=ari container_format=ari is_public=True < /vagrant/images/lucid_ami/initrd.img-2.6.32-23-server glance add name=kernel disk_format=aki container_format=aki is_public=True < /vagrant/images/lucid_ami/vmlinuz-2.6.32-23-server glance add name=lucid_ami disk_format=ami container_format=ami is_public=True ramdisk_id=1 kernel_id=2 < /vagrant/images/lucid_ami/ubuntu-lucid.img glance index - -# List -nova flavor-list -nova image-list - -# Run instance -euca-run-instances ami-00000003 -k openstack -t m1.tiny -euca-describe-instances - -echo 'check the status of your VM with euca-describe-instances' -echo 'when it is in the running state, verify that you can login' -echo 'using ssh -i ~/cert.pem root@ip.address' diff --git a/ext/nova.sh b/ext/nova.sh new file mode 100755 index 0000000..c69aecc --- /dev/null +++ b/ext/nova.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Extract creds +cd ~ +sudo nova-manage project zipfile nova novaadmin +unzip nova.zip +source novarc +euca-add-keypair openstack > ~/cert.pem +# List +nova flavor-list +nova image-list + +# Run instance +euca-run-instances ami-00000003 -k openstack -t m1.tiny +euca-describe-instances + +echo 'log into your controller VM' +echo 'check the status of your VM with euca-describe-instances' +echo 'when it is in the running state, verify that you can login' +echo 'using ssh -i ~/cert.pem root@ip.address' diff --git a/manifests/site.pp b/manifests/site.pp index 016c787..826961b 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -77,7 +77,7 @@ node compute { class { "nova": verbose => $verbose, sql_connection => "mysql://${db_username}:${db_password}@${db_host}/${db_name}", - image_service => $image_service, + image_service => 'nova.image.glance.GlanceImageService', glance_api_servers => $glance_api_servers, glance_host => $glance_host, glance_port => $glance_port,