otakumike-ruby-lvm-attrib 0.0.28
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 +7 -0
- data/.gitignore +3 -0
- data/.gitmodules +3 -0
- data/CHANGELOG.md +34 -0
- data/README.md +71 -0
- data/TODO.md +3 -0
- data/bin/generate_field_data +203 -0
- data/lib/lvm/attributes.rb +29 -0
- data/lib/lvm/attributes/2.02.100(2)/lvs.yaml +156 -0
- data/lib/lvm/attributes/2.02.100(2)/lvsseg.yaml +84 -0
- data/lib/lvm/attributes/2.02.100(2)/pvs.yaml +81 -0
- data/lib/lvm/attributes/2.02.100(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.100(2)/vgs.yaml +96 -0
- data/lib/lvm/attributes/2.02.104(2)/lvs.yaml +156 -0
- data/lib/lvm/attributes/2.02.104(2)/lvsseg.yaml +88 -0
- data/lib/lvm/attributes/2.02.104(2)/pvs.yaml +81 -0
- data/lib/lvm/attributes/2.02.104(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.104(2)/vgs.yaml +96 -0
- data/lib/lvm/attributes/2.02.105(2)/lvs.yaml +156 -0
- data/lib/lvm/attributes/2.02.105(2)/lvsseg.yaml +92 -0
- data/lib/lvm/attributes/2.02.105(2)/pvs.yaml +81 -0
- data/lib/lvm/attributes/2.02.105(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.105(2)/vgs.yaml +96 -0
- data/lib/lvm/attributes/2.02.106(2)/lvs.yaml +156 -0
- data/lib/lvm/attributes/2.02.106(2)/lvsseg.yaml +92 -0
- data/lib/lvm/attributes/2.02.106(2)/pvs.yaml +81 -0
- data/lib/lvm/attributes/2.02.106(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.106(2)/vgs.yaml +96 -0
- data/lib/lvm/attributes/2.02.111(2)/lvs.yaml +220 -0
- data/lib/lvm/attributes/2.02.111(2)/lvsseg.yaml +92 -0
- data/lib/lvm/attributes/2.02.111(2)/pvs.yaml +92 -0
- data/lib/lvm/attributes/2.02.111(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.111(2)/vgs.yaml +120 -0
- data/lib/lvm/attributes/2.02.114(2)/lvs.yaml +220 -0
- data/lib/lvm/attributes/2.02.114(2)/lvsseg.yaml +96 -0
- data/lib/lvm/attributes/2.02.114(2)/pvs.yaml +93 -0
- data/lib/lvm/attributes/2.02.114(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.114(2)/vgs.yaml +120 -0
- data/lib/lvm/attributes/2.02.115(2)/lvs.yaml +220 -0
- data/lib/lvm/attributes/2.02.115(2)/lvsseg.yaml +104 -0
- data/lib/lvm/attributes/2.02.115(2)/pvs.yaml +93 -0
- data/lib/lvm/attributes/2.02.115(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.115(2)/vgs.yaml +120 -0
- data/lib/lvm/attributes/2.02.116(2)/lvs.yaml +220 -0
- data/lib/lvm/attributes/2.02.116(2)/lvsseg.yaml +104 -0
- data/lib/lvm/attributes/2.02.116(2)/pvs.yaml +93 -0
- data/lib/lvm/attributes/2.02.116(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.116(2)/vgs.yaml +120 -0
- data/lib/lvm/attributes/2.02.118(2)/lvs.yaml +220 -0
- data/lib/lvm/attributes/2.02.118(2)/lvsseg.yaml +104 -0
- data/lib/lvm/attributes/2.02.118(2)/pvs.yaml +93 -0
- data/lib/lvm/attributes/2.02.118(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.118(2)/vgs.yaml +124 -0
- data/lib/lvm/attributes/2.02.119(2)/lvs.yaml +228 -0
- data/lib/lvm/attributes/2.02.119(2)/lvsseg.yaml +104 -0
- data/lib/lvm/attributes/2.02.119(2)/pvs.yaml +93 -0
- data/lib/lvm/attributes/2.02.119(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.119(2)/vgs.yaml +124 -0
- data/lib/lvm/attributes/2.02.120(2)/lvs.yaml +228 -0
- data/lib/lvm/attributes/2.02.120(2)/lvsseg.yaml +104 -0
- data/lib/lvm/attributes/2.02.120(2)/pvs.yaml +93 -0
- data/lib/lvm/attributes/2.02.120(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.120(2)/vgs.yaml +124 -0
- data/lib/lvm/attributes/2.02.122(2)/lvs.yaml +228 -0
- data/lib/lvm/attributes/2.02.122(2)/lvsseg.yaml +104 -0
- data/lib/lvm/attributes/2.02.122(2)/pvs.yaml +93 -0
- data/lib/lvm/attributes/2.02.122(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.122(2)/vgs.yaml +124 -0
- data/lib/lvm/attributes/2.02.130(2)/lvs.yaml +232 -0
- data/lib/lvm/attributes/2.02.130(2)/lvsseg.yaml +104 -0
- data/lib/lvm/attributes/2.02.130(2)/pvs.yaml +93 -0
- data/lib/lvm/attributes/2.02.130(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.130(2)/vgs.yaml +132 -0
- data/lib/lvm/attributes/2.02.132(2)/lvs.yaml +260 -0
- data/lib/lvm/attributes/2.02.132(2)/lvsseg.yaml +104 -0
- data/lib/lvm/attributes/2.02.132(2)/pvs.yaml +93 -0
- data/lib/lvm/attributes/2.02.132(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.132(2)/vgs.yaml +132 -0
- data/lib/lvm/attributes/2.02.133(2)/lvs.yaml +260 -0
- data/lib/lvm/attributes/2.02.133(2)/lvsseg.yaml +113 -0
- data/lib/lvm/attributes/2.02.133(2)/pvs.yaml +93 -0
- data/lib/lvm/attributes/2.02.133(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.133(2)/vgs.yaml +136 -0
- data/lib/lvm/attributes/2.02.143(2)/lvs.yaml +260 -0
- data/lib/lvm/attributes/2.02.143(2)/lvsseg.yaml +118 -0
- data/lib/lvm/attributes/2.02.143(2)/pvs.yaml +101 -0
- data/lib/lvm/attributes/2.02.143(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.143(2)/vgs.yaml +136 -0
- data/lib/lvm/attributes/2.02.149(2)/lvs.yaml +276 -0
- data/lib/lvm/attributes/2.02.149(2)/lvsseg.yaml +106 -0
- data/lib/lvm/attributes/2.02.149(2)/pvs.yaml +109 -0
- data/lib/lvm/attributes/2.02.149(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.149(2)/vgs.yaml +136 -0
- data/lib/lvm/attributes/2.02.158(2)/lvs.yaml +256 -0
- data/lib/lvm/attributes/2.02.158(2)/lvsseg.yaml +106 -0
- data/lib/lvm/attributes/2.02.158(2)/pvs.yaml +113 -0
- data/lib/lvm/attributes/2.02.158(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.158(2)/vgs.yaml +136 -0
- data/lib/lvm/attributes/2.02.161(2)/lvs.yaml +256 -0
- data/lib/lvm/attributes/2.02.161(2)/lvsseg.yaml +106 -0
- data/lib/lvm/attributes/2.02.161(2)/pvs.yaml +113 -0
- data/lib/lvm/attributes/2.02.161(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.161(2)/vgs.yaml +136 -0
- data/lib/lvm/attributes/2.02.166(2)/lvs.yaml +256 -0
- data/lib/lvm/attributes/2.02.166(2)/lvsseg.yaml +106 -0
- data/lib/lvm/attributes/2.02.166(2)/pvs.yaml +113 -0
- data/lib/lvm/attributes/2.02.166(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.166(2)/vgs.yaml +136 -0
- data/lib/lvm/attributes/2.02.26/lvs.yaml +72 -0
- data/lib/lvm/attributes/2.02.26/lvsseg.yaml +56 -0
- data/lib/lvm/attributes/2.02.26/pvs.yaml +56 -0
- data/lib/lvm/attributes/2.02.26/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.26/vgs.yaml +72 -0
- data/lib/lvm/attributes/2.02.27/lvs.yaml +72 -0
- data/lib/lvm/attributes/2.02.27/lvsseg.yaml +56 -0
- data/lib/lvm/attributes/2.02.27/pvs.yaml +60 -0
- data/lib/lvm/attributes/2.02.27/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.27/vgs.yaml +76 -0
- data/lib/lvm/attributes/2.02.29/lvs.yaml +80 -0
- data/lib/lvm/attributes/2.02.29/lvsseg.yaml +56 -0
- data/lib/lvm/attributes/2.02.29/pvs.yaml +64 -0
- data/lib/lvm/attributes/2.02.29/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.29/vgs.yaml +80 -0
- data/lib/lvm/attributes/2.02.30/lvs.yaml +84 -0
- data/lib/lvm/attributes/2.02.30/lvsseg.yaml +64 -0
- data/lib/lvm/attributes/2.02.30/pvs.yaml +64 -0
- data/lib/lvm/attributes/2.02.30/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.30/vgs.yaml +80 -0
- data/lib/lvm/attributes/2.02.54(1)/lvs.yaml +88 -0
- data/lib/lvm/attributes/2.02.54(1)/lvsseg.yaml +64 -0
- data/lib/lvm/attributes/2.02.54(1)/pvs.yaml +68 -0
- data/lib/lvm/attributes/2.02.54(1)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.54(1)/vgs.yaml +84 -0
- data/lib/lvm/attributes/2.02.66(2)/lvs.yaml +88 -0
- data/lib/lvm/attributes/2.02.66(2)/lvsseg.yaml +64 -0
- data/lib/lvm/attributes/2.02.66(2)/pvs.yaml +68 -0
- data/lib/lvm/attributes/2.02.66(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.66(2)/vgs.yaml +84 -0
- data/lib/lvm/attributes/2.02.74(2)/lvs.yaml +91 -0
- data/lib/lvm/attributes/2.02.74(2)/lvsseg.yaml +63 -0
- data/lib/lvm/attributes/2.02.74(2)/pvs.yaml +71 -0
- data/lib/lvm/attributes/2.02.74(2)/pvsseg.yaml +15 -0
- data/lib/lvm/attributes/2.02.74(2)/vgs.yaml +91 -0
- data/lib/lvm/attributes/2.02.83(2)/lvs.yaml +91 -0
- data/lib/lvm/attributes/2.02.83(2)/lvsseg.yaml +63 -0
- data/lib/lvm/attributes/2.02.83(2)/pvs.yaml +71 -0
- data/lib/lvm/attributes/2.02.83(2)/pvsseg.yaml +15 -0
- data/lib/lvm/attributes/2.02.83(2)/vgs.yaml +91 -0
- data/lib/lvm/attributes/2.02.84(2)/lvs.yaml +92 -0
- data/lib/lvm/attributes/2.02.84(2)/lvsseg.yaml +64 -0
- data/lib/lvm/attributes/2.02.84(2)/pvs.yaml +72 -0
- data/lib/lvm/attributes/2.02.84(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.84(2)/vgs.yaml +92 -0
- data/lib/lvm/attributes/2.02.86(2)/lvs.yaml +92 -0
- data/lib/lvm/attributes/2.02.86(2)/lvsseg.yaml +64 -0
- data/lib/lvm/attributes/2.02.86(2)/pvs.yaml +72 -0
- data/lib/lvm/attributes/2.02.86(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.86(2)/vgs.yaml +92 -0
- data/lib/lvm/attributes/2.02.87(2)/lvs.yaml +91 -0
- data/lib/lvm/attributes/2.02.87(2)/lvsseg.yaml +63 -0
- data/lib/lvm/attributes/2.02.87(2)/pvs.yaml +71 -0
- data/lib/lvm/attributes/2.02.87(2)/pvsseg.yaml +15 -0
- data/lib/lvm/attributes/2.02.87(2)/vgs.yaml +91 -0
- data/lib/lvm/attributes/2.02.88(2)/lvs.yaml +92 -0
- data/lib/lvm/attributes/2.02.88(2)/lvsseg.yaml +64 -0
- data/lib/lvm/attributes/2.02.88(2)/pvs.yaml +72 -0
- data/lib/lvm/attributes/2.02.88(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.88(2)/vgs.yaml +92 -0
- data/lib/lvm/attributes/2.02.95(2)/lvs.yaml +124 -0
- data/lib/lvm/attributes/2.02.95(2)/lvsseg.yaml +76 -0
- data/lib/lvm/attributes/2.02.95(2)/pvs.yaml +72 -0
- data/lib/lvm/attributes/2.02.95(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.95(2)/vgs.yaml +92 -0
- data/lib/lvm/attributes/2.02.98(2)/lvs.yaml +124 -0
- data/lib/lvm/attributes/2.02.98(2)/lvsseg.yaml +80 -0
- data/lib/lvm/attributes/2.02.98(2)/pvs.yaml +72 -0
- data/lib/lvm/attributes/2.02.98(2)/pvsseg.yaml +16 -0
- data/lib/lvm/attributes/2.02.98(2)/vgs.yaml +92 -0
- data/otakumike-ruby-lvm-attrib.gemspec +18 -0
- data/test/test_ruby-lvm-attributes.rb +0 -0
- data/update-lvm.sh +136 -0
- metadata +232 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4544c7bb058e0678c9da825418f5b3fac984b954
|
4
|
+
data.tar.gz: cc6a9bc370ed4268b87252d858aa7947f4df63b3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 99ecbdbdaf7d67c0b366bc7799e987be15cb4803f4a40b1a876d344dbab3928ce9c7736d34bb6767479e3fb5391a577ab3d66bb8b139b65e27b238f438953816
|
7
|
+
data.tar.gz: a2e092ebcbf364cac7fb488efc04f91186ca5bdd71918c96cb35af526a8f9a389eefcded24fe684e693d94209b0e7922ff30bb8c75f0792700cfadb28eb87fd8
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# 0.0.27 (2016-09-06)
|
2
|
+
- Added LVM attributes for version 2.02.161(2)
|
3
|
+
- Added LVM attributes for version 2.02.158(2)
|
4
|
+
- Reworked update script to use git submodules rather than relying on the user
|
5
|
+
to check out the LVM source. #47
|
6
|
+
- Added LVM attributes for version 2.0.2.133(2)
|
7
|
+
|
8
|
+
# 0.0.26 (2016-05-12)
|
9
|
+
- Added LVM attributes for version 2.02.149
|
10
|
+
- Added LVM attributes for version 2.02.143(2)
|
11
|
+
|
12
|
+
# 0.0.25 (2016-03-08)
|
13
|
+
- Added LVM attributes for version 2.02.122(2)
|
14
|
+
|
15
|
+
# 0.0.24 (2016-02-25)
|
16
|
+
- Added LVM attributes for version 2.0.2.120
|
17
|
+
- Added a CHANGELOG
|
18
|
+
|
19
|
+
# 0.0.23 (2015-12-04)
|
20
|
+
- Added LVM attributes for version 2.0.2.116
|
21
|
+
|
22
|
+
# 0.0.22 (2015-12-02)
|
23
|
+
- Added LVM attributes for versions 2.02.130 and 2.02.132
|
24
|
+
|
25
|
+
# 0.0.21 (2015-08-04)
|
26
|
+
- Added LVM attributes for versions 2.02.118 and 2.02.119
|
27
|
+
|
28
|
+
# 0.0.20 (2015-06-05)
|
29
|
+
- Added LVM attributes for version 2.02.114
|
30
|
+
|
31
|
+
# 0.0.19 (2015-05-30)
|
32
|
+
- Added LVM attributes for version 2.02.111
|
33
|
+
- Added MIT license to the Gemspec
|
34
|
+
- Gemspec now properly loads the version from the lib/attributes.rb file
|
data/README.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# ruby-lvm-attrib
|
2
|
+
## DESCRIPTION:
|
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.<br>Currently this is split from the main ruby-lvm gem since these files require updating to follow LVM2 releases.
|
6
|
+
|
7
|
+
## FEATURES/PROBLEMS:
|
8
|
+
- This library may go away depending on future progress of ruby-lvm.
|
9
|
+
|
10
|
+
## SYNOPSIS:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'lvm/attributes'
|
14
|
+
|
15
|
+
attributes = Attributes.load("2.0.36", "vgs.yaml")
|
16
|
+
```
|
17
|
+
|
18
|
+
## REQUIREMENTS:
|
19
|
+
- None
|
20
|
+
|
21
|
+
## INSTALL:
|
22
|
+
- `sudo gem install ruby-lvm-attrib`
|
23
|
+
|
24
|
+
## ADDING ATTRIBUTES:
|
25
|
+
|
26
|
+
To add attributes:
|
27
|
+
|
28
|
+
Use [update-lvm.sh](update-lvm.sh) script to add new version.
|
29
|
+
Find the interested LVM2 tag from [LVM2 Repository](https://git.fedorahosted.org/cgit/lvm2.git/refs/tags).
|
30
|
+
|
31
|
+
- Fork this repository
|
32
|
+
- `git clone your-forked-repo`
|
33
|
+
- `cd your-forked-repo`
|
34
|
+
- `./update-lvm.sh v2_02_155`
|
35
|
+
|
36
|
+
The script will add `lib/lvm/attributes/LVM_VERSION` where `LVM_VERSION` being something like `2.02.86(2)` or `2.02.98(2)`.
|
37
|
+
|
38
|
+
If the script will not error, it will create new branch and commit `Added LVM_VERSION attributes`.
|
39
|
+
|
40
|
+
In case of error, see missing attribute type note below.
|
41
|
+
|
42
|
+
If all is well, publish the changes and make Pull Request from GitHub web:
|
43
|
+
|
44
|
+
- `git push origin mybranch`
|
45
|
+
- Submit PR to this repository. **Please make sure to point your pull at the `next` branch -- NOT MASTER!**
|
46
|
+
|
47
|
+
### MISSING ATTRIBUTE TYPE:
|
48
|
+
If you get an error like the below:
|
49
|
+
|
50
|
+
```
|
51
|
+
Oops, missing type conversion data of column 'discards' use by 'SEGS' which says its going to return a 'discards'
|
52
|
+
Figure out the missing type and rerun.
|
53
|
+
```
|
54
|
+
|
55
|
+
- Look in `path/to/lvm-source/lib/report/columns.h` for the column name in the 7th field.
|
56
|
+
- If the 3rd field is NUM, type will be Integer. If 3rd field is STR, type will be String.
|
57
|
+
- Add the information to `bin/generate_field_data` in the TYPE_CONVERSION_MAP and try running again
|
58
|
+
|
59
|
+
## FEEDBACK:
|
60
|
+
Please feel free to submit patches or constructive criticism, I'm still pretty new to ruby and object oriented programming in general.
|
61
|
+
|
62
|
+
## LICENSE:
|
63
|
+
(The MIT License)
|
64
|
+
|
65
|
+
Copyright (c) 2008 Matthew Kent, Bravenet Web Services Inc.
|
66
|
+
|
67
|
+
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:
|
68
|
+
|
69
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
70
|
+
|
71
|
+
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/TODO.md
ADDED
@@ -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 ["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,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 di-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.
|