Class: VagrantPlugins::GANETI::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::GANETI::Config
- Defined in:
- lib/vagrant-ganeti/config.rb
Instance Attribute Summary collapse
-
#boot_order ⇒ String
hvparam Configs.
-
#cdrom_image_path ⇒ String
hvparam Configs.
-
#cluster ⇒ String
The Host Detail.
-
#cpu_type ⇒ String
hvparam Configs.
-
#disk_template ⇒ String
The name of the OS to use.
-
#disk_type ⇒ String
hvparam Configs.
-
#disks ⇒ {hash }
An array of hash of disk sizes.
-
#hvparam ⇒ String
hvparam Configs.
-
#iallocator ⇒ String
The name of the Iallocatoy.
-
#initrd_path ⇒ String
hvparam Configs.
-
#instance_name ⇒ String
The name of the Instance.
-
#instance_ready_timeout ⇒ Fixnum
The timeout to wait for an instance to become ready.
-
#ip_check ⇒ Boolean
IP Check configuration.
-
#kernel_args ⇒ String
hvparam Configs.
-
#kernel_path ⇒ String
hvparam Configs.
-
#kvm_flag ⇒ String
hvparam Configs.
-
#memory ⇒ String
Memory Configurations in MB’s.
-
#mode ⇒ String
Mode of Creation.
-
#name_check ⇒ Boolean
Name Check.
-
#nic_type ⇒ String
hvparam Configs.
-
#nics ⇒ {hash}
Network Configurations.
-
#os_type ⇒ String
The name of the OS to use.
-
#pnode ⇒ String
The name of the Primary Node.
-
#rapi_pass ⇒ String
The password for accessing GANETI.
-
#rapi_user ⇒ String
The username for accessing GANETI.
-
#root_path ⇒ String
hvparam Configs.
-
#serial_console ⇒ String
hvparam Configs.
-
#snode ⇒ String
The name of the Secondary Node for DRBD template.
-
#vcpus ⇒ String
VCPU configuration.
-
#version ⇒ String
The version of the GANETI api to use.
Instance Method Summary collapse
- #finalize! ⇒ Object
- #get_config ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/vagrant-ganeti/config.rb', line 158 def initialize() @rapi_user = UNSET_VALUE @rapi_pass = UNSET_VALUE @cluster = UNSET_VALUE @version = 2 @os_type = UNSET_VALUE @disk_template = UNSET_VALUE @disks = UNSET_VALUE @instance_name = UNSET_VALUE @mode = UNSET_VALUE @nics = UNSET_VALUE @pnode = UNSET_VALUE @snode = UNSET_VALUE @iallocator = UNSET_VALUE @memory = UNSET_VALUE @vcpus = UNSET_VALUE @ip_check = UNSET_VALUE @name_check = UNSET_VALUE @boot_order = UNSET_VALUE @cdrom_image_path = UNSET_VALUE @nic_type = UNSET_VALUE @disk_type = UNSET_VALUE @cpu_type = UNSET_VALUE @kernel_path = UNSET_VALUE @kernel_args = UNSET_VALUE @initrd_path = UNSET_VALUE @root_path = UNSET_VALUE @serial_console = UNSET_VALUE @kvm_flag = UNSET_VALUE @__finalized = false end |
Instance Attribute Details
#boot_order ⇒ String
hvparam Configs
106 107 108 |
# File 'lib/vagrant-ganeti/config.rb', line 106 def boot_order @boot_order end |
#cdrom_image_path ⇒ String
hvparam Configs
111 112 113 |
# File 'lib/vagrant-ganeti/config.rb', line 111 def cdrom_image_path @cdrom_image_path end |
#cluster ⇒ String
The Host Detail
19 20 21 |
# File 'lib/vagrant-ganeti/config.rb', line 19 def cluster @cluster end |
#cpu_type ⇒ String
hvparam Configs
126 127 128 |
# File 'lib/vagrant-ganeti/config.rb', line 126 def cpu_type @cpu_type end |
#disk_template ⇒ String
The name of the OS to use.
41 42 43 |
# File 'lib/vagrant-ganeti/config.rb', line 41 def disk_template @disk_template end |
#disk_type ⇒ String
hvparam Configs
121 122 123 |
# File 'lib/vagrant-ganeti/config.rb', line 121 def disk_type @disk_type end |
#disks ⇒ {hash }
An array of hash of disk sizes
46 47 48 |
# File 'lib/vagrant-ganeti/config.rb', line 46 def disks @disks end |
#hvparam ⇒ String
hvparam Configs
101 102 103 |
# File 'lib/vagrant-ganeti/config.rb', line 101 def hvparam @hvparam end |
#iallocator ⇒ String
The name of the Iallocatoy
76 77 78 |
# File 'lib/vagrant-ganeti/config.rb', line 76 def iallocator @iallocator end |
#initrd_path ⇒ String
hvparam Configs
141 142 143 |
# File 'lib/vagrant-ganeti/config.rb', line 141 def initrd_path @initrd_path end |
#instance_name ⇒ String
The name of the Instance
51 52 53 |
# File 'lib/vagrant-ganeti/config.rb', line 51 def instance_name @instance_name end |
#instance_ready_timeout ⇒ Fixnum
The timeout to wait for an instance to become ready.
24 25 26 |
# File 'lib/vagrant-ganeti/config.rb', line 24 def instance_ready_timeout @instance_ready_timeout end |
#ip_check ⇒ Boolean
IP Check configuration
96 97 98 |
# File 'lib/vagrant-ganeti/config.rb', line 96 def ip_check @ip_check end |
#kernel_args ⇒ String
hvparam Configs
136 137 138 |
# File 'lib/vagrant-ganeti/config.rb', line 136 def kernel_args @kernel_args end |
#kernel_path ⇒ String
hvparam Configs
131 132 133 |
# File 'lib/vagrant-ganeti/config.rb', line 131 def kernel_path @kernel_path end |
#kvm_flag ⇒ String
hvparam Configs
156 157 158 |
# File 'lib/vagrant-ganeti/config.rb', line 156 def kvm_flag @kvm_flag end |
#memory ⇒ String
Memory Configurations in MB’s
81 82 83 |
# File 'lib/vagrant-ganeti/config.rb', line 81 def memory @memory end |
#mode ⇒ String
Mode of Creation
56 57 58 |
# File 'lib/vagrant-ganeti/config.rb', line 56 def mode @mode end |
#name_check ⇒ Boolean
Name Check
91 92 93 |
# File 'lib/vagrant-ganeti/config.rb', line 91 def name_check @name_check end |
#nic_type ⇒ String
hvparam Configs
116 117 118 |
# File 'lib/vagrant-ganeti/config.rb', line 116 def nic_type @nic_type end |
#nics ⇒ {hash}
Network Configurations
61 62 63 |
# File 'lib/vagrant-ganeti/config.rb', line 61 def nics @nics end |
#os_type ⇒ String
The name of the OS to use.
36 37 38 |
# File 'lib/vagrant-ganeti/config.rb', line 36 def os_type @os_type end |
#pnode ⇒ String
The name of the Primary Node
66 67 68 |
# File 'lib/vagrant-ganeti/config.rb', line 66 def pnode @pnode end |
#rapi_pass ⇒ String
The password for accessing GANETI.
14 15 16 |
# File 'lib/vagrant-ganeti/config.rb', line 14 def rapi_pass @rapi_pass end |
#rapi_user ⇒ String
The username for accessing GANETI.
9 10 11 |
# File 'lib/vagrant-ganeti/config.rb', line 9 def rapi_user @rapi_user end |
#root_path ⇒ String
hvparam Configs
146 147 148 |
# File 'lib/vagrant-ganeti/config.rb', line 146 def root_path @root_path end |
#serial_console ⇒ String
hvparam Configs
151 152 153 |
# File 'lib/vagrant-ganeti/config.rb', line 151 def serial_console @serial_console end |
#snode ⇒ String
The name of the Secondary Node for DRBD template
71 72 73 |
# File 'lib/vagrant-ganeti/config.rb', line 71 def snode @snode end |
#vcpus ⇒ String
VCPU configuration
86 87 88 |
# File 'lib/vagrant-ganeti/config.rb', line 86 def vcpus @vcpus end |
#version ⇒ String
The version of the GANETI api to use
30 31 32 |
# File 'lib/vagrant-ganeti/config.rb', line 30 def version @version end |
Instance Method Details
#finalize! ⇒ Object
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/vagrant-ganeti/config.rb', line 190 def finalize! # Username and password for the Ganei RAPI must be set . @rapi_user = nil if @rapi_user == UNSET_VALUE @rapi_pass = nil if @rapi_pass == UNSET_VALUE # host must be nil, since we can't default that @cluster = nil if @cluster == UNSET_VALUE # OS_NAME must be nil, since we can't default that @os_type = nil if @os_type == UNSET_VALUE # disk_template since we can't default that @disk_template = "plain" if @disk_template == UNSET_VALUE # disks must be nil, since we can't default that @disks = [{"size"=>"8000"}] if @disks == UNSET_VALUE # instance_name must be nil, since we can't default that @instance_name = nil if @instance_name == UNSET_VALUE # mode must be nil, since we can't default that @mode = "create" if @mode == UNSET_VALUE # nics must be nil, since we can't default that @nics = nil if @nics == UNSET_VALUE # pnode must be nil, since we can't default that @pnode = nil if @pnode == UNSET_VALUE # snode must be nil, since we can't default that @snode = nil if @snode == UNSET_VALUE # iallocator Get default from ganeti cluster @iallocator = "__DEFAULT__" if @iallocator == UNSET_VALUE # memory must be nil, since we can't default that @memory = nil if @memory == UNSET_VALUE # vcpu must be nil, since we can't default that @vcpus = nil if @vcpus == UNSET_VALUE # ip_check defaults to True @ip_check = true if @ip_check == UNSET_VALUE # name_check defaults to True @name_check = true if @name_check == UNSET_VALUE # boot_order defaults to Nil @boot_order = nil if @boot_order == UNSET_VALUE # cdrom_image_path to Nil @cdrom_image_path= nil if @cdrom_image_path == UNSET_VALUE # nic_type defaults to nil @nic_type = nil if @nic_type == UNSET_VALUE # disk_type defaults to nil @disk_type = nil if @disk_type == UNSET_VALUE # cpu_type defaults to nil @cpu_type = nil if @cpu_type == UNSET_VALUE # kernel_path defaults to nil @kernel_path = nil if @kernel_path == UNSET_VALUE # kernel_args defaults to nil @kernel_args = nil if @kernel_args == UNSET_VALUE # initrd_path defaults to nil @initrd_path = nil if @initrd_path == UNSET_VALUE # root_path_path defaults to nil @root_path = nil if @root_path == UNSET_VALUE # serial_console defaults to nil @serial_console = nil if @serial_console == UNSET_VALUE # kvm_flag defaults to nil @kvm_flag = nil if @kvm_flag == UNSET_VALUE # Set the default timeout for waiting for an instance to be ready @instance_ready_timeout = 120 if @instance_ready_timeout == UNSET_VALUE @version = nil if @version == UNSET_VALUE # Mark that we finalized @__finalized = true end |
#get_config ⇒ Object
298 299 300 301 302 303 304 |
# File 'lib/vagrant-ganeti/config.rb', line 298 def get_config() if !@__finalized raise "Configuration must be finalized before calling this method." end self end |
#validate(machine) ⇒ Object
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/vagrant-ganeti/config.rb', line 282 def validate(machine) errors = _detected_errors errors << I18n.t("vagrant_ganeti.config.username_required") if @rapi_user.nil? errors << I18n.t("vagrant_ganeti.config.password_required") if @rapi_pass.nil? errors << I18n.t("vagrant_ganeti.config.host_required") if @cluster.nil? errors << I18n.t("vagrant_ganeti.config.os_name_required") if @os_type.nil? errors << I18n.t("vagrant_ganeti.config.disk_template_required") if @disk_template.nil? errors << I18n.t("vagrant_ganeti.config.disks_required") if @disks == nil errors << I18n.t("vagrant_ganeti.config.instance_name_required") if @instance_name.nil? errors << I18n.t("vagrant_ganeti.config.mode_required") if @mode.nil? errors << I18n.t("vagrant_ganeti.config.pnode_required") if @pnode.nil? and @iallocator.nil? errors << I18n.t("vagrant_ganeti.config.snode_required") if @snode.nil? and @disk_template == "drbd" and @iallocator.nil? { "GANETI Provider" => errors } end |