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
ListNodeFields(opts, args)
List node fields.
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
PowerNode(opts, args)
Change/ask power state of a node.
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_POWER_COMMANDS = ["on", "off", "cycle", "status"]
default list of power commands
  _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: cli, bootstrap, opcodes, utils, constants, errors, netutils, StringIO


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) - nodes to list, or empty for all
Returns: int
the desired exit code

ListNodeFields(opts, args)

source code 

List node fields.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - fields to list, or empty for all
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

PowerNode(opts, args)

source code 

Change/ask power state of a node.

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_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, NODE_FORCE_JOIN_OPT, NONODE_SETUP_OPT, VERBOSE\
_OPT, NODEGROUP_OPT, PRIORITY_OPT, CAPAB_MASTER_OPT, CAPAB_VM_OPT, NOD\
E_PARAMS_OPT], "[-s ip] [--readd] [--no-ssh-key-check] [--force-join]"\
 " [--no-node-setup] [--verbose]" " <node_name>", "Add a node to the c\
luster"), 'evacuate':(EvacuateNode, [ArgNode(min= 1)], [FORCE_OPT, IAL\
LOCATOR_OPT, NEW_SECONDARY_OPT, EARLY_RELEASE_OPT, PRIORITY_OPT], "[-f\
] {-I <iallocator> | -n <dst>} <node>", "Relocate the secondary instan\
...