Class: VagrantPlugins::Libvirt::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-libvirt/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/vagrant-libvirt/config.rb', line 29

def initialize
  @driver            = UNSET_VALUE
  @host              = UNSET_VALUE
  @connect_via_ssh   = UNSET_VALUE
  @username          = UNSET_VALUE
  @password          = UNSET_VALUE
  @storage_pool_name = UNSET_VALUE

  # Domain specific settings.
  @memory            = UNSET_VALUE
  @cpus              = UNSET_VALUE
end

Instance Attribute Details

#connect_via_sshObject

If use ssh tunnel to connect to Libvirt.



13
14
15
# File 'lib/vagrant-libvirt/config.rb', line 13

def connect_via_ssh
  @connect_via_ssh
end

#cpusObject

Returns the value of attribute cpus.



27
28
29
# File 'lib/vagrant-libvirt/config.rb', line 27

def cpus
  @cpus
end

#driverObject

A hypervisor name to access via Libvirt.



7
8
9
# File 'lib/vagrant-libvirt/config.rb', line 7

def driver
  @driver
end

#hostObject

The name of the server, where libvirtd is running.



10
11
12
# File 'lib/vagrant-libvirt/config.rb', line 10

def host
  @host
end

#memoryObject

Domain specific settings used while creating new domain.



26
27
28
# File 'lib/vagrant-libvirt/config.rb', line 26

def memory
  @memory
end

#passwordObject

Password for Libvirt connection.



19
20
21
# File 'lib/vagrant-libvirt/config.rb', line 19

def password
  @password
end

#storage_pool_nameObject

Libvirt storage pool name, where box image and instance snapshots will be stored.



23
24
25
# File 'lib/vagrant-libvirt/config.rb', line 23

def storage_pool_name
  @storage_pool_name
end

#usernameObject

The username to access Libvirt.



16
17
18
# File 'lib/vagrant-libvirt/config.rb', line 16

def username
  @username
end

Instance Method Details

#finalize!Object



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/vagrant-libvirt/config.rb', line 42

def finalize!
  @driver = 'qemu' if @driver == UNSET_VALUE
  @host = nil if @host == UNSET_VALUE
  @connect_via_ssh = false if @connect_via_ssh == UNSET_VALUE
  @username = nil if @username == UNSET_VALUE
  @password = nil if @password == UNSET_VALUE
  @storage_pool_name = 'default' if @storage_pool_name == UNSET_VALUE

  # Domain specific settings.
  @memory = 512 if @memory == UNSET_VALUE
  @cpus = 1 if @cpus == UNSET_VALUE
end

#validate(machine) ⇒ Object



55
56
# File 'lib/vagrant-libvirt/config.rb', line 55

def validate(machine)
end