Class: VagrantPlugins::XenServer::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/vagrant-xenserver/config.rb', line 60

def initialize
  @xs_host = UNSET_VALUE
  @xs_port = UNSET_VALUE
  @xs_use_ssl = UNSET_VALUE
  @xs_username = UNSET_VALUE
  @xs_password = UNSET_VALUE
  @name = UNSET_VALUE
  @pv = UNSET_VALUE
  @api_timeout = UNSET_VALUE
  @memory = UNSET_VALUE
  @xva_url = UNSET_VALUE
  @use_himn = UNSET_VALUE
end

Instance Attribute Details

#api_timeoutInt

Timeout for commands sent to XenServer

Returns:

  • (Int)


44
45
46
# File 'lib/vagrant-xenserver/config.rb', line 44

def api_timeout
  @api_timeout
end

#memoryInt

Memory settings

Returns:

  • (Int)


49
50
51
# File 'lib/vagrant-xenserver/config.rb', line 49

def memory
  @memory
end

#nameString

Name of the VM

Returns:

  • (String)


34
35
36
# File 'lib/vagrant-xenserver/config.rb', line 34

def name
  @name
end

#pvBool

True if the VM should be PV

Returns:

  • (Bool)


39
40
41
# File 'lib/vagrant-xenserver/config.rb', line 39

def pv
  @pv
end

#use_himnObject

Use HIMN: If this is set, we’ll use the host-internal-management-network to connect to the VM (proxying via dom0) Useful if the guest does not have tools installed



58
59
60
# File 'lib/vagrant-xenserver/config.rb', line 58

def use_himn
  @use_himn
end

#xs_hostString

The XenServer host name or IP

Returns:

  • (String)


9
10
11
# File 'lib/vagrant-xenserver/config.rb', line 9

def xs_host
  @xs_host
end

#xs_passwordString

The XenServer password

Returns:

  • (String)


29
30
31
# File 'lib/vagrant-xenserver/config.rb', line 29

def xs_password
  @xs_password
end

#xs_portInt

The port to communicate with the API on XenServer

Returns:

  • (Int)


14
15
16
# File 'lib/vagrant-xenserver/config.rb', line 14

def xs_port
  @xs_port
end

#xs_use_sslBool

True if the API should be accessed over SSL/TLS

Returns:

  • (Bool)


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

def xs_use_ssl
  @xs_use_ssl
end

#xs_usernameString

The XenServer username

Returns:

  • (String)


24
25
26
# File 'lib/vagrant-xenserver/config.rb', line 24

def xs_username
  @xs_username
end

#xva_urlString

XVA URL: If this is set, we’ll assume that the XenServer should directly download an XVA from the specified URL

Returns:

  • (String)


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

def xva_url
  @xva_url
end

Instance Method Details

#finalize!Object



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/vagrant-xenserver/config.rb', line 74

def finalize!
  @xs_host = nil if @xs_host == UNSET_VALUE
  @xs_port = 80 if @xs_port == UNSET_VALUE
  @xs_use_ssl = false if @xs_use_ssl == UNSET_VALUE
  @xs_username = nil if @xs_username == UNSET_VALUE
  @xs_password = nil if @xs_password == UNSET_VALUE
  @name = nil if @name == UNSET_VALUE
  @pv = nil if @pv == UNSET_VALUE
  @api_timeout = 60 if @api_timeout == UNSET_VALUE
  @memory = 1024 if @memory == UNSET_VALUE
  @xva_url = nil if @xva_url == UNSET_VALUE
  @use_himn = false if @use_himn == UNSET_VALUE
end

#validate(machine) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
# File 'lib/vagrant-xenserver/config.rb', line 88

def validate(machine)
  errors = _detected_errors
  errors << I18n.t("vagrant_xenserver.config.host_required") if @xs_host.nil?
  errors << I18n.t("vagrant_xenserver.config.username_required") if @xs_username.nil?
  errors << I18n.t("vagrant_xenserver.config.password_required") if @xs_password.nil?

  if not (machine.config.vm.networks.any? { |type,options| type == :public_network })
    errors << I18n.t("vagrant_xenserver.config.himn_required") if not @use_himn
  end
  { "XenServer Provider" => errors }
end