opennebula-provider 1.1.0 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d7cb6962f3a15c06a587d0facb4dfb8d9fc0b920
4
- data.tar.gz: 3c5e3590dcff842f5c8c39e19cc10120f90a0c85
2
+ SHA256:
3
+ metadata.gz: 8b60bec9aff9387371b4006a6ba193d70b44eb8fa5aaadbf1a2ea29703828642
4
+ data.tar.gz: 4b1d957117ed361204089545653af7f652612587384ee1540acf07275e6d152b
5
5
  SHA512:
6
- metadata.gz: 4927b9168112e605ef83f8708877589e257f462b40a91dc9361f35019d90b13e95910142b1e808618514a741b114d6a6d806b514232f43e2832f68707252a17e
7
- data.tar.gz: 9d02b553bc764ecbe055e1276d6614ee32171178ccc5459d7b1cfa31d591f9d7deef853e3ca89996e5e9df8c040e08623d17d92171c2abddef36679fd5acd2f0
6
+ metadata.gz: 4938bff37a014c11dd8c6f5e42f4a5367ef9d76ccde6d06e63e9447e7373ce65cd3df16fe7e977055e32928b3f81c33c4ee3710daab54b67025ef742adf0effe
7
+ data.tar.gz: e805d5117d6917173af079da36c044f95b60339ee4a932517c34fc8db7a7bcfe91472442d38d4f5dfd7eb6b0352fd883e13165f022a793e91a84c614a3629fec
data/README.md CHANGED
@@ -20,10 +20,6 @@ $ vagrant up --provider=opennebula
20
20
  ...
21
21
  ```
22
22
 
23
- ## Box Format
24
-
25
- TODO: Write box format creation instruction here.
26
-
27
23
  ## Usage
28
24
 
29
25
  ```
@@ -35,7 +31,7 @@ Vagrant.configure("2") do |config|
35
31
  one.username = 'YOUR NAME'
36
32
  one.password = 'YOUR PASSWORD'
37
33
  one.template_id = 123
38
- one.title = 'my vm'
34
+ one.title = 'my-vm'
39
35
  end
40
36
  end
