adrahon / vagrant-kvm

This project is dead, please use vagrant-libvirt instead! A Vagrant 1.4+ plugin that adds a KVM provider to Vagrant, allowing Vagrant to control and provision KVM/QEMU VM.
MIT License
366 stars 60 forks source link

Undefined local variable or method `random_mac' #258

Closed rosstimson closed 9 years ago

rosstimson commented 9 years ago

I cannot vagrant up with the kvm plugin on Fedora 20. My Vagrantfile is the default/generated one with the only the following line uncommented:

config.vm.network "private_network", ip: "192.168.33.10"

The full error I get and a little about my environment is below, please let me know if you need any further details for would like me to do any further troubleshooting steps/tasks.

It's the first time I've attempted to use your plugin so I may be doing something stupid.

% vagrant -v
Vagrant 1.6.5

% vagrant plugin list
vagrant-kvm (0.1.9)
vagrant-login (1.0.1, system)
vagrant-mutate (0.3.1)
vagrant-share (1.1.1, system)
% vagrant up --provider=kvm
Bringing machine 'default' up with 'kvm' provider...
==> default: Importing base box 'freebsd10'...
==> default: Assigning a new mac address to the VM.
==> default: Preparing network interfaces based on configuration...
==> default: Destroying VM and associated drives...
/home/rosstimson/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/network.rb:78:in `add_private_network_host': undefined local variable or method `random_mac' for #<VagrantPlugins::ProviderKvm::Action::Network:0x00000002fe6620> (NameError)
    from /home/rosstimson/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/network.rb:50:in `block in create_or_update_private_network!'
    from /home/rosstimson/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/network.rb:47:in `each'
    from /home/rosstimson/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/network.rb:47:in `each_with_index'
    from /home/rosstimson/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/network.rb:47:in `create_or_update_private_network!'
    from /home/rosstimson/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/network.rb:20:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /home/rosstimson/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/new_mac_address.rb:14:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /home/rosstimson/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/import.rb:106:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /home/rosstimson/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/init_storage_pool.rb:17:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /home/rosstimson/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/customize.rb:39:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /home/rosstimson/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/set_name.rb:49:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /home/rosstimson/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/init_storage_pool.rb:17:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /home/rosstimson/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/check_kvm.rb:18:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:196:in `action_raw'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:173:in `block in action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:474:in `lock'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:161:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:161:in `action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'
adrahon commented 9 years ago

Oops! It's a regression, the change to MAC address management has broken private networks. Thanks for the report, I'll correct that.

DorianGray commented 9 years ago

I'm stuck on 1.7 until this is resolved. Bumping for criticality!

adrahon commented 9 years ago

I'm on it, just being very slow

svanschalkwyk commented 9 years ago

Hi. Same thing. Just commenting to get a post back when fixed. Thanks.

adrahon commented 9 years ago

This is fixed by https://github.com/adrahon/vagrant-kvm/commit/fea85417f11260728f465fb46def1b164b35119a and a few previous commits. Please test.

DorianGray commented 9 years ago

vagrant-kvm/action/network.rb:84:in add_private_network_host': undefined methodsplit' for nil:NilClass (NoMethodError) from /home/dditthardt/.vagrant.d/gems/gems/vagrant-kvm-0.2.0/lib/vagrant-kvm/action/network.rb:50:in block in create_or_update_private_network!' from /home/dditthardt/.vagrant.d/gems/gems/vagrant-kvm-0.2.0/lib/vagrant-kvm/action/network.rb:47:ineach' from /home/dditthardt/.vagrant.d/gems/gems/vagrant-kvm-0.2.0/lib/vagrant-kvm/action/network.rb:47:in each_with_index' from /home/dditthardt/.vagrant.d/gems/gems/vagrant-kvm-0.2.0/lib/vagrant-kvm/action/network.rb:47:increate_or_update_private_network!' from /home/dditthardt/.vagrant.d/gems/gems/vagrant-kvm-0.2.0/lib/vagrant-kvm/action/network.rb:20:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:incall' from /home/dditthardt/.vagrant.d/gems/gems/vagrant-kvm-0.2.0/lib/vagrant-kvm/action/import.rb:106:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:incall' from /home/dditthardt/.vagrant.d/gems/gems/vagrant-kvm-0.2.0/lib/vagrant-kvm/action/init_storage_pool.rb:17:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:incall' from /home/dditthardt/.vagrant.d/gems/gems/vagrant-kvm-0.2.0/lib/vagrant-kvm/action/customize.rb:39:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:incall' from /home/dditthardt/.vagrant.d/gems/gems/vagrant-kvm-0.2.0/lib/vagrant-kvm/action/set_name.rb:49:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:incall' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/handle_box.rb:56:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:incall' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:95:in block in finalize_action' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:incall' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builder.rb:116:incall' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in block in run' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/util/busy.rb:19:inbusy' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in run' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/call.rb:53:incall' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in call' from /home/dditthardt/.vagrant.d/gems/gems/vagrant-kvm-0.2.0/lib/vagrant-kvm/action/init_storage_pool.rb:17:incall' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/config_validate.rb:25:incall' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in call' from /home/dditthardt/.vagrant.d/gems/gems/vagrant-kvm-0.2.0/lib/vagrant-kvm/action/check_kvm.rb:18:incall' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builder.rb:116:incall' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in block in run' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/util/busy.rb:19:inbusy' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in run' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:196:inaction_raw' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:173:in block in action' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:474:inlock' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:161:in call' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:161:inaction' from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'

DorianGray commented 9 years ago

@adrahon Different issue, but same block of code and caused by recent changes meant to fix this.

adrahon commented 9 years ago

@DorianGray could you give a few more details about your distro, environment, ...

schkovich commented 9 years ago

bumped into the same problem. fea8541 did fix the problem. $ vagrant -v Vagrant 1.6.5 $ vagrant plugin list vagrant-kvm (0.1.9) vagrant-login (1.0.1, system) vagrant-mutate (0.3.1) vagrant-share (1.1.2, system) ubuntu trusty host and guest apparmor fix applied

jochumdev commented 9 years ago

Having the same problem here: $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.10 Release: 14.10 Codename: utopic

$ uname -a Linux ThinkPad-T410 3.16.0-28-generic #38-Ubuntu SMP Sat Dec 13 16:13:28 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

$ ruby -v ruby 2.1.2p95 (2014-05-08) [x86_64-linux-gnu]

$ vagrant -v Vagrant 1.7.1

$ vagrant plugin list vagrant-kvm (0.1.9) vagrant-lxc (1.0.1) vagrant-mutate (0.3.1) vagrant-share (1.1.4, system)

Ubuntu utopic host - apparmor fix not done.

First i followed this Guide

Then i did this to fix it:


vagrant plugin uninstall vagrant-kvm
pushd .
mkdir -p ~/Software
cd ~/Software
git clone https://github.com/adrahon/vagrant-kvm.git
cd vagrant-kvm
./install.rb   # Took ages.
popd
**Apparmor fix:**

sudo apt-get install apparmor-utils
sudo aa-complain /usr/lib/libvirt/virt-aa-helper
tzach commented 9 years ago

Thanks @pcdummy had the same problem with vagrant-kvm (0.1.9) installing from git clone solved it

acornejo commented 8 years ago

installing through git clone works, but it seems that if you install vagrant-kvm through vagrant (i.e. plugin install), then you get an older version where this bug is still present.