Revision b896bb66

b/qa/rapi-workload.py
908 908
                      new_instance)
909 909

  
910 910

  
911
def TestClusterParameterModification(client):
912
  """ Try to modify some of the cluster parameters using RAPI.
913

  
914
  """
915
  cluster_info = client.GetInfo()
916

  
917
  # Each attribute has several safe choices we can use
918
  ATTRIBUTES_TO_MODIFY = [
919
    ("default_iallocator", ["hail", ""]), # Use "" to reset
920
    ("candidate_pool_size", [1, 5]),
921
    ("maintain_node_health", [True, False]),
922
    ]
923

  
924
  for attribute, options in ATTRIBUTES_TO_MODIFY:
925
    current_value = cluster_info[attribute]
926

  
927
    if current_value in options:
928
      value_to_use = options[1 - options.index(current_value)]
929
    else:
930
      value_to_use = options[0]
931

  
932
    #pylint: disable=W0142
933
    Finish(client, client.ModifyCluster, **{attribute: value_to_use})
934
    Finish(client, client.ModifyCluster, **{attribute: current_value})
935
    #pylint: enable=W0142
936

  
937

  
911 938
def Workload(client):
912 939
  """ The actual RAPI workload used for tests.
913 940

  
......
922 949
  # Then the only remaining function which is parameter-free
923 950
  Finish(client, client.RedistributeConfig)
924 951

  
952
  # Try changing the cluster parameters
953
  TestClusterParameterModification(client)
954

  
925 955
  TestTags(client, client.GetClusterTags, client.AddClusterTags,
926 956
           client.DeleteClusterTags)
927 957

  

Also available in: Unified diff