rvc 1.5.0 → 1.6.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.
Files changed (54) hide show
  1. data/README.rdoc +1 -1
  2. data/Rakefile +2 -1
  3. data/VERSION +1 -1
  4. data/bin/rvc +53 -9
  5. data/lib/rvc/completion.rb +57 -19
  6. data/lib/rvc/extensions/ComputeResource.rb +2 -2
  7. data/lib/rvc/extensions/DVPortSetting.rb +108 -0
  8. data/lib/rvc/extensions/Datacenter.rb +19 -4
  9. data/lib/rvc/extensions/Datastore.rb +6 -1
  10. data/lib/rvc/extensions/DistributedVirtualPort.rb +146 -0
  11. data/lib/rvc/extensions/DistributedVirtualPortgroup.rb +274 -10
  12. data/lib/rvc/extensions/DistributedVirtualSwitch.rb +124 -3
  13. data/lib/rvc/extensions/Folder.rb +9 -2
  14. data/lib/rvc/extensions/HostSystem.rb +60 -0
  15. data/lib/rvc/extensions/ManagedEntity.rb +19 -0
  16. data/lib/rvc/extensions/ParaVirtualSCSIController.rb +25 -0
  17. data/lib/rvc/extensions/PerfCounterInfo.rb +26 -0
  18. data/lib/rvc/extensions/PerformanceManager.rb +83 -0
  19. data/lib/rvc/extensions/ResourcePool.rb +21 -0
  20. data/lib/rvc/extensions/VirtualDevice.rb +59 -0
  21. data/lib/rvc/extensions/VirtualDisk.rb +25 -0
  22. data/lib/rvc/extensions/VirtualEthernetCard.rb +32 -0
  23. data/lib/rvc/extensions/VirtualMachine.rb +112 -1
  24. data/lib/rvc/field.rb +122 -0
  25. data/lib/rvc/filesystem_session.rb +20 -0
  26. data/lib/rvc/inventory.rb +35 -12
  27. data/lib/rvc/known_hosts.rb +20 -0
  28. data/lib/rvc/memory_session.rb +20 -0
  29. data/lib/rvc/modules.rb +67 -7
  30. data/lib/rvc/modules/alarm.rb +37 -0
  31. data/lib/rvc/modules/basic.rb +172 -41
  32. data/lib/rvc/modules/cluster.rb +18 -2
  33. data/lib/rvc/modules/core.rb +63 -0
  34. data/lib/rvc/modules/datastore.rb +158 -0
  35. data/lib/rvc/modules/device.rb +275 -0
  36. data/lib/rvc/modules/esxcli.rb +193 -0
  37. data/lib/rvc/modules/find.rb +125 -0
  38. data/lib/rvc/modules/issue.rb +33 -0
  39. data/lib/rvc/modules/perf.rb +284 -0
  40. data/lib/rvc/modules/permissions.rb +20 -0
  41. data/lib/rvc/modules/resource_pool.rb +69 -0
  42. data/lib/rvc/modules/role.rb +23 -3
  43. data/lib/rvc/modules/snapshot.rb +20 -0
  44. data/lib/rvc/modules/vds.rb +605 -0
  45. data/lib/rvc/modules/vim.rb +103 -26
  46. data/lib/rvc/modules/vm.rb +93 -220
  47. data/lib/rvc/modules/vnc.rb +50 -13
  48. data/lib/rvc/option_parser.rb +50 -2
  49. data/lib/rvc/readline-ffi.rb +2 -1
  50. data/lib/rvc/shell.rb +34 -33
  51. data/lib/rvc/util.rb +120 -2
  52. data/test/test_fs.rb +9 -5
  53. data/test/test_metric.rb +79 -0
  54. metadata +33 -3
