knife-vsphere 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/chef/knife/base_vsphere_command.rb +383 -371
- data/lib/chef/knife/customization_helper.rb +40 -0
- data/lib/chef/knife/vsphere_cluster_list.rb +47 -0
- data/lib/chef/knife/vsphere_cpu_ratio.rb +41 -45
- data/lib/chef/knife/vsphere_customization_list.rb +24 -29
- data/lib/chef/knife/vsphere_datastore_list.rb +68 -72
- data/lib/chef/knife/vsphere_datastore_maxfree.rb +48 -49
- data/lib/chef/knife/vsphere_datastorecluster_list.rb +66 -71
- data/lib/chef/knife/vsphere_datastorecluster_maxfree.rb +75 -84
- data/lib/chef/knife/vsphere_folder_list.rb +28 -30
- data/lib/chef/knife/vsphere_hosts_list.rb +42 -42
- data/lib/chef/knife/vsphere_pool_list.rb +46 -48
- data/lib/chef/knife/vsphere_pool_query.rb +58 -58
- data/lib/chef/knife/vsphere_template_list.rb +30 -32
- data/lib/chef/knife/vsphere_vlan_create.rb +51 -0
- data/lib/chef/knife/vsphere_vlan_list.rb +35 -37
- data/lib/chef/knife/vsphere_vm_clone.rb +834 -581
- data/lib/chef/knife/vsphere_vm_config.rb +48 -46
- data/lib/chef/knife/vsphere_vm_delete.rb +70 -66
- data/lib/chef/knife/vsphere_vm_execute.rb +62 -66
- data/lib/chef/knife/vsphere_vm_list.rb +57 -61
- data/lib/chef/knife/vsphere_vm_markastemplate.rb +48 -54
- data/lib/chef/knife/vsphere_vm_migrate.rb +73 -0
- data/lib/chef/knife/vsphere_vm_move.rb +88 -0
- data/lib/chef/knife/vsphere_vm_net.rb +57 -0
- data/lib/chef/knife/vsphere_vm_property_get.rb +44 -46
- data/lib/chef/knife/vsphere_vm_property_set.rb +83 -84
- data/lib/chef/knife/vsphere_vm_query.rb +48 -48
- data/lib/chef/knife/vsphere_vm_snapshot.rb +124 -130
- data/lib/chef/knife/vsphere_vm_state.rb +122 -127
- data/lib/chef/knife/vsphere_vm_toolsconfig.rb +54 -52
- data/lib/chef/knife/vsphere_vm_vmdk_add.rb +234 -241
- data/lib/chef/knife/vsphere_vm_wait_sysprep.rb +54 -0
- data/lib/knife-vsphere/version.rb +3 -4
- metadata +43 -15
- data/lib/chef/knife/vshpere_vm_migrate.rb +0 -80
- data/lib/chef/knife/vshpere_vm_move.rb +0 -92
- data/lib/chef/knife/vshpere_vm_net.rb +0 -57
@@ -0,0 +1,40 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Malte Heidenreich (https://github.com/mheidenr)
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
|
6
|
+
require 'rbvmomi'
|
7
|
+
|
8
|
+
module CustomizationHelper
|
9
|
+
def self.wait_for_sysprep(vm, vim_connection, timeout, sleep_time)
|
10
|
+
vem = vim_connection.serviceContent.eventManager
|
11
|
+
|
12
|
+
wait = true
|
13
|
+
waited_seconds = 0
|
14
|
+
|
15
|
+
print 'Waiting for sysprep...'
|
16
|
+
while wait
|
17
|
+
events = query_customization_succeeded(vm, vem)
|
18
|
+
|
19
|
+
if events.size > 0
|
20
|
+
events.each do |e|
|
21
|
+
puts "\n#{e.fullFormattedMessage}"
|
22
|
+
end
|
23
|
+
wait = false
|
24
|
+
elsif waited_seconds >= timeout
|
25
|
+
abort "\nCustomization of VM #{vm.name} not succeeded within #{timeout} seconds."
|
26
|
+
else
|
27
|
+
print '.'
|
28
|
+
sleep(sleep_time)
|
29
|
+
waited_seconds += sleep_time
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.query_customization_succeeded(vm, vem)
|
35
|
+
vem.QueryEvents(filter:
|
36
|
+
RbVmomi::VIM::EventFilterSpec(entity:
|
37
|
+
RbVmomi::VIM::EventFilterSpecByEntity(entity: vm, recursion:
|
38
|
+
RbVmomi::VIM::EventFilterSpecRecursionOption(:self)), eventTypeId: ['CustomizationSucceeded']))
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Jesse Campbell (<hikeit@gmail.com>)
|
3
|
+
# Contributor:: Dennis Pattmann (https://github.com/DennisBP)
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
require 'chef/knife'
|
7
|
+
require 'chef/knife/base_vsphere_command'
|
8
|
+
|
9
|
+
# Lists all known clusters in the configured datacenter
|
10
|
+
class Chef::Knife::VsphereClusterList < Chef::Knife::BaseVsphereCommand
|
11
|
+
banner 'knife vsphere cluster list'
|
12
|
+
|
13
|
+
common_options
|
14
|
+
|
15
|
+
def traverse_folders(folder)
|
16
|
+
return if folder.is_a? RbVmomi::VIM::VirtualApp
|
17
|
+
|
18
|
+
if folder.is_a? RbVmomi::VIM::ClusterComputeResource
|
19
|
+
clusters = folder.path[3..-1].reject { |p| p.last == 'ClusterComputeResource' }
|
20
|
+
puts "#{ui.color('Cluster', :cyan)}: " + clusters.map(&:last).join('/')
|
21
|
+
end
|
22
|
+
|
23
|
+
folders = find_all_in_folder(folder, RbVmomi::VIM::ManagedObject) || []
|
24
|
+
folders.each do |child|
|
25
|
+
traverse_folders(child)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def find_cluster_folder(folderName)
|
30
|
+
dc = datacenter
|
31
|
+
base_entity = dc.hostFolder
|
32
|
+
entity_array = folderName.split('/')
|
33
|
+
entity_array.each do |entityArrItem|
|
34
|
+
if entityArrItem != ''
|
35
|
+
base_entity = base_entity.childEntity.grep(RbVmomi::VIM::ManagedObject).find { |f| f.name == entityArrItem } ||
|
36
|
+
abort("no such folder #{folderName} while looking for #{entityArrItem}")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
base_entity
|
40
|
+
end
|
41
|
+
|
42
|
+
def run
|
43
|
+
vim_connection
|
44
|
+
base_folder = find_cluster_folder(get_config(:folder))
|
45
|
+
traverse_folders(base_folder)
|
46
|
+
end
|
47
|
+
end
|
@@ -1,45 +1,41 @@
|
|
1
|
-
require 'chef/knife'
|
2
|
-
require 'chef/knife/base_vsphere_command'
|
3
|
-
|
4
|
-
class Chef::Knife::VsphereCpuRatio < Chef::Knife::BaseVsphereCommand
|
5
|
-
banner 'knife vsphere cpu ratio [CLUSTER] [HOST]'
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
def run
|
10
|
-
$stdout.sync = true
|
11
|
-
|
12
|
-
cluster_name = @name_args[0]
|
13
|
-
host_name = @name_args[1]
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
dc =
|
18
|
-
hf = dc.hostFolder
|
19
|
-
|
20
|
-
cluster = cluster_name.nil? ? hf.childEntity : hf.childEntity.select { |c| c.name == cluster_name }
|
21
|
-
|
22
|
-
if cluster.empty?
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
puts ''
|
43
|
-
}
|
44
|
-
end
|
45
|
-
end
|
1
|
+
require 'chef/knife'
|
2
|
+
require 'chef/knife/base_vsphere_command'
|
3
|
+
|
4
|
+
class Chef::Knife::VsphereCpuRatio < Chef::Knife::BaseVsphereCommand
|
5
|
+
banner 'knife vsphere cpu ratio [CLUSTER] [HOST]'
|
6
|
+
|
7
|
+
common_options
|
8
|
+
|
9
|
+
def run
|
10
|
+
$stdout.sync = true
|
11
|
+
|
12
|
+
cluster_name = @name_args[0]
|
13
|
+
host_name = @name_args[1]
|
14
|
+
|
15
|
+
vim_connection
|
16
|
+
|
17
|
+
dc = datacenter
|
18
|
+
hf = dc.hostFolder
|
19
|
+
|
20
|
+
cluster = cluster_name.nil? ? hf.childEntity : hf.childEntity.select { |c| c.name == cluster_name }
|
21
|
+
|
22
|
+
fatal_exit("Cluster #{cluster_name} not found.") if cluster.empty?
|
23
|
+
|
24
|
+
cluster.each do |c|
|
25
|
+
host = host_name.nil? ? c.host : c.host.select { |h| h.name == host_name }
|
26
|
+
fatal_exit("Host not found in cluster #{c.name}.") if host.empty?
|
27
|
+
|
28
|
+
puts "### Cluster #{c.name} ###"
|
29
|
+
|
30
|
+
host.each do |h|
|
31
|
+
v_cpu = h.vm.inject(0) { |a, e| a + e.config.hardware.numCPU }
|
32
|
+
p_cpu = h.summary.hardware.numCpuThreads
|
33
|
+
|
34
|
+
ratio = 1.0 * v_cpu / p_cpu
|
35
|
+
|
36
|
+
puts "#{h.name}: #{ratio}"
|
37
|
+
end
|
38
|
+
puts ''
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -1,29 +1,24 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Ezra Pagel (<ezra@cpan.org>)
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
require 'chef/knife'
|
6
|
-
require 'chef/knife/base_vsphere_command'
|
7
|
-
|
8
|
-
# Lists all customization specifications in the configured datacenter
|
9
|
-
class Chef::Knife::VsphereCustomizationList < Chef::Knife::BaseVsphereCommand
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
1
|
+
#
|
2
|
+
# Author:: Ezra Pagel (<ezra@cpan.org>)
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
require 'chef/knife'
|
6
|
+
require 'chef/knife/base_vsphere_command'
|
7
|
+
|
8
|
+
# Lists all customization specifications in the configured datacenter
|
9
|
+
class Chef::Knife::VsphereCustomizationList < Chef::Knife::BaseVsphereCommand
|
10
|
+
banner 'knife vsphere customization list'
|
11
|
+
|
12
|
+
common_options
|
13
|
+
|
14
|
+
def run
|
15
|
+
$stdout.sync = true
|
16
|
+
|
17
|
+
vim = vim_connection
|
18
|
+
|
19
|
+
csm = vim.serviceContent.customizationSpecManager
|
20
|
+
csm.info.each do |c|
|
21
|
+
puts "#{ui.color('Customization Name', :cyan)}: #{c.name}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,72 +1,68 @@
|
|
1
|
-
# Copyright (C) 2012, SCM Ventures AB
|
2
|
-
# Author: Ian Delahorne <ian@scmventures.se>
|
3
|
-
#
|
4
|
-
# Permission to use, copy, modify, and/or distribute this software for
|
5
|
-
# any purpose with or without fee is hereby granted, provided that the
|
6
|
-
# above copyright notice and this permission notice appear in all
|
7
|
-
# copies.
|
8
|
-
#
|
9
|
-
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
10
|
-
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
11
|
-
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
12
|
-
# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
13
|
-
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
|
14
|
-
# OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
15
|
-
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
16
|
-
# PERFORMANCE OF THIS SOFTWARE
|
17
|
-
|
18
|
-
require 'chef/knife'
|
19
|
-
require 'chef/knife/base_vsphere_command'
|
20
|
-
|
21
|
-
def number_to_human_size(number)
|
22
|
-
number = number.to_f
|
23
|
-
storage_units_fmt =
|
24
|
-
base = 1024
|
25
|
-
if number.to_i < base
|
26
|
-
unit = storage_units_fmt[0]
|
27
|
-
else
|
28
|
-
max_exp = storage_units_fmt.size - 1
|
29
|
-
exponent = (Math.log(number) / Math.log(base)).to_i # Convert to base
|
30
|
-
exponent = max_exp if exponent > max_exp # we need this to avoid overflow for the highest unit
|
31
|
-
number /= base
|
32
|
-
unit = storage_units_fmt[exponent]
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
1
|
+
# Copyright (C) 2012, SCM Ventures AB
|
2
|
+
# Author: Ian Delahorne <ian@scmventures.se>
|
3
|
+
#
|
4
|
+
# Permission to use, copy, modify, and/or distribute this software for
|
5
|
+
# any purpose with or without fee is hereby granted, provided that the
|
6
|
+
# above copyright notice and this permission notice appear in all
|
7
|
+
# copies.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
10
|
+
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
11
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
12
|
+
# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
13
|
+
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
|
14
|
+
# OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
15
|
+
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
16
|
+
# PERFORMANCE OF THIS SOFTWARE
|
17
|
+
|
18
|
+
require 'chef/knife'
|
19
|
+
require 'chef/knife/base_vsphere_command'
|
20
|
+
|
21
|
+
def number_to_human_size(number)
|
22
|
+
number = number.to_f
|
23
|
+
storage_units_fmt = %w(byte kB MB GB TB)
|
24
|
+
base = 1024
|
25
|
+
if number.to_i < base
|
26
|
+
unit = storage_units_fmt[0]
|
27
|
+
else
|
28
|
+
max_exp = storage_units_fmt.size - 1
|
29
|
+
exponent = (Math.log(number) / Math.log(base)).to_i # Convert to base
|
30
|
+
exponent = max_exp if exponent > max_exp # we need this to avoid overflow for the highest unit
|
31
|
+
number /= base**exponent
|
32
|
+
unit = storage_units_fmt[exponent]
|
33
|
+
end
|
34
|
+
|
35
|
+
format('%0.2f %s', number, unit)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Lists all known data stores in datacenter with sizes
|
39
|
+
class Chef::Knife::VsphereDatastoreList < Chef::Knife::BaseVsphereCommand
|
40
|
+
banner 'knife vsphere datastore list'
|
41
|
+
|
42
|
+
common_options
|
43
|
+
|
44
|
+
option :list,
|
45
|
+
long: '--list',
|
46
|
+
short: '-L',
|
47
|
+
description: "Indicates whether to list VM's in datastore",
|
48
|
+
boolean: true
|
49
|
+
|
50
|
+
def run
|
51
|
+
$stdout.sync = true
|
52
|
+
|
53
|
+
vim_connection
|
54
|
+
dc = datacenter
|
55
|
+
dc.datastore.each do |store|
|
56
|
+
avail = number_to_human_size(store.summary[:freeSpace])
|
57
|
+
cap = number_to_human_size(store.summary[:capacity])
|
58
|
+
puts "#{ui.color('Datastore', :cyan)}: #{store.name} (#{avail} / #{cap})"
|
59
|
+
next unless get_config(:list)
|
60
|
+
store.vm.each do |vms|
|
61
|
+
host_name = vms.guest[:hostName]
|
62
|
+
guest_full_name = vms.guest[:guest_full_name]
|
63
|
+
guest_state = vms.guest[:guest_state]
|
64
|
+
puts "#{ui.color('VM Name:', :green)} #{host_name} #{ui.color('OS:', :magenta)} #{guest_full_name} #{ui.color('State:', :cyan)} #{guest_state}"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -1,49 +1,48 @@
|
|
1
|
-
# Copyright (C) 2012, SCM Ventures AB
|
2
|
-
# Author: Ian Delahorne <ian@scmventures.se>
|
3
|
-
#
|
4
|
-
# Permission to use, copy, modify, and/or distribute this software for
|
5
|
-
# any purpose with or without fee is hereby granted, provided that the
|
6
|
-
# above copyright notice and this permission notice appear in all
|
7
|
-
# copies.
|
8
|
-
#
|
9
|
-
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
10
|
-
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
11
|
-
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
12
|
-
# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
13
|
-
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
|
14
|
-
# OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
15
|
-
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
16
|
-
# PERFORMANCE OF THIS SOFTWARE
|
17
|
-
|
18
|
-
require 'chef/knife'
|
19
|
-
require 'chef/knife/base_vsphere_command'
|
20
|
-
|
21
|
-
# Gets the data store with the most free space in datacenter
|
22
|
-
class Chef::Knife::VsphereDatastoreMaxfree < Chef::Knife::BaseVsphereCommand
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
1
|
+
# Copyright (C) 2012, SCM Ventures AB
|
2
|
+
# Author: Ian Delahorne <ian@scmventures.se>
|
3
|
+
#
|
4
|
+
# Permission to use, copy, modify, and/or distribute this software for
|
5
|
+
# any purpose with or without fee is hereby granted, provided that the
|
6
|
+
# above copyright notice and this permission notice appear in all
|
7
|
+
# copies.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
10
|
+
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
11
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
12
|
+
# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
13
|
+
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
|
14
|
+
# OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
15
|
+
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
16
|
+
# PERFORMANCE OF THIS SOFTWARE
|
17
|
+
|
18
|
+
require 'chef/knife'
|
19
|
+
require 'chef/knife/base_vsphere_command'
|
20
|
+
|
21
|
+
# Gets the data store with the most free space in datacenter
|
22
|
+
class Chef::Knife::VsphereDatastoreMaxfree < Chef::Knife::BaseVsphereCommand
|
23
|
+
banner 'knife vsphere datastore maxfree'
|
24
|
+
|
25
|
+
option :regex,
|
26
|
+
short: '-r REGEX',
|
27
|
+
long: '--regex REGEX',
|
28
|
+
description: 'Regex to match the datastore name',
|
29
|
+
default: ''
|
30
|
+
|
31
|
+
common_options
|
32
|
+
|
33
|
+
def run
|
34
|
+
$stdout.sync = true
|
35
|
+
|
36
|
+
vim_connection
|
37
|
+
dcname = get_config(:vsphere_dc)
|
38
|
+
regex = /#{Regexp.escape(get_config(:regex))}/
|
39
|
+
dc = config[:vim].serviceInstance.find_datacenter(dcname) || abort('datacenter not found')
|
40
|
+
max = nil
|
41
|
+
dc.datastore.each do |store|
|
42
|
+
if regex.match(store.name) && (max.nil? || max.summary[:freeSpace] < store.summary[:freeSpace])
|
43
|
+
max = store
|
44
|
+
end
|
45
|
+
end
|
46
|
+
puts max ? max.name : ''
|
47
|
+
end
|
48
|
+
end
|