Device Mapper¶
Linux kernel framework for mapping physical block devices onto virtual block
devices. Underpins LVM, dm-crypt, dm-raid, and dm-multipath. Each device type
below wraps dmsetup commands and can exist in two states: configuration-only
(has target parameters but no kernel device) or active (created on the system
with a /dev/mapper/ path).
DmDevice (base — dmsetup operations)
├── LinearDevice — 1:1 sector mapping
├── DelayDevice — adds read/write/flush latency
├── FlakeyDevice — simulates transient I/O failures
├── CacheDevice — dm-cache (SSD-backed caching)
├── ThinPoolDevice — thin provisioning pool
├── ThinDevice — thin-provisioned volume
├── VdoDevice — deduplication + compression
├── ZeroDevice — returns zeros on read, discards writes
└── ErrorDevice — fails all I/O
Device Mapper Core¶
sts.dm.base
¶
Base class for Device Mapper devices and dmsetup wrapper methods.
Class Hierarchy::
BlockDevice
└── DmDevice
├── LinearDevice, DelayDevice, VdoDevice
├── ThinPoolDevice, ThinDevice
├── ZeroDevice, ErrorDevice, FlakeyDevice, CacheDevice
└── MultipathTarget
Each device can be in two states: configuration (target args only) or active (created on the system with path, dm_name, table, etc.).
For multipath devices managed by multipathd, use
sts.multipath.MultipathDevice (inherits BlockDevice directly).
DmDevice
pydantic-model
¶
Bases: BlockDevice
Base class for all Device Mapper devices.
Before create(), the device is just a target configuration
(start, size_sectors, args). After create(), it becomes a full
block device with dm_name, path, table, and all BlockDevice functionality.
Show JSON schema:
{
"$defs": {
"BlockdevInfo": {
"description": "Parsed ``blockdev --report`` output.",
"properties": {
"ro": {
"default": false,
"title": "Ro",
"type": "boolean"
},
"ra": {
"default": 0,
"title": "Ra",
"type": "integer"
},
"log-sec": {
"default": 0,
"title": "Log-Sec",
"type": "integer"
},
"phy-sec": {
"default": 0,
"title": "Phy-Sec",
"type": "integer"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size": {
"default": 0,
"title": "Size",
"type": "integer"
}
},
"title": "BlockdevInfo",
"type": "object"
},
"LsblkInfo": {
"description": "Parsed ``lsblk -JOb`` output.",
"properties": {
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"rm": {
"default": false,
"title": "Rm",
"type": "boolean"
},
"hctl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Hctl"
},
"state": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "State"
},
"pttype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pttype"
},
"wwn": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Wwn"
},
"fstype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Fstype"
},
"mountpoint": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Mountpoint"
},
"type": {
"default": "disk",
"title": "Type",
"type": "string"
},
"tran": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Tran"
},
"maj:min": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Maj:Min"
},
"pkname": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pkname"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
}
},
"title": "LsblkInfo",
"type": "object"
}
},
"additionalProperties": false,
"description": "Base class for all Device Mapper devices.\n\nBefore ``create()``, the device is just a target configuration\n(start, size_sectors, args). After ``create()``, it becomes a full\nblock device with dm_name, path, table, and all BlockDevice functionality.",
"properties": {
"path": {
"anyOf": [
{
"type": "string"
},
{
"format": "path",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Path"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"size": {
"anyOf": [
{
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Size"
},
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"blockdev_info": {
"anyOf": [
{
"$ref": "#/$defs/BlockdevInfo"
},
{
"type": "null"
}
],
"default": null
},
"lsblk_info": {
"anyOf": [
{
"$ref": "#/$defs/LsblkInfo"
},
{
"type": "null"
}
],
"default": null
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size_sectors": {
"default": 0,
"title": "Size Sectors",
"type": "integer"
},
"args": {
"default": "",
"title": "Args",
"type": "string"
},
"dm_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Dm Name"
},
"target_type": {
"default": "",
"title": "Target Type",
"type": "string"
},
"table": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Table"
},
"is_created": {
"default": false,
"title": "Is Created",
"type": "boolean"
}
},
"title": "DmDevice",
"type": "object"
}
Fields:
-
path(PathOrStr | None) -
name(str | None) -
size(int | None) -
model(str | None) -
blockdev_info(BlockdevInfo | None) -
lsblk_info(LsblkInfo | None) -
start(int) -
size_sectors(int) -
args(str) -
dm_name(str | None) -
target_type(str) -
table(str | None) -
is_created(bool)
Source code in sts_libs/src/sts/dm/base.py
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 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 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 | |
device_path
property
¶
Path to device in sysfs (/sys/class/block/<name>).
device_root_dir
property
¶
Device mapper root directory (/dev/mapper).
dm_device_path
property
¶
Full device path (e.g. /dev/mapper/my-device), or None if dm_name not set.
type
property
¶
Target type string (e.g. 'linear', 'delay', 'vdo').
__str__()
¶
Return target table entry.
Format:
Source code in sts_libs/src/sts/dm/base.py
122 123 124 125 126 127 128 | |
clear()
¶
Destroy the table in the inactive table slot.
Source code in sts_libs/src/sts/dm/base.py
376 377 378 379 380 381 382 383 384 385 | |
create(dm_name, *, uuid=None, readonly=False, notable=False, readahead=None, addnodeoncreate=False, addnodeonresume=False)
¶
Create the device on the system.
After successful creation, this device becomes a full BlockDevice with all properties populated from the system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dm_name
|
str
|
Device mapper name |
required |
uuid
|
str | None
|
UUID for the device (can be used in place of name in commands) |
None
|
readonly
|
bool
|
Load the table as read-only |
False
|
notable
|
bool
|
Create device without loading any table |
False
|
readahead
|
str | int | None
|
Sectors, or 'auto', 'none', or '+N' for minimum |
None
|
addnodeoncreate
|
bool
|
Ensure /dev/mapper node exists after create |
False
|
addnodeonresume
|
bool
|
Ensure /dev/mapper node exists after resume |
False
|
Source code in sts_libs/src/sts/dm/base.py
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 | |
create_concise(concise_spec)
classmethod
¶
Create devices from concise specification.
Format: <name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<next device>...]
Separate multiple devices with semicolons. Escape commas/semicolons with backslash.
Source code in sts_libs/src/sts/dm/base.py
941 942 943 944 945 946 947 948 949 950 951 952 | |
deps(*, output_format='devno')
¶
Get devices referenced by the live table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_format
|
str
|
'devno' (major:minor), 'blkdevname', or 'devname' |
'devno'
|
Source code in sts_libs/src/sts/dm/base.py
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 | |
discover()
¶
Load device state from the system.
Call after construction for devices that already exist (identified by dm_name, name, or path). No-op for configuration-only devices.
Source code in sts_libs/src/sts/dm/base.py
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 | |
get_all()
classmethod
¶
Discover and return all Device Mapper devices on the system.
Source code in sts_libs/src/sts/dm/base.py
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 | |
get_by_name(dm_name)
classmethod
¶
Look up a Device Mapper device by name, or return None.
Source code in sts_libs/src/sts/dm/base.py
970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 | |
get_status(*, target_type=None, noflush=False)
¶
Get device status from dmsetup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_type
|
str | None
|
Only display information for the specified target type |
None
|
noflush
|
bool
|
Do not commit thin-pool metadata before reporting |
False
|
Source code in sts_libs/src/sts/dm/base.py
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 | |
get_table(*, concise=False, target_type=None, showkeys=False)
¶
Get the current device table.
Source code in sts_libs/src/sts/dm/base.py
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 | |
help(*, columns=False)
staticmethod
¶
Get dmsetup command help.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
columns
|
bool
|
Include report field list in the output |
False
|
Source code in sts_libs/src/sts/dm/base.py
954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 | |
info(*, columns=False, noheadings=False, fields=None, separator=None, sort_fields=None, nameprefixes=False)
¶
Get device information.
Returns dict of field->value when columns=False, raw string when columns=True, or None on error.
Source code in sts_libs/src/sts/dm/base.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 458 459 460 461 462 463 464 465 466 467 468 469 | |
load(table=None, table_file=None)
¶
Load table into the inactive slot (use resume() to make it live).
Exactly one of table or table_file must be provided.
Source code in sts_libs/src/sts/dm/base.py
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 | |
ls(*, target_type=None, output_format='devno', tree=False, tree_options=None, exec_cmd=None)
classmethod
¶
List device mapper devices.
Returns tree string if tree=True, otherwise list of device names.
Source code in sts_libs/src/sts/dm/base.py
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 | |
mangle()
¶
Ensure name/UUID contain only udev-safe characters, renaming if needed.
Source code in sts_libs/src/sts/dm/base.py
687 688 689 690 691 692 693 694 695 696 | |
measure()
¶
Show IMA measurement data (debug only, does not trigger a measurement).
Source code in sts_libs/src/sts/dm/base.py
674 675 676 677 678 679 680 681 682 683 684 685 | |
message(sector, message)
¶
Send a message to the target at the given sector (use 0 if irrelevant).
Source code in sts_libs/src/sts/dm/base.py
471 472 473 474 475 476 477 478 479 480 | |
mknodes()
¶
Ensure /dev/mapper node for this device is correct.
Source code in sts_libs/src/sts/dm/base.py
618 619 620 621 622 623 624 625 626 627 | |
mknodes_all()
classmethod
¶
Sync all /dev/mapper nodes with loaded device-mapper devices.
Source code in sts_libs/src/sts/dm/base.py
847 848 849 850 851 852 853 854 | |
refresh()
¶
Refresh device table from the system.
Source code in sts_libs/src/sts/dm/base.py
244 245 246 247 248 249 250 251 252 253 | |
reload_table(new_table)
¶
Suspend, load a new table, and resume.
Source code in sts_libs/src/sts/dm/base.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | |
remove(*, force=False, retry=False, deferred=False)
¶
Remove the device mapping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force
|
bool
|
Replace the table with one that fails all I/O |
False
|
retry
|
bool
|
Retry removal for a few seconds if it fails (e.g., udev race) |
False
|
deferred
|
bool
|
Device removed when last user closes it |
False
|
Source code in sts_libs/src/sts/dm/base.py
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 | |
remove_all(*, force=False, deferred=False)
classmethod
¶
Remove all device mapper devices (resets the driver). Use with care.
Source code in sts_libs/src/sts/dm/base.py
832 833 834 835 836 837 838 839 840 841 842 843 844 845 | |
rename(new_name)
¶
Rename the device.
Source code in sts_libs/src/sts/dm/base.py
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | |
resume(*, addnodeoncreate=False, addnodeonresume=False, noflush=False, nolockfs=False, readahead=None)
¶
Resume a suspended device.
If an inactive table has been loaded, it becomes live.
Source code in sts_libs/src/sts/dm/base.py
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 | |
set_uuid(uuid)
¶
Set the UUID of a device (immutable once set).
Source code in sts_libs/src/sts/dm/base.py
499 500 501 502 503 504 505 506 507 508 509 510 | |
setgeometry(cylinders, heads, sectors, start)
¶
Set the device geometry (C/H/S).
Source code in sts_libs/src/sts/dm/base.py
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 | |
splitname(subsystem='LVM')
¶
Split device name into subsystem constituents (e.g. LVM VG/LV/Layer).
Source code in sts_libs/src/sts/dm/base.py
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 | |
suspend(*, nolockfs=False, noflush=False)
¶
Suspend I/O to the device.
Pending I/O is flushed; new I/O is postponed until resume().
Source code in sts_libs/src/sts/dm/base.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |
targets()
staticmethod
¶
Get names and versions of currently-loaded DM targets.
Source code in sts_libs/src/sts/dm/base.py
736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | |
udevcomplete(cookie)
staticmethod
¶
Signal udev processing completion for the given cookie.
Source code in sts_libs/src/sts/dm/base.py
784 785 786 787 788 789 790 791 | |
udevcomplete_all(age_in_minutes=None)
staticmethod
¶
Remove all cookies older than age_in_minutes (resumes waiting processes).
Source code in sts_libs/src/sts/dm/base.py
793 794 795 796 797 798 799 800 801 802 803 804 | |
udevcookie()
staticmethod
¶
List all existing udev cookies.
Source code in sts_libs/src/sts/dm/base.py
806 807 808 809 810 811 812 813 814 | |
udevcreatecookie()
staticmethod
¶
Create a udev synchronization cookie (must be released via udevreleasecookie()).
Source code in sts_libs/src/sts/dm/base.py
757 758 759 760 761 762 763 764 765 | |
udevflags(cookie)
staticmethod
¶
Parse udev control flags encoded in a cookie.
Source code in sts_libs/src/sts/dm/base.py
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 | |
udevreleasecookie(cookie=None)
staticmethod
¶
Wait for pending udev processing and release the cookie.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cookie
|
str | None
|
Cookie to release (default: |
None
|
Source code in sts_libs/src/sts/dm/base.py
767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | |
version()
staticmethod
¶
Get dmsetup and driver version information.
Source code in sts_libs/src/sts/dm/base.py
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 | |
wait(event_nr=None, *, noflush=False)
¶
Wait until the event counter exceeds event_nr.
Source code in sts_libs/src/sts/dm/base.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 | |
wipe_table(*, force=False, noflush=False, nolockfs=False)
¶
Replace the table with one that fails all new I/O.
Flushes in-flight I/O first, then replaces the table to release any devices held open.
Source code in sts_libs/src/sts/dm/base.py
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 | |
sts.dm.cache
¶
Device Mapper cache target.
dm-cache improves performance of a block device (e.g., a spindle) by dynamically migrating some of its data to a faster, smaller device (e.g., an SSD).
The target requires three devices: 1. Origin device - the big, slow one (e.g., HDD) 2. Cache device - the small, fast one (e.g., SSD) 3. Metadata device - records which blocks are in cache
Table format
cache
Cache modes
- writeback (default): writes go only to cache, marked dirty
- writethrough: writes go to both cache and origin
- passthrough: all I/O goes to origin, useful for coherency
Policies
- default: alias for best performing policy
- smq: stochastic multi-queue (recommended)
- mq: multi-queue (legacy)
CacheDevice
pydantic-model
¶
Bases: DmDevice
Cache target -- caches data from a slow origin on a fast device.
Args format: <metadata> <cache> <origin> <block_size> <#features> [features] <policy> <#policy_args> [args]
Show JSON schema:
{
"$defs": {
"BlockdevInfo": {
"description": "Parsed ``blockdev --report`` output.",
"properties": {
"ro": {
"default": false,
"title": "Ro",
"type": "boolean"
},
"ra": {
"default": 0,
"title": "Ra",
"type": "integer"
},
"log-sec": {
"default": 0,
"title": "Log-Sec",
"type": "integer"
},
"phy-sec": {
"default": 0,
"title": "Phy-Sec",
"type": "integer"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size": {
"default": 0,
"title": "Size",
"type": "integer"
}
},
"title": "BlockdevInfo",
"type": "object"
},
"LsblkInfo": {
"description": "Parsed ``lsblk -JOb`` output.",
"properties": {
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"rm": {
"default": false,
"title": "Rm",
"type": "boolean"
},
"hctl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Hctl"
},
"state": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "State"
},
"pttype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pttype"
},
"wwn": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Wwn"
},
"fstype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Fstype"
},
"mountpoint": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Mountpoint"
},
"type": {
"default": "disk",
"title": "Type",
"type": "string"
},
"tran": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Tran"
},
"maj:min": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Maj:Min"
},
"pkname": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pkname"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
}
},
"title": "LsblkInfo",
"type": "object"
}
},
"additionalProperties": false,
"description": "Cache target -- caches data from a slow origin on a fast device.\n\nArgs format: ``<metadata> <cache> <origin> <block_size> <#features> [features] <policy> <#policy_args> [args]``",
"properties": {
"path": {
"anyOf": [
{
"type": "string"
},
{
"format": "path",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Path"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"size": {
"anyOf": [
{
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Size"
},
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"blockdev_info": {
"anyOf": [
{
"$ref": "#/$defs/BlockdevInfo"
},
{
"type": "null"
}
],
"default": null
},
"lsblk_info": {
"anyOf": [
{
"$ref": "#/$defs/LsblkInfo"
},
{
"type": "null"
}
],
"default": null
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size_sectors": {
"default": 0,
"title": "Size Sectors",
"type": "integer"
},
"args": {
"default": "",
"title": "Args",
"type": "string"
},
"dm_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Dm Name"
},
"target_type": {
"default": "cache",
"title": "Target Type",
"type": "string"
},
"table": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Table"
},
"is_created": {
"default": false,
"title": "Is Created",
"type": "boolean"
}
},
"title": "CacheDevice",
"type": "object"
}
Fields:
-
path(PathOrStr | None) -
name(str | None) -
size(int | None) -
model(str | None) -
blockdev_info(BlockdevInfo | None) -
lsblk_info(LsblkInfo | None) -
start(int) -
size_sectors(int) -
args(str) -
dm_name(str | None) -
table(str | None) -
is_created(bool) -
target_type(str)
Source code in sts_libs/src/sts/dm/cache.py
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 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 | |
from_block_devices(metadata_device, cache_device, origin_device, block_size_sectors=512, policy='default', policy_args=None, start=0, size_sectors=None, *, writethrough=False, passthrough=False, metadata2=False, no_discard_passdown=False)
classmethod
¶
Create CacheDevice from BlockDevices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metadata_device
|
BlockDevice
|
Device for cache metadata |
required |
cache_device
|
BlockDevice
|
Fast device (e.g. SSD) |
required |
origin_device
|
BlockDevice
|
Slow device (e.g. HDD) |
required |
block_size_sectors
|
int
|
Block size in sectors (default: 512 = 256KB). Must be between 64 (32KB) and 2097152 (1GB), multiple of 64. |
512
|
policy
|
str
|
Cache policy name |
'default'
|
policy_args
|
dict[str, str] | None
|
Policy-specific key/value arguments |
None
|
start
|
int
|
Start sector in virtual device |
0
|
size_sectors
|
int | None
|
Size in sectors (default: origin device size) |
None
|
writethrough
|
bool
|
Writes go to both cache and origin |
False
|
passthrough
|
bool
|
All I/O to origin |
False
|
metadata2
|
bool
|
Use version 2 metadata format |
False
|
no_discard_passdown
|
bool
|
Don't pass discards to origin |
False
|
Source code in sts_libs/src/sts/dm/cache.py
71 72 73 74 75 76 77 78 79 80 81 82 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 | |
parse_status(status)
staticmethod
¶
Parse cache device status string.
Raw status format (from dmsetup status)::
<start> <size> cache <metadata_block_size> <used_meta>/<total_meta>
<cache_block_size> <used_cache>/<total_cache> <read_hits> <read_misses>
<write_hits> <write_misses> <demotions> <promotions> <dirty>
<#features> [features] <#core_args> [core_args] <policy>
<#policy_args> [policy_args] <mode> <needs_check>
Source code in sts_libs/src/sts/dm/cache.py
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 | |
CacheStatus
pydantic-model
¶
Bases: ReportModel
Parsed 'dmsetup status' output for a cache target.
See CacheDevice.parse_status for the raw status line format.
Show JSON schema:
{
"description": "Parsed 'dmsetup status' output for a cache target.\n\nSee `CacheDevice.parse_status` for the raw status line format.",
"properties": {
"metadata_block_size": {
"default": 0,
"title": "Metadata Block Size",
"type": "integer"
},
"used_metadata_blocks": {
"default": 0,
"title": "Used Metadata Blocks",
"type": "integer"
},
"total_metadata_blocks": {
"default": 0,
"title": "Total Metadata Blocks",
"type": "integer"
},
"cache_block_size": {
"default": 0,
"title": "Cache Block Size",
"type": "integer"
},
"used_cache_blocks": {
"default": 0,
"title": "Used Cache Blocks",
"type": "integer"
},
"total_cache_blocks": {
"default": 0,
"title": "Total Cache Blocks",
"type": "integer"
},
"read_hits": {
"default": 0,
"title": "Read Hits",
"type": "integer"
},
"read_misses": {
"default": 0,
"title": "Read Misses",
"type": "integer"
},
"write_hits": {
"default": 0,
"title": "Write Hits",
"type": "integer"
},
"write_misses": {
"default": 0,
"title": "Write Misses",
"type": "integer"
},
"demotions": {
"default": 0,
"title": "Demotions",
"type": "integer"
},
"promotions": {
"default": 0,
"title": "Promotions",
"type": "integer"
},
"dirty": {
"default": 0,
"title": "Dirty",
"type": "integer"
}
},
"title": "CacheStatus",
"type": "object"
}
Fields:
-
metadata_block_size(int) -
used_metadata_blocks(int) -
total_metadata_blocks(int) -
cache_block_size(int) -
used_cache_blocks(int) -
total_cache_blocks(int) -
read_hits(int) -
read_misses(int) -
write_hits(int) -
write_misses(int) -
demotions(int) -
promotions(int) -
dirty(int)
Source code in sts_libs/src/sts/dm/cache.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
sts.dm.delay
¶
Device Mapper delay target.
DelayDevice
pydantic-model
¶
Bases: DmDevice
Delay target -- delays reads/writes/flushes, optionally to different devices.
Table line has either 3, 6, or 9 arguments:
- 3 args:
<device> <offset> <delay>-- same delay for all operations - 6 args:
... <write_device> <write_offset> <write_delay>-- separate write/flush delay - 9 args:
... <flush_device> <flush_offset> <flush_delay>-- separate flush delay
Offsets are in sectors, delays in milliseconds. Parsed fields (read_device,
write_device, flush_device, etc.) are populated by _parse_table() and
arg_format indicates which variant ('3', '6', or '9') was used.
Show JSON schema:
{
"$defs": {
"BlockdevInfo": {
"description": "Parsed ``blockdev --report`` output.",
"properties": {
"ro": {
"default": false,
"title": "Ro",
"type": "boolean"
},
"ra": {
"default": 0,
"title": "Ra",
"type": "integer"
},
"log-sec": {
"default": 0,
"title": "Log-Sec",
"type": "integer"
},
"phy-sec": {
"default": 0,
"title": "Phy-Sec",
"type": "integer"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size": {
"default": 0,
"title": "Size",
"type": "integer"
}
},
"title": "BlockdevInfo",
"type": "object"
},
"LsblkInfo": {
"description": "Parsed ``lsblk -JOb`` output.",
"properties": {
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"rm": {
"default": false,
"title": "Rm",
"type": "boolean"
},
"hctl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Hctl"
},
"state": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "State"
},
"pttype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pttype"
},
"wwn": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Wwn"
},
"fstype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Fstype"
},
"mountpoint": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Mountpoint"
},
"type": {
"default": "disk",
"title": "Type",
"type": "string"
},
"tran": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Tran"
},
"maj:min": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Maj:Min"
},
"pkname": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pkname"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
}
},
"title": "LsblkInfo",
"type": "object"
}
},
"additionalProperties": false,
"description": "Delay target -- delays reads/writes/flushes, optionally to different devices.\n\nTable line has either 3, 6, or 9 arguments:\n\n- 3 args: ``<device> <offset> <delay>`` -- same delay for all operations\n- 6 args: ``... <write_device> <write_offset> <write_delay>`` -- separate write/flush delay\n- 9 args: ``... <flush_device> <flush_offset> <flush_delay>`` -- separate flush delay\n\nOffsets are in sectors, delays in milliseconds. Parsed fields (read_device,\nwrite_device, flush_device, etc.) are populated by ``_parse_table()`` and\n``arg_format`` indicates which variant ('3', '6', or '9') was used.",
"properties": {
"path": {
"anyOf": [
{
"type": "string"
},
{
"format": "path",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Path"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"size": {
"anyOf": [
{
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Size"
},
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"blockdev_info": {
"anyOf": [
{
"$ref": "#/$defs/BlockdevInfo"
},
{
"type": "null"
}
],
"default": null
},
"lsblk_info": {
"anyOf": [
{
"$ref": "#/$defs/LsblkInfo"
},
{
"type": "null"
}
],
"default": null
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size_sectors": {
"default": 0,
"title": "Size Sectors",
"type": "integer"
},
"args": {
"default": "",
"title": "Args",
"type": "string"
},
"dm_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Dm Name"
},
"target_type": {
"default": "delay",
"title": "Target Type",
"type": "string"
},
"table": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Table"
},
"is_created": {
"default": false,
"title": "Is Created",
"type": "boolean"
},
"read_device": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Read Device"
},
"read_offset": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Read Offset"
},
"read_delay_ms": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Read Delay Ms"
},
"write_device": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Write Device"
},
"write_offset": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Write Offset"
},
"write_delay_ms": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Write Delay Ms"
},
"flush_device": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Flush Device"
},
"flush_offset": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Flush Offset"
},
"flush_delay_ms": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Flush Delay Ms"
},
"arg_format": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Arg Format"
}
},
"title": "DelayDevice",
"type": "object"
}
Fields:
-
path(PathOrStr | None) -
name(str | None) -
size(int | None) -
model(str | None) -
blockdev_info(BlockdevInfo | None) -
lsblk_info(LsblkInfo | None) -
start(int) -
size_sectors(int) -
args(str) -
dm_name(str | None) -
table(str | None) -
is_created(bool) -
read_device(str | None) -
read_offset(int | None) -
read_delay_ms(int | None) -
write_device(str | None) -
write_offset(int | None) -
write_delay_ms(int | None) -
flush_device(str | None) -
flush_offset(int | None) -
flush_delay_ms(int | None) -
arg_format(str | None) -
target_type(str)
Source code in sts_libs/src/sts/dm/delay.py
21 22 23 24 25 26 27 28 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 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 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
create_positional(device_path, offset, delay_ms, start=0, size=None, write_device_path=None, write_offset=None, write_delay_ms=None, flush_device_path=None, flush_offset=None, flush_delay_ms=None)
classmethod
¶
Create DelayDevice with positional arguments.
Supports 3, 6, or 9 argument formats depending on which write/flush parameters are provided.
Source code in sts_libs/src/sts/dm/delay.py
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 | |
from_block_device(device, delay_ms, start=0, size_sectors=None, offset=0)
classmethod
¶
Create DelayDevice from BlockDevice (3 argument format).
Applies the same delay to read, write, and flush operations.
Source code in sts_libs/src/sts/dm/delay.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
from_block_devices_rw(read_device, read_offset, read_delay_ms, write_device, write_offset, write_delay_ms, start=0, size=None)
classmethod
¶
Create DelayDevice with separate read and write/flush devices (6 argument format).
Source code in sts_libs/src/sts/dm/delay.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
from_block_devices_rwf(read_device, read_offset, read_delay_ms, write_device, write_offset, write_delay_ms, flush_device, flush_offset, flush_delay_ms, start=0, size=None)
classmethod
¶
Create DelayDevice with separate read, write, and flush devices (9 argument format).
Source code in sts_libs/src/sts/dm/delay.py
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 | |
from_table_line(table_line)
classmethod
¶
Create DelayDevice from a dmsetup table output line.
Source code in sts_libs/src/sts/dm/delay.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
sts.dm.error
¶
Device Mapper error target.
ErrorDevice
pydantic-model
¶
Bases: DmDevice
Error target -- returns I/O errors for all operations.
Takes no target arguments.
Show JSON schema:
{
"$defs": {
"BlockdevInfo": {
"description": "Parsed ``blockdev --report`` output.",
"properties": {
"ro": {
"default": false,
"title": "Ro",
"type": "boolean"
},
"ra": {
"default": 0,
"title": "Ra",
"type": "integer"
},
"log-sec": {
"default": 0,
"title": "Log-Sec",
"type": "integer"
},
"phy-sec": {
"default": 0,
"title": "Phy-Sec",
"type": "integer"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size": {
"default": 0,
"title": "Size",
"type": "integer"
}
},
"title": "BlockdevInfo",
"type": "object"
},
"LsblkInfo": {
"description": "Parsed ``lsblk -JOb`` output.",
"properties": {
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"rm": {
"default": false,
"title": "Rm",
"type": "boolean"
},
"hctl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Hctl"
},
"state": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "State"
},
"pttype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pttype"
},
"wwn": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Wwn"
},
"fstype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Fstype"
},
"mountpoint": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Mountpoint"
},
"type": {
"default": "disk",
"title": "Type",
"type": "string"
},
"tran": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Tran"
},
"maj:min": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Maj:Min"
},
"pkname": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pkname"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
}
},
"title": "LsblkInfo",
"type": "object"
}
},
"additionalProperties": false,
"description": "Error target -- returns I/O errors for all operations.\n\nTakes no target arguments.",
"properties": {
"path": {
"anyOf": [
{
"type": "string"
},
{
"format": "path",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Path"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"size": {
"anyOf": [
{
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Size"
},
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"blockdev_info": {
"anyOf": [
{
"$ref": "#/$defs/BlockdevInfo"
},
{
"type": "null"
}
],
"default": null
},
"lsblk_info": {
"anyOf": [
{
"$ref": "#/$defs/LsblkInfo"
},
{
"type": "null"
}
],
"default": null
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size_sectors": {
"default": 0,
"title": "Size Sectors",
"type": "integer"
},
"args": {
"default": "",
"title": "Args",
"type": "string"
},
"dm_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Dm Name"
},
"target_type": {
"default": "error",
"title": "Target Type",
"type": "string"
},
"table": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Table"
},
"is_created": {
"default": false,
"title": "Is Created",
"type": "boolean"
}
},
"title": "ErrorDevice",
"type": "object"
}
Fields:
-
path(PathOrStr | None) -
name(str | None) -
size(int | None) -
model(str | None) -
blockdev_info(BlockdevInfo | None) -
lsblk_info(LsblkInfo | None) -
start(int) -
size_sectors(int) -
args(str) -
dm_name(str | None) -
table(str | None) -
is_created(bool) -
target_type(str)
Source code in sts_libs/src/sts/dm/error.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
create_config(start=0, size=None)
classmethod
¶
Create ErrorDevice configuration.
Source code in sts_libs/src/sts/dm/error.py
21 22 23 24 25 26 27 28 29 30 31 | |
sts.dm.flakey
¶
Device Mapper flakey target.
The flakey target is similar to linear but exhibits unreliable behavior periodically. It's useful for simulating failing devices for testing.
Starting from when the table is loaded, the device is available for
Table format
Features
- drop_writes: Silently ignore all writes, reads work normally
- error_writes: Fail all writes with error, reads work normally
- corrupt_bio_byte
: Corrupt specific bytes
FlakeyDevice
pydantic-model
¶
Bases: DmDevice
Flakey target -- simulates an unreliable device that periodically fails I/O.
Args format: <device> <offset> <up_interval> <down_interval> [<num_features> [<features>]]
Show JSON schema:
{
"$defs": {
"BlockdevInfo": {
"description": "Parsed ``blockdev --report`` output.",
"properties": {
"ro": {
"default": false,
"title": "Ro",
"type": "boolean"
},
"ra": {
"default": 0,
"title": "Ra",
"type": "integer"
},
"log-sec": {
"default": 0,
"title": "Log-Sec",
"type": "integer"
},
"phy-sec": {
"default": 0,
"title": "Phy-Sec",
"type": "integer"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size": {
"default": 0,
"title": "Size",
"type": "integer"
}
},
"title": "BlockdevInfo",
"type": "object"
},
"LsblkInfo": {
"description": "Parsed ``lsblk -JOb`` output.",
"properties": {
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"rm": {
"default": false,
"title": "Rm",
"type": "boolean"
},
"hctl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Hctl"
},
"state": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "State"
},
"pttype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pttype"
},
"wwn": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Wwn"
},
"fstype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Fstype"
},
"mountpoint": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Mountpoint"
},
"type": {
"default": "disk",
"title": "Type",
"type": "string"
},
"tran": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Tran"
},
"maj:min": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Maj:Min"
},
"pkname": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pkname"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
}
},
"title": "LsblkInfo",
"type": "object"
}
},
"additionalProperties": false,
"description": "Flakey target -- simulates an unreliable device that periodically fails I/O.\n\nArgs format: ``<device> <offset> <up_interval> <down_interval> [<num_features> [<features>]]``",
"properties": {
"path": {
"anyOf": [
{
"type": "string"
},
{
"format": "path",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Path"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"size": {
"anyOf": [
{
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Size"
},
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"blockdev_info": {
"anyOf": [
{
"$ref": "#/$defs/BlockdevInfo"
},
{
"type": "null"
}
],
"default": null
},
"lsblk_info": {
"anyOf": [
{
"$ref": "#/$defs/LsblkInfo"
},
{
"type": "null"
}
],
"default": null
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size_sectors": {
"default": 0,
"title": "Size Sectors",
"type": "integer"
},
"args": {
"default": "",
"title": "Args",
"type": "string"
},
"dm_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Dm Name"
},
"target_type": {
"default": "flakey",
"title": "Target Type",
"type": "string"
},
"table": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Table"
},
"is_created": {
"default": false,
"title": "Is Created",
"type": "boolean"
}
},
"title": "FlakeyDevice",
"type": "object"
}
Fields:
-
path(PathOrStr | None) -
name(str | None) -
size(int | None) -
model(str | None) -
blockdev_info(BlockdevInfo | None) -
lsblk_info(LsblkInfo | None) -
start(int) -
size_sectors(int) -
args(str) -
dm_name(str | None) -
table(str | None) -
is_created(bool) -
target_type(str)
Source code in sts_libs/src/sts/dm/flakey.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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
from_block_device(device, up_interval, down_interval, offset=0, size_sectors=None, corrupt_bio_byte=None, start=0, *, drop_writes=False, error_writes=False)
classmethod
¶
Create FlakeyDevice from BlockDevice.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device
|
BlockDevice
|
Underlying block device |
required |
up_interval
|
int
|
Seconds device is available (reliable) |
required |
down_interval
|
int
|
Seconds device is unreliable |
required |
offset
|
int
|
Starting sector in underlying device |
0
|
size_sectors
|
int | None
|
Size in sectors (default: full device) |
None
|
corrupt_bio_byte
|
tuple[int, str, int, int] | None
|
Tuple of (nth_byte, direction, value, flags) |
None
|
start
|
int
|
Start sector in virtual device |
0
|
drop_writes
|
bool
|
Silently drop writes when down |
False
|
error_writes
|
bool
|
Fail writes with error when down |
False
|
Source code in sts_libs/src/sts/dm/flakey.py
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 91 92 93 94 95 96 97 98 99 100 | |
sts.dm.linear
¶
Device Mapper linear target.
LinearDevice
pydantic-model
¶
Bases: DmDevice
Linear target -- maps a linear range onto another device.
Args format: <destination device> <sector offset>
Show JSON schema:
{
"$defs": {
"BlockdevInfo": {
"description": "Parsed ``blockdev --report`` output.",
"properties": {
"ro": {
"default": false,
"title": "Ro",
"type": "boolean"
},
"ra": {
"default": 0,
"title": "Ra",
"type": "integer"
},
"log-sec": {
"default": 0,
"title": "Log-Sec",
"type": "integer"
},
"phy-sec": {
"default": 0,
"title": "Phy-Sec",
"type": "integer"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size": {
"default": 0,
"title": "Size",
"type": "integer"
}
},
"title": "BlockdevInfo",
"type": "object"
},
"LsblkInfo": {
"description": "Parsed ``lsblk -JOb`` output.",
"properties": {
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"rm": {
"default": false,
"title": "Rm",
"type": "boolean"
},
"hctl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Hctl"
},
"state": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "State"
},
"pttype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pttype"
},
"wwn": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Wwn"
},
"fstype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Fstype"
},
"mountpoint": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Mountpoint"
},
"type": {
"default": "disk",
"title": "Type",
"type": "string"
},
"tran": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Tran"
},
"maj:min": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Maj:Min"
},
"pkname": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pkname"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
}
},
"title": "LsblkInfo",
"type": "object"
}
},
"additionalProperties": false,
"description": "Linear target -- maps a linear range onto another device.\n\nArgs format: ``<destination device> <sector offset>``",
"properties": {
"path": {
"anyOf": [
{
"type": "string"
},
{
"format": "path",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Path"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"size": {
"anyOf": [
{
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Size"
},
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"blockdev_info": {
"anyOf": [
{
"$ref": "#/$defs/BlockdevInfo"
},
{
"type": "null"
}
],
"default": null
},
"lsblk_info": {
"anyOf": [
{
"$ref": "#/$defs/LsblkInfo"
},
{
"type": "null"
}
],
"default": null
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size_sectors": {
"default": 0,
"title": "Size Sectors",
"type": "integer"
},
"args": {
"default": "",
"title": "Args",
"type": "string"
},
"dm_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Dm Name"
},
"target_type": {
"default": "linear",
"title": "Target Type",
"type": "string"
},
"table": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Table"
},
"is_created": {
"default": false,
"title": "Is Created",
"type": "boolean"
}
},
"title": "LinearDevice",
"type": "object"
}
Fields:
-
path(PathOrStr | None) -
name(str | None) -
size(int | None) -
model(str | None) -
blockdev_info(BlockdevInfo | None) -
lsblk_info(LsblkInfo | None) -
start(int) -
size_sectors(int) -
args(str) -
dm_name(str | None) -
table(str | None) -
is_created(bool) -
target_type(str)
Source code in sts_libs/src/sts/dm/linear.py
18 19 20 21 22 23 24 25 26 27 28 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 | |
create_positional(device_path, offset=0, start=0, size_sectors=None)
classmethod
¶
Create LinearDevice with positional arguments.
Source code in sts_libs/src/sts/dm/linear.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
from_block_device(device, start=0, size_sectors=None, offset=0)
classmethod
¶
Create LinearDevice from BlockDevice.
Source code in sts_libs/src/sts/dm/linear.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
sts.dm.thin
¶
Device Mapper thin provisioning targets (thin-pool and thin).
ThinDevice
pydantic-model
¶
Bases: DmDevice
Thin target -- allocates space from a thin pool on demand.
Maintains a reference to its parent pool for lifecycle management.
Args format: <pool dev> <dev id>
Show JSON schema:
{
"$defs": {
"BlockdevInfo": {
"description": "Parsed ``blockdev --report`` output.",
"properties": {
"ro": {
"default": false,
"title": "Ro",
"type": "boolean"
},
"ra": {
"default": 0,
"title": "Ra",
"type": "integer"
},
"log-sec": {
"default": 0,
"title": "Log-Sec",
"type": "integer"
},
"phy-sec": {
"default": 0,
"title": "Phy-Sec",
"type": "integer"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size": {
"default": 0,
"title": "Size",
"type": "integer"
}
},
"title": "BlockdevInfo",
"type": "object"
},
"LsblkInfo": {
"description": "Parsed ``lsblk -JOb`` output.",
"properties": {
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"rm": {
"default": false,
"title": "Rm",
"type": "boolean"
},
"hctl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Hctl"
},
"state": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "State"
},
"pttype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pttype"
},
"wwn": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Wwn"
},
"fstype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Fstype"
},
"mountpoint": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Mountpoint"
},
"type": {
"default": "disk",
"title": "Type",
"type": "string"
},
"tran": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Tran"
},
"maj:min": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Maj:Min"
},
"pkname": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pkname"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
}
},
"title": "LsblkInfo",
"type": "object"
},
"ThinDevice": {
"additionalProperties": false,
"description": "Thin target -- allocates space from a thin pool on demand.\n\nMaintains a reference to its parent pool for lifecycle management.\n\nArgs format: ``<pool dev> <dev id>``",
"properties": {
"path": {
"anyOf": [
{
"type": "string"
},
{
"format": "path",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Path"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"size": {
"anyOf": [
{
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Size"
},
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"blockdev_info": {
"anyOf": [
{
"$ref": "#/$defs/BlockdevInfo"
},
{
"type": "null"
}
],
"default": null
},
"lsblk_info": {
"anyOf": [
{
"$ref": "#/$defs/LsblkInfo"
},
{
"type": "null"
}
],
"default": null
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size_sectors": {
"default": 0,
"title": "Size Sectors",
"type": "integer"
},
"args": {
"default": "",
"title": "Args",
"type": "string"
},
"dm_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Dm Name"
},
"target_type": {
"default": "thin",
"title": "Target Type",
"type": "string"
},
"table": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Table"
},
"is_created": {
"default": false,
"title": "Is Created",
"type": "boolean"
},
"pool": {
"anyOf": [
{
"$ref": "#/$defs/ThinPoolDevice"
},
{
"type": "null"
}
],
"default": null
},
"thin_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Thin Id"
}
},
"title": "ThinDevice",
"type": "object"
},
"ThinPoolDevice": {
"additionalProperties": false,
"description": "Thin pool target -- manages a pool from which thin volumes are allocated.\n\nTracks child ThinDevice instances and provides methods for creating,\ndeleting, and snapshotting thin volumes.\n\nArgs format: ``<metadata dev> <data dev> <block size> <low water mark> <flags> <args>``\n\nExample:\n ```python\n pool = ThinPoolDevice.from_block_devices(metadata_dev, data_dev)\n pool.create('my-pool')\n thin = pool.create_thin(thin_id=0, size=2097152, dm_name='my-thin')\n snap = pool.create_snapshot(origin_id=0, snap_id=1, dm_name='my-snap')\n pool.delete_thin(1)\n pool.delete_thin(0)\n pool.remove()\n ```",
"properties": {
"path": {
"anyOf": [
{
"type": "string"
},
{
"format": "path",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Path"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"size": {
"anyOf": [
{
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Size"
},
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"blockdev_info": {
"anyOf": [
{
"$ref": "#/$defs/BlockdevInfo"
},
{
"type": "null"
}
],
"default": null
},
"lsblk_info": {
"anyOf": [
{
"$ref": "#/$defs/LsblkInfo"
},
{
"type": "null"
}
],
"default": null
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size_sectors": {
"default": 0,
"title": "Size Sectors",
"type": "integer"
},
"args": {
"default": "",
"title": "Args",
"type": "string"
},
"dm_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Dm Name"
},
"target_type": {
"default": "thin-pool",
"title": "Target Type",
"type": "string"
},
"table": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Table"
},
"is_created": {
"default": false,
"title": "Is Created",
"type": "boolean"
},
"thin_devices": {
"additionalProperties": {
"$ref": "#/$defs/ThinDevice"
},
"title": "Thin Devices",
"type": "object"
}
},
"title": "ThinPoolDevice",
"type": "object"
}
},
"$ref": "#/$defs/ThinDevice"
}
Fields:
-
path(PathOrStr | None) -
name(str | None) -
size(int | None) -
model(str | None) -
blockdev_info(BlockdevInfo | None) -
lsblk_info(LsblkInfo | None) -
start(int) -
size_sectors(int) -
args(str) -
dm_name(str | None) -
table(str | None) -
is_created(bool) -
pool(ThinPoolDevice | None) -
thin_id(int | None) -
target_type(str)
Source code in sts_libs/src/sts/dm/thin.py
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 | |
create_from_pool(pool, thin_id, size, start=0)
classmethod
¶
Create ThinDevice configuration from pool.
Used by ThinPoolDevice.create_thin() and create_snapshot()
to build device configuration before activation.
Source code in sts_libs/src/sts/dm/thin.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
from_thin_pool(pool_device, thin_id, start=0, size=None)
classmethod
¶
Create ThinDevice from thin pool device.
For full parent-child tracking, prefer ThinPoolDevice.create_thin().
Source code in sts_libs/src/sts/dm/thin.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
ThinPoolDevice
pydantic-model
¶
Bases: DmDevice
Thin pool target -- manages a pool from which thin volumes are allocated.
Tracks child ThinDevice instances and provides methods for creating, deleting, and snapshotting thin volumes.
Args format: <metadata dev> <data dev> <block size> <low water mark> <flags> <args>
Example
pool = ThinPoolDevice.from_block_devices(metadata_dev, data_dev)
pool.create('my-pool')
thin = pool.create_thin(thin_id=0, size=2097152, dm_name='my-thin')
snap = pool.create_snapshot(origin_id=0, snap_id=1, dm_name='my-snap')
pool.delete_thin(1)
pool.delete_thin(0)
pool.remove()
Show JSON schema:
{
"$defs": {
"BlockdevInfo": {
"description": "Parsed ``blockdev --report`` output.",
"properties": {
"ro": {
"default": false,
"title": "Ro",
"type": "boolean"
},
"ra": {
"default": 0,
"title": "Ra",
"type": "integer"
},
"log-sec": {
"default": 0,
"title": "Log-Sec",
"type": "integer"
},
"phy-sec": {
"default": 0,
"title": "Phy-Sec",
"type": "integer"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size": {
"default": 0,
"title": "Size",
"type": "integer"
}
},
"title": "BlockdevInfo",
"type": "object"
},
"LsblkInfo": {
"description": "Parsed ``lsblk -JOb`` output.",
"properties": {
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"rm": {
"default": false,
"title": "Rm",
"type": "boolean"
},
"hctl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Hctl"
},
"state": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "State"
},
"pttype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pttype"
},
"wwn": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Wwn"
},
"fstype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Fstype"
},
"mountpoint": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Mountpoint"
},
"type": {
"default": "disk",
"title": "Type",
"type": "string"
},
"tran": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Tran"
},
"maj:min": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Maj:Min"
},
"pkname": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pkname"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
}
},
"title": "LsblkInfo",
"type": "object"
},
"ThinDevice": {
"additionalProperties": false,
"description": "Thin target -- allocates space from a thin pool on demand.\n\nMaintains a reference to its parent pool for lifecycle management.\n\nArgs format: ``<pool dev> <dev id>``",
"properties": {
"path": {
"anyOf": [
{
"type": "string"
},
{
"format": "path",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Path"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"size": {
"anyOf": [
{
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Size"
},
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"blockdev_info": {
"anyOf": [
{
"$ref": "#/$defs/BlockdevInfo"
},
{
"type": "null"
}
],
"default": null
},
"lsblk_info": {
"anyOf": [
{
"$ref": "#/$defs/LsblkInfo"
},
{
"type": "null"
}
],
"default": null
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size_sectors": {
"default": 0,
"title": "Size Sectors",
"type": "integer"
},
"args": {
"default": "",
"title": "Args",
"type": "string"
},
"dm_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Dm Name"
},
"target_type": {
"default": "thin",
"title": "Target Type",
"type": "string"
},
"table": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Table"
},
"is_created": {
"default": false,
"title": "Is Created",
"type": "boolean"
},
"pool": {
"anyOf": [
{
"$ref": "#/$defs/ThinPoolDevice"
},
{
"type": "null"
}
],
"default": null
},
"thin_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Thin Id"
}
},
"title": "ThinDevice",
"type": "object"
},
"ThinPoolDevice": {
"additionalProperties": false,
"description": "Thin pool target -- manages a pool from which thin volumes are allocated.\n\nTracks child ThinDevice instances and provides methods for creating,\ndeleting, and snapshotting thin volumes.\n\nArgs format: ``<metadata dev> <data dev> <block size> <low water mark> <flags> <args>``\n\nExample:\n ```python\n pool = ThinPoolDevice.from_block_devices(metadata_dev, data_dev)\n pool.create('my-pool')\n thin = pool.create_thin(thin_id=0, size=2097152, dm_name='my-thin')\n snap = pool.create_snapshot(origin_id=0, snap_id=1, dm_name='my-snap')\n pool.delete_thin(1)\n pool.delete_thin(0)\n pool.remove()\n ```",
"properties": {
"path": {
"anyOf": [
{
"type": "string"
},
{
"format": "path",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Path"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"size": {
"anyOf": [
{
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Size"
},
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"blockdev_info": {
"anyOf": [
{
"$ref": "#/$defs/BlockdevInfo"
},
{
"type": "null"
}
],
"default": null
},
"lsblk_info": {
"anyOf": [
{
"$ref": "#/$defs/LsblkInfo"
},
{
"type": "null"
}
],
"default": null
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size_sectors": {
"default": 0,
"title": "Size Sectors",
"type": "integer"
},
"args": {
"default": "",
"title": "Args",
"type": "string"
},
"dm_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Dm Name"
},
"target_type": {
"default": "thin-pool",
"title": "Target Type",
"type": "string"
},
"table": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Table"
},
"is_created": {
"default": false,
"title": "Is Created",
"type": "boolean"
},
"thin_devices": {
"additionalProperties": {
"$ref": "#/$defs/ThinDevice"
},
"title": "Thin Devices",
"type": "object"
}
},
"title": "ThinPoolDevice",
"type": "object"
}
},
"$ref": "#/$defs/ThinPoolDevice"
}
Fields:
-
path(PathOrStr | None) -
name(str | None) -
size(int | None) -
model(str | None) -
blockdev_info(BlockdevInfo | None) -
lsblk_info(LsblkInfo | None) -
start(int) -
size_sectors(int) -
args(str) -
dm_name(str | None) -
table(str | None) -
is_created(bool) -
thin_devices(dict[int, ThinDevice]) -
target_type(str)
Source code in sts_libs/src/sts/dm/thin.py
23 24 25 26 27 28 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 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 210 211 212 213 214 215 216 | |
create_snapshot(origin_id, snap_id, dm_name, *, size=None, activate=True)
¶
Create a snapshot of an existing thin volume.
The origin device should be suspended during snapshot creation.
Source code in sts_libs/src/sts/dm/thin.py
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 | |
create_thin(thin_id, size, dm_name, *, activate=True)
¶
Create a new thin volume in the pool.
Sends 'create_thin' message to the pool and optionally activates the device.
Source code in sts_libs/src/sts/dm/thin.py
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 | |
delete_thin(thin_id, *, force=False)
¶
Delete a thin volume from the pool.
Removes the thin device mapping and deletes it from the pool.
Source code in sts_libs/src/sts/dm/thin.py
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 | |
from_block_devices(metadata_device, data_device, block_size_sectors=128, low_water_mark=0, features=None, start=0, size=None)
classmethod
¶
Create ThinPoolDevice from BlockDevices.
Source code in sts_libs/src/sts/dm/thin.py
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 | |
remove(*, force=False, retry=False, deferred=False)
¶
Remove the thin pool, removing all child thin devices first.
Source code in sts_libs/src/sts/dm/thin.py
209 210 211 212 213 214 215 216 | |
sts.dm.zero
¶
Device Mapper zero target.
ZeroDevice
pydantic-model
¶
Bases: DmDevice
Zero target -- returns zeros on read, discards writes.
Takes no target arguments.
Show JSON schema:
{
"$defs": {
"BlockdevInfo": {
"description": "Parsed ``blockdev --report`` output.",
"properties": {
"ro": {
"default": false,
"title": "Ro",
"type": "boolean"
},
"ra": {
"default": 0,
"title": "Ra",
"type": "integer"
},
"log-sec": {
"default": 0,
"title": "Log-Sec",
"type": "integer"
},
"phy-sec": {
"default": 0,
"title": "Phy-Sec",
"type": "integer"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size": {
"default": 0,
"title": "Size",
"type": "integer"
}
},
"title": "BlockdevInfo",
"type": "object"
},
"LsblkInfo": {
"description": "Parsed ``lsblk -JOb`` output.",
"properties": {
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"rm": {
"default": false,
"title": "Rm",
"type": "boolean"
},
"hctl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Hctl"
},
"state": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "State"
},
"pttype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pttype"
},
"wwn": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Wwn"
},
"fstype": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Fstype"
},
"mountpoint": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Mountpoint"
},
"type": {
"default": "disk",
"title": "Type",
"type": "string"
},
"tran": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Tran"
},
"maj:min": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Maj:Min"
},
"pkname": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pkname"
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
}
},
"title": "LsblkInfo",
"type": "object"
}
},
"additionalProperties": false,
"description": "Zero target -- returns zeros on read, discards writes.\n\nTakes no target arguments.",
"properties": {
"path": {
"anyOf": [
{
"type": "string"
},
{
"format": "path",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Path"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"size": {
"anyOf": [
{
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Size"
},
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"blockdev_info": {
"anyOf": [
{
"$ref": "#/$defs/BlockdevInfo"
},
{
"type": "null"
}
],
"default": null
},
"lsblk_info": {
"anyOf": [
{
"$ref": "#/$defs/LsblkInfo"
},
{
"type": "null"
}
],
"default": null
},
"start": {
"default": 0,
"title": "Start",
"type": "integer"
},
"size_sectors": {
"default": 0,
"title": "Size Sectors",
"type": "integer"
},
"args": {
"default": "",
"title": "Args",
"type": "string"
},
"dm_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Dm Name"
},
"target_type": {
"default": "zero",
"title": "Target Type",
"type": "string"
},
"table": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Table"
},
"is_created": {
"default": false,
"title": "Is Created",
"type": "boolean"
}
},
"title": "ZeroDevice",
"type": "object"
}
Fields:
-
path(PathOrStr | None) -
name(str | None) -
size(int | None) -
model(str | None) -
blockdev_info(BlockdevInfo | None) -
lsblk_info(LsblkInfo | None) -
start(int) -
size_sectors(int) -
args(str) -
dm_name(str | None) -
table(str | None) -
is_created(bool) -
target_type(str)
Source code in sts_libs/src/sts/dm/zero.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
create_config(start=0, size=None)
classmethod
¶
Create ZeroDevice configuration.
Source code in sts_libs/src/sts/dm/zero.py
21 22 23 24 25 26 27 28 29 30 31 | |