flaper87 / vagrant-openstack

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

floating_ip does not work #1

Closed mcallaway closed 11 years ago

mcallaway commented 11 years ago

Should this work?

> cat Vagrantfile
require 'vagrant-openstack'

Vagrant.configure("2") do |config|

  config.vm.box = "dummy"

  config.vm.provider :openstack do |os|
    os.url = ENV['OS_AUTH_URL']
    os.tenant = "csa"
    os.user = ENV['USER']
    os.password = ENV['OS_PASSWORD']

    os.flavor = "1"
    os.keypair = ENV['USER']
    os.image = "bd23e7f2-9434-410c-ab9a-09a3b11ed844"

    os.floating_ip = "10.0.25.227"

    os.name = ENV['USER'] + "_test"
    os.ssh_username = ENV['USER']
    os.ssh_private_key = ENV['HOME'] + "/.ssh/id_rsa"
  end

end

> vagrant up --provider=openstack
/Users/mcallawa/vagrant/ostackhost/Vagrantfile:18:in `block (2 levels) in <top (required)>': undefined method `floating_ip=' for #<VagrantPlugins::ProviderOpenStack::Config:0x00000100aab3f0> (NoMethodError)
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/plugins/kernel_v2/config/vm.rb:205:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/plugins/kernel_v2/config/vm.rb:205:in `block (2 levels) in finalize!'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/plugins/kernel_v2/config/vm.rb:205:in `each'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/plugins/kernel_v2/config/vm.rb:205:in `block in finalize!'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/plugins/kernel_v2/config/vm.rb:198:in `each'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/plugins/kernel_v2/config/vm.rb:198:in `finalize!'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/lib/vagrant/config/v2/root.rb:44:in `block in finalize!'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/lib/vagrant/config/v2/root.rb:43:in `each'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/lib/vagrant/config/v2/root.rb:43:in `finalize!'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/lib/vagrant/config/v2/loader.rb:21:in `finalize'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/lib/vagrant/config/loader.rb:159:in `load'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/lib/vagrant/environment.rb:238:in `config_global'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/lib/vagrant/environment.rb:443:in `block in action_runner'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/lib/vagrant/action/runner.rb:28:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/lib/vagrant/action/runner.rb:28:in `run'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/lib/vagrant/environment.rb:251:in `hook'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/lib/vagrant/environment.rb:131:in `initialize'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/bin/vagrant:53:in `new'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/bin/vagrant:53:in `<top (required)>'
from /Applications/Vagrant/bin/../embedded/gems/bin/vagrant:23:in `load'
from /Applications/Vagrant/bin/../embedded/gems/bin/vagrant:23:in `<main>'
flaper87 commented 11 years ago

Yes, that should work!

Are you using the version on rubygems ? This part hasn't been released yet.

Try downloading the code in master and running gem build vagrant-openstack.gemspec then you can install that gem in vagrant.

mcallaway commented 11 years ago

I can repeat the problem on the master branch from github. I'm debugging it this morning.

It looks to me like read_ssh_info.rb has a problem with get_ip(). It fetches floating IP list, but picks the first one from the list, which happens to belong to another running VM, not the instance that it launched.

More details as I have them.

On Thu, Apr 11, 2013 at 5:36 AM, Flavio Percoco Premoli < notifications@github.com> wrote:

Yes, that should work!

Are you using the version on rubygems ? This part hasn't been released yet.

Try downloading the code in master and running gem build vagrant-openstack.gemspec then you can install that gem in vagrant.

— Reply to this email directly or view it on GitHubhttps://github.com/FlaPer87/vagrant-openstack/issues/1#issuecomment-16227263 .

mcallaway commented 11 years ago

I am misguided. The read_ssh_info part is figuring out which IP to connect to. It is properly determining that the VM just booted has 'nil' for IP. I'm using the rubygems version. I'll now try to build as you suggest from github version and see what happens. I think I tried this before and had a dependency error with fog, but I'll try again.

mcallaway commented 11 years ago

Yes, I have the same problem with your code that I had with this other attempt:

https://github.com/cloudbau/vagrant-openstack/issues/1

