def __init__(self, env, node_names): """Context manager for synchronize time on nodes param: env - environment object param: node_names - list of devops node names """ if not env: raise Exception("'env' is not set, failed to initialize" " connections to {0}".format(node_names)) self.admin_ntps = [] self.pacemaker_ntps = [] self.other_ntps = [] admin_ip = get_admin_ip(env) for node_name in node_names: if node_name == 'admin': # 1. Add a 'Ntp' instance with connection to Fuel admin node self.admin_ntps.append( Ntp.get_ntp(get_admin_remote(env), 'admin')) logger.debug("Added node '{0}' to self.admin_ntps" .format(node_name)) continue ntp = Ntp.get_ntp(get_node_remote(env, node_name), node_name, admin_ip) if ntp.is_pacemaker: # 2. Create a list of 'Ntp' connections to the controller nodes self.pacemaker_ntps.append(ntp) logger.debug("Added node '{0}' to self.pacemaker_ntps" .format(node_name)) else: # 2. Create a list of 'Ntp' connections to the other nodes self.other_ntps.append(ntp) logger.debug("Added node '{0}' to self.other_ntps" .format(node_name))
def __init__(self, env, node_names): """Context manager for synchronize time on nodes param: env - environment object param: node_names - list of devops node names """ if not env: raise Exception("'env' is not set, failed to initialize" " connections to {0}".format(node_names)) self.admin_ntps = [] self.pacemaker_ntps = [] self.other_ntps = [] admin_ip = get_admin_ip(env) for node_name in node_names: if node_name == 'admin': # 1. Add a 'Ntp' instance with connection to Fuel admin node self.admin_ntps.append( self.get_ntp(get_admin_remote(env), 'admin')) logger.debug( "Added node '{0}' to self.admin_ntps".format(node_name)) continue ntp = self.get_ntp(get_node_remote(env, node_name), node_name, admin_ip) if ntp.is_pacemaker: # 2. Create a list of 'Ntp' connections to the controller nodes self.pacemaker_ntps.append(ntp) logger.debug("Added node '{0}' to self.pacemaker_ntps".format( node_name)) else: # 2. Create a list of 'Ntp' connections to the other nodes self.other_ntps.append(ntp) logger.debug( "Added node '{0}' to self.other_ntps".format(node_name))
def __init__(self, env, node_names): """Context manager for synchronize time on nodes param: env - environment object param: node_names - list of devops node names """ self.admin_ntps = [] self.pacemaker_ntps = [] self.other_ntps = [] for node_name in node_names: if node_name == 'admin': # 1. Add a 'Ntp' instance with connection to Fuel admin node admin_remote = get_admin_remote(env) admin_ntp = self.get_ntp(admin_remote, 'admin') self.admin_ntps.append(admin_ntp) logger.debug("Added node '{0}' to self.admin_ntps" .format(node_name)) continue remote = get_node_remote(env, node_name) ntp = self.get_ntp(remote, node_name) if isinstance(ntp, NtpPacemaker): # 2. Create a list of 'Ntp' connections to the controller nodes self.pacemaker_ntps.append(ntp) logger.debug("Added node '{0}' to self.pacemaker_ntps" .format(node_name)) else: # 2. Create a list of 'Ntp' connections to the other nodes self.other_ntps.append(ntp) logger.debug("Added node '{0}' to self.other_ntps" .format(node_name))
def admin_wait_bootstrap(puppet_timeout, env): """Login to master node and waiting end of installation param: puppet_timeout: Integer param: env: Environment :rtype : None """ print("Waiting while bootstrapping is in progress") print("Puppet timeout set in {0}").format(puppet_timeout) wait(lambda: not get_admin_remote(env).execute( "grep 'Fuel node deployment complete' '%s'" % MASTER_BOOTSTRAP_LOG)[ 'exit_code'], timeout=(float(puppet_timeout)))
def admin_wait_bootstrap(puppet_timeout, env): """Login to master node and waiting end of installation param: puppet_timeout: Integer param: env: Environment :rtype : None """ print("Waiting while bootstrapping is in progress") print("Puppet timeout set in {0}").format(puppet_timeout) wait( lambda: not get_admin_remote(env).execute("grep 'Fuel node deployment complete' '%s'" % MASTER_BOOTSTRAP_LOG)[ "exit_code" ], timeout=(float(puppet_timeout)), )
def check_migration_status(self): """Check periodically the status of Fuel Master migration process""" logger.info( 'Rebooting to begin the data sync process for fuel migrate') self.node_rebooted(self.env.get_admin_node_ip()) logger.info('Fuel Master is migrating..') self.node_rebooted(self.env.get_admin_node_ip(), interval=0.5, timeout=60 * 45) logger.info('Waiting for appearance of /tmp/migration-done file..') with get_admin_remote(self.env.d_env) as remote: wait(lambda: remote.exists("/tmp/migration-done"), timeout=60 * 5, timeout_msg="File /tmp/migration-done wasn't appeared")
def check_migration_status(self): """Check periodically the status of Fuel Master migration process""" logger.info("Rebooting to begin the data sync process for fuel migrate") self.node_rebooted(self.env.get_admin_node_ip()) logger.info("Fuel Master is migrating..") self.node_rebooted(self.env.get_admin_node_ip(), interval=0.5, timeout=60 * 45) logger.info("Waiting for appearance of /tmp/migration-done file..") with get_admin_remote(self.env.d_env) as remote: wait( lambda: remote.exists("/tmp/migration-done"), timeout=60 * 5, timeout_msg="File /tmp/migration-done wasn't appeared", )