Revision 3eea40a0 qa/rapi-workload.py
b/qa/rapi-workload.py | ||
---|---|---|
103 | 103 |
catching any specific non-fatal errors we would like to know more |
104 | 104 |
about. |
105 | 105 |
|
106 |
@type fn arbitrary function |
|
107 |
@param fn The function to invoke later. |
|
108 |
@type name string |
|
109 |
@param name The name of the function, for debugging purposes. |
|
110 |
@rtype function |
|
106 |
@type fn: arbitrary function
|
|
107 |
@param fn: The function to invoke later.
|
|
108 |
@type name: string
|
|
109 |
@param name: The name of the function, for debugging purposes.
|
|
110 |
@rtype: function
|
|
111 | 111 |
|
112 | 112 |
""" |
113 | 113 |
def decoratedFn(*args, **kwargs): |
... | ... | |
173 | 173 |
""" When invoked with a job-starting RAPI client method, it passes along any |
174 | 174 |
additional arguments and waits until its completion. |
175 | 175 |
|
176 |
@type client C{GanetiRapiClientWrapper} |
|
177 |
@param client The client wrapper. |
|
178 |
@type fn function |
|
179 |
@param fn A client method returning a job id. |
|
176 |
@type client: C{GanetiRapiClientWrapper}
|
|
177 |
@param client: The client wrapper.
|
|
178 |
@type fn: function
|
|
179 |
@param fn: A client method returning a job id.
|
|
180 | 180 |
|
181 |
@rtype tuple of bool, any object |
|
182 |
@return The success status and the result of the operation, if any |
|
181 |
@rtype: tuple of bool, any object
|
|
182 |
@return: The success status and the result of the operation, if any
|
|
183 | 183 |
|
184 | 184 |
""" |
185 | 185 |
possible_job_id = fn(*args, **kwargs) |
... | ... | |
209 | 209 |
def TestTags(client, get_fn, add_fn, delete_fn, *args): |
210 | 210 |
""" Tests whether tagging works. |
211 | 211 |
|
212 |
@type client C{GanetiRapiClientWrapper} |
|
213 |
@param client The client wrapper. |
|
214 |
@type get_fn function |
|
215 |
@param get_fn A Get*Tags function of the client. |
|
216 |
@type add_fn function |
|
217 |
@param add_fn An Add*Tags function of the client. |
|
218 |
@type delete_fn function |
|
219 |
@param delete_fn A Delete*Tags function of the client. |
|
212 |
@type client: C{GanetiRapiClientWrapper}
|
|
213 |
@param client: The client wrapper.
|
|
214 |
@type get_fn: function
|
|
215 |
@param get_fn: A Get*Tags function of the client.
|
|
216 |
@type add_fn: function
|
|
217 |
@param add_fn: An Add*Tags function of the client.
|
|
218 |
@type delete_fn: function
|
|
219 |
@param delete_fn: A Delete*Tags function of the client.
|
|
220 | 220 |
|
221 | 221 |
To allow this method to work for all tagging functions of the client, use |
222 | 222 |
named methods. |
... | ... | |
244 | 244 |
""" Tests the various get functions which only retrieve information about the |
245 | 245 |
cluster. |
246 | 246 |
|
247 |
@type client C{GanetiRapiClientWrapper} |
|
247 |
@type client: C{GanetiRapiClientWrapper}
|
|
248 | 248 |
|
249 | 249 |
""" |
250 | 250 |
client.GetVersion() |
... | ... | |
268 | 268 |
""" Finds out which fields are present for a given resource type, and attempts |
269 | 269 |
to retrieve their values for all present resources. |
270 | 270 |
|
271 |
@type client C{GanetiRapiClientWrapper} |
|
272 |
@param client A wrapped RAPI client. |
|
273 |
@type resource_name string |
|
274 |
@param resource_name The name of the resource to use. |
|
271 |
@type client: C{GanetiRapiClientWrapper}
|
|
272 |
@param client: A wrapped RAPI client.
|
|
273 |
@type resource_name: string
|
|
274 |
@param resource_name: The name of the resource to use.
|
|
275 | 275 |
|
276 | 276 |
""" |
277 | 277 |
|
... | ... | |
294 | 294 |
""" Performs queries by playing around with the only guaranteed resource, the |
295 | 295 |
master node. |
296 | 296 |
|
297 |
@type client C{GanetiRapiClientWrapper} |
|
298 |
@param client A wrapped RAPI client. |
|
299 |
@type master_name string |
|
300 |
@param master_name The hostname of the master node. |
|
297 |
@type client: C{GanetiRapiClientWrapper}
|
|
298 |
@param client: A wrapped RAPI client.
|
|
299 |
@type master_name: string
|
|
300 |
@param master_name: The hostname of the master node.
|
|
301 | 301 |
|
302 | 302 |
""" |
303 | 303 |
client.Query("node", ["name"], |
... | ... | |
316 | 316 |
def RemoveAllInstances(client): |
317 | 317 |
""" Queries for a list of instances, then removes them all. |
318 | 318 |
|
319 |
@type client C{GanetiRapiClientWrapper} |
|
320 |
@param client A wrapped RAPI client. |
|
319 |
@type client: C{GanetiRapiClientWrapper}
|
|
320 |
@param client: A wrapped RAPI client.
|
|
321 | 321 |
|
322 | 322 |
""" |
323 | 323 |
instances = client.GetInstances() |
... | ... | |
333 | 333 |
""" Creates an instance, performs operations involving it, and then deletes |
334 | 334 |
it. |
335 | 335 |
|
336 |
@type client C{GanetiRapiClientWrapper} |
|
337 |
@param client A wrapped RAPI client. |
|
338 |
@type instance_name string |
|
339 |
@param instance_name The hostname to use. |
|
340 |
@type instance_name string |
|
341 |
@param instance_name Another valid hostname to use. |
|
342 |
@type node_one string |
|
343 |
@param node_one A node on which an instance can be added. |
|
344 |
@type node_two string |
|
345 |
@param node_two A node on which an instance can be added.
|
|
336 |
@type client: C{GanetiRapiClientWrapper}
|
|
337 |
@param client: A wrapped RAPI client.
|
|
338 |
@type instance_name: string
|
|
339 |
@param instance_name: The hostname to use.
|
|
340 |
@type instance_name: string
|
|
341 |
@param instance_name: Another valid hostname to use.
|
|
342 |
@type node_one: string
|
|
343 |
@param node_one: A node on which an instance can be added.
|
|
344 |
@type node_two: string
|
|
345 |
@param node_two: Another node on which an instance can be added.
|
|
346 | 346 |
|
347 | 347 |
""" |
348 | 348 |
|
... | ... | |
438 | 438 |
""" Given a certain node state, marks a node as being in that state, and then |
439 | 439 |
unmarks it. |
440 | 440 |
|
441 |
@type client C{GanetiRapiClientWrapper} |
|
442 |
@param client A wrapped RAPI client. |
|
443 |
@type node string |
|
444 |
@type state string |
|
441 |
@type client: C{GanetiRapiClientWrapper}
|
|
442 |
@param client: A wrapped RAPI client.
|
|
443 |
@type node: string
|
|
444 |
@type state: string
|
|
445 | 445 |
|
446 | 446 |
""" |
447 | 447 |
# pylint: disable=W0142 |
... | ... | |
453 | 453 |
def TestNodeOperations(client, non_master_node): |
454 | 454 |
""" Tests various operations related to nodes only |
455 | 455 |
|
456 |
@type client C{GanetiRapiClientWrapper} |
|
457 |
@param client A wrapped RAPI client. |
|
458 |
@type non_master_node string |
|
459 |
@param non_master_node The name of a non-master node in the cluster. |
|
456 |
@type client: C{GanetiRapiClientWrapper}
|
|
457 |
@param client: A wrapped RAPI client.
|
|
458 |
@type non_master_node: string
|
|
459 |
@param non_master_node: The name of a non-master node in the cluster.
|
|
460 | 460 |
|
461 | 461 |
""" |
462 | 462 |
|
... | ... | |
514 | 514 |
def TestGroupOperations(client, node, another_node): |
515 | 515 |
""" Tests various operations related to groups only. |
516 | 516 |
|
517 |
@type client C{GanetiRapiClientWrapper} |
|
518 |
@param client A Ganeti RAPI client to use. |
|
519 |
@type node string |
|
520 |
@param node The name of a node in the cluster. |
|
521 |
@type another_node string |
|
522 |
@param another_node The name of another node in the cluster. |
|
517 |
@type client: C{GanetiRapiClientWrapper}
|
|
518 |
@param client: A Ganeti RAPI client to use.
|
|
519 |
@type node: string
|
|
520 |
@param node: The name of a node in the cluster.
|
|
521 |
@type another_node: string
|
|
522 |
@param another_node: The name of another node in the cluster.
|
|
523 | 523 |
|
524 | 524 |
""" |
525 | 525 |
|
... | ... | |
568 | 568 |
def TestNetworkConnectDisconnect(client, network_name, mode, link): |
569 | 569 |
""" Test connecting and disconnecting the network to a new node group. |
570 | 570 |
|
571 |
@type network_name string |
|
572 |
@param network_name The name of an existing and unconnected network. |
|
573 |
@type mode string |
|
574 |
@param mode The network mode. |
|
575 |
@type link string |
|
576 |
@param link The network link. |
|
571 |
@type network_name: string
|
|
572 |
@param network_name: The name of an existing and unconnected network.
|
|
573 |
@type mode: string
|
|
574 |
@param mode: The network mode.
|
|
575 |
@type link: string
|
|
576 |
@param link: The network link.
|
|
577 | 577 |
|
578 | 578 |
""" |
579 | 579 |
# For testing the connect/disconnect calls, a group is needed |
... | ... | |
650 | 650 |
instance_name): |
651 | 651 |
""" Test various operations related to migrating instances. |
652 | 652 |
|
653 |
@type node_one string |
|
654 |
@param node_one The name of a node in the cluster. |
|
655 |
@type node_two string |
|
656 |
@param node_two The name of another node in the cluster. |
|
657 |
@type node_three string |
|
658 |
@param node_three The name of yet another node in the cluster. |
|
659 |
@type instance_name string |
|
660 |
@param instance_name An instance name that can be used. |
|
653 |
@type node_one: string
|
|
654 |
@param node_one: The name of a node in the cluster.
|
|
655 |
@type node_two: string
|
|
656 |
@param node_two: The name of another node in the cluster.
|
|
657 |
@type node_three: string
|
|
658 |
@param node_three: The name of yet another node in the cluster.
|
|
659 |
@type instance_name: string
|
|
660 |
@param instance_name: An instance name that can be used.
|
|
661 | 661 |
|
662 | 662 |
""" |
663 | 663 |
|
... | ... | |
695 | 695 |
def ExtractAllNicInformationPossible(nics, replace_macs=True): |
696 | 696 |
""" Extracts NIC information as a dictionary. |
697 | 697 |
|
698 |
@type nics list of tuples of varying structure |
|
699 |
@param nics The network interfaces, as received from the instance info RAPI |
|
700 |
call. |
|
698 |
@type nics: list of tuples of varying structure
|
|
699 |
@param nics: The network interfaces, as received from the instance info RAPI
|
|
700 |
call.
|
|
701 | 701 |
|
702 |
@rtype list of dict |
|
703 |
@return Dictionaries of NIC information. |
|
702 |
@rtype: list of dict
|
|
703 |
@return: Dictionaries of NIC information.
|
|
704 | 704 |
|
705 | 705 |
The NIC information is returned in a different format across versions, and to |
706 | 706 |
try and see if the execution of commands is still compatible, this function |
... | ... | |
758 | 758 |
def MoveInstance(client, src_instance, dst_instance, src_node, dst_node): |
759 | 759 |
""" Moves a single instance, compatible with 2.6. |
760 | 760 |
|
761 |
@rtype bool |
|
762 |
@return Whether the instance was moved successfully |
|
761 |
@rtype: bool
|
|
762 |
@return: Whether the instance was moved successfully
|
|
763 | 763 |
|
764 | 764 |
""" |
765 | 765 |
success, inst_info_all = Finish(client, client.GetInstanceInfo, |
... | ... | |
833 | 833 |
def CreateInstanceForMoveTest(client, node, instance): |
834 | 834 |
""" Creates a single shutdown instance to move about in tests. |
835 | 835 |
|
836 |
@type node C{_QaNode} |
|
837 |
@param node A node configuration object. |
|
838 |
@type instance C{_QaInstance} |
|
839 |
@param instance An instance configuration object. |
|
836 |
@type node: C{_QaNode}
|
|
837 |
@param node: A node configuration object.
|
|
838 |
@type instance: C{_QaInstance}
|
|
839 |
@param instance: An instance configuration object.
|
|
840 | 840 |
|
841 | 841 |
""" |
842 | 842 |
Finish(client, client.CreateInstance, |
... | ... | |
892 | 892 |
""" Performs two types of instance moves, one compatible with 2.6, the other |
893 | 893 |
with 2.11. |
894 | 894 |
|
895 |
@type node_one C{_QaNode} |
|
896 |
@param node_one A node configuration object. |
|
897 |
@type node_two C{_QaNode} |
|
898 |
@param node_two A node configuration object. |
|
899 |
@type instance_to_create C{_QaInstance} |
|
900 |
@param instance_to_create An instance configuration object. |
|
901 |
@type new_instance C{_QaInstance} |
|
902 |
@param new_instance An instance configuration object. |
|
895 |
@type node_one: C{_QaNode}
|
|
896 |
@param node_one: A node configuration object.
|
|
897 |
@type node_two: C{_QaNode}
|
|
898 |
@param node_two: A node configuration object.
|
|
899 |
@type instance_to_create: C{_QaInstance}
|
|
900 |
@param instance_to_create: An instance configuration object.
|
|
901 |
@type new_instance: C{_QaInstance}
|
|
902 |
@param new_instance: An instance configuration object.
|
|
903 | 903 |
|
904 | 904 |
""" |
905 | 905 |
|
... | ... | |
939 | 939 |
def TestJobCancellation(client, node_one, node_two, instance_one, instance_two): |
940 | 940 |
""" Test if jobs can be cancelled. |
941 | 941 |
|
942 |
@type node_one string |
|
943 |
@param node_one The name of a node in the cluster. |
|
944 |
@type node_two string |
|
945 |
@param node_two The name of a node in the cluster.
|
|
946 |
@type instance_one string |
|
947 |
@param instance_one An available instance name. |
|
948 |
@type instance_two string |
|
949 |
@param instance_two An available instance name. |
|
942 |
@type node_one: string
|
|
943 |
@param node_one: The name of a node in the cluster.
|
|
944 |
@type node_two: string
|
|
945 |
@param node_two: The name of another node in the cluster.
|
|
946 |
@type instance_one: string
|
|
947 |
@param instance_one: An available instance name.
|
|
948 |
@type instance_two: string
|
|
949 |
@param instance_two: An available instance name.
|
|
950 | 950 |
|
951 | 951 |
""" |
952 | 952 |
|
... | ... | |
986 | 986 |
def Workload(client): |
987 | 987 |
""" The actual RAPI workload used for tests. |
988 | 988 |
|
989 |
@type client C{GanetiRapiClientWrapper} |
|
990 |
@param client A wrapped RAPI client. |
|
989 |
@type client: C{GanetiRapiClientWrapper}
|
|
990 |
@param client: A wrapped RAPI client.
|
|
991 | 991 |
|
992 | 992 |
""" |
993 | 993 |
|
Also available in: Unified diff