Skip to content

Commit 773200d

Browse files
authored
Merge pull request #653 from mulkieran/develop-2.1.1-rc
Develop 2.1.1 rc
2 parents 3150f10 + 90fa551 commit 773200d

16 files changed

Lines changed: 588 additions & 233 deletions

File tree

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ addons:
1010
branches:
1111
only:
1212
- master
13-
- develop-2.1.0
1413

1514
jobs:
1615
include:

CHANGES.txt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,46 @@
1+
stratis-cli 2.2.0
2+
=================
3+
4+
Required stratisd version: 2.2.0
5+
6+
Recommended Python interpreter: 3.7.7
7+
Lowest supported Python interpreter: 3.6.8
8+
Python linter: pylint (2.4.4)
9+
Python auto-formatter: black (19.10b0)
10+
Python import sorter: isort (4.3.21)
11+
YAML linter: yamllint (1.23.0)
12+
13+
- Remove terminal settings handling in interactive key entry:
14+
https://github.com/stratis-storage/stratis-cli/pull/643
15+
https://github.com/stratis-storage/stratis-cli/pull/642
16+
17+
- Update bash completion:
18+
https://github.com/stratis-storage/stratis-cli/pull/640
19+
20+
- Use older version of Manager interface for dynamic version check:
21+
https://github.com/stratis-storage/stratis-cli/issues/647
22+
https://github.com/stratis-storage/stratis-cli/pull/648
23+
24+
- Use LockedPools key with FetchProperties interface:
25+
https://github.com/stratis-storage/stratis-cli/issues/646
26+
https://github.com/stratis-storage/stratis-cli/pull/649
27+
28+
- Add some additional tests for pool creation:
29+
https://github.com/stratis-storage/stratis-cli/issues/632
30+
https://github.com/stratis-storage/stratis-cli/pull/650
31+
32+
- Autogenerate introspection data:
33+
https://github.com/stratis-storage/stratis-cli/pull/644
34+
35+
- Tidies and Maintenance:
36+
https://github.com/stratis-storage/stratis-cli/pull/641
37+
https://github.com/stratis-storage/stratis-cli/pull/636
38+
https://github.com/stratis-storage/stratis-cli/pull/634
39+
https://github.com/stratis-storage/stratis-cli/pull/633
40+
https://github.com/stratis-storage/stratis-cli/pull/631
41+
https://github.com/stratis-storage/stratis-cli/pull/629
42+
https://github.com/stratis-storage/stratis-cli/pull/628
43+
144
stratis-cli 2.1.1
245
=================
346
Recommended Python interpreter: 3.7.7
@@ -26,6 +69,7 @@ YAML linter: yamllint (1.23.0)
2669
https://github.com/stratis-storage/stratis-cli/pull/620
2770
https://github.com/stratis-storage/stratis-cli/pull/616
2871
https://github.com/stratis-storage/stratis-cli/pull/615
72+
https://github.com/stratis-storage/stratis-cli/pull/612
2973
https://github.com/stratis-storage/stratis-cli/pull/608
3074
https://github.com/stratis-storage/stratis-cli/pull/603
3175

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ UNITTEST_OPTS = --verbose
44
lint:
55
./check.py check.py
66
./check.py setup.py
7+
./check.py developer_tools
78
./check.py bin/stratis
89
./check.py src/stratis_cli
910
./check.py tests/blackbox/stratis_cli_cert.py
@@ -13,8 +14,8 @@ lint:
1314

1415
.PHONY: fmt
1516
fmt:
16-
isort --recursive check.py setup.py bin/stratis src tests
17-
black ./bin/stratis .
17+
isort --recursive check.py setup.py bin/stratis developer_tools src tests
18+
black ./bin/stratis ./developer_tools/update_introspection_data .
1819

1920
.PHONY: fmt-travis
2021
fmt-travis:

