<s> """<STR_LIT>""" <EOL> from cStringIO import StringIO <EOL> import os <EOL> import time <EOL> import OpenSSL <EOL> import tempfile <EOL> import itertools <EOL> from ganeti . cli import * <EOL> from ganeti import bootstrap <EOL> from ganeti import compat <EOL> from ganeti import constants <EOL> from ganeti import config <EOL> from ganeti import errors <EOL> from ganeti import netutils <EOL> from ganeti import objects <EOL> from ganeti import opcodes <EOL> from ganeti import pathutils <EOL> from ganeti import qlang <EOL> from ganeti import serializer <EOL> from ganeti import ssconf <EOL> from ganeti import ssh <EOL> from ganeti import uidpool <EOL> from ganeti import utils <EOL> from ganeti import wconfd <EOL> from ganeti . client import base <EOL> ON_OPT = cli_option ( "<STR_LIT>" , default = False , <EOL> action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> GROUPS_OPT = cli_option ( "<STR_LIT>" , default = False , <EOL> action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> FORCE_FAILOVER = cli_option ( "<STR_LIT>" , dest = "<STR_LIT>" , <EOL> help = "<STR_LIT>" , <EOL> default = False , action = "<STR_LIT:store_true>" ) <EOL> FORCE_DISTRIBUTION = cli_option ( "<STR_LIT>" , dest = "<STR_LIT>" , <EOL> help = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> default = False , action = "<STR_LIT:store_true>" ) <EOL> TO_OPT = cli_option ( "<STR_LIT>" , default = None , type = "<STR_LIT:string>" , <EOL> help = "<STR_LIT>" ) <EOL> RESUME_OPT = cli_option ( "<STR_LIT>" , default = False , action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> DATA_COLLECTOR_INTERVAL_OPT = cli_option ( <EOL> "<STR_LIT>" , default = { } , type = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> _EPO_PING_INTERVAL = <NUM_LIT:30> <EOL> _EPO_PING_TIMEOUT = <NUM_LIT:1> <EOL> _EPO_REACHABLE_TIMEOUT = <NUM_LIT:15> * <NUM_LIT> <EOL> def _InitEnabledDiskTemplates ( opts ) : <EOL> """<STR_LIT>""" <EOL> if opts . enabled_disk_templates : <EOL> return opts . enabled_disk_templates . split ( "<STR_LIT:U+002C>" ) <EOL> else : <EOL> return constants . DEFAULT_ENABLED_DISK_TEMPLATES <EOL> def _InitVgName ( opts , enabled_disk_templates ) : <EOL> """<STR_LIT>""" <EOL> vg_name = None <EOL> if opts . vg_name is not None : <EOL> vg_name = opts . vg_name <EOL> if vg_name : <EOL> if not utils . IsLvmEnabled ( enabled_disk_templates ) : <EOL> ToStdout ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> elif utils . IsLvmEnabled ( enabled_disk_templates ) : <EOL> raise errors . OpPrereqError ( <EOL> "<STR_LIT>" ) <EOL> elif utils . IsLvmEnabled ( enabled_disk_templates ) : <EOL> vg_name = constants . DEFAULT_VG <EOL> return vg_name <EOL> def _InitDrbdHelper ( opts , enabled_disk_templates , feedback_fn = ToStdout ) : <EOL> """<STR_LIT>""" <EOL> drbd_enabled = constants . DT_DRBD8 in enabled_disk_templates <EOL> if not drbd_enabled and opts . drbd_helper is not None : <EOL> feedback_fn ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if drbd_enabled : <EOL> if opts . drbd_helper is None : <EOL> return constants . DEFAULT_DRBD_HELPER <EOL> if opts . drbd_helper == '<STR_LIT>' : <EOL> raise errors . OpPrereqError ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return opts . drbd_helper <EOL> @ UsesRPC <EOL> def InitCluster ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> enabled_disk_templates = _InitEnabledDiskTemplates ( opts ) <EOL> try : <EOL> vg_name = _InitVgName ( opts , enabled_disk_templates ) <EOL> drbd_helper = _InitDrbdHelper ( opts , enabled_disk_templates ) <EOL> except errors . OpPrereqError , e : <EOL> ToStderr ( str ( e ) ) <EOL> return <NUM_LIT:1> <EOL> master_netdev = opts . master_netdev <EOL> if master_netdev is None : <EOL> nic_mode = opts . nicparams . get ( constants . NIC_MODE , None ) <EOL> if not nic_mode : <EOL> master_netdev = constants . DEFAULT_BRIDGE <EOL> elif nic_mode == constants . NIC_MODE_OVS : <EOL> master_netdev = constants . DEFAULT_OVS <EOL> opts . nicparams [ constants . NIC_LINK ] = constants . DEFAULT_OVS <EOL> hvlist = opts . enabled_hypervisors <EOL> if hvlist is None : <EOL> hvlist = constants . DEFAULT_ENABLED_HYPERVISOR <EOL> hvlist = hvlist . split ( "<STR_LIT:U+002C>" ) <EOL> hvparams = dict ( opts . hvparams ) <EOL> beparams = opts . beparams <EOL> nicparams = opts . nicparams <EOL> diskparams = dict ( opts . diskparams ) <EOL> diskparams_keys = set ( diskparams . keys ( ) ) <EOL> if not ( diskparams_keys <= constants . DISK_TEMPLATES ) : <EOL> unknown = utils . NiceSort ( diskparams_keys - constants . DISK_TEMPLATES ) <EOL> ToStderr ( "<STR_LIT>" % utils . CommaJoin ( unknown ) ) <EOL> return <NUM_LIT:1> <EOL> beparams = objects . FillDict ( constants . BEC_DEFAULTS , beparams ) <EOL> utils . ForceDictType ( beparams , constants . BES_PARAMETER_COMPAT ) <EOL> nicparams = objects . FillDict ( constants . NICC_DEFAULTS , nicparams ) <EOL> utils . ForceDictType ( nicparams , constants . NICS_PARAMETER_TYPES ) <EOL> if opts . ndparams is None : <EOL> ndparams = dict ( constants . NDC_DEFAULTS ) <EOL> else : <EOL> ndparams = objects . FillDict ( constants . NDC_DEFAULTS , opts . ndparams ) <EOL> utils . ForceDictType ( ndparams , constants . NDS_PARAMETER_TYPES ) <EOL> for hv in constants . HYPER_TYPES : <EOL> if hv not in hvparams : <EOL> hvparams [ hv ] = { } <EOL> hvparams [ hv ] = objects . FillDict ( constants . HVC_DEFAULTS [ hv ] , hvparams [ hv ] ) <EOL> utils . ForceDictType ( hvparams [ hv ] , constants . HVS_PARAMETER_TYPES ) <EOL> for templ in constants . DISK_TEMPLATES : <EOL> if templ not in diskparams : <EOL> diskparams [ templ ] = { } <EOL> diskparams [ templ ] = objects . FillDict ( constants . DISK_DT_DEFAULTS [ templ ] , <EOL> diskparams [ templ ] ) <EOL> utils . ForceDictType ( diskparams [ templ ] , constants . DISK_DT_TYPES ) <EOL> ipolicy = CreateIPolicyFromOpts ( <EOL> ispecs_mem_size = opts . ispecs_mem_size , <EOL> ispecs_cpu_count = opts . ispecs_cpu_count , <EOL> ispecs_disk_count = opts . ispecs_disk_count , <EOL> ispecs_disk_size = opts . ispecs_disk_size , <EOL> ispecs_nic_count = opts . ispecs_nic_count , <EOL> minmax_ispecs = opts . ipolicy_bounds_specs , <EOL> std_ispecs = opts . ipolicy_std_specs , <EOL> ipolicy_disk_templates = opts . ipolicy_disk_templates , <EOL> ipolicy_vcpu_ratio = opts . ipolicy_vcpu_ratio , <EOL> ipolicy_spindle_ratio = opts . ipolicy_spindle_ratio , <EOL> ipolicy_memory_ratio = opts . ipolicy_memory_ratio , <EOL> fill_all = True ) <EOL> if opts . candidate_pool_size is None : <EOL> opts . candidate_pool_size = constants . MASTER_POOL_SIZE_DEFAULT <EOL> if opts . mac_prefix is None : <EOL> opts . mac_prefix = constants . DEFAULT_MAC_PREFIX <EOL> uid_pool = opts . uid_pool <EOL> if uid_pool is not None : <EOL> uid_pool = uidpool . ParseUidPool ( uid_pool ) <EOL> if opts . prealloc_wipe_disks is None : <EOL> opts . prealloc_wipe_disks = False <EOL> external_ip_setup_script = opts . use_external_mip_script <EOL> if external_ip_setup_script is None : <EOL> external_ip_setup_script = False <EOL> try : <EOL> primary_ip_version = int ( opts . primary_ip_version ) <EOL> except ( ValueError , TypeError ) , err : <EOL> ToStderr ( "<STR_LIT>" % str ( err ) ) <EOL> return <NUM_LIT:1> <EOL> master_netmask = opts . master_netmask <EOL> try : <EOL> if master_netmask is not None : <EOL> master_netmask = int ( master_netmask ) <EOL> except ( ValueError , TypeError ) , err : <EOL> ToStderr ( "<STR_LIT>" % str ( err ) ) <EOL> return <NUM_LIT:1> <EOL> if opts . disk_state : <EOL> disk_state = utils . FlatToDict ( opts . disk_state ) <EOL> else : <EOL> disk_state = { } <EOL> hv_state = dict ( opts . hv_state ) <EOL> if opts . install_image : <EOL> install_image = opts . install_image <EOL> else : <EOL> install_image = "<STR_LIT>" <EOL> if opts . zeroing_image : <EOL> zeroing_image = opts . zeroing_image <EOL> else : <EOL> zeroing_image = "<STR_LIT>" <EOL> compression_tools = _GetCompressionTools ( opts ) <EOL> default_ialloc_params = opts . default_iallocator_params <EOL> if opts . enabled_user_shutdown : <EOL> enabled_user_shutdown = True <EOL> else : <EOL> enabled_user_shutdown = False <EOL> if opts . ssh_key_type : <EOL> ssh_key_type = opts . ssh_key_type <EOL> else : <EOL> ssh_key_type = constants . SSH_DEFAULT_KEY_TYPE <EOL> ssh_key_bits = ssh . DetermineKeyBits ( ssh_key_type , opts . ssh_key_bits , None , <EOL> None ) <EOL> bootstrap . InitCluster ( cluster_name = args [ <NUM_LIT:0> ] , <EOL> secondary_ip = opts . secondary_ip , <EOL> vg_name = vg_name , <EOL> mac_prefix = opts . mac_prefix , <EOL> master_netmask = master_netmask , <EOL> master_netdev = master_netdev , <EOL> file_storage_dir = opts . file_storage_dir , <EOL> shared_file_storage_dir = opts . shared_file_storage_dir , <EOL> gluster_storage_dir = opts . gluster_storage_dir , <EOL> enabled_hypervisors = hvlist , <EOL> hvparams = hvparams , <EOL> beparams = beparams , <EOL> nicparams = nicparams , <EOL> ndparams = ndparams , <EOL> diskparams = diskparams , <EOL> ipolicy = ipolicy , <EOL> candidate_pool_size = opts . candidate_pool_size , <EOL> modify_etc_hosts = opts . modify_etc_hosts , <EOL> modify_ssh_setup = opts . modify_ssh_setup , <EOL> maintain_node_health = opts . maintain_node_health , <EOL> drbd_helper = drbd_helper , <EOL> uid_pool = uid_pool , <EOL> default_iallocator = opts . default_iallocator , <EOL> default_iallocator_params = default_ialloc_params , <EOL> primary_ip_version = primary_ip_version , <EOL> prealloc_wipe_disks = opts . prealloc_wipe_disks , <EOL> use_external_mip_script = external_ip_setup_script , <EOL> hv_state = hv_state , <EOL> disk_state = disk_state , <EOL> enabled_disk_templates = enabled_disk_templates , <EOL> install_image = install_image , <EOL> zeroing_image = zeroing_image , <EOL> compression_tools = compression_tools , <EOL> enabled_user_shutdown = enabled_user_shutdown , <EOL> ssh_key_type = ssh_key_type , <EOL> ssh_key_bits = ssh_key_bits , <EOL> ) <EOL> op = opcodes . OpClusterPostInit ( ) <EOL> SubmitOpCode ( op , opts = opts ) <EOL> return <NUM_LIT:0> <EOL> @ UsesRPC <EOL> def DestroyCluster ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> if not opts . yes_do_it : <EOL> ToStderr ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> op = opcodes . OpClusterDestroy ( ) <EOL> master_uuid = SubmitOpCode ( op , opts = opts ) <EOL> bootstrap . FinalizeClusterDestroy ( master_uuid ) <EOL> return <NUM_LIT:0> <EOL> def RenameCluster ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> cl = GetClient ( ) <EOL> ( cluster_name , ) = cl . QueryConfigValues ( [ "<STR_LIT>" ] ) <EOL> new_name = args [ <NUM_LIT:0> ] <EOL> if not opts . force : <EOL> usertext = ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) % ( cluster_name , new_name ) <EOL> if not AskUser ( usertext ) : <EOL> return <NUM_LIT:1> <EOL> op = opcodes . OpClusterRename ( name = new_name ) <EOL> result = SubmitOpCode ( op , opts = opts , cl = cl ) <EOL> if result : <EOL> ToStdout ( "<STR_LIT>" , cluster_name , result ) <EOL> return <NUM_LIT:0> <EOL> def ActivateMasterIp ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> op = opcodes . OpClusterActivateMasterIp ( ) <EOL> SubmitOpCode ( op ) <EOL> return <NUM_LIT:0> <EOL> def DeactivateMasterIp ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> if not opts . confirm : <EOL> usertext = ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if not AskUser ( usertext ) : <EOL> return <NUM_LIT:1> <EOL> op = opcodes . OpClusterDeactivateMasterIp ( ) <EOL> SubmitOpCode ( op ) <EOL> return <NUM_LIT:0> <EOL> def RedistributeConfig ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> op = opcodes . OpClusterRedistConf ( ) <EOL> if opts . yes_do_it : <EOL> SubmitOpCodeToDrainedQueue ( op ) <EOL> else : <EOL> SubmitOrSend ( op , opts ) <EOL> return <NUM_LIT:0> <EOL> def ShowClusterVersion ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> cl = GetClient ( ) <EOL> result = cl . QueryClusterInfo ( ) <EOL> ToStdout ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) <EOL> ToStdout ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) <EOL> ToStdout ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) <EOL> ToStdout ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) <EOL> ToStdout ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) <EOL> ToStdout ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) <EOL> return <NUM_LIT:0> <EOL> def ShowClusterMaster ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> master = bootstrap . GetMaster ( ) <EOL> ToStdout ( master ) <EOL> return <NUM_LIT:0> <EOL> def _FormatGroupedParams ( paramsdict , roman = False ) : <EOL> """<STR_LIT>""" <EOL> ret = { } <EOL> for ( item , val ) in paramsdict . items ( ) : <EOL> if isinstance ( val , dict ) : <EOL> ret [ item ] = _FormatGroupedParams ( val , roman = roman ) <EOL> elif roman and isinstance ( val , int ) : <EOL> ret [ item ] = compat . TryToRoman ( val ) <EOL> else : <EOL> ret [ item ] = str ( val ) <EOL> return ret <EOL> def _FormatDataCollectors ( paramsdict ) : <EOL> """<STR_LIT>""" <EOL> enabled = paramsdict [ constants . DATA_COLLECTORS_ENABLED_NAME ] <EOL> interval = paramsdict [ constants . DATA_COLLECTORS_INTERVAL_NAME ] <EOL> ret = { } <EOL> for key in enabled : <EOL> ret [ key ] = dict ( active = enabled [ key ] , <EOL> interval = "<STR_LIT>" % ( interval [ key ] / <NUM_LIT> ) ) <EOL> return ret <EOL> def ShowClusterConfig ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> cl = GetClient ( ) <EOL> result = cl . QueryClusterInfo ( ) <EOL> if result [ "<STR_LIT>" ] : <EOL> tags = utils . CommaJoin ( utils . NiceSort ( result [ "<STR_LIT>" ] ) ) <EOL> else : <EOL> tags = "<STR_LIT>" <EOL> if result [ "<STR_LIT>" ] : <EOL> reserved_lvs = utils . CommaJoin ( result [ "<STR_LIT>" ] ) <EOL> else : <EOL> reserved_lvs = "<STR_LIT>" <EOL> enabled_hv = result [ "<STR_LIT>" ] <EOL> hvparams = dict ( ( k , v ) for k , v in result [ "<STR_LIT>" ] . iteritems ( ) <EOL> if k in enabled_hv ) <EOL> info = [ <EOL> ( "<STR_LIT>" , result [ "<STR_LIT:name>" ] ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , utils . FormatTime ( result [ "<STR_LIT>" ] ) ) , <EOL> ( "<STR_LIT>" , utils . FormatTime ( result [ "<STR_LIT>" ] ) ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , <EOL> "<STR_LIT>" % ( result [ "<STR_LIT>" ] [ <NUM_LIT:0> ] , result [ "<STR_LIT>" ] [ <NUM_LIT:1> ] ) ) , <EOL> ( "<STR_LIT>" , tags ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , utils . CommaJoin ( enabled_hv ) ) , <EOL> ( "<STR_LIT>" , _FormatGroupedParams ( hvparams , <EOL> opts . roman_integers ) ) , <EOL> ( "<STR_LIT>" , <EOL> _FormatGroupedParams ( result [ "<STR_LIT>" ] , opts . roman_integers ) ) , <EOL> ( "<STR_LIT>" , _FormatGroupedParams ( result [ "<STR_LIT>" ] , <EOL> opts . roman_integers ) ) , <EOL> ( "<STR_LIT>" , utils . CommaJoin ( result [ "<STR_LIT>" ] ) ) , <EOL> ( "<STR_LIT>" , utils . CommaJoin ( result [ "<STR_LIT>" ] ) ) , <EOL> ( "<STR_LIT>" , [ <EOL> ( "<STR_LIT>" , <EOL> compat . TryToRoman ( result [ "<STR_LIT>" ] , <EOL> convert = opts . roman_integers ) ) , <EOL> ( "<STR_LIT>" , <EOL> compat . TryToRoman ( result [ "<STR_LIT>" ] , <EOL> convert = opts . roman_integers ) ) , <EOL> ( "<STR_LIT>" , <EOL> compat . TryToRoman ( result [ "<STR_LIT>" ] , <EOL> convert = opts . roman_integers ) ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , compat . TryToRoman ( result [ "<STR_LIT>" ] , <EOL> opts . roman_integers ) ) , <EOL> ( "<STR_LIT>" , <EOL> result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , reserved_lvs ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , uidpool . FormatUidPool ( result [ "<STR_LIT>" ] ) ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , <EOL> result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , compat . TryToRoman ( result [ "<STR_LIT>" ] , <EOL> opts . roman_integers ) ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , utils . CommaJoin ( pathutils . OS_SEARCH_PATH ) ) , <EOL> ( "<STR_LIT>" , <EOL> utils . CommaJoin ( pathutils . ES_SEARCH_PATH ) ) , <EOL> ( "<STR_LIT>" , <EOL> utils . CommaJoin ( result [ "<STR_LIT>" ] ) ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , <EOL> result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ( "<STR_LIT>" , result [ "<STR_LIT>" ] ) , <EOL> ] ) , <EOL> ( "<STR_LIT>" , <EOL> _FormatGroupedParams ( result [ "<STR_LIT>" ] , roman = opts . roman_integers ) ) , <EOL> ( "<STR_LIT>" , <EOL> _FormatGroupedParams ( result [ "<STR_LIT>" ] , roman = opts . roman_integers ) ) , <EOL> ( "<STR_LIT>" , <EOL> _FormatGroupedParams ( result [ "<STR_LIT>" ] , roman = opts . roman_integers ) ) , <EOL> ( "<STR_LIT>" , <EOL> _FormatGroupedParams ( result [ "<STR_LIT>" ] , roman = opts . roman_integers ) ) , <EOL> ( "<STR_LIT>" , <EOL> FormatPolicyInfo ( result [ "<STR_LIT>" ] , None , True , opts . roman_integers ) ) , <EOL> ( "<STR_LIT>" , _FormatDataCollectors ( result ) ) , <EOL> ] <EOL> PrintGenericInfo ( info ) <EOL> return <NUM_LIT:0> <EOL> def ClusterCopyFile ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> filename = args [ <NUM_LIT:0> ] <EOL> filename = os . path . abspath ( filename ) <EOL> if not os . path . exists ( filename ) : <EOL> raise errors . OpPrereqError ( "<STR_LIT>" % filename , <EOL> errors . ECODE_INVAL ) <EOL> cl = GetClient ( ) <EOL> qcl = GetClient ( ) <EOL> try : <EOL> cluster_name = cl . QueryConfigValues ( [ "<STR_LIT>" ] ) [ <NUM_LIT:0> ] <EOL> results = GetOnlineNodes ( nodes = opts . nodes , cl = qcl , filter_master = True , <EOL> secondary_ips = opts . use_replication_network , <EOL> nodegroup = opts . nodegroup ) <EOL> ports = GetNodesSshPorts ( opts . nodes , qcl ) <EOL> finally : <EOL> cl . Close ( ) <EOL> qcl . Close ( ) <EOL> srun = ssh . SshRunner ( cluster_name ) <EOL> for ( node , port ) in zip ( results , ports ) : <EOL> if not srun . CopyFileToNode ( node , port , filename ) : <EOL> ToStderr ( "<STR_LIT>" , filename , node , port ) <EOL> return <NUM_LIT:0> <EOL> def RunClusterCommand ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> cl = GetClient ( ) <EOL> qcl = GetClient ( ) <EOL> command = "<STR_LIT:U+0020>" . join ( args ) <EOL> nodes = GetOnlineNodes ( nodes = opts . nodes , cl = qcl , nodegroup = opts . nodegroup ) <EOL> ports = GetNodesSshPorts ( nodes , qcl ) <EOL> cluster_name , master_node = cl . QueryConfigValues ( [ "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> srun = ssh . SshRunner ( cluster_name = cluster_name ) <EOL> if master_node in nodes : <EOL> nodes . remove ( master_node ) <EOL> nodes . append ( master_node ) <EOL> for ( name , port ) in zip ( nodes , ports ) : <EOL> result = srun . Run ( name , constants . SSH_LOGIN_USER , command , port = port ) <EOL> if opts . failure_only and result . exit_code == constants . EXIT_SUCCESS : <EOL> continue <EOL> ToStdout ( "<STR_LIT>" ) <EOL> if opts . show_machine_names : <EOL> for line in result . output . splitlines ( ) : <EOL> ToStdout ( "<STR_LIT>" , name , line ) <EOL> else : <EOL> ToStdout ( "<STR_LIT>" , name ) <EOL> ToStdout ( "<STR_LIT:%s>" , result . output ) <EOL> ToStdout ( "<STR_LIT>" , result . exit_code ) <EOL> return <NUM_LIT:0> <EOL> def VerifyCluster ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> skip_checks = [ ] <EOL> if opts . skip_nplusone_mem : <EOL> skip_checks . append ( constants . VERIFY_NPLUSONE_MEM ) <EOL> cl = GetClient ( ) <EOL> op = opcodes . OpClusterVerify ( verbose = opts . verbose , <EOL> error_codes = opts . error_codes , <EOL> debug_simulate_errors = opts . simulate_errors , <EOL> skip_checks = skip_checks , <EOL> ignore_errors = opts . ignore_errors , <EOL> group_name = opts . nodegroup , <EOL> verify_clutter = opts . verify_clutter ) <EOL> result = SubmitOpCode ( op , cl = cl , opts = opts ) <EOL> jex = JobExecutor ( cl = cl , opts = opts ) <EOL> for ( status , job_id ) in result [ constants . JOB_IDS_KEY ] : <EOL> jex . AddJobId ( None , status , job_id ) <EOL> results = jex . GetResults ( ) <EOL> ( bad_jobs , bad_results ) = map ( len , <EOL> map ( list , <EOL> map ( compat . partial ( itertools . ifilterfalse , bool ) , <EOL> zip ( * ( ( job_success , len ( op_results ) == <NUM_LIT:1> and op_results [ <NUM_LIT:0> ] ) <EOL> for ( job_success , op_results ) in results ) ) ) ) ) <EOL> if bad_jobs == <NUM_LIT:0> and bad_results == <NUM_LIT:0> : <EOL> rcode = constants . EXIT_SUCCESS <EOL> else : <EOL> rcode = constants . EXIT_FAILURE <EOL> if bad_jobs > <NUM_LIT:0> : <EOL> ToStdout ( "<STR_LIT>" , bad_jobs ) <EOL> return rcode <EOL> def VerifyDisks ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> cl = GetClient ( ) <EOL> op = opcodes . OpClusterVerifyDisks ( group_name = opts . nodegroup ) <EOL> result = SubmitOpCode ( op , cl = cl , opts = opts ) <EOL> jex = JobExecutor ( cl = cl , opts = opts ) <EOL> for ( status , job_id ) in result [ constants . JOB_IDS_KEY ] : <EOL> jex . AddJobId ( None , status , job_id ) <EOL> retcode = constants . EXIT_SUCCESS <EOL> for ( status , result ) in jex . GetResults ( ) : <EOL> if not status : <EOL> ToStdout ( "<STR_LIT>" , result ) <EOL> continue <EOL> ( ( bad_nodes , instances , missing ) , ) = result <EOL> for node , text in bad_nodes . items ( ) : <EOL> ToStdout ( "<STR_LIT>" , <EOL> node , utils . SafeEncode ( text [ - <NUM_LIT> : ] ) ) <EOL> retcode = constants . EXIT_FAILURE <EOL> ToStdout ( "<STR_LIT>" ) <EOL> for iname in instances : <EOL> if iname in missing : <EOL> continue <EOL> op = opcodes . OpInstanceActivateDisks ( instance_name = iname ) <EOL> try : <EOL> ToStdout ( "<STR_LIT>" , iname ) <EOL> SubmitOpCode ( op , opts = opts , cl = cl ) <EOL> except errors . GenericError , err : <EOL> nret , msg = FormatError ( err ) <EOL> retcode |= nret <EOL> ToStderr ( "<STR_LIT>" , iname , msg ) <EOL> if missing : <EOL> for iname , ival in missing . iteritems ( ) : <EOL> all_missing = compat . all ( x [ <NUM_LIT:0> ] in bad_nodes for x in ival ) <EOL> if all_missing : <EOL> ToStdout ( "<STR_LIT>" <EOL> "<STR_LIT>" , iname ) <EOL> else : <EOL> ToStdout ( "<STR_LIT>" , iname ) <EOL> ival . sort ( ) <EOL> for node , vol in ival : <EOL> if node in bad_nodes : <EOL> ToStdout ( "<STR_LIT>" , node , vol ) <EOL> else : <EOL> ToStdout ( "<STR_LIT>" , node , vol ) <EOL> ToStdout ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> retcode = constants . EXIT_FAILURE <EOL> elif not instances : <EOL> ToStdout ( "<STR_LIT>" ) <EOL> return retcode <EOL> def RepairDiskSizes ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> op = opcodes . OpClusterRepairDiskSizes ( instances = args ) <EOL> SubmitOpCode ( op , opts = opts ) <EOL> @ UsesRPC <EOL> def MasterFailover ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> if not opts . no_voting : <EOL> if not bootstrap . MajorityHealthy ( ) : <EOL> ToStderr ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if opts . no_voting and not opts . yes_do_it : <EOL> usertext = ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if not AskUser ( usertext ) : <EOL> return <NUM_LIT:1> <EOL> rvlaue , msgs = bootstrap . MasterFailover ( no_voting = opts . no_voting ) <EOL> for msg in msgs : <EOL> ToStderr ( msg ) <EOL> return rvlaue <EOL> def MasterPing ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> cl = GetClient ( ) <EOL> cl . QueryClusterInfo ( ) <EOL> return <NUM_LIT:0> <EOL> except Exception : <EOL> return <NUM_LIT:1> <EOL> def SearchTags ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> op = opcodes . OpTagsSearch ( pattern = args [ <NUM_LIT:0> ] ) <EOL> result = SubmitOpCode ( op , opts = opts ) <EOL> if not result : <EOL> return <NUM_LIT:1> <EOL> result = list ( result ) <EOL> result . sort ( ) <EOL> for path , tag in result : <EOL> ToStdout ( "<STR_LIT>" , path , tag ) <EOL> def _ReadAndVerifyCert ( cert_filename , verify_private_key = False ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> pem = utils . ReadFile ( cert_filename ) <EOL> except IOError , err : <EOL> raise errors . X509CertError ( cert_filename , <EOL> "<STR_LIT>" % str ( err ) ) <EOL> try : <EOL> OpenSSL . crypto . load_certificate ( OpenSSL . crypto . FILETYPE_PEM , pem ) <EOL> except Exception , err : <EOL> raise errors . X509CertError ( cert_filename , <EOL> "<STR_LIT>" % str ( err ) ) <EOL> if verify_private_key : <EOL> try : <EOL> OpenSSL . crypto . load_privatekey ( OpenSSL . crypto . FILETYPE_PEM , pem ) <EOL> except Exception , err : <EOL> raise errors . X509CertError ( cert_filename , <EOL> "<STR_LIT>" % str ( err ) ) <EOL> return pem <EOL> def _RenewCrypto ( new_cluster_cert , new_rapi_cert , <EOL> rapi_cert_filename , new_spice_cert , spice_cert_filename , <EOL> spice_cacert_filename , new_confd_hmac_key , new_cds , <EOL> cds_filename , force , new_node_cert , new_ssh_keys , <EOL> ssh_key_type , ssh_key_bits , verbose , debug ) : <EOL> """<STR_LIT>""" <EOL> ToStdout ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if new_rapi_cert and rapi_cert_filename : <EOL> ToStderr ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if new_cds and cds_filename : <EOL> ToStderr ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if new_spice_cert and ( spice_cert_filename or spice_cacert_filename ) : <EOL> ToStderr ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if bool ( spice_cacert_filename ) ^ bool ( spice_cert_filename ) : <EOL> ToStderr ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> rapi_cert_pem , spice_cert_pem , spice_cacert_pem = ( None , None , None ) <EOL> try : <EOL> if rapi_cert_filename : <EOL> rapi_cert_pem = _ReadAndVerifyCert ( rapi_cert_filename , True ) <EOL> if spice_cert_filename : <EOL> spice_cert_pem = _ReadAndVerifyCert ( spice_cert_filename , True ) <EOL> spice_cacert_pem = _ReadAndVerifyCert ( spice_cacert_filename ) <EOL> except errors . X509CertError , err : <EOL> ToStderr ( "<STR_LIT>" , err [ <NUM_LIT:0> ] , err [ <NUM_LIT:1> ] ) <EOL> return <NUM_LIT:1> <EOL> if cds_filename : <EOL> try : <EOL> cds = utils . ReadFile ( cds_filename ) <EOL> except Exception , err : <EOL> ToStderr ( "<STR_LIT>" % <EOL> ( cds_filename , str ( err ) ) ) <EOL> return <NUM_LIT:1> <EOL> else : <EOL> cds = None <EOL> if not force : <EOL> usertext = ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if not AskUser ( usertext ) : <EOL> return <NUM_LIT:1> <EOL> def _RenewCryptoInner ( ctx ) : <EOL> ctx . feedback_fn ( "<STR_LIT>" ) <EOL> bootstrap . GenerateClusterCrypto ( False , <EOL> new_rapi_cert , <EOL> new_spice_cert , <EOL> new_confd_hmac_key , <EOL> new_cds , <EOL> False , <EOL> None , <EOL> rapi_cert_pem = rapi_cert_pem , <EOL> spice_cert_pem = spice_cert_pem , <EOL> spice_cacert_pem = spice_cacert_pem , <EOL> cds = cds ) <EOL> files_to_copy = [ ] <EOL> if new_rapi_cert or rapi_cert_pem : <EOL> files_to_copy . append ( pathutils . RAPI_CERT_FILE ) <EOL> if new_spice_cert or spice_cert_pem : <EOL> files_to_copy . append ( pathutils . SPICE_CERT_FILE ) <EOL> files_to_copy . append ( pathutils . SPICE_CACERT_FILE ) <EOL> if new_confd_hmac_key : <EOL> files_to_copy . append ( pathutils . CONFD_HMAC_KEY ) <EOL> if new_cds or cds : <EOL> files_to_copy . append ( pathutils . CLUSTER_DOMAIN_SECRET_FILE ) <EOL> if files_to_copy : <EOL> for node_name in ctx . nonmaster_nodes : <EOL> port = ctx . ssh_ports [ node_name ] <EOL> ctx . feedback_fn ( "<STR_LIT>" % <EOL> ( "<STR_LIT:U+002CU+0020>" . join ( files_to_copy ) , node_name , port ) ) <EOL> for file_name in files_to_copy : <EOL> ctx . ssh . CopyFileToNode ( node_name , port , file_name ) <EOL> def _RenewClientCerts ( ctx ) : <EOL> ctx . feedback_fn ( "<STR_LIT>" ) <EOL> cluster_name = ssconf . SimpleStore ( ) . GetClusterName ( ) <EOL> for node_name in ctx . nonmaster_nodes + [ ctx . master_node ] : <EOL> ssh_port = ctx . ssh_ports [ node_name ] <EOL> data = { <EOL> constants . NDS_CLUSTER_NAME : cluster_name , <EOL> constants . NDS_NODE_DAEMON_CERTIFICATE : <EOL> utils . ReadFile ( pathutils . NODED_CERT_FILE ) , <EOL> constants . NDS_NODE_NAME : node_name , <EOL> constants . NDS_ACTION : constants . CRYPTO_ACTION_CREATE , <EOL> } <EOL> ssh . RunSshCmdWithStdin ( <EOL> cluster_name , <EOL> node_name , <EOL> pathutils . SSL_UPDATE , <EOL> ssh_port , <EOL> data , <EOL> debug = ctx . debug , <EOL> verbose = ctx . verbose , <EOL> use_cluster_key = True , <EOL> ask_key = False , <EOL> strict_host_check = True ) <EOL> master_digest = utils . GetCertificateDigest ( ) <EOL> ssconf_master_candidate_certs_filename = os . path . join ( <EOL> pathutils . DATA_DIR , "<STR_LIT>" % <EOL> ( constants . SSCONF_FILEPREFIX , constants . SS_MASTER_CANDIDATES_CERTS ) ) <EOL> utils . WriteFile ( <EOL> ssconf_master_candidate_certs_filename , <EOL> data = "<STR_LIT>" % ( constants . CRYPTO_BOOTSTRAP , master_digest ) ) <EOL> for node_name in ctx . nonmaster_nodes : <EOL> port = ctx . ssh_ports [ node_name ] <EOL> ctx . feedback_fn ( "<STR_LIT>" % <EOL> ( ssconf_master_candidate_certs_filename , node_name , port ) ) <EOL> ctx . ssh . CopyFileToNode ( node_name , port , <EOL> ssconf_master_candidate_certs_filename ) <EOL> config_live_lock = utils . livelock . LiveLock ( "<STR_LIT>" ) <EOL> cfg = config . GetConfig ( None , config_live_lock ) <EOL> cfg . AddNodeToCandidateCerts ( constants . CRYPTO_BOOTSTRAP , master_digest ) <EOL> cfg . Update ( cfg . GetClusterInfo ( ) , ctx . feedback_fn ) <EOL> def _RenewServerAndClientCerts ( ctx ) : <EOL> ctx . feedback_fn ( "<STR_LIT>" ) <EOL> master_name = ssconf . SimpleStore ( ) . GetMasterNode ( ) <EOL> bootstrap . GenerateClusterCrypto ( True , <EOL> False , <EOL> False , <EOL> False , <EOL> False , <EOL> True , <EOL> master_name ) <EOL> for node_name in ctx . nonmaster_nodes : <EOL> port = ctx . ssh_ports [ node_name ] <EOL> server_cert = pathutils . NODED_CERT_FILE <EOL> ctx . feedback_fn ( "<STR_LIT>" % <EOL> ( server_cert , node_name , port ) ) <EOL> ctx . ssh . CopyFileToNode ( node_name , port , server_cert ) <EOL> _RenewClientCerts ( ctx ) <EOL> if new_rapi_cert or new_spice_cert or new_confd_hmac_key or new_cds : <EOL> RunWhileClusterStopped ( ToStdout , _RenewCryptoInner ) <EOL> if new_node_cert and not new_cluster_cert : <EOL> RunWhileDaemonsStopped ( ToStdout , [ constants . NODED , constants . WCONFD ] , <EOL> _RenewClientCerts , verbose = verbose , debug = debug ) <EOL> if new_cluster_cert : <EOL> RunWhileDaemonsStopped ( ToStdout , [ constants . NODED , constants . WCONFD ] , <EOL> _RenewServerAndClientCerts , verbose = verbose , <EOL> debug = debug ) <EOL> if new_node_cert or new_cluster_cert or new_ssh_keys : <EOL> cl = GetClient ( ) <EOL> renew_op = opcodes . OpClusterRenewCrypto ( <EOL> node_certificates = new_node_cert or new_cluster_cert , <EOL> renew_ssh_keys = new_ssh_keys , <EOL> ssh_key_type = ssh_key_type , <EOL> ssh_key_bits = ssh_key_bits , <EOL> verbose = verbose , <EOL> debug = debug ) <EOL> SubmitOpCode ( renew_op , cl = cl ) <EOL> ToStdout ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> def _BuildGanetiPubKeys ( options , pub_key_file = pathutils . SSH_PUB_KEYS , cl = None , <EOL> get_online_nodes_fn = GetOnlineNodes , <EOL> get_nodes_ssh_ports_fn = GetNodesSshPorts , <EOL> get_node_uuids_fn = GetNodeUUIDs , <EOL> homedir_fn = None ) : <EOL> """<STR_LIT>""" <EOL> if not cl : <EOL> cl = GetClient ( ) <EOL> ( cluster_name , master_node , modify_ssh_setup , ssh_key_type ) = cl . QueryConfigValues ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> if not modify_ssh_setup : <EOL> return <EOL> if os . path . exists ( pub_key_file ) : <EOL> utils . CreateBackup ( pub_key_file ) <EOL> utils . RemoveFile ( pub_key_file ) <EOL> ssh . ClearPubKeyFile ( pub_key_file ) <EOL> online_nodes = get_online_nodes_fn ( [ ] , cl = cl ) <EOL> ssh_ports = get_nodes_ssh_ports_fn ( online_nodes + [ master_node ] , cl ) <EOL> ssh_port_map = dict ( zip ( online_nodes + [ master_node ] , ssh_ports ) ) <EOL> node_uuids = get_node_uuids_fn ( online_nodes + [ master_node ] , cl ) <EOL> node_uuid_map = dict ( zip ( online_nodes + [ master_node ] , node_uuids ) ) <EOL> nonmaster_nodes = [ name for name in online_nodes <EOL> if name != master_node ] <EOL> _ , pub_key_filename , _ = ssh . GetUserFiles ( constants . SSH_LOGIN_USER , mkdir = False , dircheck = False , <EOL> kind = ssh_key_type , _homedir_fn = homedir_fn ) <EOL> pub_key = utils . ReadFile ( pub_key_filename ) <EOL> ssh . AddPublicKey ( node_uuid_map [ master_node ] , pub_key , <EOL> key_file = pub_key_file ) <EOL> for node in nonmaster_nodes : <EOL> pub_key = ssh . ReadRemoteSshPubKey ( pub_key_filename , node , cluster_name , <EOL> ssh_port_map [ node ] , <EOL> options . ssh_key_check , <EOL> options . ssh_key_check ) <EOL> ssh . AddPublicKey ( node_uuid_map [ node ] , pub_key , key_file = pub_key_file ) <EOL> def RenewCrypto ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> if opts . new_ssh_keys : <EOL> _BuildGanetiPubKeys ( opts ) <EOL> return _RenewCrypto ( opts . new_cluster_cert , <EOL> opts . new_rapi_cert , <EOL> opts . rapi_cert , <EOL> opts . new_spice_cert , <EOL> opts . spice_cert , <EOL> opts . spice_cacert , <EOL> opts . new_confd_hmac_key , <EOL> opts . new_cluster_domain_secret , <EOL> opts . cluster_domain_secret , <EOL> opts . force , <EOL> opts . new_node_cert , <EOL> opts . new_ssh_keys , <EOL> opts . ssh_key_type , <EOL> opts . ssh_key_bits , <EOL> opts . verbose , <EOL> opts . debug > <NUM_LIT:0> ) <EOL> def _GetEnabledDiskTemplates ( opts ) : <EOL> """<STR_LIT>""" <EOL> if opts . enabled_disk_templates : <EOL> return opts . enabled_disk_templates . split ( "<STR_LIT:U+002C>" ) <EOL> else : <EOL> return None <EOL> def _GetVgName ( opts , enabled_disk_templates ) : <EOL> """<STR_LIT>""" <EOL> vg_name = None <EOL> if opts . vg_name is not None : <EOL> vg_name = opts . vg_name <EOL> if enabled_disk_templates : <EOL> if vg_name and not utils . IsLvmEnabled ( enabled_disk_templates ) : <EOL> ToStdout ( "<STR_LIT>" <EOL> "<STR_LIT>" % <EOL> utils . CommaJoin ( constants . DTS_LVM ) ) <EOL> return vg_name <EOL> def _GetDrbdHelper ( opts , enabled_disk_templates ) : <EOL> """<STR_LIT>""" <EOL> drbd_helper = opts . drbd_helper <EOL> if enabled_disk_templates : <EOL> drbd_enabled = constants . DT_DRBD8 in enabled_disk_templates <EOL> if not drbd_enabled and opts . drbd_helper : <EOL> ToStdout ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return drbd_helper <EOL> def _GetCompressionTools ( opts ) : <EOL> """<STR_LIT>""" <EOL> if opts . compression_tools : <EOL> return opts . compression_tools . split ( "<STR_LIT:U+002C>" ) <EOL> elif opts . compression_tools is None : <EOL> return None <EOL> else : <EOL> return constants . IEC_DEFAULT_TOOLS <EOL> def SetClusterParams ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> if not ( opts . vg_name is not None or <EOL> opts . drbd_helper is not None or <EOL> opts . enabled_hypervisors or opts . hvparams or <EOL> opts . beparams or opts . nicparams or <EOL> opts . ndparams or opts . diskparams or <EOL> opts . candidate_pool_size is not None or <EOL> opts . max_running_jobs is not None or <EOL> opts . max_tracked_jobs is not None or <EOL> opts . uid_pool is not None or <EOL> opts . maintain_node_health is not None or <EOL> opts . add_uids is not None or <EOL> opts . remove_uids is not None or <EOL> opts . default_iallocator is not None or <EOL> opts . default_iallocator_params is not None or <EOL> opts . reserved_lvs is not None or <EOL> opts . mac_prefix is not None or <EOL> opts . master_netdev is not None or <EOL> opts . master_netmask is not None or <EOL> opts . use_external_mip_script is not None or <EOL> opts . prealloc_wipe_disks is not None or <EOL> opts . hv_state or <EOL> opts . enabled_disk_templates or <EOL> opts . disk_state or <EOL> opts . ipolicy_bounds_specs is not None or <EOL> opts . ipolicy_std_specs is not None or <EOL> opts . ipolicy_disk_templates is not None or <EOL> opts . ipolicy_vcpu_ratio is not None or <EOL> opts . ipolicy_spindle_ratio is not None or <EOL> opts . ipolicy_memory_ratio is not None or <EOL> opts . modify_etc_hosts is not None or <EOL> opts . file_storage_dir is not None or <EOL> opts . install_image is not None or <EOL> opts . instance_communication_network is not None or <EOL> opts . zeroing_image is not None or <EOL> opts . shared_file_storage_dir is not None or <EOL> opts . compression_tools is not None or <EOL> opts . shared_file_storage_dir is not None or <EOL> opts . enabled_user_shutdown is not None or <EOL> opts . maint_round_delay is not None or <EOL> opts . maint_balance is not None or <EOL> opts . maint_balance_threshold is not None or <EOL> opts . data_collector_interval or <EOL> opts . diagnose_data_collector_filename is not None or <EOL> opts . enabled_data_collectors ) : <EOL> ToStderr ( "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> enabled_disk_templates = _GetEnabledDiskTemplates ( opts ) <EOL> vg_name = _GetVgName ( opts , enabled_disk_templates ) <EOL> try : <EOL> drbd_helper = _GetDrbdHelper ( opts , enabled_disk_templates ) <EOL> except errors . OpPrereqError , e : <EOL> ToStderr ( str ( e ) ) <EOL> return <NUM_LIT:1> <EOL> hvlist = opts . enabled_hypervisors <EOL> if hvlist is not None : <EOL> hvlist = hvlist . split ( "<STR_LIT:U+002C>" ) <EOL> hvparams = dict ( opts . hvparams ) <EOL> for hv_params in hvparams . values ( ) : <EOL> utils . ForceDictType ( hv_params , constants . HVS_PARAMETER_TYPES ) <EOL> diskparams = dict ( opts . diskparams ) <EOL> for dt_params in diskparams . values ( ) : <EOL> utils . ForceDictType ( dt_params , constants . DISK_DT_TYPES ) <EOL> beparams = opts . beparams <EOL> utils . ForceDictType ( beparams , constants . BES_PARAMETER_COMPAT ) <EOL> nicparams = opts . nicparams <EOL> utils . ForceDictType ( nicparams , constants . NICS_PARAMETER_TYPES ) <EOL> ndparams = opts . ndparams <EOL> if ndparams is not None : <EOL> utils . ForceDictType ( ndparams , constants . NDS_PARAMETER_TYPES ) <EOL> ipolicy = CreateIPolicyFromOpts ( <EOL> minmax_ispecs = opts . ipolicy_bounds_specs , <EOL> std_ispecs = opts . ipolicy_std_specs , <EOL> ipolicy_disk_templates = opts . ipolicy_disk_templates , <EOL> ipolicy_vcpu_ratio = opts . ipolicy_vcpu_ratio , <EOL> ipolicy_spindle_ratio = opts . ipolicy_spindle_ratio , <EOL> ipolicy_memory_ratio = opts . ipolicy_memory_ratio , <EOL> ) <EOL> mnh = opts . maintain_node_health <EOL> uid_pool = opts . uid_pool <EOL> if uid_pool is not None : <EOL> uid_pool = uidpool . ParseUidPool ( uid_pool ) <EOL> add_uids = opts . add_uids <EOL> if add_uids is not None : <EOL> add_uids = uidpool . ParseUidPool ( add_uids ) <EOL> remove_uids = opts . remove_uids <EOL> if remove_uids is not None : <EOL> remove_uids = uidpool . ParseUidPool ( remove_uids ) <EOL> if opts . reserved_lvs is not None : <EOL> if opts . reserved_lvs == "<STR_LIT>" : <EOL> opts . reserved_lvs = [ ] <EOL> else : <EOL> opts . reserved_lvs = utils . UnescapeAndSplit ( opts . reserved_lvs , sep = "<STR_LIT:U+002C>" ) <EOL> if opts . master_netmask is not None : <EOL> try : <EOL> opts . master_netmask = int ( opts . master_netmask ) <EOL> except ValueError : <EOL> ToStderr ( "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> ext_ip_script = opts . use_external_mip_script <EOL> if opts . disk_state : <EOL> disk_state = utils . FlatToDict ( opts . disk_state ) <EOL> else : <EOL> disk_state = { } <EOL> hv_state = dict ( opts . hv_state ) <EOL> compression_tools = _GetCompressionTools ( opts ) <EOL> enabled_data_collectors = dict ( <EOL> ( k , v . lower ( ) . startswith ( "<STR_LIT:t>" ) ) <EOL> for k , v in opts . enabled_data_collectors . items ( ) ) <EOL> unrecognized_data_collectors = [ <EOL> k for k in enabled_data_collectors . keys ( ) <EOL> if k not in constants . DATA_COLLECTOR_NAMES ] <EOL> if unrecognized_data_collectors : <EOL> ToStderr ( "<STR_LIT>" % <EOL> "<STR_LIT:U+002CU+0020>" . join ( unrecognized_data_collectors ) ) <EOL> try : <EOL> data_collector_interval = dict ( <EOL> ( k , long ( <NUM_LIT> * float ( v ) ) ) <EOL> for ( k , v ) in opts . data_collector_interval . items ( ) ) <EOL> except ValueError : <EOL> ToStderr ( "<STR_LIT>" . format ( <EOL> opts . data_collector_interval ) ) <EOL> return <NUM_LIT:1> <EOL> if any ( v <= <NUM_LIT:0> for v in data_collector_interval ) : <EOL> ToStderr ( "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> op = opcodes . OpClusterSetParams ( <EOL> vg_name = vg_name , <EOL> drbd_helper = drbd_helper , <EOL> enabled_hypervisors = hvlist , <EOL> hvparams = hvparams , <EOL> os_hvp = None , <EOL> beparams = beparams , <EOL> nicparams = nicparams , <EOL> ndparams = ndparams , <EOL> diskparams = diskparams , <EOL> ipolicy = ipolicy , <EOL> candidate_pool_size = opts . candidate_pool_size , <EOL> max_running_jobs = opts . max_running_jobs , <EOL> max_tracked_jobs = opts . max_tracked_jobs , <EOL> maintain_node_health = mnh , <EOL> modify_etc_hosts = opts . modify_etc_hosts , <EOL> uid_pool = uid_pool , <EOL> add_uids = add_uids , <EOL> remove_uids = remove_uids , <EOL> default_iallocator = opts . default_iallocator , <EOL> default_iallocator_params = opts . default_iallocator_params , <EOL> prealloc_wipe_disks = opts . prealloc_wipe_disks , <EOL> mac_prefix = opts . mac_prefix , <EOL> master_netdev = opts . master_netdev , <EOL> master_netmask = opts . master_netmask , <EOL> reserved_lvs = opts . reserved_lvs , <EOL> use_external_mip_script = ext_ip_script , <EOL> hv_state = hv_state , <EOL> disk_state = disk_state , <EOL> enabled_disk_templates = enabled_disk_templates , <EOL> force = opts . force , <EOL> file_storage_dir = opts . file_storage_dir , <EOL> install_image = opts . install_image , <EOL> instance_communication_network = opts . instance_communication_network , <EOL> zeroing_image = opts . zeroing_image , <EOL> shared_file_storage_dir = opts . shared_file_storage_dir , <EOL> compression_tools = compression_tools , <EOL> enabled_user_shutdown = opts . enabled_user_shutdown , <EOL> maint_round_delay = opts . maint_round_delay , <EOL> maint_balance = opts . maint_balance , <EOL> maint_balance_threshold = opts . maint_balance_threshold , <EOL> enabled_data_collectors = enabled_data_collectors , <EOL> data_collector_interval = data_collector_interval , <EOL> diagnose_data_collector_filename = opts . diagnose_data_collector_filename <EOL> ) <EOL> return base . GetResult ( None , opts , SubmitOrSend ( op , opts ) ) <EOL> def QueueOps ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> command = args [ <NUM_LIT:0> ] <EOL> client = GetClient ( ) <EOL> if command in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> drain_flag = command == "<STR_LIT>" <EOL> client . SetQueueDrainFlag ( drain_flag ) <EOL> elif command == "<STR_LIT:info>" : <EOL> result = client . QueryConfigValues ( [ "<STR_LIT>" ] ) <EOL> if result [ <NUM_LIT:0> ] : <EOL> val = "<STR_LIT>" <EOL> else : <EOL> val = "<STR_LIT>" <EOL> ToStdout ( "<STR_LIT>" % val ) <EOL> else : <EOL> raise errors . OpPrereqError ( "<STR_LIT>" % command , <EOL> errors . ECODE_INVAL ) <EOL> return <NUM_LIT:0> <EOL> def _ShowWatcherPause ( until ) : <EOL> if until is None or until < time . time ( ) : <EOL> ToStdout ( "<STR_LIT>" ) <EOL> else : <EOL> ToStdout ( "<STR_LIT>" , time . ctime ( until ) ) <EOL> def WatcherOps ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> command = args [ <NUM_LIT:0> ] <EOL> client = GetClient ( ) <EOL> if command == "<STR_LIT>" : <EOL> client . SetWatcherPause ( None ) <EOL> ToStdout ( "<STR_LIT>" ) <EOL> elif command == "<STR_LIT>" : <EOL> if len ( args ) < <NUM_LIT:2> : <EOL> raise errors . OpPrereqError ( "<STR_LIT>" , errors . ECODE_INVAL ) <EOL> result = client . SetWatcherPause ( time . time ( ) + ParseTimespec ( args [ <NUM_LIT:1> ] ) ) <EOL> _ShowWatcherPause ( result ) <EOL> elif command == "<STR_LIT:info>" : <EOL> result = client . QueryConfigValues ( [ "<STR_LIT>" ] ) <EOL> _ShowWatcherPause ( result [ <NUM_LIT:0> ] ) <EOL> else : <EOL> raise errors . OpPrereqError ( "<STR_LIT>" % command , <EOL> errors . ECODE_INVAL ) <EOL> return <NUM_LIT:0> <EOL> def _OobPower ( opts , node_list , power ) : <EOL> """<STR_LIT>""" <EOL> if power : <EOL> command = constants . OOB_POWER_ON <EOL> else : <EOL> command = constants . OOB_POWER_OFF <EOL> op = opcodes . OpOobCommand ( node_names = node_list , <EOL> command = command , <EOL> ignore_status = True , <EOL> timeout = opts . oob_timeout , <EOL> power_delay = opts . power_delay ) <EOL> result = SubmitOpCode ( op , opts = opts ) <EOL> errs = <NUM_LIT:0> <EOL> for node_result in result : <EOL> ( node_tuple , data_tuple ) = node_result <EOL> ( _ , node_name ) = node_tuple <EOL> ( data_status , _ ) = data_tuple <EOL> if data_status != constants . RS_NORMAL : <EOL> assert data_status != constants . RS_UNAVAIL <EOL> errs += <NUM_LIT:1> <EOL> ToStderr ( "<STR_LIT>" , <EOL> node_name ) <EOL> if errs > <NUM_LIT:0> : <EOL> return False <EOL> return True <EOL> def _InstanceStart ( opts , inst_list , start , no_remember = False ) : <EOL> """<STR_LIT>""" <EOL> if start : <EOL> opcls = opcodes . OpInstanceStartup <EOL> text_submit , text_success , text_failed = ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> else : <EOL> opcls = compat . partial ( opcodes . OpInstanceShutdown , <EOL> timeout = opts . shutdown_timeout , <EOL> no_remember = no_remember ) <EOL> text_submit , text_success , text_failed = ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> jex = JobExecutor ( opts = opts ) <EOL> for inst in inst_list : <EOL> ToStdout ( "<STR_LIT>" , text_submit , inst ) <EOL> op = opcls ( instance_name = inst ) <EOL> jex . QueueJob ( inst , op ) <EOL> results = jex . GetResults ( ) <EOL> bad_cnt = len ( [ <NUM_LIT:1> for ( success , _ ) in results if not success ] ) <EOL> if bad_cnt == <NUM_LIT:0> : <EOL> ToStdout ( "<STR_LIT>" , text_success ) <EOL> else : <EOL> ToStderr ( "<STR_LIT>" <EOL> "<STR_LIT>" , text_failed , bad_cnt , <EOL> len ( results ) ) <EOL> return False <EOL> return True <EOL> class _RunWhenNodesReachableHelper ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , node_list , action_cb , node2ip , port , feedback_fn , <EOL> _ping_fn = netutils . TcpPing , _sleep_fn = time . sleep ) : <EOL> """<STR_LIT>""" <EOL> self . down = set ( node_list ) <EOL> self . up = set ( ) <EOL> self . node2ip = node2ip <EOL> self . success = True <EOL> self . action_cb = action_cb <EOL> self . port = port <EOL> self . feedback_fn = feedback_fn <EOL> self . _ping_fn = _ping_fn <EOL> self . _sleep_fn = _sleep_fn <EOL> def __call__ ( self ) : <EOL> """<STR_LIT>""" <EOL> if not self . action_cb ( self . up ) : <EOL> self . success = False <EOL> if self . down : <EOL> raise utils . RetryAgain ( ) <EOL> else : <EOL> return self . success <EOL> def Wait ( self , secs ) : <EOL> """<STR_LIT>""" <EOL> start = time . time ( ) <EOL> for node in self . down : <EOL> if self . _ping_fn ( self . node2ip [ node ] , self . port , timeout = _EPO_PING_TIMEOUT , <EOL> live_port_needed = True ) : <EOL> self . feedback_fn ( "<STR_LIT>" % node ) <EOL> self . up . add ( node ) <EOL> self . down -= self . up <EOL> return <EOL> self . _sleep_fn ( max ( <NUM_LIT:0.0> , start + secs - time . time ( ) ) ) <EOL> def _RunWhenNodesReachable ( node_list , action_cb , interval ) : <EOL> """<STR_LIT>""" <EOL> client = GetClient ( ) <EOL> cluster_info = client . QueryClusterInfo ( ) <EOL> if cluster_info [ "<STR_LIT>" ] == constants . IP4_VERSION : <EOL> family = netutils . IPAddress . family <EOL> else : <EOL> family = netutils . IP6Address . family <EOL> node2ip = dict ( ( node , netutils . GetHostname ( node , family = family ) . ip ) <EOL> for node in node_list ) <EOL> port = netutils . GetDaemonPort ( constants . NODED ) <EOL> helper = _RunWhenNodesReachableHelper ( node_list , action_cb , node2ip , port , <EOL> ToStdout ) <EOL> try : <EOL> return utils . Retry ( helper , interval , _EPO_REACHABLE_TIMEOUT , <EOL> wait_fn = helper . Wait ) <EOL> except utils . RetryTimeout : <EOL> ToStderr ( "<STR_LIT>" <EOL> "<STR_LIT>" , "<STR_LIT>" . join ( helper . down ) ) <EOL> return False <EOL> def _MaybeInstanceStartup ( opts , inst_map , nodes_online , <EOL> _instance_start_fn = _InstanceStart ) : <EOL> """<STR_LIT>""" <EOL> start_inst_list = [ ] <EOL> for ( inst , nodes ) in inst_map . items ( ) : <EOL> if not ( nodes - nodes_online ) : <EOL> start_inst_list . append ( inst ) <EOL> for inst in start_inst_list : <EOL> del inst_map [ inst ] <EOL> if start_inst_list : <EOL> return _instance_start_fn ( opts , start_inst_list , True ) <EOL> return True <EOL> def _EpoOn ( opts , full_node_list , node_list , inst_map ) : <EOL> """<STR_LIT>""" <EOL> if node_list and not _OobPower ( opts , node_list , False ) : <EOL> ToStderr ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> action_cb = compat . partial ( _MaybeInstanceStartup , opts , dict ( inst_map ) ) <EOL> ToStdout ( "<STR_LIT>" ) <EOL> if not _RunWhenNodesReachable ( full_node_list , action_cb , _EPO_PING_INTERVAL ) : <EOL> ToStderr ( "<STR_LIT>" ) <EOL> return constants . EXIT_FAILURE <EOL> return constants . EXIT_SUCCESS <EOL> def _EpoOff ( opts , node_list , inst_map ) : <EOL> """<STR_LIT>""" <EOL> if not _InstanceStart ( opts , inst_map . keys ( ) , False , no_remember = True ) : <EOL> ToStderr ( "<STR_LIT>" ) <EOL> return constants . EXIT_FAILURE <EOL> if not node_list : <EOL> return constants . EXIT_SUCCESS <EOL> if _OobPower ( opts , node_list , False ) : <EOL> return constants . EXIT_SUCCESS <EOL> else : <EOL> return constants . EXIT_FAILURE <EOL> def Epo ( opts , args , qcl = None , _on_fn = _EpoOn , _off_fn = _EpoOff , <EOL> _confirm_fn = ConfirmOperation , <EOL> _stdout_fn = ToStdout , _stderr_fn = ToStderr ) : <EOL> """<STR_LIT>""" <EOL> if opts . groups and opts . show_all : <EOL> _stderr_fn ( "<STR_LIT>" ) <EOL> return constants . EXIT_FAILURE <EOL> elif args and opts . show_all : <EOL> _stderr_fn ( "<STR_LIT>" ) <EOL> return constants . EXIT_FAILURE <EOL> if qcl is None : <EOL> qcl = GetClient ( ) <EOL> if opts . groups : <EOL> node_query_list = itertools . chain ( * qcl . QueryGroups ( args , [ "<STR_LIT>" ] , False ) ) <EOL> else : <EOL> node_query_list = args <EOL> result = qcl . QueryNodes ( node_query_list , [ "<STR_LIT:name>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] , <EOL> False ) <EOL> all_nodes = map ( compat . fst , result ) <EOL> node_list = [ ] <EOL> inst_map = { } <EOL> for ( node , master , pinsts , sinsts , powered , offline ) in result : <EOL> if not offline : <EOL> for inst in ( pinsts + sinsts ) : <EOL> if inst in inst_map : <EOL> if not master : <EOL> inst_map [ inst ] . add ( node ) <EOL> elif master : <EOL> inst_map [ inst ] = set ( ) <EOL> else : <EOL> inst_map [ inst ] = set ( [ node ] ) <EOL> if master and opts . on : <EOL> continue <EOL> elif master and not opts . show_all : <EOL> _stderr_fn ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , node ) <EOL> return constants . EXIT_FAILURE <EOL> elif powered is None : <EOL> _stdout_fn ( "<STR_LIT>" <EOL> "<STR_LIT>" , node ) <EOL> elif powered == opts . on : <EOL> _stdout_fn ( "<STR_LIT>" , node ) <EOL> elif not offline or ( offline and powered ) : <EOL> node_list . append ( node ) <EOL> if not ( opts . force or _confirm_fn ( all_nodes , "<STR_LIT>" , "<STR_LIT>" ) ) : <EOL> return constants . EXIT_FAILURE <EOL> if opts . on : <EOL> return _on_fn ( opts , all_nodes , node_list , inst_map ) <EOL> else : <EOL> return _off_fn ( opts , node_list , inst_map ) <EOL> def RemoveRepair ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> uuid = args [ <NUM_LIT:0> ] <EOL> wconfd . Client ( ) . RmMaintdIncident ( uuid ) <EOL> return <NUM_LIT:0> <EOL> def _GetCreateCommand ( info ) : <EOL> buf = StringIO ( ) <EOL> buf . write ( "<STR_LIT>" ) <EOL> PrintIPolicyCommand ( buf , info [ "<STR_LIT>" ] , False ) <EOL> buf . write ( "<STR_LIT:U+0020>" ) <EOL> buf . write ( info [ "<STR_LIT:name>" ] ) <EOL> return buf . getvalue ( ) <EOL> def ShowCreateCommand ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> cl = GetClient ( ) <EOL> result = cl . QueryClusterInfo ( ) <EOL> ToStdout ( _GetCreateCommand ( result ) ) <EOL> def _RunCommandAndReport ( cmd ) : <EOL> """<STR_LIT>""" <EOL> result = utils . RunCmd ( cmd ) <EOL> if result . failed : <EOL> ToStderr ( "<STR_LIT>" % <EOL> ( cmd , result . fail_reason , result . output ) ) <EOL> return False <EOL> return True <EOL> def _VerifyCommand ( cmd ) : <EOL> """<STR_LIT>""" <EOL> command = utils . text . ShellQuoteArgs ( [ str ( val ) for val in cmd ] ) <EOL> return _VerifyCommandRaw ( command ) <EOL> def _VerifyCommandRaw ( command ) : <EOL> """<STR_LIT>""" <EOL> nodes = ssconf . SimpleStore ( ) . GetOnlineNodeList ( ) <EOL> master_node = ssconf . SimpleStore ( ) . GetMasterNode ( ) <EOL> cluster_name = ssconf . SimpleStore ( ) . GetClusterName ( ) <EOL> if master_node in nodes : <EOL> nodes . remove ( master_node ) <EOL> nodes . append ( master_node ) <EOL> failed = [ ] <EOL> srun = ssh . SshRunner ( cluster_name = cluster_name ) <EOL> for name in nodes : <EOL> result = srun . Run ( name , constants . SSH_LOGIN_USER , command ) <EOL> if result . exit_code != <NUM_LIT:0> : <EOL> failed . append ( name ) <EOL> return failed <EOL> def _VerifyVersionInstalled ( versionstring ) : <EOL> """<STR_LIT>""" <EOL> badnodes = _VerifyCommand ( [ "<STR_LIT:test>" , "<STR_LIT>" , <EOL> os . path . join ( pathutils . PKGLIBDIR , versionstring ) ] ) <EOL> if badnodes : <EOL> ToStderr ( "<STR_LIT>" <EOL> % ( versionstring , "<STR_LIT:U+002CU+0020>" . join ( badnodes ) ) ) <EOL> return False <EOL> return True <EOL> def _GetRunning ( ) : <EOL> """<STR_LIT>""" <EOL> cl = GetClient ( ) <EOL> qfilter = qlang . MakeSimpleFilter ( "<STR_LIT:status>" , <EOL> frozenset ( [ constants . JOB_STATUS_RUNNING ] ) ) <EOL> return len ( cl . Query ( constants . QR_JOB , [ ] , qfilter ) . data ) <EOL> def _SetGanetiVersionAndEnsure ( versionstring ) : <EOL> """<STR_LIT>""" <EOL> if constants . HAS_GNU_LN : <EOL> link_lib_cmd = [ <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> os . path . join ( pathutils . PKGLIBDIR , versionstring ) , <EOL> os . path . join ( pathutils . SYSCONFDIR , "<STR_LIT>" ) ] <EOL> link_share_cmd = [ <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> os . path . join ( pathutils . SHAREDIR , versionstring ) , <EOL> os . path . join ( pathutils . SYSCONFDIR , "<STR_LIT>" ) ] <EOL> cmds = [ link_lib_cmd , link_share_cmd ] <EOL> else : <EOL> rm_lib_cmd = [ <EOL> "<STR_LIT>" , "<STR_LIT>" , os . path . join ( pathutils . SYSCONFDIR , "<STR_LIT>" ) ] <EOL> link_lib_cmd = [ <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , os . path . join ( pathutils . PKGLIBDIR , versionstring ) , <EOL> os . path . join ( pathutils . SYSCONFDIR , "<STR_LIT>" ) ] <EOL> rm_share_cmd = [ <EOL> "<STR_LIT>" , "<STR_LIT>" , os . path . join ( pathutils . SYSCONFDIR , "<STR_LIT>" ) ] <EOL> ln_share_cmd = [ <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , os . path . join ( pathutils . SHAREDIR , versionstring ) , <EOL> os . path . join ( pathutils . SYSCONFDIR , "<STR_LIT>" ) ] <EOL> cmds = [ rm_lib_cmd , link_lib_cmd , rm_share_cmd , ln_share_cmd ] <EOL> cmds . append ( [ pathutils . ENSURE_DIRS ] ) <EOL> quoted_cmds = [ utils . text . ShellQuoteArgs ( cmd ) for cmd in cmds ] <EOL> cmd = "<STR_LIT>" . join ( quoted_cmds ) <EOL> failed = _VerifyCommandRaw ( cmd ) <EOL> return list ( set ( failed ) ) <EOL> def _ExecuteCommands ( fns ) : <EOL> """<STR_LIT>""" <EOL> for fn in reversed ( fns ) : <EOL> fn ( ) <EOL> def _GetConfigVersion ( ) : <EOL> """<STR_LIT>""" <EOL> config_data = serializer . LoadJson ( utils . ReadFile ( pathutils . CLUSTER_CONF_FILE ) ) <EOL> try : <EOL> config_version = config_data [ "<STR_LIT:version>" ] <EOL> except KeyError : <EOL> return None <EOL> return utils . SplitVersion ( config_version ) <EOL> def _ReadIntentToUpgrade ( ) : <EOL> """<STR_LIT>""" <EOL> if not os . path . isfile ( pathutils . INTENT_TO_UPGRADE ) : <EOL> return ( None , None ) <EOL> contentstring = utils . ReadFile ( pathutils . INTENT_TO_UPGRADE ) <EOL> contents = utils . UnescapeAndSplit ( contentstring ) <EOL> if len ( contents ) != <NUM_LIT:3> : <EOL> return ( None , None ) <EOL> return ( contents [ <NUM_LIT:0> ] , contents [ <NUM_LIT:1> ] ) <EOL> def _WriteIntentToUpgrade ( version ) : <EOL> """<STR_LIT>""" <EOL> utils . WriteFile ( pathutils . INTENT_TO_UPGRADE , <EOL> data = utils . EscapeAndJoin ( [ constants . RELEASE_VERSION , version , <EOL> "<STR_LIT>" % os . getpid ( ) ] ) ) <EOL> def _UpgradeBeforeConfigurationChange ( versionstring ) : <EOL> """<STR_LIT>""" <EOL> rollback = [ ] <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" , versionstring ) <EOL> if not _VerifyVersionInstalled ( versionstring ) : <EOL> return ( False , rollback ) <EOL> _WriteIntentToUpgrade ( versionstring ) <EOL> rollback . append ( <EOL> lambda : utils . RunCmd ( [ "<STR_LIT>" , "<STR_LIT>" , pathutils . INTENT_TO_UPGRADE ] ) ) <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" ) <EOL> client = GetClient ( ) <EOL> client . SetQueueDrainFlag ( True ) <EOL> rollback . append ( lambda : GetClient ( ) . SetQueueDrainFlag ( False ) ) <EOL> if utils . SimpleRetry ( <NUM_LIT:0> , _GetRunning , <EOL> constants . UPGRADE_QUEUE_POLL_INTERVAL , <EOL> constants . UPGRADE_QUEUE_DRAIN_TIMEOUT ) : <EOL> ToStderr ( "<STR_LIT>" ) <EOL> return ( False , rollback ) <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" ) <EOL> rollback . append ( lambda : GetClient ( ) . SetWatcherPause ( None ) ) <EOL> GetClient ( ) . SetWatcherPause ( time . time ( ) + <NUM_LIT> * <NUM_LIT> ) <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" ) <EOL> if not _RunCommandAndReport ( [ pathutils . DAEMON_UTIL , "<STR_LIT>" ] ) : <EOL> return ( False , rollback ) <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" ) <EOL> rollback . append ( lambda : _VerifyCommand ( [ pathutils . DAEMON_UTIL , "<STR_LIT>" ] ) ) <EOL> badnodes = _VerifyCommand ( [ pathutils . DAEMON_UTIL , "<STR_LIT>" ] ) <EOL> if badnodes : <EOL> ToStderr ( "<STR_LIT>" % ( "<STR_LIT:U+002CU+0020>" . join ( badnodes ) , ) ) <EOL> return ( False , rollback ) <EOL> backuptar = os . path . join ( pathutils . BACKUP_DIR , "<STR_LIT>" % time . time ( ) ) <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" , backuptar ) <EOL> if not _RunCommandAndReport ( [ "<STR_LIT>" , "<STR_LIT>" , pathutils . BACKUP_DIR ] ) : <EOL> return ( False , rollback ) <EOL> ( _ , tmp_name ) = tempfile . mkstemp ( prefix = backuptar , dir = pathutils . BACKUP_DIR ) <EOL> if not _RunCommandAndReport ( [ "<STR_LIT>" , "<STR_LIT>" , tmp_name , <EOL> "<STR_LIT>" , <EOL> pathutils . DATA_DIR ] ) : <EOL> return ( False , rollback ) <EOL> os . rename ( tmp_name , backuptar ) <EOL> return ( True , rollback ) <EOL> def _VersionSpecificDowngrade ( ) : <EOL> """<STR_LIT>""" <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" ) <EOL> return True <EOL> def _SwitchVersionAndConfig ( versionstring , downgrade ) : <EOL> """<STR_LIT>""" <EOL> rollback = [ ] <EOL> if downgrade : <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" ) <EOL> if not _RunCommandAndReport ( [ pathutils . CFGUPGRADE , "<STR_LIT>" , "<STR_LIT>" ] ) : <EOL> return ( False , rollback ) <EOL> if not _VersionSpecificDowngrade ( ) : <EOL> return ( False , rollback ) <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" , versionstring ) <EOL> rollback . append ( lambda : _SetGanetiVersionAndEnsure ( constants . DIR_VERSION ) ) <EOL> badnodes = _SetGanetiVersionAndEnsure ( versionstring ) <EOL> if badnodes : <EOL> ToStderr ( "<STR_LIT>" <EOL> % ( versionstring , "<STR_LIT:U+002CU+0020>" . join ( badnodes ) ) ) <EOL> if not downgrade : <EOL> return ( False , rollback ) <EOL> if not downgrade : <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" ) <EOL> if not _RunCommandAndReport ( [ pathutils . CFGUPGRADE , "<STR_LIT>" ] ) : <EOL> return ( False , rollback ) <EOL> return ( True , rollback ) <EOL> def _UpgradeAfterConfigurationChange ( oldversion ) : <EOL> """<STR_LIT>""" <EOL> returnvalue = <NUM_LIT:0> <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" ) <EOL> badnodes = _VerifyCommand ( [ pathutils . DAEMON_UTIL , "<STR_LIT>" ] ) <EOL> if badnodes : <EOL> ToStderr ( "<STR_LIT>" % ( "<STR_LIT:U+002CU+0020>" . join ( badnodes ) , ) ) <EOL> returnvalue = <NUM_LIT:1> <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" ) <EOL> if not _RunCommandAndReport ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) : <EOL> returnvalue = <NUM_LIT:1> <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" ) <EOL> badnodes = _VerifyCommand ( [ pathutils . DAEMON_UTIL , "<STR_LIT>" ] ) <EOL> badnodes . extend ( _VerifyCommand ( [ pathutils . DAEMON_UTIL , "<STR_LIT>" ] ) ) <EOL> if badnodes : <EOL> ToStderr ( "<STR_LIT>" % <EOL> ( "<STR_LIT:U+002CU+0020>" . join ( list ( set ( badnodes ) ) ) , ) ) <EOL> returnvalue = <NUM_LIT:1> <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" ) <EOL> if not _RunCommandAndReport ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) : <EOL> returnvalue = <NUM_LIT:1> <EOL> _RunCommandAndReport ( [ "<STR_LIT>" , "<STR_LIT>" , pathutils . INTENT_TO_UPGRADE ] ) <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" ) <EOL> if not _RunCommandAndReport ( [ pathutils . POST_UPGRADE , oldversion ] ) : <EOL> returnvalue = <NUM_LIT:1> <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" ) <EOL> if not _RunCommandAndReport ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) : <EOL> returnvalue = <NUM_LIT:1> <EOL> ToStdoutAndLoginfo ( "<STR_LIT>" ) <EOL> if not _RunCommandAndReport ( [ "<STR_LIT>" , "<STR_LIT>" ] ) : <EOL> returnvalue = <NUM_LIT:1> <EOL> return returnvalue <EOL> def UpgradeGanetiCommand ( opts , args ) : <EOL> """<STR_LIT>""" <EOL> if ( ( not opts . resume and opts . to is None ) <EOL> or ( opts . resume and opts . to is not None ) ) : <EOL> ToStderr ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if not opts . resume : <EOL> oldversion , versionstring = _ReadIntentToUpgrade ( ) <EOL> if versionstring is not None : <EOL> if versionstring == opts . to : <EOL> ToStderr ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> opts . resume = True <EOL> opts . to = None <EOL> else : <EOL> ToStderr ( "<STR_LIT>" <EOL> "<STR_LIT>" % ( oldversion , versionstring ) ) <EOL> return <NUM_LIT:1> <EOL> utils . SetupLogging ( pathutils . LOG_COMMANDS , '<STR_LIT>' , debug = <NUM_LIT:1> ) <EOL> oldversion = constants . RELEASE_VERSION <EOL> if opts . resume : <EOL> ssconf . CheckMaster ( False ) <EOL> oldversion , versionstring = _ReadIntentToUpgrade ( ) <EOL> if versionstring is None : <EOL> return <NUM_LIT:0> <EOL> version = utils . version . ParseVersion ( versionstring ) <EOL> if version is None : <EOL> return <NUM_LIT:1> <EOL> configversion = _GetConfigVersion ( ) <EOL> if configversion is None : <EOL> return <NUM_LIT:1> <EOL> config_already_modified = ( utils . IsCorrectConfigVersion ( version , configversion ) and <EOL> not ( versionstring != constants . DIR_VERSION and <EOL> configversion == ( constants . CONFIG_MAJOR , constants . CONFIG_MINOR , <EOL> constants . CONFIG_REVISION ) ) ) <EOL> if not config_already_modified : <EOL> _VerifyCommand ( [ pathutils . DAEMON_UTIL , "<STR_LIT>" ] ) <EOL> else : <EOL> versionstring = opts . to <EOL> config_already_modified = False <EOL> version = utils . version . ParseVersion ( versionstring ) <EOL> if version is None : <EOL> ToStderr ( "<STR_LIT>" % versionstring ) <EOL> return <NUM_LIT:1> <EOL> msg = utils . version . UpgradeRange ( version ) <EOL> if msg is not None : <EOL> ToStderr ( "<STR_LIT>" % ( versionstring , msg ) ) <EOL> return <NUM_LIT:1> <EOL> if not config_already_modified : <EOL> success , rollback = _UpgradeBeforeConfigurationChange ( versionstring ) <EOL> if not success : <EOL> _ExecuteCommands ( rollback ) <EOL> return <NUM_LIT:1> <EOL> else : <EOL> rollback = [ ] <EOL> downgrade = utils . version . ShouldCfgdowngrade ( version ) <EOL> success , additionalrollback = _SwitchVersionAndConfig ( versionstring , downgrade ) <EOL> if not success : <EOL> rollback . extend ( additionalrollback ) <EOL> _ExecuteCommands ( rollback ) <EOL> return <NUM_LIT:1> <EOL> return _UpgradeAfterConfigurationChange ( oldversion ) <EOL> commands = { <EOL> "<STR_LIT>" : ( <EOL> InitCluster , [ ArgHost ( min = <NUM_LIT:1> , max = <NUM_LIT:1> ) ] , <EOL> [ BACKEND_OPT , CP_SIZE_OPT , ENABLED_HV_OPT , GLOBAL_FILEDIR_OPT , <EOL> HVLIST_OPT , MAC_PREFIX_OPT , MASTER_NETDEV_OPT , MASTER_NETMASK_OPT , <EOL> NIC_PARAMS_OPT , NOMODIFY_ETCHOSTS_OPT , NOMODIFY_SSH_SETUP_OPT , <EOL> SECONDARY_IP_OPT , VG_NAME_OPT , MAINTAIN_NODE_HEALTH_OPT , UIDPOOL_OPT , <EOL> DRBD_HELPER_OPT , DEFAULT_IALLOCATOR_OPT , DEFAULT_IALLOCATOR_PARAMS_OPT , <EOL> PRIMARY_IP_VERSION_OPT , PREALLOC_WIPE_DISKS_OPT , NODE_PARAMS_OPT , <EOL> GLOBAL_SHARED_FILEDIR_OPT , USE_EXTERNAL_MIP_SCRIPT , DISK_PARAMS_OPT , <EOL> HV_STATE_OPT , DISK_STATE_OPT , ENABLED_DISK_TEMPLATES_OPT , <EOL> IPOLICY_STD_SPECS_OPT , GLOBAL_GLUSTER_FILEDIR_OPT , INSTALL_IMAGE_OPT , <EOL> ZEROING_IMAGE_OPT , COMPRESSION_TOOLS_OPT , <EOL> ENABLED_USER_SHUTDOWN_OPT , SSH_KEY_BITS_OPT , SSH_KEY_TYPE_OPT , <EOL> ] <EOL> + INSTANCE_POLICY_OPTS + SPLIT_ISPECS_OPTS , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> DestroyCluster , ARGS_NONE , [ YES_DOIT_OPT ] , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> RenameCluster , [ ArgHost ( min = <NUM_LIT:1> , max = <NUM_LIT:1> ) ] , <EOL> [ FORCE_OPT , DRY_RUN_OPT ] , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> RedistributeConfig , ARGS_NONE , SUBMIT_OPTS + <EOL> [ DRY_RUN_OPT , PRIORITY_OPT , FORCE_DISTRIBUTION ] , <EOL> "<STR_LIT>" , "<STR_LIT>" <EOL> "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> VerifyCluster , ARGS_NONE , <EOL> [ VERBOSE_OPT , DEBUG_SIMERR_OPT , ERROR_CODES_OPT , NONPLUS1_OPT , <EOL> PRIORITY_OPT , NODEGROUP_OPT , IGNORE_ERRORS_OPT , VERIFY_CLUTTER_OPT ] , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> VerifyDisks , ARGS_NONE , [ PRIORITY_OPT , NODEGROUP_OPT ] , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> RepairDiskSizes , ARGS_MANY_INSTANCES , [ DRY_RUN_OPT , PRIORITY_OPT ] , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> MasterFailover , ARGS_NONE , [ NOVOTING_OPT , FORCE_FAILOVER ] , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> MasterPing , ARGS_NONE , [ ] , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT:version>" : ( <EOL> ShowClusterVersion , ARGS_NONE , [ ] , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> ShowClusterMaster , ARGS_NONE , [ ] , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> ClusterCopyFile , [ ArgFile ( min = <NUM_LIT:1> , max = <NUM_LIT:1> ) ] , <EOL> [ NODE_LIST_OPT , USE_REPL_NET_OPT , NODEGROUP_OPT ] , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> RunClusterCommand , [ ArgCommand ( min = <NUM_LIT:1> ) ] , <EOL> [ NODE_LIST_OPT , NODEGROUP_OPT , SHOW_MACHINE_OPT , FAILURE_ONLY_OPT ] , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT:info>" : ( <EOL> ShowClusterConfig , ARGS_NONE , [ ROMAN_OPT ] , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> ListTags , ARGS_NONE , [ ] , "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> AddTags , [ ArgUnknown ( ) ] , [ TAG_SRC_OPT , PRIORITY_OPT ] + SUBMIT_OPTS , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> RemoveTags , [ ArgUnknown ( ) ] , [ TAG_SRC_OPT , PRIORITY_OPT ] + SUBMIT_OPTS , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> SearchTags , [ ArgUnknown ( min = <NUM_LIT:1> , max = <NUM_LIT:1> ) ] , [ PRIORITY_OPT ] , "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> QueueOps , <EOL> [ ArgChoice ( min = <NUM_LIT:1> , max = <NUM_LIT:1> , choices = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:info>" ] ) ] , <EOL> [ ] , "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> WatcherOps , <EOL> [ ArgChoice ( min = <NUM_LIT:1> , max = <NUM_LIT:1> , choices = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:info>" ] ) , <EOL> ArgSuggest ( min = <NUM_LIT:0> , max = <NUM_LIT:1> , choices = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) ] , <EOL> [ ] , <EOL> "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> SetClusterParams , ARGS_NONE , <EOL> [ FORCE_OPT , <EOL> BACKEND_OPT , CP_SIZE_OPT , RQL_OPT , MAX_TRACK_OPT , INSTALL_IMAGE_OPT , <EOL> INSTANCE_COMMUNICATION_NETWORK_OPT , ENABLED_HV_OPT , HVLIST_OPT , <EOL> MAC_PREFIX_OPT , MASTER_NETDEV_OPT , MASTER_NETMASK_OPT , NIC_PARAMS_OPT , <EOL> VG_NAME_OPT , MAINTAIN_NODE_HEALTH_OPT , UIDPOOL_OPT , ADD_UIDS_OPT , <EOL> REMOVE_UIDS_OPT , DRBD_HELPER_OPT , DEFAULT_IALLOCATOR_OPT , <EOL> DEFAULT_IALLOCATOR_PARAMS_OPT , RESERVED_LVS_OPT , DRY_RUN_OPT , PRIORITY_OPT , <EOL> PREALLOC_WIPE_DISKS_OPT , NODE_PARAMS_OPT , USE_EXTERNAL_MIP_SCRIPT , <EOL> DISK_PARAMS_OPT , HV_STATE_OPT , DISK_STATE_OPT ] + SUBMIT_OPTS + <EOL> [ ENABLED_DISK_TEMPLATES_OPT , IPOLICY_STD_SPECS_OPT , MODIFY_ETCHOSTS_OPT , <EOL> ENABLED_USER_SHUTDOWN_OPT ] + <EOL> INSTANCE_POLICY_OPTS + <EOL> [ GLOBAL_FILEDIR_OPT , GLOBAL_SHARED_FILEDIR_OPT , ZEROING_IMAGE_OPT , <EOL> COMPRESSION_TOOLS_OPT ] + <EOL> [ ENABLED_DATA_COLLECTORS_OPT , DATA_COLLECTOR_INTERVAL_OPT , <EOL> DIAGNOSE_DATA_COLLECTOR_FILENAME_OPT , <EOL> MAINT_INTERVAL_OPT , MAINT_BALANCE_OPT , MAINT_BALANCE_THRESHOLD_OPT ] , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> RenewCrypto , ARGS_NONE , <EOL> [ NEW_CLUSTER_CERT_OPT , NEW_RAPI_CERT_OPT , RAPI_CERT_OPT , <EOL> NEW_CONFD_HMAC_KEY_OPT , FORCE_OPT , <EOL> NEW_CLUSTER_DOMAIN_SECRET_OPT , CLUSTER_DOMAIN_SECRET_OPT , <EOL> NEW_SPICE_CERT_OPT , SPICE_CERT_OPT , SPICE_CACERT_OPT , <EOL> NEW_NODE_CERT_OPT , NEW_SSH_KEY_OPT , NOSSH_KEYCHECK_OPT , <EOL> VERBOSE_OPT , SSH_KEY_BITS_OPT , SSH_KEY_TYPE_OPT ] , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> Epo , [ ArgUnknown ( ) ] , <EOL> [ FORCE_OPT , ON_OPT , GROUPS_OPT , ALL_OPT , OOB_TIMEOUT_OPT , <EOL> SHUTDOWN_TIMEOUT_OPT , POWER_DELAY_OPT ] , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> ActivateMasterIp , ARGS_NONE , [ ] , "<STR_LIT>" , "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> DeactivateMasterIp , ARGS_NONE , [ CONFIRM_OPT ] , "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> ShowCreateCommand , ARGS_NONE , [ ] , "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> UpgradeGanetiCommand , ARGS_NONE , [ TO_OPT , RESUME_OPT ] , "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> "<STR_LIT>" : ( <EOL> RemoveRepair , [ ArgUnknown ( ) ] , [ ] , "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> } <EOL> aliases = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT:info>" , <EOL> } <EOL> def Main ( ) : <EOL> return GenericMain ( commands , override = { "<STR_LIT>" : constants . TAG_CLUSTER } , <EOL> aliases = aliases ) </s>