41
37
  ```
@@ -46,10 +42,14 @@ end
46
42
  * `username` - OpenNebula username
47
43
  * `password` - OpenNebula password
48
44
  * `template_id` - OpenNebula template id
45
+ * `template_name` - OpenNebula template name
49
46
  * `title` - OpenNebula instance name
50
47
  * `memory` - An instance memory in MB
51
48
  * `cpu` - An instance cpus
52
49
  * `vcpu` - An instance virtual cpus
50
+ * `disk_size` - Disk size, in MB, for templates with ONLY one disk
51
+
52
+ You can use `template_name` parameters instead `template_id` to define template by name and if there are multiple templates with the same name will be used the most recent.
53
53
 
54
54
  You can use ONE_USER, ONE_PASSWORD, ONE_XMLRPC (or ONE_ENDPOINT) environment variables
55
55
  instead of defining it in Vagrantfile.
@@ -17,7 +17,7 @@ module VagrantPlugins
17
17
  driver = machine.provider.driver
18
18
 
19
19
  host = driver.ssh_info(machine.id)
20
- { host: host, port: 22 }
20
+ { host: host, port: 22 } unless host.nil?
21
21
  end
22
22
  end
23
23
  end
@@ -14,6 +14,7 @@ module VagrantPlugins
14
14
  attr_accessor :memory
15
15
  attr_accessor :cpu
16
16
  attr_accessor :vcpu
17
+ attr_accessor :disk_size
17
18
 
18
19
  def initialize
19
20
  @endpoint = ENV['ONE_XMLRPC'] || ENV['ONE_ENDPOINT'] || UNSET_VALUE
@@ -28,6 +29,7 @@ module VagrantPlugins
28
29
  @memory = UNSET_VALUE
29
30
  @cpu = UNSET_VALUE
30
31
  @vcpu = UNSET_VALUE
32
+ @disk_size = UNSET_VALUE
31
33
  end
32
34
 
33
35
  def finalize!
@@ -52,6 +54,7 @@ module VagrantPlugins
52
54
  if @cpu && ! @vcpu
53
55
  @vcpu = @cpu
54
56
  end
57
+ @disk_size = nil if @disk_size == UNSET_VALUE
55
58
  end
56
59
 
57
60
  def validate(machine)
@@ -41,7 +41,11 @@ module VagrantPlugins
41
41
  if @provider_config.template_id
42
42
  newvm.flavor = @fog_client.flavors.get @provider_config.template_id
43
43
  elsif @provider_config.template_name
44
- newvm.flavor = @fog_client.flavors.get_by_filter({name: @provider_config.template_name})
44
+ flavors = @fog_client.flavors.get_by_filter({name: @provider_config.template_name})
45
+ if flavors.nil?
46
+ fail Errors::ComputeError, error: I18n.t('opennebula_provider.compute.template_missing', template: @provider_config.template_name)
47
+ end
48
+ newvm.flavor = flavors.last
45
49
  end
46
50
  if newvm.flavor.nil?
47
51
  fail Errors::ComputeError, error: I18n.t('opennebula_provider.compute.template_missing', template: @provider_config.template)
@@ -54,6 +58,18 @@ module VagrantPlugins
54
58
  newvm.flavor.memory = @provider_config.memory unless @provider_config.memory.nil?
55
59
  newvm.flavor.cpu = @provider_config.cpu unless @provider_config.cpu.nil?
56
60
  newvm.flavor.vcpu = @provider_config.vcpu unless @provider_config.vcpu.nil?
61
+
62
+ if newvm.flavor.disk.instance_of? Array
63
+ fail Errors::AllocateError, error: I18n.t(
64
+ 'opennebula_provider.errors.allocate',
65
+ error: 'Template has more than one disk attached and `disk_size` ' +
66
+ 'feature is supported only for templates with only one')
67
+ end
68
+
69
+ if @provider_config.disk_size != nil
70
+ newvm.flavor.disk["SIZE"] = @provider_config.disk_size
71
+ end
72
+ @logger.warn "Deploying VM with options #{newvm.flavor.inspect}"
57
73
  vm = newvm.save
58
74
  vm.id
59
75
  rescue RuntimeError => e
@@ -102,7 +118,7 @@ module VagrantPlugins
102
118
 
103
119
  def ssh_info(id)
104
120
  desc = @fog_client.servers.get(id)
105
- desc.ip
121
+ desc.ip unless desc.nil?
106
122
  end
107
123
 
108
124
  private
@@ -111,7 +127,7 @@ module VagrantPlugins
111
127
  case state
112
128
  when 'LCM_INIT'
113
129
  case status
114
- when 1
130
+ when 1, 3
115
131
  pretty = 'pending'
116
132
  when 4
117
133
  pretty = 'stopped'
@@ -120,7 +136,7 @@ module VagrantPlugins
120
136
  when 7
121
137
  pretty = 'error'
122
138
  end
123
- when 'PROLOG'
139
+ when 'PROLOG', 'PROLOG_RESUME'
124
140
  case status
125
141
  when 3
126
142
  pretty = 'prolog'
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module OpenNebulaProvider
3
- VERSION = '1.1.0'
3
+ VERSION = '1.1.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula-provider
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cherdancev Evgeni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-12 00:00:00.000000000 Z
11
+ date: 2020-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opennebula
@@ -142,8 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  - !ruby/object:Gem::Version
143
143
  version: '0'
144
144
  requirements: []
145
- rubyforge_project:
146
- rubygems_version: 2.5.1
145
+ rubygems_version: 3.1.2
147
146
  signing_key:
148
147
  specification_version: 4
149
148
  summary: OpenNebula provider for Vagrant