Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confused about userdata #79

Open
myoung34 opened this issue Apr 28, 2015 · 5 comments
Open

Confused about userdata #79

myoung34 opened this issue Apr 28, 2015 · 5 comments

Comments

@myoung34
Copy link

I'm scratching my head with an issue, perhaps you can save me that headache.

I maintain the vagrant-ovirt3 plugin, and I'm looking to actually utilize userdata. The documentation I took over from the upstream project is lacking.

My vagrantfile contains:

ovirt.user_data =<<-EOF
  runcmd:
    - yum install -y ntpdate samba-winbind krb5-workstation samba-winbind-krb5-locator
EOF

that gets set in lib/vagrant-ovirt3/action/create_vm.rb as:

user_data = config.user_data ?
  Base64::encode64(config.user_data) :
    nil

and evenually

           attr = {
               :name     => name,
               :cores    => cpus,
               :memory   => memory_size*1024,
               :cluster  => cluster.id,
               :template => template.id,
               :display  => {:type => console },
               :user_data => user_data,
           }

           begin
             server = env[:ovirt_compute].servers.create(attr)
...snip...

My locales gets no error message from this, so pulling it out of the begin/rescue i get a pretty ugly stacktrace:

Marc-win8:example_box $ vagrant up --provider=ovirt3
Bringing machine 'default' up with 'ovirt3' provider...
==> default: Creating VM with the following settings...
==> default:  -- Name:          example_box_1430229427.903915
==> default:  -- Cpus:          1
==> default:  -- Memory:        512M
==> default:  -- Template:      vagrant-centos65
==> default:  -- Version:       0
==> default:  -- Datacenter:    local_dc
==> default:  -- Cluster:       local_cluster
==> default:  -- Console:       spice
==> default:  -- User data:
==> default:     runcmd:
==> default:      - yum install -y ntpdate samba-winbind krb5-workstation samba-winbind-krb5-locator
==> default: An error occured. Recovering..
==> default: VM is not created. Please run `vagrant up` first.
C:/Users/myoung/.vagrant.d/gems/gems/rbovirt-0.0.35/lib/rbovirt.rb:197:in `handle_fault': OVIRT::OvirtException
        from C:/Users/myoung/.vagrant.d/gems/gems/rbovirt-0.0.35/lib/rbovirt.rb:124:in `rescue in http_post'
        from C:/Users/myoung/.vagrant.d/gems/gems/rbovirt-0.0.35/lib/rbovirt.rb:119:in `http_post'
        from C:/Users/myoung/.vagrant.d/gems/gems/rbovirt-0.0.35/lib/client/vm_api.rb:34:in `create_vm'
        from C:/Users/myoung/.vagrant.d/gems/gems/fog-1.29.0/lib/fog/ovirt/requests/compute/create_vm.rb:6:in `create_vm'
        from C:/Users/myoung/.vagrant.d/gems/gems/fog-1.29.0/lib/fog/ovirt/models/compute/server.rb:157:in `save'
        from C:/Users/myoung/.vagrant.d/gems/gems/fog-core-1.30.0/lib/fog/core/collection.rb:51:in `create'
        from C:/Users/myoung/.vagrant.d/gems/gems/vagrant-ovirt3-1.4.0/lib/vagrant-ovirt3/action/create_vm.rb:89:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
        from C:/Users/myoung/.vagrant.d/gems/gems/vagrant-ovirt3-1.4.0/lib/vagrant-ovirt3/action/set_name_of_domain.rb:24:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builder.rb:116:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `block in run'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/util/busy.rb:19:in `busy'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `run'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/call.rb:53:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
        from C:/Users/myoung/.vagrant.d/gems/gems/vagrant-ovirt3-1.4.0/lib/vagrant-ovirt3/action/connect_ovirt.rb:25:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builder.rb:116:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `block in run'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/util/busy.rb:19:in `busy'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `run'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:214:in `action_raw'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:191:in `block in action'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:516:in `lock'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:178:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:178:in `action'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'

I'm really drawing a blank as to what rbovirt expects for its user_data.
Cloud-init is all YAML, If i use the oVirt UI and paste in the YAML, things are good.
Is my expectation wrong?

@myoung34
Copy link
Author

also, the fork is here

@karmab
Copy link
Contributor

karmab commented May 6, 2015

@myoung34 i think rbovirt rather expects xml

@myoung34
Copy link
Author

myoung34 commented May 6, 2015

@karmab looking at the code, that makes sense since the user_data stuff is wrapped in a Nokogiri call.
I really really wish I could find some usage on it, however.

The only thing i have to go off of is a test:

  it "test_should_start_with_cloudinit" do
    hostname = "host-"+Time.now.to_i.to_s
    user_data={ :hostname => hostname }
    @client.vm_start_with_cloudinit(@vm.id, user_data)
    while [email protected](@vm.id).running? do
    end
    @client.vm_action(@vm.id, :shutdown)
  end

which gives me nada on usage.
@abenari any tips?

@karmab
Copy link
Contributor

karmab commented May 6, 2015

@myoung34 i wrote the start_with_cloud_init code so i guess i can help. join me at #vagrant on freenode?

@myoung34
Copy link
Author

myoung34 commented May 6, 2015

I'm on as c2074dfa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants