flaper87 / vagrant-openstack

OpenStack provider for vagrant
BSD 3-Clause "New" or "Revised" License
29 stars 5 forks source link

multiple VM support wrt floating ips? #10

Open baboune opened 10 years ago

baboune commented 10 years ago

When using multiple VMs in a single Vagrantfile, I am unsure how to assign the floating ip for each of the VM.

Error log: ==> devstack: Using floating IP ["147.214.206.149", "147.214.206.157"] An error occurred while executing multiple actions in parallel. Any errors that occurred are shown below.

An unexpected error ocurred when executing the action on the 'monitoring' machine. Please report this as a bug:

undefined method `server=' for nil:NilClass

/home/lmcnise/.vagrant.d/gems/gems/vagrant-openstack-plugin-0.3.0/lib/vagrant-openstack-plugin/action/create_server.rb:90:in block in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/util/retryable.rb:17:inretryable' /home/lmcnise/.vagrant.d/gems/gems/vagrant-openstack-plugin-0.3.0/lib/vagrant-openstack-plugin/action/create_server.rb:75:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /home/lmcnise/.vagrant.d/gems/gems/vagrant-openstack-plugin-0.3.0/lib/vagrant-openstack-plugin/action/warn_networks.rb:14:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/set_hostname.rb:16:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /home/lmcnise/.vagrant.d/gems/gems/vagrant-openstack-plugin-0.3.0/lib/vagrant-openstack-plugin/action/sync_folders.rb:17:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/provision.rb:76:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /home/lmcnise/.vagrant.d/gems/gems/vagrant-openstack-plugin-0.3.0/lib/vagrant-openstack-plugin/action/connect_openstack.rb:45:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:95:in block in finalize_action' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builder.rb:116:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/runner.rb:69:in block in run' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/util/busy.rb:19:inbusy' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/runner.rb:69:in run' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/call.rb:51:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/config_validate.rb:25:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/handle_box.rb:56:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/handle_box_url.rb:9:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builder.rb:116:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/runner.rb:69:inblock in run' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/util/busy.rb:19:in busy' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/runner.rb:69:inrun' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/machine.rb:157:in action' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/batch_action.rb:72:inblock (2 levels) in run'

An unexpected error ocurred when executing the action on the 'devstack' machine. Please report this as a bug:

undefined method `server=' for nil:NilClass

/home/lmcnise/.vagrant.d/gems/gems/vagrant-openstack-plugin-0.3.0/lib/vagrant-openstack-plugin/action/create_server.rb:90:in block in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/util/retryable.rb:17:inretryable' /home/lmcnise/.vagrant.d/gems/gems/vagrant-openstack-plugin-0.3.0/lib/vagrant-openstack-plugin/action/create_server.rb:75:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /home/lmcnise/.vagrant.d/gems/gems/vagrant-openstack-plugin-0.3.0/lib/vagrant-openstack-plugin/action/warn_networks.rb:14:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/set_hostname.rb:16:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /home/lmcnise/.vagrant.d/gems/gems/vagrant-openstack-plugin-0.3.0/lib/vagrant-openstack-plugin/action/sync_folders.rb:17:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/provision.rb:76:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /home/lmcnise/.vagrant.d/gems/gems/vagrant-openstack-plugin-0.3.0/lib/vagrant-openstack-plugin/action/connect_openstack.rb:45:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:95:in block in finalize_action' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builder.rb:116:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/runner.rb:69:in block in run' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/util/busy.rb:19:inbusy' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/runner.rb:69:in run' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/call.rb:51:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/config_validate.rb:25:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/handle_box.rb:56:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/handle_box_url.rb:9:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:incall' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builder.rb:116:in call' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/runner.rb:69:inblock in run' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/util/busy.rb:19:in busy' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/runner.rb:69:inrun' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/machine.rb:157:in action' /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/batch_action.rb:72:inblock (2 levels) in run'

Relevant section in Vagrantfile:

if ENV['PROVIDER'].downcase == 'openstack'

  # Make sure the private key from the key pair is provided
  config.ssh.private_key_path = "./cloud-analytics-kds.pem"

  config.vm.provider :openstack do |os|   

      os.username     = OS_USERNAME
      os.api_key      = OS_PASSWORD
      os.flavor       = /m1.medium/                                       # Regex or String
      os.image        = "trusty-server-cloudimg-amd64"
      os.endpoint     = "http://147.214.206.185:5000/v2.0/tokens"
      os.keypair_name = "bla"
      os.ssh_username = "ubuntu"
      os.network      = "cloud-analytics-net"
      os.tenant       = "cloud-analytics"         
      os.floating_ip  = ["147.214.206.149", "147.214.206.157"]
  end

Later on two VMs are defined: config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" config.vm.provision :shell, :path => "./sh/repository.sh"

config.vm.define "monitoring" do |monitoring|
monitoring.vm.provision :shell, :path => "monitoring.sh", :args => MONITORING_IP end

config.vm.define "devstack" do |devstack|
devstack.vm.provision :shell, :path => "./sh/vagrant.sh", :args => DEVSTACK_IP end