| 1 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 2 |
import sys |
| 3 |
|
| 4 |
import dbus |
| 5 |
|
| 6 |
uuid = sys.argv[1] |
| 7 |
slot = sys.argv[2] |
| 8 |
file_descriptor = sys.argv[3] |
| 9 |
|
| 10 |
if slot == "-": |
| 11 |
slot_arg = [False, [False, 0]] |
| 12 |
elif slot == "any": |
| 13 |
slot_arg = [True, [False, 0]] |
| 14 |
else: |
| 15 |
slot_arg = [True, [True, int(slot)]] |
| 16 |
|
| 17 |
if file_descriptor == "-": |
| 18 |
file_descriptor_arg = [False, 0] |
| 19 |
else: |
| 20 |
file_descriptor_arg = [True, int(file_descriptor)] |
| 21 |
|
| 22 |
reply = dbus.SystemBus().call_blocking('org.storage.stratis3', '/org/storage/stratis3', |
| 23 |
'org.storage.stratis3.Manager.r8', 'StartPool', |
| 24 |
'ss(b(bu))(bh)', |
| 25 |
[uuid, 'uuid', slot_arg, file_descriptor_arg]) |
| 26 |
if reply[1] != 0: |
| 27 |
sys.stderr.write(reply[2] + '\n') |
| 28 |
sys.exit(1) |