def unmove_unban( env, resource_id, node=None, master=False, expired=False, wait=False ): """ Remove all constraints created by move and ban LibraryEnvironment env string resource_id -- id of a resource to be unmoved/unbanned string node -- node to limit unmoving/unbanning to, all nodes if None bool master -- only remove constraints for Master role bool expired -- only remove constrains which have already expired mixed wait -- flag for controlling waiting for pacemaker idle mechanism """ # validate env.ensure_wait_satisfiable(wait) # raises on error report_list = [] resource_el = resource.common.find_one_resource_and_report( get_resources(env.get_cib()), resource_id, report_list, ) if resource_el is not None: report_list.extend( resource.common.validate_unmove_unban(resource_el, master) ) if ( expired and not has_resource_unmove_unban_expired_support(env.cmd_runner()) ): report_list.append( reports.resource_unmove_unban_pcmk_expired_not_supported() ) env.report_processor.process_list(report_list) # raises on error # run the action stdout, stderr, retval = resource_unmove_unban( env.cmd_runner(), resource_id, node=node, master=master, expired=expired ) if retval != 0: raise LibraryError( reports.resource_unmove_unban_pcmk_error( resource_id, stdout, stderr ) ) env.report_processor.process( reports.resource_unmove_unban_pcmk_success(resource_id, stdout, stderr) ) # process wait if wait is not False: wait_for_idle(env.cmd_runner(), env.get_wait_timeout(wait)) env.report_processor.process( info_resource_state(env.get_cluster_state(), resource_id) )
def unmove_unban(env, resource_id, node=None, master=False, expired=False, wait=False): """ Remove all constraints created by move and ban LibraryEnvironment env string resource_id -- id of a resource to be unmoved/unbanned string node -- node to limit unmoving/unbanning to, all nodes if None bool master -- only remove constraints for Master role bool expired -- only remove constrains which have already expired mixed wait -- flag for controlling waiting for pacemaker idle mechanism """ # validate env.ensure_wait_satisfiable(wait) # raises on error report_list = [] resource_el = resource.common.find_one_resource_and_report( get_resources(env.get_cib()), resource_id, report_list, ) if resource_el is not None: report_list.extend( resource.common.validate_unmove_unban(resource_el, master)) if (expired and not has_resource_unmove_unban_expired_support(env.cmd_runner())): report_list.append( reports.resource_unmove_unban_pcmk_expired_not_supported()) env.report_processor.process_list(report_list) # raises on error # run the action stdout, stderr, retval = resource_unmove_unban(env.cmd_runner(), resource_id, node=node, master=master, expired=expired) if retval != 0: raise LibraryError( reports.resource_unmove_unban_pcmk_error(resource_id, stdout, stderr)) env.report_processor.process( reports.resource_unmove_unban_pcmk_success(resource_id, stdout, stderr)) # process wait if wait is not False: wait_for_idle(env.cmd_runner(), env.get_wait_timeout(wait)) env.report_processor.process( info_resource_state(env.get_cluster_state(), resource_id))