fog-vsphere 1.9.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/fog/vsphere/compute.rb +10 -1
- data/lib/fog/vsphere/requests/compute/create_vm.rb +1 -1
- data/lib/fog/vsphere/requests/compute/current_time.rb +1 -1
- data/lib/fog/vsphere/requests/compute/get_datacenter.rb +1 -1
- data/lib/fog/vsphere/requests/compute/get_datastore.rb +1 -1
- data/lib/fog/vsphere/requests/compute/get_network.rb +1 -1
- data/lib/fog/vsphere/requests/compute/get_storage_pod.rb +1 -1
- data/lib/fog/vsphere/requests/compute/get_virtual_machine.rb +1 -1
- data/lib/fog/vsphere/requests/compute/list_customfields.rb +1 -1
- data/lib/fog/vsphere/requests/compute/list_datacenters.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_processes.rb +1 -1
- data/lib/fog/vsphere/requests/compute/list_storage_pods.rb +1 -1
- data/lib/fog/vsphere/requests/compute/list_templates.rb +1 -1
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +1 -1
- data/lib/fog/vsphere/requests/compute/upload_iso.rb +1 -1
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +1 -1
- data/lib/fog/vsphere/requests/compute/vm_config_vnc.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_execute.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_migrate.rb +1 -1
- data/lib/fog/vsphere/requests/compute/vm_power_off.rb +1 -1
- data/lib/fog/vsphere/requests/compute/vm_power_on.rb +1 -1
- data/lib/fog/vsphere/requests/compute/vm_reboot.rb +1 -1
- data/lib/fog/vsphere/requests/compute/vm_suspend.rb +1 -1
- data/lib/fog/vsphere/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06eca68fe929424802778ca57a027d81db538f60
|
4
|
+
data.tar.gz: 2118bba5d8f23607ddf6133f4fb81fafd58c113d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 255282ce591683af7e4edd73719d73b6d541acfa33ba2017a1439368431f9a29de7de33b78a6fa5bb422886651088b7f01f554329adb8f0d643ed178da499e85
|
7
|
+
data.tar.gz: 8fecbdda3f9b1f05065976b221557b0dbd1f8f2c3197889948b02e21014975d2f8ce565468e6e62b2d210ed57fabba6b94f700a42ef7df94a398882c8afdb954
|
data/CHANGELOG.md
CHANGED
data/lib/fog/vsphere/compute.rb
CHANGED
@@ -156,7 +156,7 @@ module Fog
|
|
156
156
|
}
|
157
157
|
|
158
158
|
def convert_vm_view_to_attr_hash(vms)
|
159
|
-
vms =
|
159
|
+
vms = connection.serviceContent.propertyCollector.collectMultiple(vms,*ATTR_TO_PROP.values.uniq)
|
160
160
|
vms.map { |vm| props_to_attr_hash(*vm) }
|
161
161
|
end
|
162
162
|
|
@@ -525,6 +525,15 @@ module Fog
|
|
525
525
|
authenticate
|
526
526
|
end
|
527
527
|
|
528
|
+
def connection
|
529
|
+
if @connection.nil? || @connection.serviceContent.sessionManager.currentSession.nil?
|
530
|
+
Fog::Logger.debug('Reconnecting to vSphere.')
|
531
|
+
@connection = nil
|
532
|
+
reload
|
533
|
+
end
|
534
|
+
@connection
|
535
|
+
end
|
536
|
+
|
528
537
|
def reload
|
529
538
|
connect
|
530
539
|
# Check if the negotiation was ever run
|
@@ -60,7 +60,7 @@ module Fog
|
|
60
60
|
:configSpec => vm_cfg,
|
61
61
|
:host => host,
|
62
62
|
)
|
63
|
-
srm =
|
63
|
+
srm = connection.serviceContent.storageResourceManager
|
64
64
|
result = srm.RecommendDatastores(:storageSpec => storage_spec)
|
65
65
|
|
66
66
|
# if result array contains recommendation, we can apply it
|
@@ -13,7 +13,7 @@ module Fog
|
|
13
13
|
def get_raw_datastore(name, datacenter_name)
|
14
14
|
dc = find_raw_datacenter(datacenter_name)
|
15
15
|
|
16
|
-
|
16
|
+
connection.serviceContent.viewManager.CreateContainerView({
|
17
17
|
:container => dc.datastoreFolder,
|
18
18
|
:type => ["Datastore"],
|
19
19
|
:recursive => true
|
@@ -23,7 +23,7 @@ module Fog
|
|
23
23
|
|
24
24
|
def get_all_raw_networks(datacenter_name)
|
25
25
|
dc = find_raw_datacenter(datacenter_name)
|
26
|
-
|
26
|
+
connection.serviceContent.viewManager.
|
27
27
|
CreateContainerView({
|
28
28
|
:container => dc.networkFolder,
|
29
29
|
:type => ["Network"],
|
@@ -13,7 +13,7 @@ module Fog
|
|
13
13
|
def get_raw_storage_pod(name, datacenter_name)
|
14
14
|
dc = find_raw_datacenter(datacenter_name)
|
15
15
|
|
16
|
-
|
16
|
+
connection.serviceContent.viewManager.CreateContainerView({
|
17
17
|
:container => dc,
|
18
18
|
:type => ["StoragePod"],
|
19
19
|
:recursive => true
|
@@ -16,7 +16,7 @@ module Fog
|
|
16
16
|
when true
|
17
17
|
params = {:uuid => id, :vmSearch => true, :instanceUuid => true}
|
18
18
|
params[:datacenter] = raw_datacenter if dc
|
19
|
-
|
19
|
+
connection.searchIndex.FindByUuid(params)
|
20
20
|
else
|
21
21
|
# try to find based on VM name
|
22
22
|
if dc
|
@@ -3,7 +3,7 @@ module Fog
|
|
3
3
|
class Vsphere
|
4
4
|
class Real
|
5
5
|
def list_customfields()
|
6
|
-
|
6
|
+
connection.serviceContent.customFieldsManager.field.map do |customfield|
|
7
7
|
{
|
8
8
|
:key => customfield.key.to_i,
|
9
9
|
:name => customfield.name,
|
@@ -16,7 +16,7 @@ module Fog
|
|
16
16
|
protected
|
17
17
|
|
18
18
|
def raw_getpathmo mo
|
19
|
-
if mo.parent == nil or mo.parent.name ==
|
19
|
+
if mo.parent == nil or mo.parent.name == connection.rootFolder.name then
|
20
20
|
[ mo.name ]
|
21
21
|
else
|
22
22
|
[ raw_getpathmo(mo.parent), mo.name ].flatten
|
@@ -24,7 +24,7 @@ module Fog
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def raw_datacenters folder=nil
|
27
|
-
folder ||=
|
27
|
+
folder ||= connection.rootFolder
|
28
28
|
@raw_datacenters ||= get_raw_datacenters_from_folder folder
|
29
29
|
end
|
30
30
|
|
@@ -11,7 +11,7 @@ module Fog
|
|
11
11
|
:interactiveSession => false
|
12
12
|
)
|
13
13
|
|
14
|
-
p_manager =
|
14
|
+
p_manager = connection.serviceContent.guestOperationsManager.processManager
|
15
15
|
processes = p_manager.ListProcessesInGuest(:vm => vm, :auth => auth)
|
16
16
|
processes.map do |pi|
|
17
17
|
Process.new(
|
@@ -13,7 +13,7 @@ module Fog
|
|
13
13
|
def raw_storage_pods(datacenter_name)
|
14
14
|
dc = find_raw_datacenter(datacenter_name)
|
15
15
|
|
16
|
-
|
16
|
+
connection.serviceContent.viewManager.CreateContainerView({
|
17
17
|
:container => dc,
|
18
18
|
:type => ["StoragePod"],
|
19
19
|
:recursive => true
|
@@ -27,7 +27,7 @@ module Fog
|
|
27
27
|
datacenters = find_datacenters(options[:datacenter])
|
28
28
|
|
29
29
|
vms = datacenters.map do |dc|
|
30
|
-
|
30
|
+
connection.serviceContent.viewManager.CreateContainerView({
|
31
31
|
:container => dc.vmFolder,
|
32
32
|
:type => ["VirtualMachine"],
|
33
33
|
:recursive => true
|
@@ -62,7 +62,7 @@ module Fog
|
|
62
62
|
## much faster to interact for some functions.
|
63
63
|
datacenters = find_datacenters(datacenter_name)
|
64
64
|
datacenters.map do |dc|
|
65
|
-
|
65
|
+
connection.serviceContent.viewManager.CreateContainerView({
|
66
66
|
:container => dc.vmFolder,
|
67
67
|
:type => ["VirtualMachine"],
|
68
68
|
:recursive => true
|
@@ -22,7 +22,7 @@ module Fog
|
|
22
22
|
datacenter = get_raw_datacenter(options['datacenter'])
|
23
23
|
filename = options['filename'] || File.basename(options['local_path'])
|
24
24
|
unless datastore.exists? options['upload_directory']+'/'
|
25
|
-
|
25
|
+
connection.serviceContent.fileManager.MakeDirectory :name => "[#{options['datastore']}] #{options['upload_directory']}",
|
26
26
|
:datacenter => datacenter,
|
27
27
|
:createParentDirectories => false
|
28
28
|
end
|
@@ -618,7 +618,7 @@ module Fog
|
|
618
618
|
:cloneName => options['name'],
|
619
619
|
:vm => vm_mob_ref,
|
620
620
|
)
|
621
|
-
srm =
|
621
|
+
srm = connection.serviceContent.storageResourceManager
|
622
622
|
result = srm.RecommendDatastores(:storageSpec => storage_spec)
|
623
623
|
|
624
624
|
# if result array contains recommendation, we can apply it
|
@@ -6,7 +6,7 @@ module Fog
|
|
6
6
|
raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid'
|
7
7
|
|
8
8
|
search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true }
|
9
|
-
vm_mob_ref =
|
9
|
+
vm_mob_ref = connection.searchIndex.FindAllByUuid(search_filter).first
|
10
10
|
task = vm_mob_ref.ReconfigVM_Task(:spec => {
|
11
11
|
:extraConfig => [
|
12
12
|
{ :key => 'RemoteDisplay.vnc.enabled', :value => options[:enabled] ? 'true' : 'false' },
|
@@ -21,7 +21,7 @@ module Fog
|
|
21
21
|
# return a hash of VNC attributes required to view the console
|
22
22
|
def vm_get_vnc uuid
|
23
23
|
search_filter = { :uuid => uuid, 'vmSearch' => true, 'instanceUuid' => true }
|
24
|
-
vm =
|
24
|
+
vm = connection.searchIndex.FindAllByUuid(search_filter).first
|
25
25
|
Hash[vm.config.extraConfig.map do |config|
|
26
26
|
if config.key =~ /^RemoteDisplay\.vnc\.(\w+)$/
|
27
27
|
[$1.to_sym, config.value]
|
@@ -18,7 +18,7 @@ module Fog
|
|
18
18
|
raise ArgumentError, "password is a required parameter" unless options.key? 'password'
|
19
19
|
|
20
20
|
search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true }
|
21
|
-
vm_mob_ref =
|
21
|
+
vm_mob_ref = connection.searchIndex.FindAllByUuid(search_filter).first
|
22
22
|
|
23
23
|
auth = RbVmomi::VIM::NamePasswordAuthentication(:interactiveSession => false,
|
24
24
|
:username => options['user'],
|
@@ -28,7 +28,7 @@ module Fog
|
|
28
28
|
:arguments => options['args'],
|
29
29
|
:workingDirectory => options['working_dir'])
|
30
30
|
|
31
|
-
gom =
|
31
|
+
gom = connection.serviceContent.guestOperationsManager
|
32
32
|
gom.processManager.StartProgramInGuest(:vm => vm_mob_ref, :auth => auth, :spec => spec)
|
33
33
|
end
|
34
34
|
end
|
@@ -9,7 +9,7 @@ module Fog
|
|
9
9
|
|
10
10
|
# Find the VM Object
|
11
11
|
search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true }
|
12
|
-
vm_mob_ref =
|
12
|
+
vm_mob_ref = connection.searchIndex.FindAllByUuid(search_filter).first
|
13
13
|
|
14
14
|
unless vm_mob_ref.kind_of? RbVmomi::VIM::VirtualMachine
|
15
15
|
raise Fog::Vsphere::Errors::NotFound,
|
@@ -7,7 +7,7 @@ module Fog
|
|
7
7
|
raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid'
|
8
8
|
|
9
9
|
search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true }
|
10
|
-
vm_mob_ref =
|
10
|
+
vm_mob_ref = connection.searchIndex.FindAllByUuid(search_filter).first
|
11
11
|
|
12
12
|
if options['force'] then
|
13
13
|
task = vm_mob_ref.PowerOffVM_Task
|
@@ -6,7 +6,7 @@ module Fog
|
|
6
6
|
raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid'
|
7
7
|
|
8
8
|
search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true }
|
9
|
-
vm_mob_ref =
|
9
|
+
vm_mob_ref = connection.searchIndex.FindAllByUuid(search_filter).first
|
10
10
|
|
11
11
|
task = vm_mob_ref.PowerOnVM_Task
|
12
12
|
task.wait_for_completion
|
@@ -7,7 +7,7 @@ module Fog
|
|
7
7
|
raise ArgumentError, "instance_uuid is a required parameter" unless options.key? 'instance_uuid'
|
8
8
|
|
9
9
|
search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true }
|
10
|
-
vm_mob_ref =
|
10
|
+
vm_mob_ref = connection.searchIndex.FindAllByUuid(search_filter).first
|
11
11
|
|
12
12
|
if options['force'] then
|
13
13
|
task = vm_mob_ref.ResetVM_Task
|
@@ -7,7 +7,7 @@ module Fog
|
|
7
7
|
options = { 'force' => false }.merge(options)
|
8
8
|
|
9
9
|
search_filter = { :uuid => options['instance_uuid'], 'vmSearch' => true, 'instanceUuid' => true }
|
10
|
-
vm =
|
10
|
+
vm = connection.searchIndex.FindAllByUuid(search_filter).first
|
11
11
|
|
12
12
|
if options['force']
|
13
13
|
suspend_forcefully(vm)
|
data/lib/fog/vsphere/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-vsphere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- J.R. Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|