Bundler could not find compatible versions for gem "net-scp":
  In Gemfile:
    vagrant-openstack (>= 0) ruby depends on
      net-scp (~> 1.0.4) ruby

    vagrant (>= 0) ruby depends on
      net-scp (1.1.0)
mcallaway commented 11 years ago

So, trying to find code that works together, I tried this:

> cat Gemfile
source 'https://rubygems.org'

# fails with fog
#gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
#gem "vagrant-openstack", :git => "https://github.com/FlaPer87/vagrant-openstack"

gem 'vagrant', :git => 'git://github.com/mitchellh/vagrant.git', :ref => '54273924592bb4070a6af69f021efcead9deceb2'
gem 'vagrant-openstack', :git => 'git://github.com/FlaPer87/vagrant-openstack.git'
gem 'rake'
gem "fog", "~> 1.6.0"

I run bundle install then bundle exec vagrant plugin list, which shows me:

> bundle exec vagrant plugin list
You appear to be running Vagrant outside of the official installers.
Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.
You cannot run the `vagrant plugin` command while in a bundler environment.
This should generally never happen unless Vagrant is installed outside
of the official installers or another gem is wrongly attempting to
use Vagrant internals directly. Please properly install Vagrant to
fix this. If this error persists, please contact support.

Can you provide instructions on how you set your plugin up to run with the officially released vagrant-1.1.5 package from the vagrant download site?

flaper87 commented 11 years ago

Hey,

Yeah, unfortunately vagrant 1.1 isn't on rubgems yet, you'll have to either use it through bundle or make sure you remove vagrant from your system and it's dependencies (net-scp 1.0.4). I suggest you the first.

Inside vagrant-openstack directory:

bundle install --path .bundle 

Then you can use the openstack provider:

 bundle exec vagrant up --provider=openstack

Let me know if that works for you!

Thanks for looking at this and reporting!

mcallaway commented 11 years ago
-> git status
# On branch master
nothing to commit (working directory clean)

-> git remote -v
origin https://github.com/FlaPer87/vagrant-openstack (fetch)
origin https://github.com/FlaPer87/vagrant-openstack (push)

-> bundle install --path bundles
Fetching git://github.com/mitchellh/vagrant.git
remote: Counting objects: 30738, done.
remote: Compressing objects: 100% (10408/10408), done.
remote: Total 30738 (delta 20485), reused 29481 (delta 19324)
Receiving objects: 100% (30738/30738), 4.21 MiB | 848 KiB/s, done.
Resolving deltas: 100% (20485/20485), done.
Fetching gem metadata from http://rubygems.org/........
Fetching gem metadata from http://rubygems.org/..
Installing rake (10.0.3)
Installing builder (3.2.0)
Installing ffi (1.4.0) with native extensions
Installing childprocess (0.3.9)
Installing diff-lcs (1.1.3)
Installing erubis (2.7.0)
Installing excon (0.19.5)
Installing formatador (0.2.4)
Installing mime-types (1.21)
Installing multi_json (1.6.1)
Installing net-ssh (2.2.2)
Installing net-scp (1.0.4)
Installing nokogiri (1.5.6) with native extensions
Installing ruby-hmac (0.4.0)
Installing fog (1.9.0)
Installing i18n (0.6.4)
Installing json (1.7.7) with native extensions
Installing log4r (1.1.10)
Installing rspec-core (2.12.2)
Installing rspec-expectations (2.12.1)
Installing rspec-mocks (2.12.2)
Using vagrant (1.1.0.dev) from git://github.com/mitchellh/vagrant.git (at
master)
Using vagrant-openstack (0.0.2) from source at .
Using bundler (1.2.1)
Your bundle is complete! It was installed into ./bundles

-> cat Vagrantfile
require 'vagrant-openstack'

Vagrant.configure("2") do |config|

  config.vm.box = "dummy"

  config.vm.provider :openstack do |os|
    os.url = ENV['OS_AUTH_URL']
    os.tenant = "csa"
    os.user = ENV['USER']
    os.password = ENV['OS_PASSWORD']

    os.flavor = "1"
    os.keypair = ENV['USER']
    os.image = "bd23e7f2-9434-410c-ab9a-09a3b11ed844"

    #os.floating_ip = "10.0.25.227"

    os.name = ENV['USER'] + "_test"
    os.ssh_username = ENV['USER']
    os.ssh_private_key = ENV['HOME'] + "/.ssh/id_rsa"
  end

