chef-ruby-lvm-attrib 0.0.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.gitmodules +3 -0
  4. data/CHANGELOG.md +51 -0
  5. data/Gemfile +7 -0
  6. data/README.md +74 -0
  7. data/Rakefile +9 -0
  8. data/bin/generate_field_data +203 -0
  9. data/di-ruby-lvm-attrib.gemspec +18 -0
  10. data/lib/lvm/attributes.rb +29 -0
  11. data/lib/lvm/attributes/2.02.100(2)/lvs.yaml +156 -0
  12. data/lib/lvm/attributes/2.02.100(2)/lvsseg.yaml +84 -0
  13. data/lib/lvm/attributes/2.02.100(2)/pvs.yaml +81 -0
  14. data/lib/lvm/attributes/2.02.100(2)/pvsseg.yaml +16 -0
  15. data/lib/lvm/attributes/2.02.100(2)/vgs.yaml +96 -0
  16. data/lib/lvm/attributes/2.02.104(2)/lvs.yaml +156 -0
  17. data/lib/lvm/attributes/2.02.104(2)/lvsseg.yaml +88 -0
  18. data/lib/lvm/attributes/2.02.104(2)/pvs.yaml +81 -0
  19. data/lib/lvm/attributes/2.02.104(2)/pvsseg.yaml +16 -0
  20. data/lib/lvm/attributes/2.02.104(2)/vgs.yaml +96 -0
  21. data/lib/lvm/attributes/2.02.105(2)/lvs.yaml +156 -0
  22. data/lib/lvm/attributes/2.02.105(2)/lvsseg.yaml +92 -0
  23. data/lib/lvm/attributes/2.02.105(2)/pvs.yaml +81 -0
  24. data/lib/lvm/attributes/2.02.105(2)/pvsseg.yaml +16 -0
  25. data/lib/lvm/attributes/2.02.105(2)/vgs.yaml +96 -0
  26. data/lib/lvm/attributes/2.02.106(2)/lvs.yaml +156 -0
  27. data/lib/lvm/attributes/2.02.106(2)/lvsseg.yaml +92 -0
  28. data/lib/lvm/attributes/2.02.106(2)/pvs.yaml +81 -0
  29. data/lib/lvm/attributes/2.02.106(2)/pvsseg.yaml +16 -0
  30. data/lib/lvm/attributes/2.02.106(2)/vgs.yaml +96 -0
  31. data/lib/lvm/attributes/2.02.111(2)/lvs.yaml +220 -0
  32. data/lib/lvm/attributes/2.02.111(2)/lvsseg.yaml +92 -0
  33. data/lib/lvm/attributes/2.02.111(2)/pvs.yaml +92 -0
  34. data/lib/lvm/attributes/2.02.111(2)/pvsseg.yaml +16 -0
  35. data/lib/lvm/attributes/2.02.111(2)/vgs.yaml +120 -0
  36. data/lib/lvm/attributes/2.02.114(2)/lvs.yaml +220 -0
  37. data/lib/lvm/attributes/2.02.114(2)/lvsseg.yaml +96 -0
  38. data/lib/lvm/attributes/2.02.114(2)/pvs.yaml +93 -0
  39. data/lib/lvm/attributes/2.02.114(2)/pvsseg.yaml +16 -0
  40. data/lib/lvm/attributes/2.02.114(2)/vgs.yaml +120 -0
  41. data/lib/lvm/attributes/2.02.115(2)/lvs.yaml +220 -0
  42. data/lib/lvm/attributes/2.02.115(2)/lvsseg.yaml +104 -0
  43. data/lib/lvm/attributes/2.02.115(2)/pvs.yaml +93 -0
  44. data/lib/lvm/attributes/2.02.115(2)/pvsseg.yaml +16 -0
  45. data/lib/lvm/attributes/2.02.115(2)/vgs.yaml +120 -0
  46. data/lib/lvm/attributes/2.02.116(2)/lvs.yaml +220 -0
  47. data/lib/lvm/attributes/2.02.116(2)/lvsseg.yaml +104 -0
  48. data/lib/lvm/attributes/2.02.116(2)/pvs.yaml +93 -0
  49. data/lib/lvm/attributes/2.02.116(2)/pvsseg.yaml +16 -0
  50. data/lib/lvm/attributes/2.02.116(2)/vgs.yaml +120 -0
  51. data/lib/lvm/attributes/2.02.118(2)/lvs.yaml +220 -0
  52. data/lib/lvm/attributes/2.02.118(2)/lvsseg.yaml +104 -0
  53. data/lib/lvm/attributes/2.02.118(2)/pvs.yaml +93 -0
  54. data/lib/lvm/attributes/2.02.118(2)/pvsseg.yaml +16 -0
  55. data/lib/lvm/attributes/2.02.118(2)/vgs.yaml +124 -0
  56. data/lib/lvm/attributes/2.02.119(2)/lvs.yaml +228 -0
  57. data/lib/lvm/attributes/2.02.119(2)/lvsseg.yaml +104 -0
  58. data/lib/lvm/attributes/2.02.119(2)/pvs.yaml +93 -0
  59. data/lib/lvm/attributes/2.02.119(2)/pvsseg.yaml +16 -0
  60. data/lib/lvm/attributes/2.02.119(2)/vgs.yaml +124 -0
  61. data/lib/lvm/attributes/2.02.120(2)/lvs.yaml +228 -0
  62. data/lib/lvm/attributes/2.02.120(2)/lvsseg.yaml +104 -0
  63. data/lib/lvm/attributes/2.02.120(2)/pvs.yaml +93 -0
  64. data/lib/lvm/attributes/2.02.120(2)/pvsseg.yaml +16 -0
  65. data/lib/lvm/attributes/2.02.120(2)/vgs.yaml +124 -0
  66. data/lib/lvm/attributes/2.02.122(2)/lvs.yaml +228 -0
  67. data/lib/lvm/attributes/2.02.122(2)/lvsseg.yaml +104 -0
  68. data/lib/lvm/attributes/2.02.122(2)/pvs.yaml +93 -0
  69. data/lib/lvm/attributes/2.02.122(2)/pvsseg.yaml +16 -0
  70. data/lib/lvm/attributes/2.02.122(2)/vgs.yaml +124 -0
  71. data/lib/lvm/attributes/2.02.130(2)/lvs.yaml +232 -0
  72. data/lib/lvm/attributes/2.02.130(2)/lvsseg.yaml +104 -0
  73. data/lib/lvm/attributes/2.02.130(2)/pvs.yaml +93 -0
  74. data/lib/lvm/attributes/2.02.130(2)/pvsseg.yaml +16 -0
  75. data/lib/lvm/attributes/2.02.130(2)/vgs.yaml +132 -0
  76. data/lib/lvm/attributes/2.02.132(2)/lvs.yaml +260 -0
  77. data/lib/lvm/attributes/2.02.132(2)/lvsseg.yaml +104 -0
  78. data/lib/lvm/attributes/2.02.132(2)/pvs.yaml +93 -0
  79. data/lib/lvm/attributes/2.02.132(2)/pvsseg.yaml +16 -0
  80. data/lib/lvm/attributes/2.02.132(2)/vgs.yaml +132 -0
  81. data/lib/lvm/attributes/2.02.133(2)/lvs.yaml +260 -0
  82. data/lib/lvm/attributes/2.02.133(2)/lvsseg.yaml +113 -0
  83. data/lib/lvm/attributes/2.02.133(2)/pvs.yaml +93 -0
  84. data/lib/lvm/attributes/2.02.133(2)/pvsseg.yaml +16 -0
  85. data/lib/lvm/attributes/2.02.133(2)/vgs.yaml +136 -0
  86. data/lib/lvm/attributes/2.02.143(2)/lvs.yaml +260 -0
  87. data/lib/lvm/attributes/2.02.143(2)/lvsseg.yaml +118 -0
  88. data/lib/lvm/attributes/2.02.143(2)/pvs.yaml +101 -0
  89. data/lib/lvm/attributes/2.02.143(2)/pvsseg.yaml +16 -0
  90. data/lib/lvm/attributes/2.02.143(2)/vgs.yaml +136 -0
  91. data/lib/lvm/attributes/2.02.149(2)/lvs.yaml +276 -0
  92. data/lib/lvm/attributes/2.02.149(2)/lvsseg.yaml +106 -0
  93. data/lib/lvm/attributes/2.02.149(2)/pvs.yaml +109 -0
  94. data/lib/lvm/attributes/2.02.149(2)/pvsseg.yaml +16 -0
  95. data/lib/lvm/attributes/2.02.149(2)/vgs.yaml +136 -0
  96. data/lib/lvm/attributes/2.02.158(2)/lvs.yaml +256 -0
  97. data/lib/lvm/attributes/2.02.158(2)/lvsseg.yaml +106 -0
  98. data/lib/lvm/attributes/2.02.158(2)/pvs.yaml +113 -0
  99. data/lib/lvm/attributes/2.02.158(2)/pvsseg.yaml +16 -0
  100. data/lib/lvm/attributes/2.02.158(2)/vgs.yaml +136 -0
  101. data/lib/lvm/attributes/2.02.161(2)/lvs.yaml +256 -0
  102. data/lib/lvm/attributes/2.02.161(2)/lvsseg.yaml +106 -0
  103. data/lib/lvm/attributes/2.02.161(2)/pvs.yaml +113 -0
  104. data/lib/lvm/attributes/2.02.161(2)/pvsseg.yaml +16 -0
  105. data/lib/lvm/attributes/2.02.161(2)/vgs.yaml +136 -0
  106. data/lib/lvm/attributes/2.02.166(2)/lvs.yaml +256 -0
  107. data/lib/lvm/attributes/2.02.166(2)/lvsseg.yaml +106 -0
  108. data/lib/lvm/attributes/2.02.166(2)/pvs.yaml +113 -0
  109. data/lib/lvm/attributes/2.02.166(2)/pvsseg.yaml +16 -0
  110. data/lib/lvm/attributes/2.02.166(2)/vgs.yaml +136 -0
  111. data/lib/lvm/attributes/2.02.167(2)/lvs.yaml +256 -0
  112. data/lib/lvm/attributes/2.02.167(2)/lvsseg.yaml +106 -0
  113. data/lib/lvm/attributes/2.02.167(2)/pvs.yaml +113 -0
  114. data/lib/lvm/attributes/2.02.167(2)/pvsseg.yaml +16 -0
  115. data/lib/lvm/attributes/2.02.167(2)/vgs.yaml +136 -0
  116. data/lib/lvm/attributes/2.02.26/lvs.yaml +72 -0
  117. data/lib/lvm/attributes/2.02.26/lvsseg.yaml +56 -0
  118. data/lib/lvm/attributes/2.02.26/pvs.yaml +56 -0
  119. data/lib/lvm/attributes/2.02.26/pvsseg.yaml +16 -0
  120. data/lib/lvm/attributes/2.02.26/vgs.yaml +72 -0
  121. data/lib/lvm/attributes/2.02.27/lvs.yaml +72 -0
  122. data/lib/lvm/attributes/2.02.27/lvsseg.yaml +56 -0
  123. data/lib/lvm/attributes/2.02.27/pvs.yaml +60 -0
  124. data/lib/lvm/attributes/2.02.27/pvsseg.yaml +16 -0
  125. data/lib/lvm/attributes/2.02.27/vgs.yaml +76 -0
  126. data/lib/lvm/attributes/2.02.29/lvs.yaml +80 -0
  127. data/lib/lvm/attributes/2.02.29/lvsseg.yaml +56 -0
  128. data/lib/lvm/attributes/2.02.29/pvs.yaml +64 -0
  129. data/lib/lvm/attributes/2.02.29/pvsseg.yaml +16 -0
  130. data/lib/lvm/attributes/2.02.29/vgs.yaml +80 -0
  131. data/lib/lvm/attributes/2.02.30/lvs.yaml +84 -0
  132. data/lib/lvm/attributes/2.02.30/lvsseg.yaml +64 -0
  133. data/lib/lvm/attributes/2.02.30/pvs.yaml +64 -0
  134. data/lib/lvm/attributes/2.02.30/pvsseg.yaml +16 -0
  135. data/lib/lvm/attributes/2.02.30/vgs.yaml +80 -0
  136. data/lib/lvm/attributes/2.02.54(1)/lvs.yaml +88 -0
  137. data/lib/lvm/attributes/2.02.54(1)/lvsseg.yaml +64 -0
  138. data/lib/lvm/attributes/2.02.54(1)/pvs.yaml +68 -0
  139. data/lib/lvm/attributes/2.02.54(1)/pvsseg.yaml +16 -0
  140. data/lib/lvm/attributes/2.02.54(1)/vgs.yaml +84 -0
  141. data/lib/lvm/attributes/2.02.66(2)/lvs.yaml +88 -0
  142. data/lib/lvm/attributes/2.02.66(2)/lvsseg.yaml +64 -0
  143. data/lib/lvm/attributes/2.02.66(2)/pvs.yaml +68 -0
  144. data/lib/lvm/attributes/2.02.66(2)/pvsseg.yaml +16 -0
  145. data/lib/lvm/attributes/2.02.66(2)/vgs.yaml +84 -0
  146. data/lib/lvm/attributes/2.02.74(2)/lvs.yaml +91 -0
  147. data/lib/lvm/attributes/2.02.74(2)/lvsseg.yaml +63 -0
  148. data/lib/lvm/attributes/2.02.74(2)/pvs.yaml +71 -0
  149. data/lib/lvm/attributes/2.02.74(2)/pvsseg.yaml +15 -0
  150. data/lib/lvm/attributes/2.02.74(2)/vgs.yaml +91 -0
  151. data/lib/lvm/attributes/2.02.83(2)/lvs.yaml +91 -0
  152. data/lib/lvm/attributes/2.02.83(2)/lvsseg.yaml +63 -0
  153. data/lib/lvm/attributes/2.02.83(2)/pvs.yaml +71 -0
  154. data/lib/lvm/attributes/2.02.83(2)/pvsseg.yaml +15 -0
  155. data/lib/lvm/attributes/2.02.83(2)/vgs.yaml +91 -0
  156. data/lib/lvm/attributes/2.02.84(2)/lvs.yaml +92 -0
  157. data/lib/lvm/attributes/2.02.84(2)/lvsseg.yaml +64 -0
  158. data/lib/lvm/attributes/2.02.84(2)/pvs.yaml +72 -0
  159. data/lib/lvm/attributes/2.02.84(2)/pvsseg.yaml +16 -0
  160. data/lib/lvm/attributes/2.02.84(2)/vgs.yaml +92 -0
  161. data/lib/lvm/attributes/2.02.86(2)/lvs.yaml +92 -0
  162. data/lib/lvm/attributes/2.02.86(2)/lvsseg.yaml +64 -0
  163. data/lib/lvm/attributes/2.02.86(2)/pvs.yaml +72 -0
  164. data/lib/lvm/attributes/2.02.86(2)/pvsseg.yaml +16 -0
  165. data/lib/lvm/attributes/2.02.86(2)/vgs.yaml +92 -0
  166. data/lib/lvm/attributes/2.02.87(2)/lvs.yaml +91 -0
  167. data/lib/lvm/attributes/2.02.87(2)/lvsseg.yaml +63 -0
  168. data/lib/lvm/attributes/2.02.87(2)/pvs.yaml +71 -0
  169. data/lib/lvm/attributes/2.02.87(2)/pvsseg.yaml +15 -0
  170. data/lib/lvm/attributes/2.02.87(2)/vgs.yaml +91 -0
  171. data/lib/lvm/attributes/2.02.88(2)/lvs.yaml +92 -0
  172. data/lib/lvm/attributes/2.02.88(2)/lvsseg.yaml +64 -0
  173. data/lib/lvm/attributes/2.02.88(2)/pvs.yaml +72 -0
  174. data/lib/lvm/attributes/2.02.88(2)/pvsseg.yaml +16 -0
  175. data/lib/lvm/attributes/2.02.88(2)/vgs.yaml +92 -0
  176. data/lib/lvm/attributes/2.02.95(2)/lvs.yaml +124 -0
  177. data/lib/lvm/attributes/2.02.95(2)/lvsseg.yaml +76 -0
  178. data/lib/lvm/attributes/2.02.95(2)/pvs.yaml +72 -0
  179. data/lib/lvm/attributes/2.02.95(2)/pvsseg.yaml +16 -0
  180. data/lib/lvm/attributes/2.02.95(2)/vgs.yaml +92 -0
  181. data/lib/lvm/attributes/2.02.98(2)/lvs.yaml +124 -0
  182. data/lib/lvm/attributes/2.02.98(2)/lvsseg.yaml +80 -0
  183. data/lib/lvm/attributes/2.02.98(2)/pvs.yaml +72 -0
  184. data/lib/lvm/attributes/2.02.98(2)/pvsseg.yaml +16 -0
  185. data/lib/lvm/attributes/2.02.98(2)/vgs.yaml +92 -0
  186. data/test/test_ruby-lvm-attributes.rb +0 -0
  187. data/update-lvm.sh +136 -0
  188. metadata +237 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9db1aac413fbd4d2120278b2368623e135c9861b
