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

Script move_instance

Tool to move instances from one cluster to another.

Classes [hide private]
  Error
Generic error.
  Abort
Special exception for aborting import/export.
  RapiClientFactory
Factory class for creating RAPI clients.
  MoveJobPollReportCb
  InstanceMove
Status class for instance moves.
  MoveRuntime
Class to keep track of instance move.
  MoveDestExecutor
  MoveSourceExecutor
  MoveSourceWorker
Functions [hide private]
 
CheckRapiSetup(rapi_factory)
Checks the RAPI setup by retrieving the version.
 
ParseOptions()
Parses options passed to program.
 
_CheckAllocatorOptions(parser, options)
 
_CheckOpportunisticLockingOptions(parser, options)
 
_CheckInstanceOptions(parser, options, instance_names)
 
CheckOptions(parser, options, args)
Checks options and arguments for validity.
 
DestClusterHasDefaultIAllocator(rapi_factory)
Determines if a given cluster has a default iallocator.
 
ExitWithError(message)
Exits after an error and shows a message.
 
_PrepareListOfInstanceMoves(options, instance_names)
 
main()
Main routine.
Variables [hide private]
  SRC_RAPI_PORT_OPT = cli.cli_option("--src-rapi-port", action= ...
  SRC_CA_FILE_OPT = cli.cli_option("--src-ca-file", action= "sto...
  SRC_USERNAME_OPT = cli.cli_option("--src-username", action= "s...
  SRC_PASSWORD_FILE_OPT = cli.cli_option("--src-password-file", ...
  DEST_RAPI_PORT_OPT = cli.cli_option("--dest-rapi-port", action...
  DEST_CA_FILE_OPT = cli.cli_option("--dest-ca-file", action= "s...
  DEST_USERNAME_OPT = cli.cli_option("--dest-username", action= ...
  DEST_PASSWORD_FILE_OPT = cli.cli_option("--dest-password-file"...
  DEST_INSTANCE_NAME_OPT = cli.cli_option("--dest-instance-name"...
  DEST_PRIMARY_NODE_OPT = cli.cli_option("--dest-primary-node", ...
  DEST_SECONDARY_NODE_OPT = cli.cli_option("--dest-secondary-nod...
  DEST_DISK_TEMPLATE_OPT = cli.cli_option("--dest-disk-template"...
  COMPRESS_OPT = cli.cli_option("--compress", action= "store", t...
  PARALLEL_OPT = cli.cli_option("-p", "--parallel", action= "sto...
  OPPORTUNISTIC_TRIES_OPT = cli.cli_option("--opportunistic-trie...
  OPPORTUNISTIC_DELAY_OPT = cli.cli_option("--opportunistic-dela...

Imports: os, sys, time, logging, optparse, random, threading, cli, constants, utils, workerpool, objects, compat, rapi, errors, ganeti, UsesRapiClient


Function Details [hide private]

CheckRapiSetup(rapi_factory)

 

Checks the RAPI setup by retrieving the version.

Parameters:

main()

 

Main routine.

Decorators:
  • @UsesRapiClient

Variables Details [hide private]

SRC_RAPI_PORT_OPT

Value:
cli.cli_option("--src-rapi-port", action= "store", type= "int", dest= \
"src_rapi_port", default= constants.DEFAULT_RAPI_PORT, help= ("Source \
cluster RAPI port (defaults to %s)" % constants.DEFAULT_RAPI_PORT))

SRC_CA_FILE_OPT

Value:
cli.cli_option("--src-ca-file", action= "store", type= "string", dest=\
 "src_ca_file", help= ("File containing source cluster Certificate" " \
Authority (CA) in PEM format"))

SRC_USERNAME_OPT

Value:
cli.cli_option("--src-username", action= "store", type= "string", dest\
= "src_username", default= None, help= "Source cluster username")

SRC_PASSWORD_FILE_OPT

Value:
cli.cli_option("--src-password-file", action= "store", type= "string",\
 dest= "src_password_file", help= "File containing source cluster pass\
word")

DEST_RAPI_PORT_OPT

Value:
cli.cli_option("--dest-rapi-port", action= "store", type= "int", dest=\
 "dest_rapi_port", default= constants.DEFAULT_RAPI_PORT, help= ("Desti\
nation cluster RAPI port (defaults to source" " cluster RAPI port)"))

DEST_CA_FILE_OPT

Value:
cli.cli_option("--dest-ca-file", action= "store", type= "string", dest\
= "dest_ca_file", help= ("File containing destination cluster Certific\
ate" " Authority (CA) in PEM format (defaults to source" " cluster CA)\
"))

DEST_USERNAME_OPT

Value:
cli.cli_option("--dest-username", action= "store", type= "string", des\
t= "dest_username", default= None, help= ("Destination cluster usernam\
e (defaults to" " source cluster username)"))

DEST_PASSWORD_FILE_OPT

Value:
cli.cli_option("--dest-password-file", action= "store", type= "string"\
, dest= "dest_password_file", help= ("File containing destination clus\
ter password" " (defaults to source cluster password)"))

DEST_INSTANCE_NAME_OPT

Value:
cli.cli_option("--dest-instance-name", action= "store", type= "string"\
, dest= "dest_instance_name", help= ("Instance name on destination clu\
ster (only" " when moving exactly one instance)"))

DEST_PRIMARY_NODE_OPT

Value:
cli.cli_option("--dest-primary-node", action= "store", type= "string",\
 dest= "dest_primary_node", help= ("Primary node on destination cluste\
r (only" " when moving exactly one instance)"))

DEST_SECONDARY_NODE_OPT

Value:
cli.cli_option("--dest-secondary-node", action= "store", type= "string\
", dest= "dest_secondary_node", help= ("Secondary node on destination \
cluster (only" " when moving exactly one instance)"))

DEST_DISK_TEMPLATE_OPT

Value:
cli.cli_option("--dest-disk-template", action= "store", type= "string"\
, dest= "dest_disk_template", default= None, help= "Disk template to u\
se on destination cluster")

COMPRESS_OPT

Value:
cli.cli_option("--compress", action= "store", type= "string", dest= "c\
ompress", default= "none", help= "Compression mode to use during the m\
ove (this mode has" " to be supported by both clusters)")

PARALLEL_OPT

Value:
cli.cli_option("-p", "--parallel", action= "store", type= "int", defau\
lt= 1, dest= "parallel", metavar= "<number>", help= "Number of instanc\
es to be moved simultaneously")

OPPORTUNISTIC_TRIES_OPT

Value:
cli.cli_option("--opportunistic-tries", action= "store", type= "int", \
dest= "opportunistic_tries", metavar= "<number>", help= "Number of opp\
ortunistic instance creation attempts" " before a normal creation is p\
erformed. An opportunistic" " attempt will use the iallocator with all\
 the nodes" " currently unlocked, failing if not enough nodes are" " a\
vailable. Even though it will succeed (or fail) more" " quickly, it ca\
n result in suboptimal instance" " placement")

OPPORTUNISTIC_DELAY_OPT

Value:
cli.cli_option("--opportunistic-delay", action= "store", type= "int", \
dest= "opportunistic_delay", metavar= "<number>", help= "The delay bet\
ween successive opportunistic instance" " creation attempts, in second\
s")