rbvmomi 1.9.4 → 1.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/LICENSE +1 -1
- data/README.rdoc +20 -17
- data/Rakefile +3 -0
- data/devel/analyze-vim-declarations.rb +4 -0
- data/devel/analyze-xml.rb +3 -0
- data/devel/benchmark.rb +4 -0
- data/devel/collisions.rb +4 -0
- data/devel/merge-internal-vmodl.rb +4 -0
- data/devel/merge-manual-vmodl.rb +4 -0
- data/examples/annotate.rb +3 -0
- data/examples/cached_ovf_deploy.rb +4 -0
- data/examples/clone_vm.rb +4 -0
- data/examples/create_vm-1.9.rb +4 -0
- data/examples/create_vm.rb +4 -0
- data/examples/extraConfig.rb +3 -0
- data/examples/lease_tool.rb +4 -0
- data/examples/logbundle.rb +3 -0
- data/examples/logtail.rb +3 -0
- data/examples/nfs_datastore.rb +4 -0
- data/examples/power.rb +3 -0
- data/examples/readme-1.rb +3 -0
- data/examples/readme-2.rb +3 -0
- data/examples/screenshot.rb +3 -0
- data/examples/vdf.rb +3 -0
- data/examples/vm_drs_behavior.rb +4 -0
- data/lib/rbvmomi.rb +3 -1
- data/lib/rbvmomi/basic_types.rb +3 -1
- data/lib/rbvmomi/connection.rb +3 -1
- data/lib/rbvmomi/deserialization.rb +3 -1
- data/lib/rbvmomi/fault.rb +3 -1
- data/lib/rbvmomi/pbm.rb +3 -1
- data/lib/rbvmomi/sms.rb +3 -1
- data/lib/rbvmomi/sms/SmsStorageManager.rb +3 -0
- data/lib/rbvmomi/trivial_soap.rb +3 -1
- data/lib/rbvmomi/trollop.rb +3 -1
- data/lib/rbvmomi/type_loader.rb +3 -1
- data/lib/rbvmomi/utils/admission_control.rb +3 -0
- data/lib/rbvmomi/utils/deploy.rb +4 -1
- data/lib/rbvmomi/utils/leases.rb +4 -1
- data/lib/rbvmomi/utils/perfdump.rb +3 -0
- data/lib/rbvmomi/version.rb +4 -1
- data/lib/rbvmomi/vim.rb +11 -3
- data/lib/rbvmomi/vim/ComputeResource.rb +3 -0
- data/lib/rbvmomi/vim/Datacenter.rb +3 -0
- data/lib/rbvmomi/vim/Datastore.rb +3 -0
- data/lib/rbvmomi/vim/DynamicTypeMgrAllTypeInfo.rb +3 -0
- data/lib/rbvmomi/vim/DynamicTypeMgrDataTypeInfo.rb +4 -1
- data/lib/rbvmomi/vim/DynamicTypeMgrManagedTypeInfo.rb +3 -0
- data/lib/rbvmomi/vim/Folder.rb +3 -0
- data/lib/rbvmomi/vim/HostSystem.rb +3 -0
- data/lib/rbvmomi/vim/ManagedEntity.rb +3 -0
- data/lib/rbvmomi/vim/ManagedObject.rb +3 -0
- data/lib/rbvmomi/vim/ObjectContent.rb +3 -0
- data/lib/rbvmomi/vim/ObjectUpdate.rb +3 -0
- data/lib/rbvmomi/vim/OvfManager.rb +3 -0
- data/lib/rbvmomi/vim/PerfCounterInfo.rb +3 -1
- data/lib/rbvmomi/vim/PerformanceManager.rb +3 -0
- data/lib/rbvmomi/vim/PropertyCollector.rb +3 -0
- data/lib/rbvmomi/vim/ReflectManagedMethodExecuter.rb +3 -0
- data/lib/rbvmomi/vim/ResourcePool.rb +3 -0
- data/lib/rbvmomi/vim/ServiceInstance.rb +3 -0
- data/lib/rbvmomi/vim/Task.rb +3 -0
- data/lib/rbvmomi/vim/VirtualMachine.rb +7 -0
- data/rbvmomi.gemspec +6 -2
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ac40ac25d354b258a89ece0441d03f7f95fa672
|
4
|
+
data.tar.gz: c28c494a41960e27986a3f57919775b288f20463
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0931dce171b497dec343f3eca7b1f7ff82081ae77be70fd2cedc7a8742d1e78702fd4a548cff827cdb8b53a56a4b67df54711d785e41d5623427d6fafc2e9912'
|
7
|
+
data.tar.gz: 3c012ef0838f2488b5136d20c23d7c990c8e0367fd2db3a59a67811b6f11e30d5486c23d6b6d5d4e528cc241146c8bd727fa25ab9ae1d79c15ec1b1fb12de1ba
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2010 VMware, Inc. All Rights Reserved.
|
1
|
+
Copyright (c) 2010-2017 VMware, Inc. All Rights Reserved.
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.rdoc
CHANGED
@@ -3,14 +3,14 @@
|
|
3
3
|
{<img src="https://badge.fury.io/rb/rbvmomi.svg" alt="gem-version">}[https://rubygems.org/gems/rbvmomi]
|
4
4
|
{<img src="https://travis-ci.org/vmware/rbvmomi.svg?branch=master" alt="travis-ci">}[http://travis-ci.org/vmware/rbvmomi]
|
5
5
|
|
6
|
-
This is
|
6
|
+
This is a community-supported, open source project at VMware. It is built and maintained by programmers like you!
|
7
7
|
|
8
8
|
== Introduction
|
9
9
|
|
10
10
|
RbVmomi is a Ruby interface to the vSphere API. Like the Perl and Java SDKs,
|
11
|
-
you can use it to manage ESX and
|
12
|
-
supports the vSphere
|
13
|
-
online[http://rdoc.info/github/
|
11
|
+
you can use it to manage ESX and vCenter servers. The current release
|
12
|
+
supports the vSphere 6.0 API. RbVmomi specific documentation is
|
13
|
+
online[http://rdoc.info/github/vmware/rbvmomi/master/frames] and is meant to
|
14
14
|
be used alongside the official documentation[http://pubs.vmware.com/vsphere-60/topic/com.vmware.sdk.doc/GUID-19793BCA-9EAB-42E2-8B9F-F9F2129E7741.html].
|
15
15
|
|
16
16
|
== Installation
|
@@ -35,9 +35,10 @@ On both Ruby 1.9 and 1.8.7:
|
|
35
35
|
A simple example of turning on a VM:
|
36
36
|
|
37
37
|
require 'rbvmomi'
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
|
39
|
+
vim = RbVmomi::VIM.connect(host: 'foo', user: 'bar', password: 'baz')
|
40
|
+
dc = vim.serviceInstance.find_datacenter('my_datacenter') || fail('datacenter not found')
|
41
|
+
vm = dc.find_vm('my_vm') || fail('VM not found')
|
41
42
|
vm.PowerOnVM_Task.wait_for_completion
|
42
43
|
|
43
44
|
This code uses several RbVmomi extensions to the vSphere API for concision. The
|
@@ -45,10 +46,11 @@ expanded snippet below uses only standard API calls and should be familiar to
|
|
45
46
|
users of the Java SDK:
|
46
47
|
|
47
48
|
require 'rbvmomi'
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
|
50
|
+
vim = RbVmomi::VIM.connect(host: 'foo', user: 'bar', password: 'baz')
|
51
|
+
root_folder = vim.serviceInstance.content.rootFolder
|
52
|
+
dc = rootFolder.childEntity.grep(RbVmomi::VIM::Datacenter).find { |x| x.name == 'mydatacenter' } || fail('datacenter not found')
|
53
|
+
vm = dc.vmFolder.childEntity.grep(RbVmomi::VIM::VirtualMachine).find { |x| x.name == 'my_vm' } || fail('VM not found')
|
52
54
|
task = vm.PowerOnVM_Task
|
53
55
|
filter = vim.propertyCollector.CreateFilter(
|
54
56
|
spec: {
|
@@ -58,13 +60,13 @@ users of the Java SDK:
|
|
58
60
|
partialUpdates: false
|
59
61
|
)
|
60
62
|
ver = ''
|
61
|
-
|
63
|
+
loop do
|
62
64
|
result = vim.propertyCollector.WaitForUpdates(version: ver)
|
63
65
|
ver = result.version
|
64
|
-
break if ['success', 'error'].member?
|
66
|
+
break if ['success', 'error'].member?(task.info.state)
|
65
67
|
end
|
66
68
|
filter.DestroyPropertyFilter
|
67
|
-
raise
|
69
|
+
raise(task.info.error) if task.info.state == 'error'
|
68
70
|
|
69
71
|
As you can see, the extensions RbVmomi adds can dramatically decrease the code
|
70
72
|
needed to perform simple tasks while still letting you use the full power of
|
@@ -88,9 +90,10 @@ A few important points:
|
|
88
90
|
|
89
91
|
Built-in extensions are under +lib/rbvmomi/vim/+. You are encouraged to
|
90
92
|
reopen VIM classes in your applications and add extensions of your own. If you
|
91
|
-
write something generally useful please
|
93
|
+
write something generally useful please open a {pull request}[https://github.com/vmware/rbvmomi/pulls] so it
|
94
|
+
can be merged back in
|
92
95
|
|
93
96
|
== Development
|
94
97
|
|
95
|
-
|
96
|
-
|
98
|
+
Open an issue on the {issues page}[https://github.com/vmware/rbvmomi/issues] or
|
99
|
+
fork the project on {GitHub}[https://github.com/vmware/rbvmomi] and send a {pull request}[https://github.com/vmware/rbvmomi/pulls].
|
data/Rakefile
CHANGED
data/devel/analyze-xml.rb
CHANGED
data/devel/benchmark.rb
CHANGED
data/devel/collisions.rb
CHANGED
data/devel/merge-manual-vmodl.rb
CHANGED
data/examples/annotate.rb
CHANGED
data/examples/clone_vm.rb
CHANGED
data/examples/create_vm-1.9.rb
CHANGED
data/examples/create_vm.rb
CHANGED
data/examples/extraConfig.rb
CHANGED
data/examples/lease_tool.rb
CHANGED
data/examples/logbundle.rb
CHANGED
data/examples/logtail.rb
CHANGED
data/examples/nfs_datastore.rb
CHANGED
data/examples/power.rb
CHANGED
data/examples/readme-1.rb
CHANGED
data/examples/readme-2.rb
CHANGED
data/examples/screenshot.rb
CHANGED
data/examples/vdf.rb
CHANGED
data/examples/vm_drs_behavior.rb
CHANGED
data/lib/rbvmomi.rb
CHANGED
data/lib/rbvmomi/basic_types.rb
CHANGED
data/lib/rbvmomi/connection.rb
CHANGED
data/lib/rbvmomi/fault.rb
CHANGED
data/lib/rbvmomi/pbm.rb
CHANGED
data/lib/rbvmomi/sms.rb
CHANGED
data/lib/rbvmomi/trivial_soap.rb
CHANGED
data/lib/rbvmomi/trollop.rb
CHANGED
data/lib/rbvmomi/type_loader.rb
CHANGED
data/lib/rbvmomi/utils/deploy.rb
CHANGED
data/lib/rbvmomi/utils/leases.rb
CHANGED
data/lib/rbvmomi/version.rb
CHANGED
data/lib/rbvmomi/vim.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
# Copyright (c) 2011 VMware, Inc. All Rights Reserved.
|
1
|
+
# Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
|
2
4
|
require 'rbvmomi'
|
3
5
|
|
4
6
|
# Win32::SSPI is part of core on Windows
|
@@ -40,7 +42,7 @@ class VIM < Connection
|
|
40
42
|
opts[:rev] = '6.0' unless rev_given
|
41
43
|
opts[:debug] = (!ENV['RBVMOMI_DEBUG'].empty? rescue false) unless opts.member? :debug
|
42
44
|
|
43
|
-
new(opts).tap do |vim|
|
45
|
+
conn = new(opts).tap do |vim|
|
44
46
|
unless opts[:cookie]
|
45
47
|
if WIN32 && opts[:password] == ''
|
46
48
|
# Attempt login by SSPI if no password specified on Windows
|
@@ -63,10 +65,16 @@ class VIM < Connection
|
|
63
65
|
vim.rev = [rev, '6.0'].min
|
64
66
|
end
|
65
67
|
end
|
68
|
+
|
69
|
+
at_exit { conn.close }
|
70
|
+
conn
|
66
71
|
end
|
67
72
|
|
68
73
|
def close
|
69
|
-
|
74
|
+
serviceContent.sessionManager.Logout
|
75
|
+
rescue RbVmomi::Fault => e
|
76
|
+
$stderr.puts(e.message) if debug
|
77
|
+
ensure
|
70
78
|
self.cookie = nil
|
71
79
|
super
|
72
80
|
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
|
1
4
|
# @note +download+ and +upload+ require +curl+. If +curl+ is not in your +PATH+
|
2
5
|
# then set the +CURL+ environment variable to point to it.
|
3
6
|
# @todo Use an HTTP library instead of executing +curl+.
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
|
1
4
|
class RbVmomi::VIM::DynamicTypeMgrDataTypeInfo
|
2
5
|
def toRbvmomiTypeHash
|
3
6
|
{
|
@@ -17,4 +20,4 @@ class RbVmomi::VIM::DynamicTypeMgrDataTypeInfo
|
|
17
20
|
}
|
18
21
|
}
|
19
22
|
end
|
20
|
-
end
|
23
|
+
end
|
data/lib/rbvmomi/vim/Folder.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
|
1
4
|
# @note +deployOVF+ and requires +curl+. If +curl+ is not in your +PATH+
|
2
5
|
# then set the +CURL+ environment variable to point to it.
|
3
6
|
# @todo Use an HTTP library instead of executing +curl+.
|
@@ -1,4 +1,6 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2012-2017 VMware, Inc. All Rights Reserved.
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
6
|
# of this software and associated documentation files (the "Software"), to deal
|
data/lib/rbvmomi/vim/Task.rb
CHANGED
@@ -1,9 +1,16 @@
|
|
1
|
+
# Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
|
1
4
|
class RbVmomi::VIM::VirtualMachine
|
2
5
|
# Retrieve the MAC addresses for all virtual NICs.
|
3
6
|
# @return [Hash] Keyed by device label.
|
4
7
|
def macs
|
5
8
|
Hash[self.config.hardware.device.grep(RbVmomi::VIM::VirtualEthernetCard).map { |x| [x.deviceInfo.label, x.macAddress] }]
|
6
9
|
end
|
10
|
+
|
11
|
+
def network
|
12
|
+
Hash[self.config.hardware.device.grep(RbVmomi::VIM::VirtualEthernetCard).map { |x| [x.deviceInfo.label, x.deviceInfo.summary] }]
|
13
|
+
end
|
7
14
|
|
8
15
|
# Retrieve all virtual disk devices.
|
9
16
|
# @return [Array] Array of virtual disk devices.
|
data/rbvmomi.gemspec
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# Copyright (c) 2016-2017 VMware, Inc. All Rights Reserved.
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
|
1
4
|
$LOAD_PATH.unshift(File.expand_path('../lib', __FILE__))
|
2
5
|
|
3
6
|
require 'rbvmomi/version'
|
@@ -8,14 +11,15 @@ Gem::Specification.new do |spec|
|
|
8
11
|
spec.version = RbVmomi::VERSION
|
9
12
|
|
10
13
|
spec.authors = ['Rich Lane', 'Christian Dickmann']
|
11
|
-
spec.email = '
|
14
|
+
spec.email = 'jrg@vmware.com'
|
12
15
|
spec.homepage = 'https://github.com/vmware/rbvmomi'
|
16
|
+
spec.license = 'MIT'
|
13
17
|
|
14
18
|
spec.bindir = 'exe'
|
15
19
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(/^test\//) }
|
16
20
|
spec.executables << 'rbvmomish'
|
17
21
|
|
18
|
-
spec.add_runtime_dependency('builder', '~> 3.
|
22
|
+
spec.add_runtime_dependency('builder', '~> 3.0')
|
19
23
|
spec.add_runtime_dependency('json', '>= 1.8')
|
20
24
|
spec.add_runtime_dependency('nokogiri', '~> 1.5')
|
21
25
|
spec.add_runtime_dependency('trollop', '~> 2.1')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbvmomi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rich Lane
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: builder
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '3.
|
20
|
+
version: '3.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '3.
|
27
|
+
version: '3.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: json
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,7 +124,7 @@ dependencies:
|
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '2.5'
|
126
126
|
description:
|
127
|
-
email:
|
127
|
+
email: jrg@vmware.com
|
128
128
|
executables:
|
129
129
|
- rbvmomish
|
130
130
|
extensions: []
|
@@ -203,7 +203,8 @@ files:
|
|
203
203
|
- rbvmomi.gemspec
|
204
204
|
- vmodl.db
|
205
205
|
homepage: https://github.com/vmware/rbvmomi
|
206
|
-
licenses:
|
206
|
+
licenses:
|
207
|
+
- MIT
|
207
208
|
metadata: {}
|
208
209
|
post_install_message:
|
209
210
|
rdoc_options: []
|
@@ -221,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
222
|
version: '0'
|
222
223
|
requirements: []
|
223
224
|
rubyforge_project:
|
224
|
-
rubygems_version: 2.
|
225
|
+
rubygems_version: 2.6.10
|
225
226
|
signing_key:
|
226
227
|
specification_version: 4
|
227
228
|
summary: Ruby interface to the VMware vSphere API
|