check.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,17 @@
2020
"--disable=I",
2121
"--msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}'",
2222
],
23+
"developer_tools": [
24+
"--reports=no",
25+
"--disable=I",
26+
"--msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}'",
27+
],
2328
"src/stratis_cli": [
2429
"--reports=no",
2530
"--disable=I",
2631
"--disable=duplicate-code",
32+
# ignore _introspect.py because it will be auto-generated
33+
"--ignore=_introspect.py",
2734
"--msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}'",
2835
],
2936
"tests/blackbox/stratisd_cert.py": [
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
#!/usr/bin/env python3
2+
3+
# Copyright 2016 Red Hat, Inc.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
"""
17+
Update Stratis introspection data.
18+
"""
19+
20+
# isort: STDLIB
21+
import xml.etree.ElementTree as ET
22+
23+
# isort: THIRDPARTY
24+
import dbus
25+
26+
# isort: FIRSTPARTY
27+
from dbus_python_client_gen import make_class
28+
29+
# a minimal chunk of introspection data, enough for the methods needed.
30+
SPECS = {
31+
"org.freedesktop.DBus.Introspectable": """
32+
<interface name="org.freedesktop.DBus.Introspectable">
33+
<method name="Introspect">
34+
<arg name="xml_data" type="s" direction="out"/>
35+
</method>
36+
</interface>
37+
""",
38+
"org.storage.stratis2.Manager.r1": """
39+
<interface name="org.storage.stratis2.Manager.r1">
40+
<method name="CreatePool">
41+
<arg name="name" type="s" direction="in"/>
42+
<arg name="redundancy" type="(bq)" direction="in"/>
43+
<arg name="devices" type="as" direction="in"/>
44+
<arg name="key_desc" type="(bs)" direction="in"/>
45+
<arg name="result" type="(b(oao))" direction="out"/>
46+
<arg name="return_code" type="q" direction="out"/>
47+
<arg name="return_string" type="s" direction="out"/>
48+
</method>
49+
</interface>
50+
""",
51+
"org.storage.stratis2.pool.r1": """
52+
<interface name="org.storage.stratis2.pool.r1">
53+
<method name="CreateFilesystems">
54+
<arg name="specs" type="as" direction="in"/>
55+
<arg name="results" type="(ba(os))" direction="out"/>
56+
<arg name="return_code" type="q" direction="out"/>
57+
<arg name="return_string" type="s" direction="out"/>
58+
</method>
59+
</interface>
60+
""",
61+
}
62+
63+
_SERVICE = "org.storage.stratis2"
64+
65+
_INTROSPECTABLE_IFACE = "org.freedesktop.DBus.Introspectable"
66+
_MANAGER_IFACE = "org.storage.stratis2.Manager.r1"
67+
_POOL_IFACE = "org.storage.stratis2.pool.r1"
68+
_TIMEOUT = 120000
69+
70+
Introspectable = make_class(
71+
"Introspectable", ET.fromstring(SPECS[_INTROSPECTABLE_IFACE]), _TIMEOUT
72+
)
73+
Manager = make_class("Manager", ET.fromstring(SPECS[_MANAGER_IFACE]), _TIMEOUT)
74+
Pool = make_class("Pool", ET.fromstring(SPECS[_POOL_IFACE]), _TIMEOUT)
75+
76+
# EDIT these fields to get the interfaces and revisions desired
77+
TOP_OBJECT_INTERFACES = [
78+
"org.freedesktop.DBus.ObjectManager",
79+
"org.storage.stratis2.FetchProperties.r2",
80+
"org.storage.stratis2.Manager.r2",
81+
"org.storage.stratis2.Report.r1",
82+
]
83+
POOL_OBJECT_INTERFACES = ["org.storage.stratis2.pool.r1"]
84+
BLOCKDEV_OBJECT_INTERFACES = ["org.storage.stratis2.blockdev.r2"]
85+
FILESYSTEM_OBJECT_INTERFACES = ["org.storage.stratis2.filesystem"]
86+
87+
88+
def _add_data(proxy, interfaces, table):
89+
"""
90+
Introspect on the proxy, get the information for the specified interfaces,
91+
and add it to the table.
92+
93+
:param proxy: dbus Proxy object
94+
:param list interfaces: list of interesting interface names
95+
:param dict table: table from interface names to introspection data as text
96+
"""
97+
string_data = Introspectable.Methods.Introspect(proxy, {})
98+
xml_data = ET.fromstring(string_data)
99+
for interface in xml_data:
100+
interface_name = interface.attrib["name"]
101+
if interface_name in interfaces:
102+
table[interface_name] = ET.tostring(interface).decode("utf-8").rstrip(" \n")
103+
104+
if not (frozenset(interfaces) <= frozenset(table.keys())):
105+
exit(
106+
"not %s <= %s"
107+
% (sorted(frozenset(interfaces)), sorted(frozenset(table.keys())),)
108+
)
109+
110+
111+
def main():
112+
"""
113+
The main method.
114+
"""
115+
specs = {}
116+
bus = dbus.SystemBus()
117+
118+
proxy = bus.get_object(_SERVICE, "/org/storage/stratis2", introspect=False)
119+
120+
(
121+
(_, (pool_object_path, dev_object_paths)),
122+
return_code,
123+
return_msg,
124+
) = Manager.Methods.CreatePool(
125+
proxy,
126+
{
127+
"name": "pool_name",
128+
"redundancy": (True, 0),
129+
"devices": ["/fake/fake"],
130+
"key_desc": (False, ""),
131+
},
132+
)
133+
134+
if return_code != 0:
135+
exit(return_msg)
136+
137+
pool_proxy = bus.get_object(_SERVICE, pool_object_path, introspect=False)
138+
139+
blockdev_proxy = bus.get_object(_SERVICE, dev_object_paths[0], introspect=False)
140+
141+
((_, (filesystems)), return_code, return_msg,) = Pool.Methods.CreateFilesystems(
142+
pool_proxy, {"specs": ["fs_name"],},
143+
)
144+
145+
if return_code != 0:
146+
exit(return_msg)
147+
148+
filesystem_object_path = filesystems[0][0]
149+
filesystem_proxy = bus.get_object(
150+
_SERVICE, filesystem_object_path, introspect=False
151+
)
152+
153+
_add_data(proxy, TOP_OBJECT_INTERFACES, specs)
154+
_add_data(pool_proxy, POOL_OBJECT_INTERFACES, specs)
155+
_add_data(blockdev_proxy, BLOCKDEV_OBJECT_INTERFACES, specs)
156+
_add_data(filesystem_proxy, FILESYSTEM_OBJECT_INTERFACES, specs)
157+
158+
print("SPECS = {")
159+
160+
# format the lines in a way that will satisfy black
161+
print(
162+
",\n".join(
163+
' "%s": """\n%s\n"""' % (key, value)
164+
for (key, value) in sorted(specs.items())
165+
)
166+
+ ","
167+
)
168+
print("}")
169+
170+
171+
if __name__ == "__main__":
172+
main()

0 commit comments

Comments
 (0)