Script gnt_node
[hide private]
[frames] | no frames]

Script gnt_node

Node related commands

Functions [hide private]
 
ConvertStorageType(user_storage_type)
Converts a user storage type to its internal name.
int
AddNode(opts, args)
Add a node to the cluster.
int
ListNodes(opts, args)
List nodes and their properties.
int
EvacuateNode(opts, args)
Relocate all secondary instance from a node.
int
FailoverNode(opts, args)
Failover all primary instance on a node.
 
MigrateNode(opts, args)
Migrate all primary instance on a node.
int
ShowNodeConfig(opts, args)
Show node information.
int
RemoveNode(opts, args)
Remove a node from the cluster.
int
PowercycleNode(opts, args)
Remove a node from the cluster.
int
ListVolumes(opts, args)
List logical volumes on node(s).
int
ListStorage(opts, args)
List physical volumes on node(s).
int
ModifyStorage(opts, args)
Modify storage volume on a node.
int
RepairStorage(opts, args)
Repairs a storage volume on a node.
int
SetNodeParams(opts, args)
Modifies a node.
Variables [hide private]
  _LIST_DEF_FIELDS = ["name", "dtotal", "dfree", "mtotal", "mnod...
default list of field for ListNodes
  _LIST_VOL_DEF_FIELDS = ["node", "phys", "vg", "name", "size", ...
Default field list for ListVolumes
  _LIST_STOR_DEF_FIELDS = [constants.SF_NODE, constants.SF_TYPE,...
default list of field for ListStorage
  _LIST_HEADERS = {"name": "Node", "pinst_cnt": "Pinst", "sinst_...
headers (and full field list for ListNodes
  _LIST_STOR_HEADERS = {constants.SF_NODE: "Node", constants.SF_...
headers (and full field list for ListStorage
  _USER_STORAGE_TYPE = {constants.ST_FILE: "file", constants.ST_...
User-facing storage unit types
  _STORAGE_TYPE_OPT = cli_option("-t", "--storage-type", dest= "...
  _REPAIRABLE_STORAGE_TYPES = [st for st, so in constants.VALID_...
  _MODIFIABLE_STORAGE_TYPES = constants.MODIFIABLE_STORAGE_FIELD...
  commands = {'add':(AddNode, [ArgHost(min= 1, max= 1)], [SECOND...

Imports: sys, opcodes, utils, constants, compat, errors, bootstrap, netutils


Function Details [hide private]

AddNode(opts, args)

 

Add a node to the cluster.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should contain only one element, the new node name
Returns: int
the desired exit code
Decorators:
  • @UsesRPC

ListNodes(opts, args)

 

List nodes and their properties.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should be an empty list
Returns: int
the desired exit code

EvacuateNode(opts, args)

 

Relocate all secondary instance from a node.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should be an empty list
Returns: int
the desired exit code

FailoverNode(opts, args)

 

Failover all primary instance on a node.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should be an empty list
Returns: int
the desired exit code

ShowNodeConfig(opts, args)

 

Show node information.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should either be an empty list, in which case we show information about all nodes, or should contain a list of nodes to be queried for information
Returns: int
the desired exit code

RemoveNode(opts, args)

 

Remove a node from the cluster.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should contain only one element, the name of the node to be removed
Returns: int
the desired exit code

PowercycleNode(opts, args)

 

Remove a node from the cluster.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should contain only one element, the name of the node to be removed
Returns: int
the desired exit code

ListVolumes(opts, args)

 

List logical volumes on node(s).

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should either be an empty list, in which case we list data for all nodes, or contain a list of nodes to display data only for those
Returns: int
the desired exit code

ListStorage(opts, args)

 

List physical volumes on node(s).

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should either be an empty list, in which case we list data for all nodes, or contain a list of nodes to display data only for those
Returns: int
the desired exit code

ModifyStorage(opts, args)

 

Modify storage volume on a node.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should contain 3 items: node name, storage type and volume name
Returns: int
the desired exit code

RepairStorage(opts, args)

 

Repairs a storage volume on a node.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should contain 3 items: node name, storage type and volume name
Returns: int
the desired exit code

SetNodeParams(opts, args)

 

Modifies a node.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should contain only one element, the node name
Returns: int
the desired exit code

Variables Details [hide private]

_LIST_DEF_FIELDS

default list of field for ListNodes

Value:
["name", "dtotal", "dfree", "mtotal", "mnode", "mfree", "pinst_cnt", "\
sinst_cnt",]

_LIST_VOL_DEF_FIELDS

Default field list for ListVolumes

Value:
["node", "phys", "vg", "name", "size", "instance"]

_LIST_STOR_DEF_FIELDS

default list of field for ListStorage

Value:
[constants.SF_NODE, constants.SF_TYPE, constants.SF_NAME, constants.SF\
_SIZE, constants.SF_USED, constants.SF_FREE, constants.SF_ALLOCATABLE,\
]

_LIST_HEADERS

headers (and full field list for ListNodes

Value:
{"name": "Node", "pinst_cnt": "Pinst", "sinst_cnt": "Sinst", "pinst_li\
st": "PriInstances", "sinst_list": "SecInstances", "pip": "PrimaryIP",\
 "sip": "SecondaryIP", "dtotal": "DTotal", "dfree": "DFree", "mtotal":\
 "MTotal", "mnode": "MNode", "mfree": "MFree", "bootid": "BootID", "ct\
otal": "CTotal", "cnodes": "CNodes", "csockets": "CSockets", "tags": "\
Tags", "serial_no": "SerialNo", "master_candidate": "MasterC", "master\
": "IsMaster", "offline": "Offline", "drained": "Drained", "role": "Ro\
le", "ctime": "CTime", "mtime": "MTime", "uuid": "UUID"}

_LIST_STOR_HEADERS

headers (and full field list for ListStorage

Value:
{constants.SF_NODE: "Node", constants.SF_TYPE: "Type", constants.SF_NA\
ME: "Name", constants.SF_SIZE: "Size", constants.SF_USED: "Used", cons\
tants.SF_FREE: "Free", constants.SF_ALLOCATABLE: "Allocatable",}

_USER_STORAGE_TYPE

User-facing storage unit types

Value:
{constants.ST_FILE: "file", constants.ST_LVM_PV: "lvm-pv", constants.S\
T_LVM_VG: "lvm-vg",}

_STORAGE_TYPE_OPT

Value:
cli_option("-t", "--storage-type", dest= "user_storage_type", choices=\
 _USER_STORAGE_TYPE.keys(), default= None, metavar= "STORAGE_TYPE", he\
lp= ("Storage type (%s)" % utils.CommaJoin(_USER_STORAGE_TYPE.keys()))\
)

_REPAIRABLE_STORAGE_TYPES

Value:
[st for st, so in constants.VALID_STORAGE_OPERATIONS.iteritems() if co\
nstants.SO_FIX_CONSISTENCY in so]

_MODIFIABLE_STORAGE_TYPES

Value:
constants.MODIFIABLE_STORAGE_FIELDS.keys()

commands

Value:
{'add':(AddNode, [ArgHost(min= 1, max= 1)], [SECONDARY_IP_OPT, READD_O\
PT, NOSSH_KEYCHECK_OPT], "[-s ip] [--readd] [--no-ssh-key-check] <node\
_name>", "Add a node to the cluster"), 'evacuate':(EvacuateNode, [ArgN\
ode(min= 1)], [FORCE_OPT, IALLOCATOR_OPT, NEW_SECONDARY_OPT, EARLY_REL\
EASE_OPT], "[-f] {-I <iallocator> | -n <dst>} <node>", "Relocate the s\
econdary instances from a node" " to other nodes (only for instances w\
ith drbd disk template)"), 'failover':(FailoverNode, ARGS_ONE_NODE, [F\
ORCE_OPT, IGNORE_CONSIST_OPT], "[-f] <node>", "Stops the primary insta\
...