24
Vagrant plugin development Parallels Provider for Vagrant @legal90 @legal_90 Mikhail Zholobov HASHICONF 2015 Portland, OR September 28-29

Vagrant Plugin development

Embed Size (px)

Citation preview

Vagrant plugin

developmentParallels Provider for Vagrant

@legal90

@legal_90

Mikhail Zholobov HASHICONF 2015

Portland, OR

September 28-29

@legal90

Who am I?

Mikhail Zholobov

Automation Engineer at Parallels

@legal_90

Parallels Desktop for Mac

Desktop virtualization system by Parallels

http://www.parallels.com/desktop/

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

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

• 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

Vagrant Plugin Model

Vagrant Plugin Model“vagrant up” example

Get command plugin

Vagrant Plugin Model“vagrant up” example

Get config plugins

Vagrant Plugin Model“vagrant up” example

Get provider plugin

Vagrant Plugin Model“vagrant up” example

Get guest capability

Vagrant Plugin Model“vagrant up” example

Get provisioner plugin

Vagrant Plugin Model“vagrant up” example

Vagrant Plugin Model

Host

Guest

Provider

Provisioner

Push

Config

Host Capability

Guest Capability

Provider Capability Synced Folder

Command

Action Hook

Plugin API components (v2)

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

Host

Guest

Provider

Provisioner

Push

Config

Host Capability

Guest Capability

Provider Capability Synced Folder

Command

Action Hook

Implemented Components

Vagrant Parallels Provider

“Provider” component

• Driver is bridge to Parallels Desktop CLI

• Actions - steps for “up”, “halt”, “destroy”, etc.

• Box format - there is a prepared “*.pvm” image

Vagrant Parallels Provider

“Provider Capability” component

• Interaction with other plugins or Vagrant core:

• `public_address` for Vagrant Share

• `nic_mac_addresses` for Windows guests

Vagrant Parallels Provider

• 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

“Guest Capability” component

• Extensions for guests:

• How to mount Parallels Shared Folders

• How to install Parallels Tools

Vagrant Parallels Provider

“Config” component

• All provider-specific options for Vagrantfile

• Feature “Use Linked Clone”

• Feature “Parallels Tools Auto-update”

Vagrant Parallels Provider

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

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