Merge pull request #41 from miurahr/fix_namespace_collision

fix #40 namespace Libvirt collision with ruby-libvirt library
This commit is contained in:
Дмитрий Василец 2013-08-03 13:23:50 -07:00
commit 4ddd150084
43 changed files with 65 additions and 60 deletions

View File

@ -1,3 +1,8 @@
# 0.0.7
* Fixed namespace collision with ruby-libvirt library which used by
vagrant-kvm provider.(by Hiroshi Miura)
# 0.0.6 (Jul 24, 2013)
* Synced folder via NFS support.

View File

@ -2,7 +2,7 @@ require 'pathname'
require 'vagrant-libvirt/plugin'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
lib_path = Pathname.new(File.expand_path("../vagrant-libvirt", __FILE__))
autoload :Action, lib_path.join("action")
autoload :Errors, lib_path.join("errors")

View File

@ -1,7 +1,7 @@
require 'vagrant/action/builder'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# Include the built-in modules so we can use them as top-level things.
include Vagrant::Action::Builtin

View File

@ -2,7 +2,7 @@ require 'fog'
require 'log4r'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
class ConnectLibvirt
def initialize(app, env)
@ -14,8 +14,8 @@ module VagrantPlugins
# If already connected to libvirt, just use it and don't connect
# again.
if Libvirt.libvirt_connection
env[:libvirt_compute] = Libvirt.libvirt_connection
if ProviderLibvirt.libvirt_connection
env[:libvirt_compute] = ProviderLibvirt.libvirt_connection
return @app.call(env)
end
@ -64,7 +64,7 @@ module VagrantPlugins
raise Errors::FogLibvirtConnectionError,
:error_message => e.message
end
Libvirt.libvirt_connection = env[:libvirt_compute]
ProviderLibvirt.libvirt_connection = env[:libvirt_compute]
@app.call(env)
end

View File

