Package ganeti :: Package client :: Module gnt_node
[hide private]
[frames] | no frames]

Module gnt_node

source code

Node related commands

Functions [hide private]
 
ConvertStorageType(user_storage_type)
Converts a user storage type to its internal name.
source code
 
_RunSetupSSH(options, nodes)
Wrapper around utils.RunCmd to call setup-ssh
source code
int
AddNode(opts, args)
Add a node to the cluster.
source code
int
ListNodes(opts, args)
List nodes and their properties.
source code
int
EvacuateNode(opts, args)
Relocate all secondary instance from a node.
source code
int
FailoverNode(opts, args)
Failover all primary instance on a node.
source code
 
MigrateNode(opts, args)
Migrate all primary instance on a node.
source code
int
ShowNodeConfig(opts, args)
Show node information.
source code
int
RemoveNode(opts, args)
Remove a node from the cluster.
source code
int
PowercycleNode(opts, args)
Remove a node from the cluster.
source code
int
ListVolumes(opts, args)
List logical volumes on node(s).
source code
int
ListStorage(opts, args)
List physical volumes on node(s).
source code
int
ModifyStorage(opts, args)
Modify storage volume on a node.
source code
int
RepairStorage(opts, args)
Repairs a storage volume on a node.
source code
int
SetNodeParams(opts, args)
Modifies a node.
source code
 
Main() source code
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...
  NONODE_SETUP_OPT = cli_option("--no-node-setup", default= True...
  commands = {'add':(AddNode, [ArgHost(min= 1, max= 1)], [SECOND...

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


Function Details [hide private]

_RunSetupSSH(options, nodes)

source code 

Wrapper around utils.RunCmd to call setup-ssh

Parameters:
  • options - The command line options
  • nodes - The nodes to setup

AddNode(opts, args)

source code 

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)

source code 

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)

source code 

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)

source code 

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)

source code 

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)

source code 

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)

source code 

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)

source code 

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)

source code 

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)

source code 

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)

source code 

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)

source code 

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", "master_capab\
...

_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()

NONODE_SETUP_OPT

Value:
cli_option("--no-node-setup", default= True, action= "store_false", de\
st= "node_setup", help= ("Do not make initial SSH setup on remote" " n\
ode (needs to be done manually)"))

commands

Value:
{'add':(AddNode, [ArgHost(min= 1, max= 1)], [SECONDARY_IP_OPT, READD_O\
PT, NOSSH_KEYCHECK_OPT, NONODE_SETUP_OPT, VERBOSE_OPT, NODEGROUP_OPT, \
PRIORITY_OPT, CAPAB_MASTER_OPT, CAPAB_VM_OPT], "[-s ip] [--readd] [--n\
o-ssh-key-check] [--no-node-setup]  [--verbose] " " <node_name>", "Add\
 a node to the cluster"), 'evacuate':(EvacuateNode, [ArgNode(min= 1)],\
 [FORCE_OPT, IALLOCATOR_OPT, NEW_SECONDARY_OPT, EARLY_RELEASE_OPT, PRI\
ORITY_OPT], "[-f] {-I <iallocator> | -n <dst>} <node>", "Relocate the \
secondary instances from a node" " to other nodes (only for instances \
...