Revision 620a85fd scripts/gnt-node
b/scripts/gnt-node | ||
---|---|---|
41 | 41 |
"pinst_cnt", "sinst_cnt", |
42 | 42 |
] |
43 | 43 |
|
44 |
|
|
45 |
#: default list of field for L{ListStorage} |
|
46 |
_LIST_STOR_DEF_FIELDS = [ |
|
47 |
constants.SF_NODE, |
|
48 |
constants.SF_TYPE, |
|
49 |
constants.SF_NAME, |
|
50 |
constants.SF_SIZE, |
|
51 |
constants.SF_USED, |
|
52 |
constants.SF_FREE, |
|
53 |
constants.SF_ALLOCATABLE, |
|
54 |
] |
|
55 |
|
|
56 |
|
|
44 | 57 |
#: headers (and full field list for L{ListNodes} |
45 | 58 |
_LIST_HEADERS = { |
46 | 59 |
"name": "Node", "pinst_cnt": "Pinst", "sinst_cnt": "Sinst", |
... | ... | |
59 | 72 |
"ctime": "CTime", "mtime": "MTime", "uuid": "UUID" |
60 | 73 |
} |
61 | 74 |
|
75 |
|
|
76 |
#: headers (and full field list for L{ListStorage} |
|
77 |
_LIST_STOR_HEADERS = { |
|
78 |
constants.SF_NODE: "Node", |
|
79 |
constants.SF_TYPE: "Type", |
|
80 |
constants.SF_NAME: "Name", |
|
81 |
constants.SF_SIZE: "Size", |
|
82 |
constants.SF_USED: "Used", |
|
83 |
constants.SF_FREE: "Free", |
|
84 |
constants.SF_ALLOCATABLE: "Allocatable", |
|
85 |
} |
|
86 |
|
|
87 |
|
|
62 | 88 |
#: User-facing storage unit types |
63 | 89 |
_USER_STORAGE_TYPE = { |
64 | 90 |
constants.ST_FILE: "file", |
... | ... | |
476 | 502 |
|
477 | 503 |
storage_type = ConvertStorageType(opts.user_storage_type) |
478 | 504 |
|
479 |
default_fields = { |
|
480 |
constants.ST_FILE: [ |
|
481 |
constants.SF_NAME, |
|
482 |
constants.SF_USED, |
|
483 |
constants.SF_FREE, |
|
484 |
], |
|
485 |
constants.ST_LVM_PV: [ |
|
486 |
constants.SF_NAME, |
|
487 |
constants.SF_SIZE, |
|
488 |
constants.SF_USED, |
|
489 |
constants.SF_FREE, |
|
490 |
], |
|
491 |
constants.ST_LVM_VG: [ |
|
492 |
constants.SF_NAME, |
|
493 |
constants.SF_SIZE, |
|
494 |
], |
|
495 |
} |
|
496 |
|
|
497 |
def_fields = ["node"] + default_fields[storage_type] |
|
498 | 505 |
if opts.output is None: |
499 |
selected_fields = def_fields
|
|
506 |
selected_fields = _LIST_STOR_DEF_FIELDS
|
|
500 | 507 |
elif opts.output.startswith("+"): |
501 |
selected_fields = def_fields + opts.output[1:].split(",")
|
|
508 |
selected_fields = _LIST_STOR_DEF_FIELDS + opts.output[1:].split(",")
|
|
502 | 509 |
else: |
503 | 510 |
selected_fields = opts.output.split(",") |
504 | 511 |
|
... | ... | |
509 | 516 |
|
510 | 517 |
if not opts.no_headers: |
511 | 518 |
headers = { |
512 |
"node": "Node", |
|
519 |
constants.SF_NODE: "Node", |
|
520 |
constants.SF_TYPE: "Type", |
|
513 | 521 |
constants.SF_NAME: "Name", |
514 | 522 |
constants.SF_SIZE: "Size", |
515 | 523 |
constants.SF_USED: "Used", |
... | ... | |
568 | 576 |
name=volume_name, |
569 | 577 |
changes=changes) |
570 | 578 |
SubmitOpCode(op) |
579 |
else: |
|
580 |
ToStderr("No changes to perform, exiting.") |
|
571 | 581 |
|
572 | 582 |
|
573 | 583 |
def RepairStorage(opts, args): |
... | ... | |
683 | 693 |
'list-storage': ( |
684 | 694 |
ListStorage, ARGS_MANY_NODES, |
685 | 695 |
[NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT, _STORAGE_TYPE_OPT], |
686 |
"[<node_name>...]", "List physical volumes on node(s)"), |
|
696 |
"[<node_name>...]", "List physical volumes on node(s). The available" |
|
697 |
" fields are (see the man page for details): %s." % |
|
698 |
(", ".join(_LIST_STOR_HEADERS))), |
|
687 | 699 |
'modify-storage': ( |
688 | 700 |
ModifyStorage, |
689 | 701 |
[ArgNode(min=1, max=1), |
Also available in: Unified diff