@@ -0,0 +1,79 @@
1
+ require 'test/unit'
2
+ require 'rvc'
3
+
4
+ class MetricTest < Test::Unit::TestCase
5
+ def test_decimal_str
6
+ [
7
+ [0.2, '', '0.20'],
8
+ [2, '', '2.00'],
9
+ [2, 'B', '2.00 B'],
10
+ [2 * 10**3, 'B', '2.00 kB'],
11
+ [2 * 10**6, 'B', '2.00 MB'],
12
+ [2 * 10**9, 'B', '2.00 GB'],
13
+ [2 * 10**12, 'B', '2.00 TB'],
14
+ [2 * 10**15, 'B', '2.00 PB'],
15
+ [2 * 10**18, 'B', '2000.00 PB'],
16
+ ].each do |v, u, s|
17
+ assert_equal MetricNumber.new(v, u).to_s, s, "test #{[v,u,s].inspect}"
18
+ end
19
+ end
20
+
21
+ def test_binary_str
22
+ [
23
+ [0.2, '', '0.20'],
24
+ [2, '', '2.00'],
25
+ [2, 'B', '2.00 B'],
26
+ [2 * 2**10, 'B', '2.00 KiB'],
27
+ [2 * 2**20, 'B', '2.00 MiB'],
28
+ [2 * 2**30, 'B', '2.00 GiB'],
29
+ [2 * 2**40, 'B', '2.00 TiB'],
30
+ [2 * 2**50, 'B', '2.00 PiB'],
31
+ [2 * 2**60, 'B', '2048.00 PiB'],
32
+ ].each do |v, u, s|
33
+ assert_equal MetricNumber.new(v, u, true).to_s, s, "test #{[v,u,s].inspect}"
34
+ end
35
+ end
36
+
37
+ def assert_metrics_equal a, b, msg=nil
38
+ assert_equal a, b, "a != b in #{msg}"
39
+ assert_equal a.unit, b.unit, "a.unit != b.unit in #{msg}"
40
+ assert_equal a.binary, b.binary, "a.binary != b.binary in #{msg}"
41
+ end
42
+
43
+ def test_decimal_parse
44
+ [
45
+ [2, '', '2'],
46
+ [2, 'B', '2B'],
47
+ [2, 'B', '2 B'],
48
+ [2 * 10**3, 'B', '2 kB'],
49
+ [2 * 10**3, 'B', '2 KB'],
50
+ [2 * 10**6, 'B', '2 MB'],
51
+ [2 * 10**9, 'B', '2 GB'],
52
+ [2 * 10**12, 'B', '2 TB'],
53
+ [2 * 10**15, 'B', '2 PB'],
54
+ [2 * 10**18, 'B', '2000 PB'],
55
+ [3140000, 'B', '3140 kB'],
56
+ [3140000, 'B', '3.14 MB'],
57
+ [3140000, 'B', '3,140,000.00 B'],
58
+ [500, 'B', '0.5 KB'],
59
+ ].each do |v, u, s|
60
+ assert_metrics_equal MetricNumber.new(v, u), MetricNumber.parse(s), "test #{[v,u,s].inspect}"
61
+ end
62
+ end
63
+
64
+ def test_binary_parse
65
+ [
66
+ [2 * 2**10, 'B', '2 KiB'],
67
+ [2 * 2**20, 'B', '2 MiB'],
68
+ [2 * 2**30, 'B', '2 GiB'],
69
+ [2 * 2**40, 'B', '2 TiB'],
70
+ [2 * 2**50, 'B', '2 PiB'],
71
+ [2 * 2**60, 'B', '2048 PiB'],
72
+ [3215360, 'B', '3140 KiB'],
73
+ [3670016, 'B', '3.5 MIB'],
74
+ [512, 'B', '0.5 KiB'],
75
+ ].each do |v, u, s|
76
+ assert_metrics_equal MetricNumber.new(v, u, true), MetricNumber.parse(s), "test #{[v,u,s].inspect}"
77
+ end
78
+ end
79
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rvc
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.5.0
5
+ version: 1.6.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Rich Lane
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-09-02 00:00:00 -07:00
13
+ date: 2012-02-03 00:00:00 -08:00
14
14
  default_executable: rvc
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: 1.3.0
24
+ version: 1.5.0
25
25
  type: :runtime
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency
@@ -68,6 +68,17 @@ dependencies:
68
68
  version: 2.0.2