@ -1,11 +1,11 @@
require 'log4r'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
class CreateDomain
include VagrantPlugins::Libvirt::Util::ErbTemplate
include VagrantPlugins::ProviderLibvirt::Util::ErbTemplate
def initialize(app, env)
@logger = Log4r::Logger.new("vagrant_libvirt::action::create_domain")
@ -28,7 +28,7 @@ module VagrantPlugins
@os_type = 'hvm'
# Get path to domain image.
domain_volume = Libvirt::Util::Collection.find_matching(
domain_volume = ProviderLibvirt::Util::Collection.find_matching(
env[:libvirt_compute].volumes.all, "#{@name}.img")
raise Errors::DomainVolumeExists if domain_volume == nil
@domain_volume_path = domain_volume.path

View File

@ -1,14 +1,14 @@
require 'log4r'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# Create a snapshot of base box image. This new snapshot is just new
# cow image with backing storage pointing to base box image. Use this
# image as new domain volume.
class CreateDomainVolume
include VagrantPlugins::Libvirt::Util::ErbTemplate
include VagrantPlugins::ProviderLibvirt::Util::ErbTemplate
def initialize(app, env)
@logger = Log4r::Logger.new("vagrant_libvirt::action::create_domain_volume")
@ -25,12 +25,12 @@ module VagrantPlugins
@name = "#{env[:domain_name]}.img"
# Verify the volume doesn't exist already.
domain_volume = Libvirt::Util::Collection.find_matching(
domain_volume = ProviderLibvirt::Util::Collection.find_matching(
env[:libvirt_compute].volumes.all, @name)
raise Errors::DomainVolumeExists if domain_volume
# Get path to backing image - box volume.
box_volume = Libvirt::Util::Collection.find_matching(
box_volume = ProviderLibvirt::Util::Collection.find_matching(
env[:libvirt_compute].volumes.all, env[:box_volume_name])
@backing_file = box_volume.path

View File

@ -3,14 +3,14 @@ require 'vagrant/util/network_ip'
require 'vagrant/util/scoped_hash_override'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# Create network interfaces for domain, before domain is running.
# Networks for connecting those interfaces should be already prepared.
class CreateNetworkInterfaces
include VagrantPlugins::Libvirt::Util::ErbTemplate
include VagrantPlugins::Libvirt::Util::LibvirtUtil
include VagrantPlugins::ProviderLibvirt::Util::ErbTemplate
include VagrantPlugins::ProviderLibvirt::Util::LibvirtUtil
include Vagrant::Util::NetworkIP
include Vagrant::Util::ScopedHashOverride

View File

@ -4,14 +4,14 @@ require 'vagrant/util/scoped_hash_override'
require 'ipaddr'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# Prepare all networks needed for domain connections.
class CreateNetworks
include Vagrant::Util::NetworkIP
include Vagrant::Util::ScopedHashOverride
include VagrantPlugins::Libvirt::Util::ErbTemplate
include VagrantPlugins::Libvirt::Util::LibvirtUtil
include VagrantPlugins::ProviderLibvirt::Util::ErbTemplate
include VagrantPlugins::ProviderLibvirt::Util::LibvirtUtil
def initialize(app, env)
@logger = Log4r::Logger.new("vagrant_libvirt::action::create_networks")

View File

@ -1,7 +1,7 @@
require 'log4r'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
class DestroyDomain
def initialize(app, env)

View File

@ -2,7 +2,7 @@ require 'log4r'
require 'nokogiri'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# Destroy all networks created for this specific domain. Skip
# removing if network has still active connections.

View File

@ -1,7 +1,7 @@
require 'log4r'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# Halt the domain.
class HaltDomain

View File

@ -1,7 +1,7 @@
require 'log4r'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
class HandleBoxImage
def initialize(app, env)
@ -35,7 +35,7 @@ module VagrantPlugins
env[:box_volume_name] << '_vagrant_box_image.img'
# Don't continue if image already exists in storage pool.
return @app.call(env) if Libvirt::Util::Collection.find_matching(
return @app.call(env) if ProviderLibvirt::Util::Collection.find_matching(
env[:libvirt_compute].volumes.all, env[:box_volume_name])
# Box is not available as a storage pool volume. Create and upload
@ -97,7 +97,7 @@ module VagrantPlugins
stream = env[:libvirt_compute].client.stream
volume.upload(stream, offset=0, length=image_size)
# Exception Libvirt::RetrieveError can be raised if buffer is
# Exception ProviderLibvirt::RetrieveError can be raised if buffer is
# longer than length accepted by API send function.
#
# TODO: How to find out if buffer is too large and what is the

View File

@ -1,10 +1,10 @@
require 'log4r'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
class HandleStoragePool
include VagrantPlugins::Libvirt::Util::ErbTemplate
include VagrantPlugins::ProviderLibvirt::Util::ErbTemplate
def initialize(app, env)
@logger = Log4r::Logger.new("vagrant_libvirt::action::handle_storage_pool")
@ -16,7 +16,7 @@ module VagrantPlugins
config = env[:machine].provider_config
# Check for storage pool, where box image should be created
fog_pool = Libvirt::Util::Collection.find_matching(
fog_pool = ProviderLibvirt::Util::Collection.find_matching(
env[:libvirt_compute].pools.all, config.storage_pool_name)
return @app.call(env) if fog_pool

View File

@ -1,5 +1,5 @@
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# This can be used with "Call" built-in to check if the machine
# is created and branch in the middleware.

View File

@ -1,5 +1,5 @@
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# This can be used with "Call" built-in to check if the machine
# is running and branch in the middleware.

View File

@ -1,5 +1,5 @@
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# This can be used with "Call" built-in to check if the machine
# is suspended and branch in the middleware.

View File

@ -1,5 +1,5 @@
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
class MessageAlreadyCreated
def initialize(app, env)

View File

@ -1,5 +1,5 @@
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
class MessageNotCreated
def initialize(app, env)

View File

@ -1,5 +1,5 @@
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
class MessageNotRunning
def initialize(app, env)

View File

@ -1,5 +1,5 @@
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
class MessageNotSuspended
def initialize(app, env)

View File

@ -1,6 +1,6 @@
require 'nokogiri'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
class PrepareNFSSettings
def initialize(app,env)

View File

@ -1,6 +1,6 @@
require 'yaml'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
class PruneNFSExports

View File

@ -1,7 +1,7 @@
require "log4r"
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# This action reads the SSH info for the machine and puts it into the
# `:machine_ssh_info` key in the environment.

View File

@ -1,7 +1,7 @@
require "log4r"
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# This action reads the state of the machine and puts it in the
# `:machine_state_id` key in the environment.

View File

@ -1,7 +1,7 @@
require 'log4r'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# Resume suspended domain.
class ResumeDomain

View File

@ -1,5 +1,5 @@
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# Setup name for domain and domain volumes.
@ -14,7 +14,7 @@ module VagrantPlugins
env[:domain_name] << "_#{Time.now.to_i}"
# Check if the domain name is not already taken
domain = Libvirt::Util::Collection.find_matching(
domain = ProviderLibvirt::Util::Collection.find_matching(
env[:libvirt_compute].servers.all, env[:domain_name])
if domain != nil
raise Vagrant::Errors::DomainNameExists,

View File

@ -3,7 +3,7 @@ require "pathname"
require "log4r"
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
class ShareFolders
def initialize(app, env)

View File

@ -1,7 +1,7 @@
require 'log4r'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# Just start the domain.

View File

@ -1,7 +1,7 @@
require 'log4r'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# Suspend domain.
class SuspendDomain

View File

@ -2,7 +2,7 @@ require "log4r"
require "vagrant/util/subprocess"
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# This middleware uses `rsync` to sync the folders over to the
# libvirt domain.

View File

@ -1,7 +1,7 @@
require "vagrant-libvirt/util/timer"
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# This is the same as the builtin provision except it times the
# provisioner runs.

View File

@ -3,7 +3,7 @@ require 'vagrant-libvirt/util/timer'
require 'vagrant/util/retryable'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Action
# Wait till domain is started, till it obtains an IP address and is

View File

@ -1,7 +1,7 @@
require 'vagrant'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
class Config < Vagrant.plugin('2', :config)
# A hypervisor name to access via Libvirt.
attr_accessor :driver

View File

@ -1,7 +1,7 @@
require 'vagrant'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Errors
class VagrantLibvirtError < Vagrant::Errors::VagrantError
error_namespace("vagrant_libvirt.errors")

View File

@ -12,7 +12,7 @@ if Vagrant::VERSION < '1.1.0'
end
module VagrantPlugins
module Libvirt
module ProviderLibvirt
class Plugin < Vagrant.plugin('2')
name "libvirt"
description <<-DESC

View File

@ -1,7 +1,7 @@
require 'vagrant'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
# This is the base class for a provider for the V2 API. A provider
# is responsible for creating compute resources to match the

View File

@ -1,5 +1,5 @@
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Util
autoload :ErbTemplate, 'vagrant-libvirt/util/erb_template'
autoload :Collection, 'vagrant-libvirt/util/collection'

View File

@ -1,5 +1,5 @@
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Util
module Collection

View File

@ -1,7 +1,7 @@
require 'erb'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Util
module ErbTemplate

View File

@ -2,7 +2,7 @@ require 'nokogiri'
require 'vagrant/util/network_ip'
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Util
module LibvirtUtil
include Vagrant::Util::NetworkIP

View File

@ -1,5 +1,5 @@
module VagrantPlugins
module Libvirt
module ProviderLibvirt
module Util
class Timer
# A basic utility method that times the execution of the given

View File

@ -1,5 +1,5 @@
module VagrantPlugins
module Libvirt
VERSION = "0.0.6"
module ProviderLibvirt
VERSION = "0.0.7"
end
end

View File

@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.name = "vagrant-libvirt"
gem.require_paths = ["lib"]
gem.version = VagrantPlugins::Libvirt::VERSION
gem.version = VagrantPlugins::ProviderLibvirt::VERSION
gem.add_runtime_dependency "fog", "~> 1.10.0"
gem.add_runtime_dependency "ruby-libvirt", "~> 0.4.0"