mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Updated Libvirt-based Vagrant box search reference and edited names for consistency
This commit is contained in:
@@ -8,7 +8,7 @@ module VagrantPlugins
|
||||
include Vagrant::Action::Builtin
|
||||
@logger = Log4r::Logger.new('vagrant_libvirt::action')
|
||||
|
||||
# remove image from libvirt storage pool
|
||||
# remove image from Libvirt storage pool
|
||||
def self.remove_libvirt_image
|
||||
Vagrant::Action::Builder.new.tap do |b|
|
||||
b.use RemoveLibvirtImage
|
||||
|
||||
@@ -323,7 +323,7 @@ module VagrantPlugins
|
||||
|
||||
env[:ui].info(" -- Command line : #{@cmd_line}") unless @cmd_line.empty?
|
||||
|
||||
# Create libvirt domain.
|
||||
# Create Libvirt domain.
|
||||
# Is there a way to tell fog to create new domain with already
|
||||
# existing volume? Use domain creation from template..
|
||||
begin
|
||||
|
||||
@@ -283,7 +283,7 @@ module VagrantPlugins
|
||||
return options[:network_name]
|
||||
end
|
||||
|
||||
# Get list of all (active and inactive) libvirt networks.
|
||||
# Get list of all (active and inactive) Libvirt networks.
|
||||
available_networks = libvirt_networks(libvirt_client)
|
||||
|
||||
return 'public' if options[:iface_type] == :public_network
|
||||
|
||||
@@ -47,9 +47,9 @@ module VagrantPlugins
|
||||
# should fix other methods so this doesn't have to be instance var
|
||||
@options = options
|
||||
|
||||
# Get a list of all (active and inactive) libvirt networks. This
|
||||
# Get a list of all (active and inactive) Libvirt networks. This
|
||||
# list is used throughout this class and should be easier to
|
||||
# process than libvirt API calls.
|
||||
# process than Libvirt API calls.
|
||||
@available_networks = libvirt_networks(
|
||||
env[:machine].provider.driver.connection.client
|
||||
)
|
||||
|
||||
@@ -14,7 +14,7 @@ module VagrantPlugins
|
||||
env[:ui].info(I18n.t('vagrant_libvirt.destroy_domain'))
|
||||
|
||||
# Must delete any snapshots before domain can be destroyed
|
||||
# Fog libvirt currently doesn't support snapshots. Use
|
||||
# Fog Libvirt currently doesn't support snapshots. Use
|
||||
# ruby-libvirt client directly. Note this is racy, see
|
||||
# http://www.libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotListNames
|
||||
libvirt_domain = env[:machine].provider.driver.connection.client.lookup_domain_by_uuid(
|
||||
|
||||
@@ -19,7 +19,7 @@ module VagrantPlugins
|
||||
begin
|
||||
env[:machine].guest.capability(:halt)
|
||||
rescue
|
||||
@logger.info('Trying libvirt graceful shutdown.')
|
||||
@logger.info('Trying Libvirt graceful shutdown.')
|
||||
domain.shutdown
|
||||
end
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ module VagrantPlugins
|
||||
|
||||
protected
|
||||
|
||||
# Fog libvirt currently doesn't support uploading images to storage
|
||||
# Fog Libvirt currently doesn't support uploading images to storage
|
||||
# pool volumes. Use ruby-libvirt client instead.
|
||||
def upload_image(image_file, pool_name, volume_name, env)
|
||||
image_size = File.size(image_file) # B
|
||||
|
||||
@@ -36,7 +36,7 @@ module VagrantPlugins
|
||||
|
||||
@logger.info("Creating storage pool 'default'")
|
||||
|
||||
# Fog libvirt currently doesn't support creating pools. Use
|
||||
# Fog Libvirt currently doesn't support creating pools. Use
|
||||
# ruby-libvirt client directly.
|
||||
begin
|
||||
@storage_pool_path = storage_pool_path(env)
|
||||
|
||||
@@ -3,7 +3,7 @@ require 'log4r'
|
||||
module VagrantPlugins
|
||||
module ProviderLibvirt
|
||||
module Action
|
||||
# Action for create new box for libvirt provider
|
||||
# Action for create new box for Libvirt provider
|
||||
class PackageDomain
|
||||
def initialize(app, env)
|
||||
@logger = Log4r::Logger.new('vagrant_libvirt::action::package_domain')
|
||||
|
||||
@@ -10,8 +10,8 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def call(env)
|
||||
env[:ui].info('Vagrant-libvirt plugin removed box only from you LOCAL ~/.vagrant/boxes directory')
|
||||
env[:ui].info('From libvirt storage pool you have to delete image manually(virsh, virt-manager or by any other tool)')
|
||||
env[:ui].info('Vagrant-libvirt plugin removed box only from your LOCAL ~/.vagrant/boxes directory')
|
||||
env[:ui].info('From Libvirt storage pool you have to delete image manually(virsh, virt-manager or by any other tool)')
|
||||
@app.call(env)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ module VagrantPlugins
|
||||
if @boot_order.count >= 1
|
||||
|
||||
# If a domain is initially defined with no box or disk or
|
||||
# with an explicit boot order, libvirt adds <boot dev="foo">
|
||||
# with an explicit boot order, Libvirt adds <boot dev="foo">
|
||||
# This conflicts with an explicit boot_order configuration,
|
||||
# so we need to remove it from the domain xml and feed it back.
|
||||
# Also see https://bugzilla.redhat.com/show_bug.cgi?id=1248514
|
||||
@@ -66,7 +66,7 @@ module VagrantPlugins
|
||||
logger_msg(node, index)
|
||||
end
|
||||
|
||||
# Finally redefine the domain XML through libvirt
|
||||
# Finally redefine the domain XML through Libvirt
|
||||
# to apply the boot ordering
|
||||
env[:machine].provider
|
||||
.driver
|
||||
|
||||
@@ -41,7 +41,7 @@ module VagrantPlugins
|
||||
# parsable and sortable by epoch time
|
||||
# @example
|
||||
# development-centos-6-chef-11_1404488971_3b7a569e2fd7c554b852
|
||||
# @return [String] libvirt domain name
|
||||
# @return [String] Libvirt domain name
|
||||
def build_domain_name(env)
|
||||
config = env[:machine].provider_config
|
||||
domain_name =
|
||||
|
||||
@@ -23,7 +23,7 @@ module VagrantPlugins
|
||||
|
||||
libvirt_domain = env[:machine].provider.driver.connection.client.lookup_domain_by_uuid(env[:machine].id)
|
||||
|
||||
# libvirt API doesn't support modifying memory on NUMA enabled CPUs
|
||||
# Libvirt API doesn't support modifying memory on NUMA enabled CPUs
|
||||
# http://libvirt.org/git/?p=libvirt.git;a=commit;h=d174394105cf00ed266bf729ddf461c21637c736
|
||||
if config.numa_nodes == nil
|
||||
if config.memory.to_i * 1024 != libvirt_domain.max_memory
|
||||
|
||||
@@ -28,7 +28,7 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
# Wait for domain to obtain an ip address. Ip address is searched
|
||||
# from arp table, either localy or remotely via ssh, if libvirt
|
||||
# from arp table, either locally or remotely via ssh, if Libvirt
|
||||
# connection was done via ssh.
|
||||
env[:ip_address] = nil
|
||||
@logger.debug("Searching for IP for MAC address: #{domain.mac}")
|
||||
|
||||
@@ -20,7 +20,7 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def usable?(machine, _raise_error = false)
|
||||
# bail now if not using libvirt since checking version would throw error
|
||||
# bail now if not using Libvirt since checking version would throw error
|
||||
return false unless machine.provider_name == :libvirt
|
||||
|
||||
# <filesystem/> support in device attach/detach introduced in 1.2.2
|
||||
@@ -30,7 +30,7 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def prepare(machine, folders, _opts)
|
||||
raise Vagrant::Errors::Error('No libvirt connection') if machine.provider.driver.connection.nil?
|
||||
raise Vagrant::Errors::Error('No Libvirt connection') if machine.provider.driver.connection.nil?
|
||||
@conn = machine.provider.driver.connection.client
|
||||
|
||||
begin
|
||||
@@ -89,7 +89,7 @@ module VagrantPlugins
|
||||
|
||||
def cleanup(machine, _opts)
|
||||
if machine.provider.driver.connection.nil?
|
||||
raise Vagrant::Errors::Error('No libvirt connection')
|
||||
raise Vagrant::Errors::Error('No Libvirt connection')
|
||||
end
|
||||
@conn = machine.provider.driver.connection.client
|
||||
begin
|
||||
|
||||
@@ -20,12 +20,12 @@ module VagrantPlugins
|
||||
# A hypervisor name to access via Libvirt.
|
||||
attr_accessor :driver
|
||||
|
||||
# The name of the server, where libvirtd is running.
|
||||
# The name of the server, where Libvirtd is running.
|
||||
attr_accessor :host
|
||||
|
||||
# If use ssh tunnel to connect to Libvirt.
|
||||
attr_accessor :connect_via_ssh
|
||||
# Path towards the libvirt socket
|
||||
# Path towards the Libvirt socket
|
||||
attr_accessor :socket
|
||||
|
||||
# The username to access Libvirt.
|
||||
@@ -161,7 +161,7 @@ module VagrantPlugins
|
||||
# Additional qemuargs arguments
|
||||
attr_accessor :qemu_args
|
||||
|
||||
# Use qemu session instead of system
|
||||
# Use QEMU session instead of system
|
||||
attr_accessor :qemu_use_session
|
||||
|
||||
def initialize
|
||||
@@ -309,7 +309,7 @@ module VagrantPlugins
|
||||
end
|
||||
end
|
||||
|
||||
# is it better to raise our own error, or let libvirt cause the exception?
|
||||
# is it better to raise our own error, or let Libvirt cause the exception?
|
||||
raise 'Only four cdroms may be attached at a time'
|
||||
end
|
||||
|
||||
@@ -586,7 +586,7 @@ module VagrantPlugins
|
||||
|
||||
# code to generate URI from a config moved out of the connect action
|
||||
def _generate_uri
|
||||
# builds the libvirt connection URI from the given driver config
|
||||
# builds the Libvirt connection URI from the given driver config
|
||||
# Setup connection uri.
|
||||
uri = @driver.dup
|
||||
virt_path = case uri
|
||||
@@ -602,7 +602,7 @@ module VagrantPlugins
|
||||
raise "Require specify driver #{uri}"
|
||||
end
|
||||
if uri == 'kvm'
|
||||
uri = 'qemu' # use qemu uri for kvm domain type
|
||||
uri = 'qemu' # use QEMU uri for KVM domain type
|
||||
end
|
||||
|
||||
if @connect_via_ssh
|
||||
@@ -623,13 +623,13 @@ module VagrantPlugins
|
||||
uri << '?no_verify=1'
|
||||
|
||||
if @id_ssh_key_file
|
||||
# set ssh key for access to libvirt host
|
||||
# set ssh key for access to Libvirt host
|
||||
uri << "\&keyfile="
|
||||
# if no slash, prepend $HOME/.ssh/
|
||||
@id_ssh_key_file.prepend("#{`echo ${HOME}`.chomp}/.ssh/") if @id_ssh_key_file !~ /\A\//
|
||||
uri << @id_ssh_key_file
|
||||
end
|
||||
# set path to libvirt socket
|
||||
# set path to Libvirt socket
|
||||
uri << "\&socket=" + @socket if @socket
|
||||
uri
|
||||
end
|
||||
|
||||
@@ -19,11 +19,11 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def connection
|
||||
# If already connected to libvirt, just use it and don't connect
|
||||
# If already connected to Libvirt, just use it and don't connect
|
||||
# again.
|
||||
return @@connection if @@connection
|
||||
|
||||
# Get config options for libvirt provider.
|
||||
# Get config options for Libvirt provider.
|
||||
config = @machine.provider_config
|
||||
uri = config.uri
|
||||
|
||||
@@ -50,7 +50,7 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def system_connection
|
||||
# If already connected to libvirt, just use it and don't connect
|
||||
# If already connected to Libvirt, just use it and don't connect
|
||||
# again.
|
||||
return @@system_connection if @@system_connection
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ module VagrantPlugins
|
||||
error_key(:wrong_box_format)
|
||||
end
|
||||
|
||||
# Fog libvirt exceptions
|
||||
# Fog Libvirt exceptions
|
||||
class FogError < VagrantLibvirtError
|
||||
error_key(:fog_error)
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ rescue LoadError
|
||||
raise 'The Vagrant Libvirt plugin must be run within Vagrant.'
|
||||
end
|
||||
|
||||
# compatibility fix to define constant not available vagrant <1.6
|
||||
# compatibility fix to define constant not available Vagrant <1.6
|
||||
::Vagrant::MachineState::NOT_CREATED_ID ||= :not_created
|
||||
|
||||
module VagrantPlugins
|
||||
@@ -12,7 +12,7 @@ module VagrantPlugins
|
||||
class Plugin < Vagrant.plugin('2')
|
||||
name 'libvirt'
|
||||
description <<-DESC
|
||||
Vagrant plugin to manage VMs in libvirt.
|
||||
Vagrant plugin to manage VMs in Libvirt.
|
||||
DESC
|
||||
|
||||
config('libvirt', :provider) do
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
<% if d[:serial] %>
|
||||
<serial><%= d[:serial] %></serial>
|
||||
<% end %>
|
||||
<%# this will get auto generated by libvirt
|
||||
<%# this will get auto generated by Libvirt
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='???' function='0x0'/>
|
||||
-%>
|
||||
</disk>
|
||||
|
||||
@@ -109,7 +109,7 @@ module VagrantPlugins
|
||||
networks
|
||||
end
|
||||
|
||||
# Return a list of all (active and inactive) libvirt networks as a list
|
||||
# Return a list of all (active and inactive) Libvirt networks as a list
|
||||
# of hashes with their name, network address and status (active or not)
|
||||
def libvirt_networks(libvirt_client)
|
||||
libvirt_networks = []
|
||||
|
||||
Reference in New Issue
Block a user