end

-> bundle exec vagrant up --provider=openstack
The plugin "vagrant-vbguest" could not be found. Please make sure that it is
properly installed via `vagrant plugin`. Note that plugins made for
Vagrant 1.0.x are not compatible with 1.1+ and this error will likely
continue to show when you use `plugin install` with a 1.0.x plugin.

You appear to be running Vagrant outside of the official installers.
Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.
Bringing machine 'default' up with 'openstack' provider...
/Users/me/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/uri/common.rb:176:in
`split': bad URI(is not URI?):  (URI::InvalidURIError)
from
/Users/me/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/uri/common.rb:211:in
`parse'
from
/Users/me/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/uri/common.rb:747:in
`parse'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/gems/fog-1.9.0/lib/fog/openstack/compute.rb:394:in
`authenticate'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/gems/fog-1.9.0/lib/fog/openstack/compute.rb:304:in
`initialize'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/gems/fog-1.9.0/lib/fog/core/service.rb:68:in
`new'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/gems/fog-1.9.0/lib/fog/core/service.rb:68:in
`new'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/gems/fog-1.9.0/lib/fog/compute.rb:64:in
`new'
from
/Users/me/git/vagrant-openstack2/lib/vagrant-openstack/action/connect.rb:25:in
`call'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/action/warden.rb:34:in
`call'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/action/builder.rb:109:in
`call'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/action/runner.rb:61:in
`block in run'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/util/busy.rb:19:in
`busy'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/action/runner.rb:61:in
`run'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/machine.rb:129:in
`action'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/plugins/commands/up/command.rb:37:in
`block in execute'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/plugin/v2/command.rb:182:in
`block in with_target_vms'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/plugin/v2/command.rb:180:in
`each'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/plugin/v2/command.rb:180:in
`with_target_vms'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/plugins/commands/up/command.rb:32:in
`execute'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/cli.rb:46:in
`execute'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/environment.rb:406:in
`cli'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/bin/vagrant:60:in
`<top (required)>'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bin/vagrant:23:in
`load'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bin/vagrant:23:in
`<main>'-> git status
# On branch master
nothing to commit (working directory clean)

-> git remote -v
origin https://github.com/FlaPer87/vagrant-openstack (fetch)
origin https://github.com/FlaPer87/vagrant-openstack (push)

-> bundle install --path bundles
Fetching git://github.com/mitchellh/vagrant.git
remote: Counting objects: 30738, done.
remote: Compressing objects: 100% (10408/10408), done.
remote: Total 30738 (delta 20485), reused 29481 (delta 19324)
Receiving objects: 100% (30738/30738), 4.21 MiB | 848 KiB/s, done.
Resolving deltas: 100% (20485/20485), done.
Fetching gem metadata from http://rubygems.org/........
Fetching gem metadata from http://rubygems.org/..
Installing rake (10.0.3)
Installing builder (3.2.0)
Installing ffi (1.4.0) with native extensions
Installing childprocess (0.3.9)
Installing diff-lcs (1.1.3)
Installing erubis (2.7.0)
Installing excon (0.19.5)
Installing formatador (0.2.4)
Installing mime-types (1.21)
Installing multi_json (1.6.1)
Installing net-ssh (2.2.2)
Installing net-scp (1.0.4)
Installing nokogiri (1.5.6) with native extensions
Installing ruby-hmac (0.4.0)
Installing fog (1.9.0)
Installing i18n (0.6.4)
Installing json (1.7.7) with native extensions
Installing log4r (1.1.10)
Installing rspec-core (2.12.2)
Installing rspec-expectations (2.12.1)
Installing rspec-mocks (2.12.2)
Using vagrant (1.1.0.dev) from git://github.com/mitchellh/vagrant.git (at
master)
Using vagrant-openstack (0.0.2) from source at .
Using bundler (1.2.1)
Your bundle is complete! It was installed into ./bundles

-> cat Vagrantfile
require 'vagrant-openstack'

Vagrant.configure("2") do |config|

  config.vm.box = "dummy"

  config.vm.provider :openstack do |os|
    os.url = ENV['OS_AUTH_URL']
    os.tenant = "csa"
    os.user = ENV['USER']
    os.password = ENV['OS_PASSWORD']

    os.flavor = "1"
    os.keypair = ENV['USER']
    os.image = "bd23e7f2-9434-410c-ab9a-09a3b11ed844"

    #os.floating_ip = "10.0.25.227"

    os.name = ENV['USER'] + "_test"
    os.ssh_username = ENV['USER']
    os.ssh_private_key = ENV['HOME'] + "/.ssh/id_rsa"
  end

end

-> bundle exec vagrant up --provider=openstack
You appear to be running Vagrant outside of the official installers.
Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.
Bringing machine 'default' up with 'openstack' provider...
/Users/me/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/uri/common.rb:176:in
`split': bad URI(is not URI?):  (URI::InvalidURIError)
from
/Users/me/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/uri/common.rb:211:in
`parse'
from
/Users/me/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/uri/common.rb:747:in
`parse'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/gems/fog-1.9.0/lib/fog/openstack/compute.rb:394:in
`authenticate'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/gems/fog-1.9.0/lib/fog/openstack/compute.rb:304:in
`initialize'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/gems/fog-1.9.0/lib/fog/core/service.rb:68:in
`new'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/gems/fog-1.9.0/lib/fog/core/service.rb:68:in
`new'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/gems/fog-1.9.0/lib/fog/compute.rb:64:in
`new'
from
/Users/me/git/vagrant-openstack2/lib/vagrant-openstack/action/connect.rb:25:in
`call'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/action/warden.rb:34:in
`call'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/action/builder.rb:109:in
`call'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/action/runner.rb:61:in
`block in run'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/util/busy.rb:19:in
`busy'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/action/runner.rb:61:in
`run'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/machine.rb:129:in
`action'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/plugins/commands/up/command.rb:37:in
`block in execute'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/plugin/v2/command.rb:182:in
`block in with_target_vms'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/plugin/v2/command.rb:180:in
`each'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/plugin/v2/command.rb:180:in
`with_target_vms'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/plugins/commands/up/command.rb:32:in
`execute'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/cli.rb:46:in
`execute'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/lib/vagrant/environment.rb:406:in
`cli'
from
/Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bundler/gems/vagrant-cd36088d2f2d/bin/vagrant:60:in
`<top (required)>'
from /Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bin/vagrant:23:in
`load'
from /Users/me/git/vagrant-openstack2/bundles/ruby/1.9.1/bin/vagrant:23:in
`<main>'
flaper87 commented 11 years ago

