xdp-tutorial icon indicating copy to clipboard operation
xdp-tutorial copied to clipboard

Add vagrant VM support and XDP_USE_NEED_WAKEUP for advanced03

Open chaudron opened this issue 6 years ago • 16 comments

vagrant: add vagrant support to build latest bpf-next in VM advanced03: add support for the XDP_USE_NEED_WAKEUP API

chaudron avatar Sep 03 '19 11:09 chaudron

Why fedora 29 instead of 30? Also, what would it take to turn this into a test runnable from CI? We'd probably need a 'make selftest' kind of target, but what else?

tohojo avatar Sep 03 '19 11:09 tohojo

Why fedora 29 instead of 30?

I tried Fedora30 but was giving me some odd errors on kernel install. Rather than spending too much time troubleshooting, I reverted to 29 which I know to be working.

Also, what would it take to turn this into a test runnable from CI? We'd probably need a 'make selftest' kind of target, but what else?

Good question, I have no real experience with CI integration with Vagrant (from GitHub).

chaudron avatar Sep 03 '19 12:09 chaudron

I'll admit upfront: I have zero experience with "vagrant".

Could you explain what is the advantage of using vagrant?

Is this only to get a VM installed? Or it is also an advantage for CI testing?

I do love the idea of adding make target for: 'make selftests'

netoptimizer avatar Sep 03 '19 12:09 netoptimizer

Could you explain what is the advantage of using vagrant?

Vagrant just installs a VM from a base image. This is useful if you want to test your code in a clean environment. If you have the latest includes copied, for example, the build will not fail.

It also helps for people willing to try out the tutorial but don't want to mess with the kernel on their machine.

chaudron avatar Sep 03 '19 12:09 chaudron

Eelco Chaudron [email protected] writes:

Could you explain what is the advantage of using vagrant?

Vagrant just installs a VM from a base image. This is useful if you want to test your code in a clean environment. If you have the latest includes copied, for example, the build will not fail.

Does it also support running the VM and executing a command inside it? That is basically what we need to hook this up to CI...

tohojo avatar Sep 03 '19 13:09 tohojo

Does it also support running the VM and executing a command inside it? That is basically what we need to hook this up to CI...

Yes you can, for example:

vagrant ssh -c "cd xdp-turorial/advanced03-AF_XDP && make"

chaudron avatar Sep 03 '19 13:09 chaudron

Eelco Chaudron [email protected] writes:

Does it also support running the VM and executing a command inside it? That is basically what we need to hook this up to CI...

Yes you can, for example:

vagrant ssh -c "cd xdp-turorial/advanced03-AF_XDP && make"

Right, so I tried actually running this, and it seems the vagrant plugin installer is somewhat broken:

vagrant plugin install vagrant-reload
Installing the 'vagrant-reload' plugin. This can take a few minutes... Fetching vagrant-reload-0.0.1.gem Fetching formatador-0.2.5.gem Fetching excon-0.66.0.gem Fetching mini_portile2-2.4.0.gem Fetching nokogiri-1.10.4.gem Building native extensions. This could take a while... Fetching fog-xml-0.1.3.gem Fetching fog-json-1.2.0.gem Traceback (most recent call last): 21: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/bin/vagrant:182:in <main>' 20: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/lib/vagrant/environment.rb:290:in cli' 19: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/lib/vagrant/cli.rb:66:in execute' 18: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/plugins/commands/plugin/command/root.rb:66:in execute' 17: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/plugins/commands/plugin/command/install.rb:69:in execute' 16: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/plugins/commands/plugin/command/install.rb:69:in each' 15: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/plugins/commands/plugin/command/install.rb:70:in block in execute' 14: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/plugins/commands/plugin/command/base.rb:14:in action' 13: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/lib/vagrant/action/runner.rb:102:in run' 12: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/lib/vagrant/util/busy.rb:19:in busy' 11: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/lib/vagrant/action/runner.rb:102:in block in run' 10: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/lib/vagrant/action/builder.rb:116:in call' 9: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/lib/vagrant/action/warden.rb:50:in call' 8: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/lib/vagrant/action/builtin/before_trigger.rb:23:in call' 7: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/lib/vagrant/action/warden.rb:50:in call' 6: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/plugins/commands/plugin/action/install_gem.rb:30:in call' 5: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/lib/vagrant/plugin/manager.rb:167:in install_plugin' 4: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/lib/vagrant/bundler.rb:242:in clean' 3: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/lib/vagrant/bundler.rb:242:in each' 2: from /opt/vagrant/embedded/gems/gems/vagrant-2.2.5/lib/vagrant/bundler.rb:251:in block in clean' 1: from /usr/lib/ruby/2.6.0/rubygems/uninstaller.rb:162:in uninstall_gem' /usr/lib/ruby/2.6.0/rubygems/uninstaller.rb:264:in remove': uninitialized constant Gem::RDoc (NameError)

tohojo avatar Sep 03 '19 14:09 tohojo

What distro are you using, works on RHEL7. Some distributions have the vagrant modules as packages.

chaudron avatar Sep 11 '19 06:09 chaudron

Eelco Chaudron [email protected] writes:

What distro are you using, works on RHEL7. Some distributions have the vagrant modules as packages.

I'm on Arch, which doesn't have the reload package, sadly... :/

tohojo avatar Sep 11 '19 12:09 tohojo

@tohojo any reason for not merging this besides your distro having issues with vagrant? Not showing this on RHEL/Fedora.

chaudron avatar Sep 25 '19 13:09 chaudron

Eelco Chaudron [email protected] writes:

@tohojo any reason for not merging this besides your distro having issues with vagrant? Not showing this on RHEL/Fedora.

Hmm, not really, other than the fact that I couldn't really test it ;)

I'll give it another shot and see if I can't persuade the Vagrant plugin installer to do its thing...

tohojo avatar Sep 26 '19 09:09 tohojo

No dice; the Arch packaging for Vagrant plugins appears to be completely broken, and I can't get the vagrant plugin installer itself to do anything other than spit out errors.

Can you make this work without the 'reload' plugin?

tohojo avatar Sep 26 '19 09:09 tohojo

Can you make this work without the 'reload' plugin?

I need to restart the machine after the kernel build, did not find a way to do this without a plugin.

chaudron avatar Sep 26 '19 09:09 chaudron

Eelco Chaudron [email protected] writes:

Can you make this work without the 'reload' plugin?

I need to restart the machine after the kernel build, did not find a way to do this without a plugin.

Why can't the kernel build not just execute a 'reboot' inside the vm?

tohojo avatar Sep 26 '19 10:09 tohojo

Why can't the kernel build not just execute a 'reboot' inside the vm?

As vagrant is doing the provisioning, just calling reboot will fail the provisioning step.

chaudron avatar Sep 26 '19 12:09 chaudron

Eelco Chaudron [email protected] writes:

Why can't the kernel build not just execute a 'reboot' inside the vm?

As vagrant is doing the provisioning, just calling reboot will fail the provisioning step.

Hmm, bugger.

Well, I guess I'll either have to find a Fedora or Debian install to try this out on, or we'll just have to merge it without independent testing.

@netoptimizer, have you tried running vagrant script?

tohojo avatar Sep 30 '19 07:09 tohojo