4
+ data.tar.gz: 0f80d064e8697de47640882d64baef9f8f7c7293
5
+ SHA512:
6
+ metadata.gz: c72654fb2694e1d6bd443600d2df6cab52c2a9124abaebba34cee3a6e088b2e039512bd863d321c901b3a742e77ad2a018f6f84f14a5798f54f1419595ee0c5c
7
+ data.tar.gz: 8345f5b478110930ab269b564328da46f40e2defd45cf2b843f1e898de92d89e440a62a5e09d37478c1db4298bbcf17fbd4db91e98cc141ea49b3e9872609efd
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ *.sw?
2
+ Gemfile.lock
3
+ pkg/
4
+ tmp/
5
+ coverage/
6
+ .DS_Store
7
+ .bundle
8
+ *~
9
+ vendor
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "lvm2"]
2
+ path = lvm2
3
+ url = git://git.fedorahosted.org/git/lvm2.git
data/CHANGELOG.md ADDED
@@ -0,0 +1,51 @@
1
+ # 0.0.28 (2016-12-12)
2
+
3
+ - Added LVM attributes for version 2.02.166(2)
4
+ - Added LVM attributes for version 2.02.167(2)
5
+ - Corrected all Chefstyle (rubocop) warnings
6
+ - update-lvm.sh: exit with error if nothing updated
7
+ - Add Gemfile for dev deps (chefstyle for now)
8
+ - Added rakefile for gem releases and chefstyle
9
+
10
+ # 0.0.27 (2016-09-06)
11
+
12
+ - Added LVM attributes for version 2.02.161(2)
13
+ - Added LVM attributes for version 2.02.158(2)
14
+ - Reworked update script to use git submodules rather than relying on the user to check out the LVM source. #47
15
+ - Added LVM attributes for version 2.0.2.133(2)
16
+
17
+ # 0.0.26 (2016-05-12)
18
+
19
+ - Added LVM attributes for version 2.02.149
20
+ - Added LVM attributes for version 2.02.143(2)
21
+
22
+ # 0.0.25 (2016-03-08)
23
+
24
+ - Added LVM attributes for version 2.02.122(2)
25
+
26
+ # 0.0.24 (2016-02-25)
27
+
28
+ - Added LVM attributes for version 2.0.2.120
29
+ - Added a CHANGELOG
30
+
31
+ # 0.0.23 (2015-12-04)
32
+
33
+ - Added LVM attributes for version 2.0.2.116
34
+
35
+ # 0.0.22 (2015-12-02)
36
+
37
+ - Added LVM attributes for versions 2.02.130 and 2.02.132
38
+
39
+ # 0.0.21 (2015-08-04)
40
+
41
+ - Added LVM attributes for versions 2.02.118 and 2.02.119
42
+
43
+ # 0.0.20 (2015-06-05)
44
+
45
+ - Added LVM attributes for version 2.02.114
46
+
47
+ # 0.0.19 (2015-05-30)
48
+
49
+ - Added LVM attributes for version 2.02.111
50
+ - Added MIT license to the Gemspec
51
+ - Gemspec now properly loads the version from the lib/attributes.rb file
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem "chefstyle"
7
+ end
data/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # ruby-lvm-attrib
2
+
3
+ This is a list of attributes for lvm objects. They are generated from the source code and broken down by version. See ADDING ATTRIBUTES below to contribute.
4
+
5
+ At their core these files exist to determine which arguments to pass lvs/vgs/pvs and the subsequent type conversions.
6
+
7
+ Currently this is split from the main ruby-lvm gem since these files require updating to follow LVM2 releases.
8
+
9
+ ## Usage
10
+
11
+ ```ruby
12
+ require 'lvm/attributes'
13
+
14
+ attributes = Attributes.load("2.0.36", "vgs.yaml")
15
+ ```
16
+
17
+ ## Requirements
18
+
19
+ - None
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ sudo gem install ruby-lvm-attrib
25
+ ```
26
+
27
+ ## Updating for new LVM releases
28
+
29
+ To add attributes:
30
+
31
+ Use
32
+
33
+ <update-lvm.sh> script to add new version. Find the interested LVM2 tag from <a href="https://git.fedorahosted.org/cgit/lvm2.git/refs/tags">LVM2 Repository</a>.</update-lvm.sh>
34
+
35
+ - Fork this repository
36
+ - `git clone your-forked-repo`
37
+ - `cd your-forked-repo`
38
+ - `./update-lvm.sh v2_02_155`
39
+
40
+ The script will add `lib/lvm/attributes/LVM_VERSION` where `LVM_VERSION` being something like `2.02.86(2)` or `2.02.98(2)`.
41
+
42
+ If the script will not error, it will create new branch and commit `Added LVM_VERSION attributes`.
43
+
44
+ In case of error, see missing attribute type note below.
45
+
46
+ If all is well, publish the changes and make Pull Request from GitHub web:
47
+
48
+ - `git push origin mybranch`
49
+ - Submit PR to this repository. **Please make sure to point your pull at the `next` branch -- NOT MASTER!**
50
+
51
+ ### Missing Attribute Type:
52
+
53
+ If you get an error like the below:
54
+
55
+ ```
56
+ Oops, missing type conversion data of column 'discards' use by 'SEGS' which says its going to return a 'discards'
57
+ Figure out the missing type and rerun.
58
+ ```
59
+
60
+ - Look in `path/to/lvm-source/lib/report/columns.h` for the column name in the 7th field.
61
+ - If the 3rd field is NUM, type will be Integer. If 3rd field is STR, type will be String.
62
+ - Add the information to `bin/generate_field_data` in the TYPE_CONVERSION_MAP and try running again
63
+
64
+ ## License
65
+
66
+ (The MIT License)
67
+
68
+ Copyright (c) 2008 Matthew Kent, Bravenet Web Services Inc.
69
+
70
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
71
+
72
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
73
+
74
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task :default => :style
4
+
5
+ require "chefstyle"
6
+ require "rubocop/rake_task"
7
+ RuboCop::RakeTask.new(:style) do |task|
8
+ task.options += ["--display-cop-names", "--no-color"]
9
+ end
@@ -0,0 +1,203 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Build yaml files which provide arguments passed to {lv,pv,vg}s and subsequent
4
+ # type conversions.
5
+ #
6
+ # ./generate_field_data ~/LVM2.2.02.38
7
+
8
+ require "fileutils"
9
+ require "yaml"
10
+
11
+ VERSION_FILE = "/VERSION"
12
+ COLUMNS_FILE = "/lib/report/columns.h"
13
+
14
+ debug = false
15
+
16
+ TYPE_CONVERSION_MAP = {
17
+ # Only types we can really trust
18
+ "uint32" => "Integer",
19
+ "int32" => "Integer",
20
+ # These were determined by reading the code, they invoke _(u)int32_disp right away
21
+ "pvmdas" => "Integer",
22
+ "vgmdas" => "Integer",
23
+ "lvcount" => "Integer",
24
+ "lvsegcount" => "Integer",
25
+ "segstartpe" => "Integer",
26
+ # listed to return STR?
27
+ "lvkmaj" => "Integer",
28
+ "lvkmin" => "Integer",
29
+ "snpercent" => "Float",
30
+ "copypercent" => "Float",
31
+ # size32/64, these do unit formatting unless overridden on command line. We
32
+ # typically want them in bytes so we can convert them to Integers safely
33
+ "size32" => "Integer",
34
+ "size64" => "Integer",
35
+ # These types return size32/size64 as well
36
+ "lvkreadahead" => "Integer",
37
+ "pvsize" => "Integer",
38
+ "devsize" => "Integer",
39
+ "originsize" => "Integer",
40
+ "pvfree" => "Integer",
41
+ "pvused" => "Integer",
42
+ "pvmdafree" => "Integer",
43
+ "pvmdasize" => "Integer",
44
+ "vgsize" => "Integer",
45
+ "vgfree" => "Integer",
46
+ "vgmda_free" => "Integer",
47
+ "chunksize" => "Integer",
48
+ "segstart" => "Integer",
49
+ "segsize" => "Integer",
50
+ "snapcount" => "Integer",
51
+ "vgmdafree" => "Integer",
52
+ "vgmdasize" => "Integer",
53
+ "pvextvsn" => "Integer",
54
+ "vgmissingpvcount" => "Integer",
55
+ # Weird one, can be "auto" or size32
56
+ "lvreadahead" => "String",
57
+ "lvmetadatasize" => "Integer",
58
+ "datapercent" => "Float",
59
+ "metadatapercent" => "Float",
60
+ "pvmdasused" => "Integer",
61
+ "vgmdasused" => "Integer",
62
+ "vgmdacopies" => "Integer",
63
+ "thincount" => "Integer",
64
+ "thinid" => "Integer",
65
+ "discards" => "Integer",
66
+ "thinzero" => "Integer",
67
+ "transactionid" => "Integer",
68
+ "raidmismatchcount" => "Integer",
69
+ "raidwritebehind" => "Integer",
70
+ "raidminrecoveryrate" => "Integer",
71
+ "raidmaxrecoveryrate" => "Integer",
72
+ "segsizepe" => "Integer",
73
+ "thinid" => "Integer",
74
+ # New fields for caching
75
+ "cache_total_blocks" => "Integer",
76
+ "cache_used_blocks" => "Integer",
77
+ "cache_dirty_blocks" => "Integer",
78
+ "cache_read_hits" => "Integer",
79
+ "cache_read_misses" => "Integer",
80
+ "cache_write_hits" => "Integer",
81
+ "cache_write_misses" => "Integer",
82
+ }
83
+
84
+ lvm_source = ARGV[0]
85
+
86
+ version = File.readlines(lvm_source + VERSION_FILE)[0].split(" ")[0]
87
+
88
+ lvs = []
89
+ lvssegs = []
90
+ pvs = []
91
+ pvssegs = []
92
+ vgs = []
93
+ File.readlines(lvm_source + COLUMNS_FILE).each do |line|
94
+ # eg: FIELD(LVS, lv, STR, "LV UUID", lvid.id[1], 38, uuid, "lv_uuid", "Unique identifier")
95
+ next unless line =~ %r{^FIELD\((.*)\)$}
96
+ fields = $1.split(", ")
97
+ fields.each { |f| f.gsub!(%r{^"}, ""); f.gsub!(%r{"$}, "") }
98
+ p fields if debug
99
+ app = fields[0]
100
+ general_type = fields[2]
101
+ specific_type = fields[6]
102
+ column = fields[7]
103
+ method = fields[7].dup
104
+ description = fields[8]
105
+ p app, general_type, specific_type, column, method, description if debug
106
+
107
+ if %w{NUM SIZ}.include?(general_type)
108
+ attribute_type = TYPE_CONVERSION_MAP[specific_type]
109
+ if attribute_type.nil?
110
+ puts "Oops, missing type conversion data of column '#{specific_type}' use by '#{app}' which says its going to return a '#{specific_type}'"
111
+ puts "Figure out the missing type and rerun."
112
+ exit 1
113
+ end
114
+ else
115
+ attribute_type = "String"
116
+ end
117
+
118
+ # our shorter nicer method names, according to the man page these can be
119
+ # dropped when passing column names as arguments as well, but i found a few
120
+ # with issues (seg_start).
121
+ case app
122
+ when "LVS", "LVSINFOSTATUS"
123
+ method.sub!(%r{^lv_}, "")
124
+ when "SEGS"
125
+ method.sub!(%r{^seg_}, "")
126
+ when "LABEL"
127
+ method.sub!(%r{^pv_}, "")
128
+ when "PVS"
129
+ method.sub!(%r{^pv_}, "")
130
+ when "PVSEGS"
131
+ method.sub!(%r{^pvseg_}, "")
132
+ when "VGS"
133
+ method.sub!(%r{^vg_}, "")
134
+ end
135
+
136
+ attribute = {
137
+ :method => method,
138
+ :column => column,
139
+ :type_hint => attribute_type,
140
+ :description => description,
141
+ }
142
+
143
+ case app
144
+ when "LVS", "LVSINFOSTATUS"
145
+ lvs << attribute
146
+ when "SEGS"
147
+ lvssegs << attribute
148
+ when "LABEL"
149
+ pvs << attribute
150
+ when "PVS"
151
+ pvs << attribute
152
+ when "PVSEGS"
153
+ pvssegs << attribute
154
+ when "VGS"
155
+ vgs << attribute
156
+ end
157
+ end
158
+
159
+ # we use vg_uuid as our crossover attribute that links vg->lv and vg->pv
160
+ attribute = { :method => "vg_uuid",
161
+ :column => "vg_uuid",
162
+ :type_hint => "String",
163
+ :description => "For VolumeGroup to LogicalVolume relationship." }
164
+ lvs << attribute
165
+ attribute = { :method => "vg_uuid",
166
+ :column => "vg_uuid",
167
+ :type_hint => "String",
168
+ :description => "For VolumeGroup to PhysicalVolume relationship." }
169
+ pvs << attribute
170
+
171
+ # and we link lv->lvsegment, pv->pvsegment
172
+ attribute = { :method => "lv_uuid",
173
+ :column => "lv_uuid",
174
+ :type_hint => "String",
175
+ :description => "For LogicalVolume to LogicalVolumeSegment relationship." }
176
+ lvssegs << attribute
177
+ attribute = { :method => "pv_uuid",
178
+ :column => "pv_uuid",
179
+ :type_hint => "String",
180
+ :description => "For PhysicalVolume to PhysicalVolumeSegment relationship." }
181
+ pvssegs << attribute
182
+
183
+ lvs.sort! { |x, y| x[:column] <=> y[:column] }
184
+ lvssegs.sort! { |x, y| x[:column] <=> y[:column] }
185
+ pvs.sort! { |x, y| x[:column] <=> y[:column] }
186
+ pvssegs.sort! { |x, y| x[:column] <=> y[:column] }
187
+ vgs.sort! { |x, y| x[:column] <=> y[:column] }
188
+
189
+ FileUtils.mkdir(version)
190
+
191
+ disclaimer = <<go
192
+ # These are column to object attribute mappings
193
+ # generated by #{$0} based on
194
+ # #{lvm_source}/lib/report/columns.h
195
+ go
196
+
197
+ File.open("#{version}/lvs.yaml", "w") { |f| f.write(disclaimer); f.write(lvs.to_yaml) }
198
+ File.open("#{version}/lvsseg.yaml", "w") { |f| f.write(disclaimer); f.write(lvssegs.to_yaml) }
199
+ File.open("#{version}/pvs.yaml", "w") { |f| f.write(disclaimer); f.write(pvs.to_yaml) }
200
+ File.open("#{version}/pvsseg.yaml", "w") { |f| f.write(disclaimer); f.write(pvssegs.to_yaml) }
201
+ File.open("#{version}/vgs.yaml", "w") { |f| f.write(disclaimer); f.write(vgs.to_yaml) }
202
+
203
+ puts "Done."
@@ -0,0 +1,18 @@
1
+ $:.unshift(File.expand_path("../lib/", __FILE__))
2
+ require "lvm/attributes"
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Tim Smith", "Greg Symons", "Elan Ruusamäe", "Matthew Kent"]
6
+ gem.email = ["tsmith@chef.io", "mkent@magoazul.com", "gsymons@gsconsulting.biz"]
7
+ gem.description = "A list of attributes for LVM objects"
8
+ gem.license = "MIT"
9
+ gem.summary = "A list of attributes for LVM objects"
10
+ gem.homepage = "https://github.com/chef/chef-ruby-lvm-attrib"
11
+ gem.executables = ["generate_field_data"]
12
+
13
+ gem.files = `git ls-files`.split($\)
14
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
+ gem.name = "chef-ruby-lvm-attrib"
16
+ gem.require_paths = ["lib"]
17
+ gem.version = LVM::Attributes::VERSION
18
+ end
@@ -0,0 +1,29 @@
1
+ require "yaml"
2
+
3
+ module LVM
4
+ module Attributes
5
+ VERSION = "0.0.28"
6
+
7
+ def load(version, name)
8
+ cwd = File.dirname(__FILE__)
9
+
10
+ # was going to be symlinks, but rubygems didn't seem to want to package
11
+ # them
12
+ if version == "2.02.28"
13
+ version = "2.02.27"
14
+ elsif ((31..39).map { |x| "2.02.#{x}" }).include?(version)
15
+ version = "2.02.30"
16
+ end
17
+
18
+ file = File.join(cwd, "attributes", version, name)
19
+
20
+ begin
21
+ return YAML.load_file(file)
22
+ rescue Errno::ENOENT => e
23
+ raise ArgumentError.new("Unable to load lvm attributes [#{name}] for version [#{version}]. " \
24
+ "The version/object may not be supported or you may need to upgrade the chef-ruby-lvm-attrib gem. Error [#{e.message}]")
25
+ end
26
+ end
27
+ module_function :load
28
+ end # module Attributes
29
+ end # module LVM
@@ -0,0 +1,156 @@
1
+ # These are column to object attribute mappings
2
+ # generated by bin/generate_field_data based on
3
+ # /Users/Staer/Downloads/lvm2-2_02_100/lib/report/columns.h
4
+ ---
5
+ - :method: convert_lv
6
+ :column: convert_lv
7
+ :type_hint: String
8
+ :description: For lvconvert
9
+ - :method: copy_percent
10
+ :column: copy_percent
11
+ :type_hint: Float
12
+ :description: For RAID
13
+ - :method: data_lv
14
+ :column: data_lv
15
+ :type_hint: String
16
+ :description: For thin pools
17
+ - :method: data_percent
18
+ :column: data_percent
19
+ :type_hint: Float
20
+ :description: For snapshot and thin pools and volumes
21
+ - :method: active
22
+ :column: lv_active
23
+ :type_hint: String
24
+ :description: Active state of the LV.
25
+ - :method: attr
26
+ :column: lv_attr
27
+ :type_hint: String
28
+ :description: Various attributes - see man page.
29
+ - :method: host
30
+ :column: lv_host
31
+ :type_hint: String
32
+ :description: Creation host of the LV
33
+ - :method: kernel_major
34
+ :column: lv_kernel_major
35
+ :type_hint: String
36
+ :description: Currently assigned major number or -1 if LV is not active.
37
+ - :method: kernel_minor
38
+ :column: lv_kernel_minor
39
+ :type_hint: String
40
+ :description: Currently assigned minor number or -1 if LV is not active.
41
+ - :method: kernel_read_ahead
42
+ :column: lv_kernel_read_ahead
43
+ :type_hint: Integer
44
+ :description: Currently-in-use read ahead setting in current units.
45
+ - :method: major
46
+ :column: lv_major
47
+ :type_hint: Integer
48
+ :description: Persistent major number or -1 if not persistent.
49
+ - :method: metadata_size
50
+ :column: lv_metadata_size
51
+ :type_hint: Integer
52
+ :description: For thin pools
53
+ - :method: minor
54
+ :column: lv_minor
55
+ :type_hint: Integer
56
+ :description: Persistent minor number or -1 if not persistent.
57
+ - :method: modules
58
+ :column: lv_modules
59
+ :type_hint: String
60
+ :description: Kernel device-mapper modules required for this LV.
61
+ - :method: name
62
+ :column: lv_name
63
+ :type_hint: String
64
+ :description: Name. LVs created for internal use are enclosed in brackets.
65
+ - :method: path
66
+ :column: lv_path
67
+ :type_hint: String
68
+ :description: Full pathname for LV.
69
+ - :method: profile
70
+ :column: lv_profile
71
+ :type_hint: String
72
+ :description: Configuration profile attached to this LV.
73
+ - :method: read_ahead
74
+ :column: lv_read_ahead
75
+ :type_hint: String
76
+ :description: Read ahead setting in current units.
77
+ - :method: size
78
+ :column: lv_size
79
+ :type_hint: Integer
80
+ :description: Size of LV in current units.
81
+ - :method: tags
82
+ :column: lv_tags
83
+ :type_hint: String
84
+ :description: Tags
85
+ - :method: time
86
+ :column: lv_time
87
+ :type_hint: String
88
+ :description: Creation time of the LV
89
+ - :method: uuid
90
+ :column: lv_uuid
91
+ :type_hint: String
92
+ :description: Unique identifier.
93
+ - :method: metadata_lv
94
+ :column: metadata_lv
95
+ :type_hint: String
96
+ :description: For thin pools
97
+ - :method: metadata_percent
98
+ :column: metadata_percent
99
+ :type_hint: Float
100
+ :description: For thin pools
101
+ - :method: mirror_log
102
+ :column: mirror_log
103
+ :type_hint: String
104
+ :description: For mirrors
105
+ - :method: move_pv
106
+ :column: move_pv
107
+ :type_hint: String
108
+ :description: For pvmove
109
+ - :method: origin
110
+ :column: origin
111
+ :type_hint: String
112
+ :description: For snapshots
113
+ - :method: origin_size
114
+ :column: origin_size
115
+ :type_hint: Integer
116
+ :description: For snapshots
117
+ - :method: pool_lv
118
+ :column: pool_lv
119
+ :type_hint: String
120
+ :description: For thin volumes
121
+ - :method: raid_max_recovery_rate
122
+ :column: raid_max_recovery_rate
123
+ :type_hint: Integer
124
+ :description: For RAID1
125
+ - :method: raid_min_recovery_rate
126
+ :column: raid_min_recovery_rate
127
+ :type_hint: Integer
128
+ :description: For RAID1
129
+ - :method: raid_mismatch_count
130
+ :column: raid_mismatch_count
131
+ :type_hint: Integer
132
+ :description: For RAID
133
+ - :method: raid_sync_action
134
+ :column: raid_sync_action
135
+ :type_hint: String
136
+ :description: For RAID
137
+ - :method: raid_write_behind
138
+ :column: raid_write_behind
139
+ :type_hint: Integer
140
+ :description: For RAID1
141
+ - :method: seg_count
142
+ :column: seg_count
143
+ :type_hint: Integer
144
+ :description: Number of segments in LV.
145
+ - :method: snap_percent
146
+ :column: snap_percent
147
+ :type_hint: Float
148
+ :description: For snapshots
149
+ - :method: sync_percent
150
+ :column: sync_percent
151
+ :type_hint: Float
152
+ :description: For RAID
153
+ - :method: vg_uuid
154
+ :column: vg_uuid
155
+ :type_hint: String
156
+ :description: For VolumeGroup to LogicalVolume relationship.