esx 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +1 -1
- data/README.md +17 -17
- data/Rakefile +2 -2
- data/esx.gemspec +3 -3
- data/lib/esx.rb +2 -0
- data/templates/vmx_template.erb +1 -0
- metadata +36 -65
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 748b08c1052f4581aa4783034d43c715c9f8caad
|
4
|
+
data.tar.gz: a222577824994d451e8bb1816e0e4f6fd163f286
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0cab24d67f125361798d46eb0adfdaea2ba301726c12c2df7d4fbc01dd84d578e1e10982cfc5d5876f1ce2f1f6f10715e65d902676473390481a5370553d6009
|
7
|
+
data.tar.gz: 43dc7c84da4ee003fb3a74176763ae5425b8559a5a5c8eb7d4dae9d414142e564afda1b3e4b200b2e1d417e558bcbcb9ba11b92909503126e9d92341190f4657
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ESX
|
2
2
|
|
3
|
-
Simple rbvmomi wrapper to manage VMWare ESX hosts.
|
3
|
+
Simple rbvmomi wrapper to manage VMWare ESX hosts.
|
4
4
|
|
5
5
|
The goal of the library is to keep things simple so vCenter support isn't planned.
|
6
6
|
|
@@ -9,7 +9,7 @@ If you want a full VMWare vSphere API ruby implementation have a look at https:/
|
|
9
9
|
# Installation
|
10
10
|
|
11
11
|
## Ubuntu/Debian
|
12
|
-
|
12
|
+
|
13
13
|
apt-get install libxml2-dev libxslt-dev gcc make rubygems
|
14
14
|
gem install esx
|
15
15
|
|
@@ -42,7 +42,7 @@ Sample output:
|
|
42
42
|
Power State: poweredOn
|
43
43
|
Hosted VMs: 2
|
44
44
|
Running VMs: 1
|
45
|
-
|
45
|
+
|
46
46
|
Virtual Machines:
|
47
47
|
+-------------------------+--------+------+------+-------+------------+
|
48
48
|
| NAME | MEMORY | CPUS | NICS | DISKS | STATE |
|
@@ -50,7 +50,7 @@ Sample output:
|
|
50
50
|
| foobar | 128 | 1 | 1 | 1 | poweredOn |
|
51
51
|
| foobar2 | 256 | 2 | 1 | 1 | poweredOff |
|
52
52
|
+-------------------------+--------+------+------+-------+------------+
|
53
|
-
|
53
|
+
|
54
54
|
Datastores:
|
55
55
|
+------------+--------------+--------------+-----------+------+---------------------------------------------------+
|
56
56
|
| NAME | CAPACITY | FREESPACE | ACCESIBLE | TYPE | URL |
|
@@ -59,17 +59,17 @@ Sample output:
|
|
59
59
|
| datastore1 | 141465485312 | 20716716032 | VMFS | true | /vmfs/volumes/4e6117e7-35c82a3e-ba79-5cf3fc9699c2 |
|
60
60
|
+------------+--------------+--------------+-----------+------+---------------------------------------------------+
|
61
61
|
|
62
|
-
__esx create-vm --user root --password foo --name esx-
|
62
|
+
__esx create-vm --user root --password foo --name esx-maintux --disk-file /path/to/file.vmdk --datastore datastore1 --memory 2048 --poweron 10.10.0.2__
|
63
63
|
|
64
64
|
# Using the library
|
65
65
|
|
66
66
|
require 'rubygems'
|
67
67
|
require 'lib/esx.rb'
|
68
|
-
|
69
|
-
|
68
|
+
|
69
|
+
|
70
70
|
# Connect to the ESX Host
|
71
71
|
host = ESX::Host.connect 'my-esx-host', 'root', 'secret'
|
72
|
-
|
72
|
+
|
73
73
|
# Print hypervisor info
|
74
74
|
puts
|
75
75
|
name = host.name.upcase
|
@@ -80,27 +80,27 @@ __esx create-vm --user root --password foo --name esx-rubiojr --disk-file /path/
|
|
80
80
|
puts "Memory Usage: %s" % host.memory_usage.bytes.to.megabytes.to_i
|
81
81
|
puts "Cpu Cores: %s" % host.cpu_cores
|
82
82
|
puts "Power State: %s" % host.power_state
|
83
|
-
|
83
|
+
|
84
84
|
# Create a VM with 4GB disk, 128 MB mem, e1000 nic, 1CPU in datastore1
|
85
85
|
vm = host.create_vm :vm_name => 'foobar'
|
86
|
-
|
86
|
+
|
87
87
|
# Create a VM with 5GB disk, 256 MB mem, e1000 nic, 1CPU in datastore2
|
88
88
|
vm = host.create_vm :vm_name => 'foobar2', :disk_size => 5000, :cpus => 2, :memory => 256, :datastore => 'datastore2'
|
89
|
-
|
90
|
-
|
89
|
+
|
90
|
+
|
91
91
|
host.virtual_machines.each do |vm|
|
92
|
-
|
92
|
+
|
93
93
|
# PowerOff the VM if powered On
|
94
94
|
vm.power_off if (vm.name =~ /foobar/ and vm.power_state == 'poweredOn')
|
95
|
-
|
95
|
+
|
96
96
|
# Destroy the VM if name matches foobar
|
97
97
|
if vm.name =~ /foobar.*/
|
98
98
|
vm.destroy
|
99
99
|
end
|
100
|
-
|
100
|
+
|
101
101
|
end
|
102
102
|
|
103
|
-
# Testing
|
103
|
+
# Testing
|
104
104
|
|
105
105
|
Run 'bundler install' to install required deps.
|
106
106
|
|
@@ -108,5 +108,5 @@ Run rspec from the base dir. By default, the tests try to connect to an ESX host
|
|
108
108
|
|
109
109
|
# Copyright
|
110
110
|
|
111
|
-
Copyright (c) 2011 Sergio Rubio. See LICENSE.txt for
|
111
|
+
Copyright (c) 2011 Sergio Rubio, Massimo Maino. See LICENSE.txt for
|
112
112
|
further details.
|
data/Rakefile
CHANGED
@@ -7,11 +7,11 @@ Jeweler::Tasks.new do |gem|
|
|
7
7
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
8
8
|
gem.version = ESX::VERSION
|
9
9
|
gem.name = "esx"
|
10
|
-
gem.homepage = "http://github.com/
|
10
|
+
gem.homepage = "http://github.com/maintux/esx"
|
11
11
|
gem.license = "MIT"
|
12
12
|
gem.summary = %Q{Simple RbVmomi wrapper library to manage VMWare ESX hosts}
|
13
13
|
gem.description = %Q{Manage VMWare ESX hosts with ease}
|
14
|
-
gem.email = "
|
14
|
+
gem.email = "maintux@gmail.com"
|
15
15
|
gem.authors = ["Sergio Rubio","Massimo Maino"]
|
16
16
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
17
17
|
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
data/esx.gemspec
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "esx"
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Sergio Rubio", "Massimo Maino"]
|
12
12
|
s.date = "2013-03-29"
|
13
13
|
s.description = "Manage VMWare ESX hosts with ease"
|
14
|
-
s.email = "
|
14
|
+
s.email = "maintux@gmail.com"
|
15
15
|
s.executables = ["esx"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE.txt",
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"spec/unit/vm_spec.rb",
|
36
36
|
"templates/vmx_template.erb"
|
37
37
|
]
|
38
|
-
s.homepage = "http://github.com/
|
38
|
+
s.homepage = "http://github.com/maintux/esx"
|
39
39
|
s.licenses = ["MIT"]
|
40
40
|
s.require_paths = ["lib"]
|
41
41
|
s.rubygems_version = "1.8.25"
|
data/lib/esx.rb
CHANGED
@@ -125,6 +125,7 @@ module ESX
|
|
125
125
|
def create_vm(specification)
|
126
126
|
spec = specification
|
127
127
|
spec[:cpus] = (specification[:cpus] || 1).to_i
|
128
|
+
spec[:cpu_cores] = (specification[:cpu_cores] || 1).to_i
|
128
129
|
spec[:guest_id] = specification[:guest_id] || 'otherGuest'
|
129
130
|
if specification[:disk_size]
|
130
131
|
spec[:disk_size] = (specification[:disk_size].to_i * 1024)
|
@@ -142,6 +143,7 @@ module ESX
|
|
142
143
|
:guestId => spec[:guest_id],
|
143
144
|
:files => { :vmPathName => spec[:datastore] },
|
144
145
|
:numCPUs => spec[:cpus],
|
146
|
+
:numCoresPerSocket => spec[:cpu_cores],
|
145
147
|
:memoryMB => spec[:memory],
|
146
148
|
:deviceChange => [
|
147
149
|
{
|
data/templates/vmx_template.erb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: esx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sergio Rubio
|
@@ -15,229 +14,201 @@ dependencies:
|
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: net-ssh
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: '0'
|
23
21
|
type: :development
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - '>='
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '0'
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: net-scp
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - '>='
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: '0'
|
39
35
|
type: :development
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - '>='
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: '0'
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: rbvmomi
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
|
-
- -
|
46
|
+
- - '>='
|
53
47
|
- !ruby/object:Gem::Version
|
54
48
|
version: '0'
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
|
-
- -
|
53
|
+
- - '>='
|
61
54
|
- !ruby/object:Gem::Version
|
62
55
|
version: '0'
|
63
56
|
- !ruby/object:Gem::Dependency
|
64
57
|
name: alchemist
|
65
58
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
59
|
requirements:
|
68
|
-
- -
|
60
|
+
- - '>='
|
69
61
|
- !ruby/object:Gem::Version
|
70
62
|
version: '0'
|
71
63
|
type: :development
|
72
64
|
prerelease: false
|
73
65
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
66
|
requirements:
|
76
|
-
- -
|
67
|
+
- - '>='
|
77
68
|
- !ruby/object:Gem::Version
|
78
69
|
version: '0'
|
79
70
|
- !ruby/object:Gem::Dependency
|
80
71
|
name: rspec
|
81
72
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
73
|
requirements:
|
84
|
-
- -
|
74
|
+
- - '>='
|
85
75
|
- !ruby/object:Gem::Version
|
86
76
|
version: '0'
|
87
77
|
type: :development
|
88
78
|
prerelease: false
|
89
79
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
80
|
requirements:
|
92
|
-
- -
|
81
|
+
- - '>='
|
93
82
|
- !ruby/object:Gem::Version
|
94
83
|
version: '0'
|
95
84
|
- !ruby/object:Gem::Dependency
|
96
85
|
name: bundler
|
97
86
|
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
87
|
requirements:
|
100
|
-
- -
|
88
|
+
- - '>'
|
101
89
|
- !ruby/object:Gem::Version
|
102
90
|
version: 1.0.0
|
103
91
|
type: :development
|
104
92
|
prerelease: false
|
105
93
|
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
94
|
requirements:
|
108
|
-
- -
|
95
|
+
- - '>'
|
109
96
|
- !ruby/object:Gem::Version
|
110
97
|
version: 1.0.0
|
111
98
|
- !ruby/object:Gem::Dependency
|
112
99
|
name: jeweler
|
113
100
|
requirement: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
101
|
requirements:
|
116
|
-
- -
|
102
|
+
- - '>='
|
117
103
|
- !ruby/object:Gem::Version
|
118
104
|
version: '0'
|
119
105
|
type: :development
|
120
106
|
prerelease: false
|
121
107
|
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
108
|
requirements:
|
124
|
-
- -
|
109
|
+
- - '>='
|
125
110
|
- !ruby/object:Gem::Version
|
126
111
|
version: '0'
|
127
112
|
- !ruby/object:Gem::Dependency
|
128
113
|
name: simplecov
|
129
114
|
requirement: !ruby/object:Gem::Requirement
|
130
|
-
none: false
|
131
115
|
requirements:
|
132
|
-
- -
|
116
|
+
- - '>='
|
133
117
|
- !ruby/object:Gem::Version
|
134
118
|
version: '0'
|
135
119
|
type: :development
|
136
120
|
prerelease: false
|
137
121
|
version_requirements: !ruby/object:Gem::Requirement
|
138
|
-
none: false
|
139
122
|
requirements:
|
140
|
-
- -
|
123
|
+
- - '>='
|
141
124
|
- !ruby/object:Gem::Version
|
142
125
|
version: '0'
|
143
126
|
- !ruby/object:Gem::Dependency
|
144
127
|
name: alchemist
|
145
128
|
requirement: !ruby/object:Gem::Requirement
|
146
|
-
none: false
|
147
129
|
requirements:
|
148
|
-
- -
|
130
|
+
- - '>='
|
149
131
|
- !ruby/object:Gem::Version
|
150
132
|
version: '0'
|
151
133
|
type: :runtime
|
152
134
|
prerelease: false
|
153
135
|
version_requirements: !ruby/object:Gem::Requirement
|
154
|
-
none: false
|
155
136
|
requirements:
|
156
|
-
- -
|
137
|
+
- - '>='
|
157
138
|
- !ruby/object:Gem::Version
|
158
139
|
version: '0'
|
159
140
|
- !ruby/object:Gem::Dependency
|
160
141
|
name: rbvmomi
|
161
142
|
requirement: !ruby/object:Gem::Requirement
|
162
|
-
none: false
|
163
143
|
requirements:
|
164
|
-
- -
|
144
|
+
- - '>='
|
165
145
|
- !ruby/object:Gem::Version
|
166
146
|
version: '0'
|
167
147
|
type: :runtime
|
168
148
|
prerelease: false
|
169
149
|
version_requirements: !ruby/object:Gem::Requirement
|
170
|
-
none: false
|
171
150
|
requirements:
|
172
|
-
- -
|
151
|
+
- - '>='
|
173
152
|
- !ruby/object:Gem::Version
|
174
153
|
version: '0'
|
175
154
|
- !ruby/object:Gem::Dependency
|
176
155
|
name: terminal-table
|
177
156
|
requirement: !ruby/object:Gem::Requirement
|
178
|
-
none: false
|
179
157
|
requirements:
|
180
|
-
- -
|
158
|
+
- - '>='
|
181
159
|
- !ruby/object:Gem::Version
|
182
160
|
version: '0'
|
183
161
|
type: :runtime
|
184
162
|
prerelease: false
|
185
163
|
version_requirements: !ruby/object:Gem::Requirement
|
186
|
-
none: false
|
187
164
|
requirements:
|
188
|
-
- -
|
165
|
+
- - '>='
|
189
166
|
- !ruby/object:Gem::Version
|
190
167
|
version: '0'
|
191
168
|
- !ruby/object:Gem::Dependency
|
192
169
|
name: net-ssh
|
193
170
|
requirement: !ruby/object:Gem::Requirement
|
194
|
-
none: false
|
195
171
|
requirements:
|
196
|
-
- -
|
172
|
+
- - '>='
|
197
173
|
- !ruby/object:Gem::Version
|
198
174
|
version: '0'
|
199
175
|
type: :runtime
|
200
176
|
prerelease: false
|
201
177
|
version_requirements: !ruby/object:Gem::Requirement
|
202
|
-
none: false
|
203
178
|
requirements:
|
204
|
-
- -
|
179
|
+
- - '>='
|
205
180
|
- !ruby/object:Gem::Version
|
206
181
|
version: '0'
|
207
182
|
- !ruby/object:Gem::Dependency
|
208
183
|
name: net-scp
|
209
184
|
requirement: !ruby/object:Gem::Requirement
|
210
|
-
none: false
|
211
185
|
requirements:
|
212
|
-
- -
|
186
|
+
- - '>='
|
213
187
|
- !ruby/object:Gem::Version
|
214
188
|
version: '0'
|
215
189
|
type: :runtime
|
216
190
|
prerelease: false
|
217
191
|
version_requirements: !ruby/object:Gem::Requirement
|
218
|
-
none: false
|
219
192
|
requirements:
|
220
|
-
- -
|
193
|
+
- - '>='
|
221
194
|
- !ruby/object:Gem::Version
|
222
195
|
version: '0'
|
223
196
|
- !ruby/object:Gem::Dependency
|
224
197
|
name: clamp
|
225
198
|
requirement: !ruby/object:Gem::Requirement
|
226
|
-
none: false
|
227
199
|
requirements:
|
228
|
-
- -
|
200
|
+
- - '>='
|
229
201
|
- !ruby/object:Gem::Version
|
230
202
|
version: '0'
|
231
203
|
type: :runtime
|
232
204
|
prerelease: false
|
233
205
|
version_requirements: !ruby/object:Gem::Requirement
|
234
|
-
none: false
|
235
206
|
requirements:
|
236
|
-
- -
|
207
|
+
- - '>='
|
237
208
|
- !ruby/object:Gem::Version
|
238
209
|
version: '0'
|
239
210
|
description: Manage VMWare ESX hosts with ease
|
240
|
-
email:
|
211
|
+
email: maintux@gmail.com
|
241
212
|
executables:
|
242
213
|
- esx
|
243
214
|
extensions: []
|
@@ -261,29 +232,29 @@ files:
|
|
261
232
|
- spec/unit/host_spec.rb
|
262
233
|
- spec/unit/vm_spec.rb
|
263
234
|
- templates/vmx_template.erb
|
264
|
-
homepage: http://github.com/
|
235
|
+
homepage: http://github.com/maintux/esx
|
265
236
|
licenses:
|
266
237
|
- MIT
|
238
|
+
metadata: {}
|
267
239
|
post_install_message:
|
268
240
|
rdoc_options: []
|
269
241
|
require_paths:
|
270
242
|
- lib
|
271
243
|
required_ruby_version: !ruby/object:Gem::Requirement
|
272
|
-
none: false
|
273
244
|
requirements:
|
274
|
-
- -
|
245
|
+
- - '>='
|
275
246
|
- !ruby/object:Gem::Version
|
276
247
|
version: '0'
|
277
248
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
278
|
-
none: false
|
279
249
|
requirements:
|
280
|
-
- -
|
250
|
+
- - '>='
|
281
251
|
- !ruby/object:Gem::Version
|
282
252
|
version: '0'
|
283
253
|
requirements: []
|
284
254
|
rubyforge_project:
|
285
|
-
rubygems_version: 1.
|
255
|
+
rubygems_version: 2.1.5
|
286
256
|
signing_key:
|
287
257
|
specification_version: 3
|
288
258
|
summary: Simple RbVmomi wrapper library to manage VMWare ESX hosts
|
289
259
|
test_files: []
|
260
|
+
has_rdoc:
|