def unconfigure_target_ha(primary, ha_label, uuid): ''' Unconfigure the target high availability Return: Value using simple return protocol ''' with PreservePacemakerCorosyncState(): if get_resource_location(ha_label): return agent_error("cannot unconfigure-ha: %s is still running " % ha_label) if primary: result = cibadmin( ["-D", "-X", "<rsc_location id=\"%s-primary\">" % ha_label]) result = cibadmin(["-D", "-X", "<primitive id=\"%s\">" % ha_label]) if result.rc != 0 and result.rc != 234: return agent_error("Error %s trying to cleanup resource %s" % (result.rc, ha_label)) else: result = cibadmin( ["-D", "-X", "<rsc_location id=\"%s-secondary\">" % ha_label]) return agent_result_ok
def unconfigure_target_ha(primary, ha_label, uuid): ''' Unconfigure the target high availability :param primary: Boolean if localhost is primary :param ha_label: String that identifies resource :param uuid: UUID that identifies config :return: Value using simple return protocol ''' with PreservePacemakerCorosyncState(): info = _get_target_config(uuid) if get_resource_location(ha_label): return agent_error( "cannot unconfigure-ha: {} is still running ".format(ha_label)) _unconfigure_target_priority(primary, ha_label) if primary: result = _unconfigure_target_ha(ha_label, info) if result.rc != 0 and result.rc != 234: return agent_error( "Error {} trying to cleanup resource {}".format( result.rc, ha_label)) return agent_result_ok