Hey,

What dos your auth url look like? (perhaps there should be a check on it). It is completely failing at parsing that url.

mcallaway commented 11 years ago

echo $OS_AUTH_URL http://blade9-2-3.gsc.wustl.edu:5000/v2.0

flaper87 commented 11 years ago

mmh, this looks really weird to me. (btw, I think you're missing /tokens at the end of that url).

Are you still having this issue? I'm trying to reproduce it!

mcallaway commented 11 years ago

Sorry to take so long to reply. It's now working for me. Thank you!

When will you make a new release so that "vagrant plugin install" works?

bcwaldon commented 11 years ago

I've been moving away from vagrant recently, so I'm not the right one to answer the plugin question. @FlaPer87 what do you think?

flaper87 commented 11 years ago

I did some tests the other day (new bundle built from the code in master) and everything seemed to work. I just found an issue (net-scp conflict) but I think that's just related to old vagrant stuff are still present in my env. I'll try again today and if everything works I'll release a 0.3.

Though, any feedback, missing feature you wanna see (I know there are, just want to put some priorities) is very welcome. :)

mcallaway commented 11 years ago

Any updates on a 0.3 release? I'm making progress with openstack and would love to use this plugin without having a special git checkout and bundle install. I'd like it to just be a vagrant plugin install.

bcwaldon commented 11 years ago

@FlaPer87 you're on point here - any news?

flaper87 commented 11 years ago

vagrant-openstack 0.0.4 released. It should be now possible to install it using:

$ vagrant plugin install vagrant-openstack