Stratis¶
This section documents the Stratis storage management functionality.
Base Functionality¶
sts.stratis.base
¶
Base Stratis functionality.
This module provides base functionality for Stratis operations: - Command execution - Common utilities
Stratis is a storage management solution that provides: - Advanced storage pools - Thin provisioning - Snapshots - RAID support - Encryption
Key
¶
Bases: StratisBase
Stratis key management.
Manages encryption keys for: - Pool encryption - Data security - Access control
Keys are identified by: - Key description (user-friendly name) - Key file path (contains actual key)
Examples:
Create with default configuration: key = Key()
Create with error propagation: key = Key(StratisConfig(propagate=True))
Source code in sts_libs/src/sts/stratis/base.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
|
exists(keydesc)
¶
Check if key exists.
Verifies key registration: - Checks key description - Does not verify key file - Does not check key validity
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keydesc
|
str
|
Key description |
required |
Returns:
Type | Description |
---|---|
bool
|
True if key exists, False otherwise |
Example
Check key registration:
exists = key.exists('mykey')
Source code in sts_libs/src/sts/stratis/base.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
|
list()
¶
List keys.
Shows all registered keys: - Key descriptions only - No key file contents - No usage information
Returns:
Type | Description |
---|---|
CommandResult
|
Command result |
Example
Show registered keys:
key.list()
Source code in sts_libs/src/sts/stratis/base.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
|
set(keydesc, keyfile_path)
¶
Set key.
Associates a key file with a description: - Key file must exist - Description must be unique - Used for pool encryption
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keydesc
|
str
|
Key description (identifier) |
required |
keyfile_path
|
str
|
Path to key file |
required |
Returns:
Type | Description |
---|---|
CommandResult
|
Command result |
Example
Register encryption key:
key.set('mykey', '/path/to/keyfile')
Source code in sts_libs/src/sts/stratis/base.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
unset(keydesc)
¶
Unset key.
Removes key association: - Key must not be in use - Does not delete key file - Cannot undo operation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keydesc
|
str
|
Key description |
required |
Returns:
Type | Description |
---|---|
CommandResult
|
Command result |
Example
Remove key registration:
key.unset('mykey')
Source code in sts_libs/src/sts/stratis/base.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
|
StratisBase
¶
Base class for Stratis operations.
Provides common functionality: - Command execution with options - Error handling - Version information - System reporting
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
StratisConfig | None
|
Stratis configuration (optional) |
None
|
Examples:
Create with default configuration: stratis = StratisBase()
Create with custom configuration: stratis = StratisBase(StratisConfig(propagate=True))
Source code in sts_libs/src/sts/stratis/base.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
__init__(config=None)
¶
Initialize Stratis base.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
StratisConfig | None
|
Stratis configuration |
None
|
Source code in sts_libs/src/sts/stratis/base.py
103 104 105 106 107 108 109 |
|
get_report()
¶
Get Stratis report.
Retrieves system-wide information about: - Storage pools - Filesystems - Block devices - Cache devices
Returns:
Type | Description |
---|---|
StratisReportData | None
|
Report data or None if failed |
Example
Get system report:
report = stratis.get_report()
Source code in sts_libs/src/sts/stratis/base.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
run_command(subcommand=None, action=None, options=None, positional_args=None)
¶
Run stratis command.
Command Structure: The command starts with 'stratis', followed by any global options from the configuration. Next comes the subcommand (like 'pool' or 'filesystem'), then the action (like 'create' or 'list'). Finally, any command-specific options and positional arguments are added.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
subcommand
|
str | None
|
Command category (pool, filesystem, key) |
None
|
action
|
str | None
|
Operation to perform (list, create, set) |
None
|
options
|
StratisOptions | None
|
Command-specific options as key-value pairs |
None
|
positional_args
|
list[str] | None
|
Additional arguments |
None
|
Returns:
Type | Description |
---|---|
CommandResult
|
Command result |
Examples:
List all pools: stratis.run_command('pool', 'list')
Create a filesystem: stratis.run_command('filesystem', 'create', positional_args=['pool1', 'fs1'])
Set encryption key: stratis.run_command('key', 'set', options={'--keyfile-path': '/path/to/key'}, positional_args=['mykey'])
Source code in sts_libs/src/sts/stratis/base.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
version()
¶
Get Stratis version.
Returns version information for: - stratisd daemon - stratis-cli tool - libstratis library
Returns:
Type | Description |
---|---|
CommandResult
|
Version information |
Example
Get version information:
version = stratis.version()
Source code in sts_libs/src/sts/stratis/base.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
StratisConfig
dataclass
¶
Stratis configuration.
Controls Stratis behavior: - Error handling: Whether to raise exceptions - UUID format: Hyphenated or not - Command execution: Global options
Parameters:
Name | Type | Description | Default |
---|---|---|---|
propagate
|
bool
|
Whether to propagate errors as exceptions |
False
|
unhyphenated_uuids
|
bool
|
Whether to use UUIDs without hyphens |
False
|
Examples:
Create with default settings: stratis = StratisConfig()
Create with error propagation: stratis = StratisConfig(propagate=True)
Source code in sts_libs/src/sts/stratis/base.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
to_args()
¶
Convert configuration to command arguments.
Generates CLI options based on settings: - --propagate: Raise exceptions - --unhyphenated_uuids: Change UUID format
Returns:
Type | Description |
---|---|
list[str]
|
List of command arguments |
Example
Get command line arguments:
config = StratisConfig(propagate=True)
args = config.to_args() # Returns ['--propagate']
Source code in sts_libs/src/sts/stratis/base.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
Pool Management¶
sts.stratis.pool
¶
Stratis pool management.
This module provides functionality for managing Stratis pools: - Pool creation - Pool operations - Pool encryption
BlockDevInfo
dataclass
¶
Block device information from stratis report.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str | None
|
Device path |
None
|
size
|
str | None
|
Device size in sectors |
None
|
uuid
|
str | None
|
Device UUID |
None
|
in_use
|
bool
|
Whether device is in use |
False
|
blksizes
|
str | None
|
Block size information |
None
|
Source code in sts_libs/src/sts/stratis/pool.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
from_dict(data)
classmethod
¶
Create device info from dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict[str, Any]
|
Dictionary data |
required |
Returns:
Type | Description |
---|---|
BlockDevInfo
|
BlockDevInfo instance |
Source code in sts_libs/src/sts/stratis/pool.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
parse_bool(value)
staticmethod
¶
Parse boolean value from stratis output.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
bool | int | str | None
|
Value to parse (can be bool, int, str, or None) |
required |
Returns:
Type | Description |
---|---|
bool
|
Parsed boolean value |
Source code in sts_libs/src/sts/stratis/pool.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
BlockDevs
dataclass
¶
Block devices from stratis report.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
datadevs
|
list[BlockDevInfo]
|
List of data devices |
list()
|
cachedevs
|
list[BlockDevInfo]
|
List of cache devices |
list()
|
Source code in sts_libs/src/sts/stratis/pool.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
from_dict(data)
classmethod
¶
Create block devices from dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict[str, Any]
|
Dictionary data |
required |
Returns:
Type | Description |
---|---|
BlockDevs
|
BlockDevs instance |
Source code in sts_libs/src/sts/stratis/pool.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
PoolCreateConfig
dataclass
¶
Pool creation configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key_desc
|
str | None
|
Key description for keyring encryption (optional) |
None
|
tang_url
|
str | None
|
Tang server URL for tang encryption (optional) |
None
|
thumbprint
|
str | None
|
Tang server thumbprint (optional) |
None
|
clevis
|
str | None
|
Clevis encryption configuration (optional) |
None
|
trust_url
|
bool
|
Trust Tang server URL (optional) |
False
|
no_overprovision
|
bool
|
Disable overprovisioning (optional) |
False
|
Example
config = PoolCreateConfig() # Uses defaults
config = PoolCreateConfig(key_desc='mykey') # Custom settings
Source code in sts_libs/src/sts/stratis/pool.py
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
|
PoolReport
dataclass
¶
Bases: StratisBase
Pool report data.
This class provides detailed information about a Stratis pool: - Direct report fetching - Refreshable data - Complete pool information
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str | None
|
Pool name (optional) |
None
|
uuid
|
str | None
|
Pool UUID (optional) |
None
|
blockdevs
|
BlockDevs
|
Block devices (optional) |
BlockDevs()
|
encryption
|
list[str]
|
Encryption type (optional) |
list()
|
fs_limit
|
int | None
|
Filesystem limit (optional) |
None
|
available_actions
|
str | None
|
Available actions (optional) |
None
|
filesystems
|
list[Any]
|
List of filesystems (optional) |
list()
|
raw_data
|
dict[str, Any]
|
Raw pool data from report |
dict()
|
total_size
|
int | None
|
Total pool size in sectors (optional) |
None
|
used_size
|
int | None
|
Used size of pool in sectors (optional) |
None
|
object_path
|
str | None
|
Pool Dbus object path |
None
|
prevent_update
|
bool
|
Flag to prevent updates from report (defaults to False) |
False
|
Source code in sts_libs/src/sts/stratis/pool.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
|
__post_init__()
¶
Initialize the report with default config.
Source code in sts_libs/src/sts/stratis/pool.py
158 159 160 161 162 163 164 |
|
from_dict(data)
classmethod
¶
Create report from dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict[str, Any]
|
Dictionary data |
required |
Returns:
Type | Description |
---|---|
PoolReport | None
|
PoolReport instance or None if invalid |
Source code in sts_libs/src/sts/stratis/pool.py
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
|
get_all()
classmethod
¶
Get reports for all pools.
Returns:
Type | Description |
---|---|
list[PoolReport]
|
List of PoolReport instances |
Source code in sts_libs/src/sts/stratis/pool.py
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
|
get_device_paths()
¶
Get all device paths from the pool.
Returns:
Type | Description |
---|---|
list[str]
|
List of device paths for both data and cache devices |
Source code in sts_libs/src/sts/stratis/pool.py
325 326 327 328 329 330 331 332 333 |
|
refresh()
¶
Refresh pool report data from system.
Updates all fields with the latest information from stratisd.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if refresh was successful, False otherwise |
Source code in sts_libs/src/sts/stratis/pool.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
update_size_info()
¶
Update size information from managed objects.
Fetches total and used size from the managed objects interface.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise |
Source code in sts_libs/src/sts/stratis/pool.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
|
StratisPool
dataclass
¶
Bases: StratisBase
Stratis pool representation.
This class provides functionality for managing Stratis pools: - Pool creation - Pool operations - Pool encryption
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str | None
|
Pool name (optional, discovered from system) |
None
|
uuid
|
str | None
|
Pool UUID (optional, discovered from system) |
None
|
encryption
|
list[str]
|
Encryption type (optional, discovered from system) |
list()
|
blockdevs
|
list[str]
|
List of block devices (optional, discovered from system) |
list()
|
report
|
PoolReport | None
|
Pool report (optional, discovered from system) |
None
|
Example
pool = StratisPool() # Discovers first available pool
pool = StratisPool(name='pool1') # Discovers other values
Source code in sts_libs/src/sts/stratis/pool.py
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 |
|
__post_init__()
¶
Initialize pool.
Source code in sts_libs/src/sts/stratis/pool.py
487 488 489 490 491 492 493 494 495 |
|
add_cache(blockdevs)
¶
Add cache devices to pool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
blockdevs
|
list[str]
|
List of block devices |
required |
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.add_cache(['/dev/nvme0n2'])
True
Source code in sts_libs/src/sts/stratis/pool.py
797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 |
|
add_data(blockdevs)
¶
Add data devices to pool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
blockdevs
|
list[str]
|
List of block devices |
required |
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.add_data(['/dev/sdd', '/dev/sde'])
True
Source code in sts_libs/src/sts/stratis/pool.py
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 |
|
bind_keyring(key_desc)
¶
Bind pool to keyring.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key_desc
|
str
|
Key description |
required |
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.bind_keyring('mykey')
True
Source code in sts_libs/src/sts/stratis/pool.py
826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 |
|
bind_tang(config)
¶
Bind pool to Tang server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
TangConfig
|
Tang server configuration |
required |
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.bind_tang(TangConfig('http://tang.example.com'))
True
Source code in sts_libs/src/sts/stratis/pool.py
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 |
|
bind_tpm2()
¶
Bind pool to TPM2.
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.bind_tpm2()
True
Source code in sts_libs/src/sts/stratis/pool.py
895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 |
|
create(config=None)
¶
Create pool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
PoolCreateConfig | None
|
Pool creation configuration |
None
|
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.create(PoolCreateConfig(key_desc='mykey'))
True
Source code in sts_libs/src/sts/stratis/pool.py
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
|
destroy()
¶
Destroy pool.
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.destroy()
True
Source code in sts_libs/src/sts/stratis/pool.py
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 |
|
extend_data()
¶
Extend data devices in the pool to use the full device size.
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.extend_data()
True
Source code in sts_libs/src/sts/stratis/pool.py
737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 |
|
from_report(report)
classmethod
¶
Create pool from report.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
report
|
PoolReport
|
Pool report data |
required |
Returns:
Type | Description |
---|---|
StratisPool | None
|
StratisPool instance or None if invalid |
Example
pool = StratisPool.from_report(report)
Source code in sts_libs/src/sts/stratis/pool.py
1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 |
|
get_all()
classmethod
¶
Get all Stratis pools.
Returns:
Type | Description |
---|---|
list[StratisPool]
|
List of StratisPool instances |
Example
StratisPool.get_all()
[StratisPool(name='pool1', ...), StratisPool(name='pool2', ...)]
Source code in sts_libs/src/sts/stratis/pool.py
1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 |
|
init_cache(blockdevs)
¶
Initialize cache devices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
blockdevs
|
list[str]
|
List of block devices |
required |
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.init_cache(['/dev/nvme0n1'])
True
Source code in sts_libs/src/sts/stratis/pool.py
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 |
|
list(*, stopped=False, current_pool=True)
¶
List information about pools.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stopped
|
bool
|
Display information about stopped pools only |
False
|
current_pool
|
bool
|
Display information about all pools |
True
|
Returns:
Type | Description |
---|---|
str
|
stdout if successful, None otherwise |
Example
pool.list(stopped=True)
Name Total / Used / Free Properties UUID Alerts
p1 7.28 TiB / 4.21 GiB / 7.27 TiB ~Ca,~Cr, Op 398925ee-6efa-4fe1-bc0f-9cd13e3da8d7
Source code in sts_libs/src/sts/stratis/pool.py
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 |
|
rebind_clevis()
¶
Rebind pool to Clevis.
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.rebind_clevis()
True
Source code in sts_libs/src/sts/stratis/pool.py
951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 |
|
rebind_keyring(key_desc)
¶
Rebind pool to keyring.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key_desc
|
str
|
Key description |
required |
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.rebind_keyring('mykey')
True
Source code in sts_libs/src/sts/stratis/pool.py
921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 |
|
refresh_report()
¶
Refresh pool report data.
Creates or updates the pool report with the latest information.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if refresh was successful |
Source code in sts_libs/src/sts/stratis/pool.py
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 |
|
setup_blockdevices()
classmethod
¶
Set up block devices for testing.
Returns:
Type | Description |
---|---|
list[str]
|
List of device paths |
Example
StratisPool.setup_blockdevices()
['/dev/sda', '/dev/sdb']
Source code in sts_libs/src/sts/stratis/pool.py
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 |
|
start(unlock_method=None)
¶
Start pool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
unlock_method
|
UnlockMethod | None
|
Encryption unlock method |
None
|
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.start(unlock_method='keyring')
True
Source code in sts_libs/src/sts/stratis/pool.py
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 |
|
stop()
¶
Stop pool.
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.stop()
True
Source code in sts_libs/src/sts/stratis/pool.py
680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 |
|
unbind_clevis()
¶
Unbind pool from Clevis.
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.unbind_clevis()
True
Source code in sts_libs/src/sts/stratis/pool.py
1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 |
|
unbind_keyring()
¶
Unbind pool from keyring.
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
pool.unbind_keyring()
True
Source code in sts_libs/src/sts/stratis/pool.py
978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 |
|
TangConfig
dataclass
¶
Tang server configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str | None
|
Tang server URL (optional, discovered from system) |
None
|
trust_url
|
bool
|
Trust server URL (optional) |
False
|
thumbprint
|
str | None
|
Server thumbprint (optional) |
None
|
Example
config = TangConfig() # Uses defaults
config = TangConfig(url='http://tang.example.com') # Custom settings
Source code in sts_libs/src/sts/stratis/pool.py
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
|
Filesystem Management¶
sts.stratis.filesystem
¶
Stratis filesystem management.
This module provides functionality for managing Stratis filesystems: - Filesystem creation and management - Thin provisioning and size limits - Snapshot creation and tracking - Space usage monitoring
Key features: - XFS as the default filesystem - Copy-on-write snapshots - Dynamic size management - Origin tracking for snapshots
FilesystemReport
dataclass
¶
Filesystem report data.
Contains filesystem metadata: - Basic information (name, UUID) - Size information (total, limit) - Snapshot details (origin) - Usage statistics
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str | None
|
Filesystem name (optional, discovered from system) |
None
|
uuid
|
str | None
|
Filesystem UUID (optional, discovered from system) |
None
|
size
|
str | None
|
Filesystem size (optional, discovered from system) |
None
|
size_limit
|
str | None
|
Size limit (optional, discovered from system) |
None
|
origin
|
str | None
|
Origin filesystem for snapshots (optional) |
None
|
used
|
str | None
|
Used space (optional, discovered from system) |
None
|
Example
report = FilesystemReport() # Discovers first available filesystem
report = FilesystemReport(name='fs1') # Discovers other values
Source code in sts_libs/src/sts/stratis/filesystem.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
from_dict(data)
classmethod
¶
Create report from dictionary.
Parses stratis report format: - Handles missing fields - Validates data types - Reports parsing errors
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict[str, Any]
|
Dictionary data from stratis report |
required |
Returns:
Type | Description |
---|---|
FilesystemReport | None
|
FilesystemReport instance or None if invalid |
Source code in sts_libs/src/sts/stratis/filesystem.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
StratisFilesystem
dataclass
¶
Bases: StratisBase
Stratis filesystem representation.
Manages filesystems with: - Thin provisioning - Snapshot capabilities - Size management - Usage tracking
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str | None
|
Filesystem name (optional, discovered from system) |
None
|
pool_name
|
str | None
|
Pool name (optional, discovered from system) |
None
|
uuid
|
str | None
|
Filesystem UUID (optional, discovered from system) |
None
|
size
|
int | None
|
Filesystem size in bytes (optional, discovered from system) |
None
|
size_limit
|
str | None
|
Size limit (optional, discovered from system) |
None
|
origin
|
str | None
|
Origin filesystem for snapshots (optional) |
None
|
used
|
str | None
|
Used space (optional, discovered from system) |
None
|
Example
fs = StratisFilesystem() # Discovers first available filesystem
fs = StratisFilesystem(name='fs1') # Discovers other values
Source code in sts_libs/src/sts/stratis/filesystem.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
|
__post_init__()
¶
Initialize filesystem.
Discovery process: 1. Initialize base class 2. Find pool and filesystem info 3. Parse size information 4. Set filesystem attributes
Source code in sts_libs/src/sts/stratis/filesystem.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
create(size=None, size_limit=None)
¶
Create filesystem.
Creates filesystem with: - Optional initial size - Optional size limit - Thin provisioning enabled - Default mount options
Parameters:
Name | Type | Description | Default |
---|---|---|---|
size
|
str | None
|
Initial size (e.g. "10G") |
None
|
size_limit
|
str | None
|
Size limit (e.g. "20G") |
None
|
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
fs.create(size='10G', size_limit='20G')
True
Source code in sts_libs/src/sts/stratis/filesystem.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
|
destroy()
¶
Destroy filesystem.
Removes filesystem: - Unmounts if mounted - Removes from pool - Deletes all data - Cannot be undone
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
fs.destroy()
True
Source code in sts_libs/src/sts/stratis/filesystem.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
|
from_report(report, pool_name)
classmethod
¶
Create filesystem from report.
Parses report data: - Validates required fields - Converts size formats - Sets relationships
Parameters:
Name | Type | Description | Default |
---|---|---|---|
report
|
FilesystemReport
|
Filesystem report data |
required |
pool_name
|
str
|
Pool name |
required |
Returns:
Type | Description |
---|---|
StratisFilesystem | None
|
StratisFilesystem instance or None if invalid |
Example
fs = StratisFilesystem.from_report(report, 'pool1')
Source code in sts_libs/src/sts/stratis/filesystem.py
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
|
get_all(pool_name=None)
classmethod
¶
Get all Stratis filesystems.
Lists filesystems: - Optionally filtered by pool - Includes snapshots - Provides full details - Sorted by pool
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pool_name
|
str | None
|
Filter by pool name |
None
|
Returns:
Type | Description |
---|---|
list[StratisFilesystem]
|
List of StratisFilesystem instances |
Example
StratisFilesystem.get_all('pool1')
[StratisFilesystem(name='fs1', ...), StratisFilesystem(name='fs2', ...)]
Source code in sts_libs/src/sts/stratis/filesystem.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
|
get_fs_uuid()
¶
Get filesystem UUID.
Retrieves UUID from system: - Requires pool and filesystem names - UUID is stable across reboots - Used for unique identification
Returns:
Type | Description |
---|---|
str | None
|
Filesystem UUID or None if not found |
Example
fs.get_fs_uuid()
'123e4567-e89b-12d3-a456-426614174000'
Source code in sts_libs/src/sts/stratis/filesystem.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|
rename(new_name)
¶
Rename filesystem.
Changes filesystem name: - Updates mount points - Preserves data and settings - Updates snapshot references
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_name
|
str
|
New filesystem name |
required |
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
fs.rename('fs2')
True
Source code in sts_libs/src/sts/stratis/filesystem.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
|
set_size_limit(limit)
¶
Set filesystem size limit.
Limits filesystem growth: - Thin provisioning still active - Prevents space exhaustion - Can be changed later - Uses human-readable sizes
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
str
|
Size limit (e.g. "20G") |
required |
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
fs.set_size_limit('20G')
True
Source code in sts_libs/src/sts/stratis/filesystem.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
|
snapshot(snapshot_name)
¶
Create filesystem snapshot.
Creates copy-on-write snapshot: - Instant creation - Space-efficient - Tracks origin - Writable by default
Parameters:
Name | Type | Description | Default |
---|---|---|---|
snapshot_name
|
str
|
Snapshot name |
required |
Returns:
Type | Description |
---|---|
StratisFilesystem | None
|
New filesystem instance or None if failed |
Example
fs.snapshot('snap1')
StratisFilesystem(name='snap1', ...)
Source code in sts_libs/src/sts/stratis/filesystem.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
|
unset_size_limit()
¶
Unset filesystem size limit.
Removes growth limit: - Allows unlimited growth - Limited only by pool size - Cannot be undone (must set new limit)
Returns:
Type | Description |
---|---|
bool
|
True if successful, False otherwise |
Example
fs.unset_size_limit()
True
Source code in sts_libs/src/sts/stratis/filesystem.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
|