69
69
  type: :runtime
70
70
  version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: terminal-table
73
+ prerelease: false
74
+ requirement: &id006 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 1.4.2
80
+ type: :runtime
81
+ version_requirements: *id006
71
82
  description:
72
83
  email: rlane@vmware.com
73
84
  executables:
@@ -89,33 +100,50 @@ files:
89
100
  - lib/rvc/completion.rb
90
101
  - lib/rvc/extensions/ClusterComputeResource.rb
91
102
  - lib/rvc/extensions/ComputeResource.rb
103
+ - lib/rvc/extensions/DVPortSetting.rb
92
104
  - lib/rvc/extensions/Datacenter.rb
93
105
  - lib/rvc/extensions/Datastore.rb
106
+ - lib/rvc/extensions/DistributedVirtualPort.rb
94
107
  - lib/rvc/extensions/DistributedVirtualPortgroup.rb
95
108
  - lib/rvc/extensions/DistributedVirtualSwitch.rb
96
109
  - lib/rvc/extensions/Folder.rb
97
110
  - lib/rvc/extensions/HostSystem.rb
98
111
  - lib/rvc/extensions/ManagedEntity.rb
99
112
  - lib/rvc/extensions/Network.rb
113
+ - lib/rvc/extensions/ParaVirtualSCSIController.rb
114
+ - lib/rvc/extensions/PerfCounterInfo.rb
115
+ - lib/rvc/extensions/PerformanceManager.rb
100
116
  - lib/rvc/extensions/ResourcePool.rb
117
+ - lib/rvc/extensions/VirtualDevice.rb
118
+ - lib/rvc/extensions/VirtualDisk.rb
119
+ - lib/rvc/extensions/VirtualEthernetCard.rb
101
120
  - lib/rvc/extensions/VirtualMachine.rb
121
+ - lib/rvc/field.rb
102
122
  - lib/rvc/filesystem_session.rb
103
123
  - lib/rvc/fs.rb
104
124
  - lib/rvc/inventory.rb
105
125
  - lib/rvc/known_hosts.rb
106
126
  - lib/rvc/memory_session.rb
107
127
  - lib/rvc/modules.rb
128
+ - lib/rvc/modules/alarm.rb
108
129
  - lib/rvc/modules/basic.rb
109
130
  - lib/rvc/modules/cluster.rb
131
+ - lib/rvc/modules/core.rb
110
132
  - lib/rvc/modules/datacenter.rb
111
133
  - lib/rvc/modules/datastore.rb
134
+ - lib/rvc/modules/device.rb
135
+ - lib/rvc/modules/esxcli.rb
136
+ - lib/rvc/modules/find.rb
112
137
  - lib/rvc/modules/host.rb
138
+ - lib/rvc/modules/issue.rb
113
139
  - lib/rvc/modules/mark.rb
140
+ - lib/rvc/modules/perf.rb
114
141
  - lib/rvc/modules/permissions.rb
115
142
  - lib/rvc/modules/resource_pool.rb
116
143
  - lib/rvc/modules/role.rb
117
144
  - lib/rvc/modules/snapshot.rb
118
145
  - lib/rvc/modules/statsinterval.rb
146
+ - lib/rvc/modules/vds.rb
119
147
  - lib/rvc/modules/vim.rb
120
148
  - lib/rvc/modules/vm.rb
121
149
  - lib/rvc/modules/vmrc.rb
@@ -128,6 +156,7 @@ files:
128
156
  - lib/rvc/util.rb
129
157
  - test/inventory_fixtures.rb
130
158
  - test/test_fs.rb
159
+ - test/test_metric.rb
131
160
  - test/test_parse_path.rb
132
161
  has_rdoc: true
133
162
  homepage:
@@ -160,4 +189,5 @@ summary: vSphere console UI
160
189
  test_files:
161
190
  - test/inventory_fixtures.rb
162
191
  - test/test_fs.rb
192
+ - test/test_metric.rb
163
193
  - test/test_parse_path.rb