frapposelli / vagrant-vcenter

A Vagrant provider for VMware vCenter®
MIT License
107 stars 36 forks source link

`vcenter_check_inventory': undefined method `serviceInstance' #23

Open tehranian opened 10 years ago

tehranian commented 10 years ago

Hi @frapposelli ,

I get the following error when uploading a new box for the first time. I am able to work-around by running the same vagrant up command a second time. The upload starts & completes without issue on the second invocation.

==> default: Successfully added box 'vw-21767-516' (v0) for 'vmware_ovf'!
/Users/tehranian/.vagrant.d/gems/gems/vagrant-vcenter-0.3.2/lib/vagrant-vcenter/action/inventory_check.rb:94:in `vcenter_check_inventory': undefined method `serviceInstance' for nil:NilClass (NoMethodError)
    from /Users/tehranian/.vagrant.d/gems/gems/vagrant-vcenter-0.3.2/lib/vagrant-vcenter/action/inventory_check.rb:21:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/tehranian/.vagrant.d/gems/gems/vagrant-vcenter-0.3.2/lib/vagrant-vcenter/action/connect_vcenter.rb:32:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:196:in `action_raw'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:173:in `block in action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:474:in `lock'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:161:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:161:in `action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'
tsugliani commented 10 years ago

@tehranian how long took the upload ? I suppose the main connection handle probably timeouted.

I found this https://github.com/rlane/rbvmomi/blob/master/lib/rbvmomi/trivial_soap.rb

  @http.read_timeout = 1000000

That's around 16 minutes

tehranian commented 10 years ago

Hi @tsugliani ,

The command that fails with the above stack trace fails almost immediately.

The upload on the second invocation takes only a minute or two. I'm on the same 1Gb LAN as my vCenter server.

tsugliani commented 10 years ago

@tehranian ohhh ok, from your explanation I thought it was like after a box upload that the issue was happening, as you said the "when uploading a box for the first time".

I may give it a try this week, never tested this plugin yet, only the vagrant-vcloud one, but I'm sure @frapposelli will look into it too :)

nilic commented 10 years ago

Got the same error using Vagrantfile from Dock Your Container on VMware With Vagrant

[root@splunktest00 docker-test]# vagrant up
Bringing machine 'docker-test' up with 'vcenter' provider...
==> docker-test: Box 'gosddc/trusty64' could not be found. Attempting to find and install...
    docker-test: Box Provider: vmware_ovf, vcloud, vcenter
    docker-test: Box Version: >= 0
==> docker-test: Loading metadata for box 'gosddc/trusty64'
    docker-test: URL: https://vagrantcloud.com/gosddc/trusty64
==> docker-test: Adding box 'gosddc/trusty64' (v1.1.0) for provider: vmware_ovf
    docker-test: Downloading: https://vagrantcloud.com/gosddc/boxes/trusty64/versions/4/providers/vmware_ovf.box
==> docker-test: Successfully added box 'gosddc/trusty64' (v1.1.0) for 'vmware_ovf'!
/root/.vagrant.d/gems/gems/vagrant-vcenter-0.3.2/lib/vagrant-vcenter/action/inventory_check.rb:94:in `vcenter_check_inventory': undefined method `serviceInstance' for nil:NilClass (NoMethodError)
    from /root/.vagrant.d/gems/gems/vagrant-vcenter-0.3.2/lib/vagrant-vcenter/action/inventory_check.rb:21:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
    from /root/.vagrant.d/gems/gems/vagrant-vcenter-0.3.2/lib/vagrant-vcenter/action/connect_vcenter.rb:32:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:196:in `action_raw'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:173:in `block in action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:434:in `lock'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:161:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:161:in `action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'
[root@splunktest00 docker-test]# vagrant up
Bringing machine 'docker-test' up with 'vcenter' provider...
==> docker-test: Uploading [gosddc-trusty64]...
==> docker-test: Adding [gosddc-trusty64]
2014-11-17 15:02:41 +0100: networks: nat = XXX
2014-11-17 15:02:41 +0100: Uploading OVF to X.X.X.X...
DEBUG: Timeout: 300
Iteration 1: Trying to get host's IP address ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  785M  100  785M    0     0  12.8M      0  0:01:01  0:01:01 --:--:-- 17.0M
Iteration 1: Trying to access nfcLease.info.entity ...
HttpNfcLeaseComplete succeeded
==> docker-test: Creating VM...
==> docker-test: Powering on VM...
==> docker-test: Rsyncing folder: /docker-test/ => /vagrant
==> docker-test: Running provisioner: docker...
    docker-test: Installing Docker (latest) onto machine...
    docker-test: Configuring Docker to autostart containers...
==> docker-test: Starting Docker containers...
==> docker-test: -- Container: tutum/wordpress
[root@splunktest00 docker-test]# 
tsugliani commented 10 years ago

Hi @tehranian and @nilic

Can one of you try the following fix ? In $HOME/.vagrant.d/gems/gems/vagrant-vcenter-0.3.2/lib/vagrant-vcenter/action.rb

screenshot 2014-11-17 16 44 01

Basically modifying action_up as following:

      def self.action_up
        Vagrant::Action::Builder.new.tap do |b|
          b.use ConfigValidate
          b.use Call, IsCreated do |env, b2|
            b2.use HandleBox unless env[:result]
          end
          b.use ConnectvCenter
          b.use InventoryCheck
          b.use Call, IsCreated do |env, b2|
            b2.use BuildVM unless env[:result]
          end
          b.use action_start
        end
      end

I didn't have much time to test, but would just like to see if it has a positive behavior.

Thanks in advance,

nilic commented 10 years ago

Solves the issue for me

vladistan commented 9 years ago

I still see the issue. Running version 0.3.2

frapposelli commented 9 years ago

@vladistan you have to check out the repo and build from the develop branch as the fix that @tsugliani applied is not merged on master yet.

vladistan commented 9 years ago

Thanks any plans get another release soon. Looks like this project is on hold, there hasn't been any activity since November.

frapposelli commented 9 years ago

The plan is to continue working on it, but work commitments are taking precedence right now.