Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Vagrant Plugin Development: Parallels Provider for Vagrant

Vagrant Plugin Development: Parallels Provider for Vagrant

This talk will discuss the development process of Vagrant plugins. At Parallels we are maintaining our own Vagrant "provider", which is the plugin allowing to use Vagrant with our virtualization product, Parallels Desktop for Mac.

In talking about plugin development, I will use the Parallels provider as an example and explore these general aspects:

* Plugin model in Vagrant. Short introduction to plugin types and API.
* Creation of Vagrant provider. How we have implemented most of provider features.
* Plugin testing. Unit and acceptance tests, "vagrant-spec" usage.
* Release stage.

In the end I will share our experiences with Vagrant in our company.

Mikhail Zholobov

September 29, 2015
Tweet

More Decks by Mikhail Zholobov

Other Decks in Programming

Transcript

  1. Why am I here? • Explore how Vagrant plugin model

    is designed • Share our experience with Vagrant plugin development • Tell how we’ve created the Parallels provider for Vagrant
  2. On the Inside of Vagrant • Vagrant world is plugin-centric

    • Most of basic features are implemented via built-in plugins • Internal and external plugins uses the same API
  3. • vagrant-aws • vagrant-digitalocean • vagrant-google • vagrant-libvirt • vagrant-lxc

    • vagrant-openstack • vagrant-parallels • vagrant-rackspace • vagrant-omnibus • vagrant-fabric • vagrant-berkshelf • vagrant-librarian-chef • vagrant-librarian-puppet • vagrant-puppet-install • vagrant-cachier • vagrant-serverspec • vagrant-foodshow • vagrant-hostsupdater • vagrant-reload • vagrant-vbguest • oh-my-vagrant • sahara • landrush • <…> Vagrant Community Plugins
  4. Vagrant Plugin Model Built-In Plugins Plugin Registry Vagrant “Core” Built-In

    Plugins Built-In Plugins Built-In Plugins Built-In Plugins External Plugins
  5. Vagrant Plugin Model Run provider action Run command Plugin Registry

    “vagrant up” example Get provider plugin Parse Vagrantfile
  6. Vagrant Plugin Model Run provider action Run guest capability Run

    command Plugin Registry “vagrant up” example Get guest capability Parse Vagrantfile
  7. Vagrant Plugin Model Run provider action Run guest capability Run

    command Run provisioner Plugin Registry “vagrant up” example Get provisioner plugin Parse Vagrantfile
  8. Parse Vagrantfile Vagrant Plugin Model Run provider action Run guest

    capability Run command Run provisioner Plugin Registry “vagrant up” example
  9. Vagrant Plugin Model Host Guest Provider Provisioner Push Config Host

    Capability Guest Capability Provider Capability Synced Folder Command Action Hook Plugin API components (v2)
  10. Before You Start • Requirement - be familiar with Ruby

    • Each plugin is a RubyGem • Run acceptance tests via “vagrant-spec” • Check whether it's already implemented
  11. Host Guest Provider Provisioner Push Config Host Capability Guest Capability

    Provider Capability Synced Folder Command Action Hook Implemented Components Vagrant Parallels Provider
  12. “Provider” component Vagrant Parallels Provider • Driver as a wrapper

    at the top of Parallels Desktop CLI • Box format - there is a prepared “*.pvm” image
  13. “Provider Capability” component • Interaction with other plugins or Vagrant

    core: • `public_address` for Vagrant Share • `nic_mac_addresses` for Windows guests Vagrant Parallels Provider
  14. • Implementation of Parallels Shared Folders • How to configure

    the VM to use Shared Folders • How to mount/unmount them (guest capability call) “Synced Folder” component Vagrant Parallels Provider
  15. “Guest Capability” component • Extensions for guests: • How to

    mount Parallels Shared Folders • How to install Parallels Tools Vagrant Parallels Provider
  16. “Config” component • All provider-specific options for Vagrantfile • Feature

    “Use Linked Clone” • Feature “Parallels Tools Auto-update” Vagrant Parallels Provider
  17. Provider Summary: Vagrant Plugin Development • Provider is the most

    complicated component in Vagrant • Maintenance issues request much time and effort • Don’t forget about acceptance testing
  18. Useful links • Vagrant Parallels Provider: https://github.com/Parallels/vagrant-parallels • Available Vagrant

    Plugins: https://github.com/mitchellh/vagrant/wiki/Available-Vagrant-Plugins • Basics of Vagrant Plugin Development: https://docs.vagrantup.com/v2/plugins/development-basics.html