From 604b59141723babacb4789efaa9d36593eb3b31d Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Tue, 28 Jun 2011 06:40:56 -0700 Subject: [PATCH 1/4] ignore graphs. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8790fbf..be3bf4c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ facter puppet bashrc .vagrant +graphs/* From 1f0495a0daa4d70f961c7d58207d44c30d8908cf Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Tue, 28 Jun 2011 06:41:39 -0700 Subject: [PATCH 2/4] updated image service. --- manifests/site.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From fb4809a0686721f2a199b7f43bcfca3aa5a76b5a Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Tue, 28 Jun 2011 06:42:03 -0700 Subject: [PATCH 3/4] split tests out into nova and glance tests. --- ext/{test.sh => glance.sh} | 19 +------------------ ext/nova.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 18 deletions(-) rename ext/{test.sh => glance.sh} (51%) mode change 100644 => 100755 create mode 100755 ext/nova.sh 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' From 44dfe179f58a0b5b491ec81346c27094eeb29d21 Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Thu, 30 Jun 2011 13:12:18 -0700 Subject: [PATCH 4/4] updated vagrant build utilities: updated vagrang build utils. added rakefile that performs multi-node tests removed puppetmaster stuff from Vagrantfile --- Rakefile | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Vagrantfile | 8 +++--- 2 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 Rakefile 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|