Skip to content

Commit c1a3729

Browse files
committed
feat(scripts): add xcp-linstor-manager script
Signed-off-by: Ronan Abhamon <ronan.abhamon@vates.tech>
1 parent 54d4065 commit c1a3729

3 files changed

Lines changed: 56 additions & 0 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ if (NOT DEFINED SYSTEMD_SYSTEM_UNIT_DIR)
2929
pkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR systemd systemdsystemunitdir)
3030
endif()
3131

32+
# ------------------------------------------------------------------------------
33+
# Scripts.
34+
# ------------------------------------------------------------------------------
35+
36+
set(SCRIPT_LIST
37+
"xcp-linstor-manager"
38+
)
39+
40+
foreach(SCRIPT IN LISTS SCRIPT_LIST)
41+
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/${SCRIPT}.py
42+
DESTINATION ${CMAKE_INSTALL_SBINDIR}
43+
RENAME ${SCRIPT}
44+
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
45+
GROUP_READ GROUP_EXECUTE
46+
WORLD_READ WORLD_EXECUTE
47+
)
48+
endforeach()
49+
3250
# ------------------------------------------------------------------------------
3351
# Daemons.
3452
# ------------------------------------------------------------------------------

‎pyproject.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ mypy_path = [
3030
files = [
3131
"connectors",
3232
"daemons",
33+
"scripts",
3334
"src",
3435
"tests"
3536
]
@@ -108,6 +109,7 @@ search-path = ["stubs"]
108109
project-includes = [
109110
"connectors",
110111
"daemons",
112+
"scripts",
111113
"src",
112114
"tests"
113115
]
@@ -116,6 +118,7 @@ project-includes = [
116118
include = [
117119
"connectors/**/*.py",
118120
"daemons/**/*.py",
121+
"scripts/**/*.py",
119122
"src/**/*.py",
120123
"tests/**/*.py"
121124
]

‎scripts/xcp-linstor-manager.py‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env python3
2+
#
3+
# Copyright (C) 2026 Vates SAS
4+
#
5+
# This program is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation, either version 3 of the License, or
8+
# (at your option) any later version.
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
17+
import argparse
18+
19+
from xcp_storage.backends.linstor.manager import LinstorManager
20+
21+
# ==============================================================================
22+
23+
if __name__ == "__main__":
24+
parser = argparse.ArgumentParser()
25+
26+
parser.add_argument("-u", "--uri", required=False)
27+
28+
action_group = parser.add_mutually_exclusive_group(required=True)
29+
action_group.add_argument("--remove-skip-disks", action="store_true")
30+
31+
args = parser.parse_args()
32+
33+
linstor_manager = LinstorManager(args.uri)
34+
if args.remove_skip_disks:
35+
linstor_manager.remove_controller_skip_disks()

0 commit comments

Comments
 (0)