vmpooler-provider-vsphere 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vmpooler/providers/vsphere.rb +41 -12
- data/lib/vmpooler-provider-vsphere/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2eb4a595094d7c121a9308d3014fb03c08a5d9de9a3e56eacca6bdd98f0664f
|
4
|
+
data.tar.gz: b020dbb9c7f1391f72998af060d7e65ba069d147c27414d8bf324d50c64f0cb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e295730311c7133b17726fc1c3c3f123b7ec8533781dbdc62f7d5e61597a337fd9ad8d985efd6be74308921ad5fed09a0a0d2557b7ef725e48c8d61aa7f8023
|
7
|
+
data.tar.gz: cdca88b8aa4e50a0823d8e23656ffa4ef04c56432de57ddb2134c89e5998c7b59c45aeb0b840b4a857d48fe9051400c36d67647149cde423660fba5c9a001d0b
|
@@ -51,6 +51,11 @@ module Vmpooler
|
|
51
51
|
'vsphere'
|
52
52
|
end
|
53
53
|
|
54
|
+
def domain(pool_name)
|
55
|
+
dns_plugin_name = pool_config(pool_name)['dns_plugin']
|
56
|
+
dns_config(dns_plugin_name)
|
57
|
+
end
|
58
|
+
|
54
59
|
def folder_configured?(folder_title, base_folder, configured_folders, allowlist)
|
55
60
|
return true if allowlist&.include?(folder_title)
|
56
61
|
return false unless configured_folders.keys.include?(folder_title)
|
@@ -387,6 +392,16 @@ module Vmpooler
|
|
387
392
|
vm_hash
|
388
393
|
end
|
389
394
|
|
395
|
+
# The inner method requires vmware tools running in the guest os
|
396
|
+
def get_vm_ip_address(vm_name, pool_name)
|
397
|
+
@connection_pool.with_metrics do |pool_object|
|
398
|
+
connection = ensured_vsphere_connection(pool_object)
|
399
|
+
vm_object = find_vm(pool_name, vm_name, connection)
|
400
|
+
vm_hash = generate_vm_hash(vm_object, pool_name)
|
401
|
+
return vm_hash['ip']
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
390
405
|
def create_config_spec(vm_name, template_name, extra_config)
|
391
406
|
RbVmomi::VIM.VirtualMachineConfigSpec(
|
392
407
|
annotation: JSON.pretty_generate(
|
@@ -540,9 +555,10 @@ module Vmpooler
|
|
540
555
|
true
|
541
556
|
end
|
542
557
|
|
543
|
-
def vm_ready?(
|
558
|
+
def vm_ready?(pool_name, vm_name)
|
544
559
|
begin
|
545
|
-
|
560
|
+
domain = domain(pool_name)
|
561
|
+
open_socket(vm_name, domain)
|
546
562
|
rescue StandardError => _e
|
547
563
|
return false
|
548
564
|
end
|
@@ -582,13 +598,28 @@ module Vmpooler
|
|
582
598
|
boottime = vm_object.runtime.bootTime if vm_object.runtime&.bootTime
|
583
599
|
powerstate = vm_object.runtime.powerState if vm_object.runtime&.powerState
|
584
600
|
|
601
|
+
ip_maxloop = 60
|
602
|
+
ip_loop_delay = 1
|
603
|
+
ip_loop_count = 1
|
604
|
+
ip = nil
|
605
|
+
while ip.nil?
|
606
|
+
sleep(ip_loop_delay)
|
607
|
+
ip = vm_object.guest_ip
|
608
|
+
unless ip_maxloop == 0
|
609
|
+
break if ip_loop_count >= ip_maxloop
|
610
|
+
|
611
|
+
ip_loop_count += 1
|
612
|
+
end
|
613
|
+
end
|
614
|
+
|
585
615
|
{
|
586
616
|
'name' => vm_object.name,
|
587
617
|
'hostname' => hostname,
|
588
618
|
'template' => pool_configuration['template'],
|
589
619
|
'poolname' => pool_name,
|
590
620
|
'boottime' => boottime,
|
591
|
-
'powerstate' => powerstate
|
621
|
+
'powerstate' => powerstate,
|
622
|
+
'ip' => ip
|
592
623
|
}
|
593
624
|
end
|
594
625
|
|
@@ -632,15 +663,13 @@ module Vmpooler
|
|
632
663
|
|
633
664
|
# This should supercede the open_socket method in the Pool Manager
|
634
665
|
def open_socket(host, domain = nil, timeout = 5, port = 22, &_block)
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
sock.close
|
643
|
-
end
|
666
|
+
target_host = host
|
667
|
+
target_host = "#{host}.#{domain}" if domain
|
668
|
+
sock = TCPSocket.new(target_host, port, connect_timeout: timeout)
|
669
|
+
begin
|
670
|
+
yield sock if block_given?
|
671
|
+
ensure
|
672
|
+
sock.close
|
644
673
|
end
|
645
674
|
end
|
646
675
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vmpooler-provider-vsphere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -35,7 +35,7 @@ dependencies:
|
|
35
35
|
requirements:
|
36
36
|
- - "~>"
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version: '
|
38
|
+
version: '3.0'
|
39
39
|
name: vmpooler
|
40
40
|
prerelease: false
|
41
41
|
type: :runtime
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '3.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
204
|
- !ruby/object:Gem::Version
|
205
205
|
version: '0'
|
206
206
|
requirements: []
|
207
|
-
rubygems_version: 3.
|
207
|
+
rubygems_version: 3.3.25
|
208
208
|
signing_key:
|
209
209
|
specification_version: 4
|
210
210
|
summary: VMware provider for VMPooler
|