aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/availability
AgeCommit message (Collapse)AuthorFilesLines
2017-10-04Add intermediate variables for attacker,monitor,result_checkerqiujuan9-44/+61
JIRA: YARDSTICK-790 Change-Id: I6bb36c98b8673155d3142fc54cfb39315d5ce613 Signed-off-by: qiujuan <juan_qiu@tongji.edu.cn>
2017-10-02drain runner queue and undo cancel_join_threadRoss Brattain1-1/+0
Sometimes the runners can hang. Initially debugging lead to the queue join thread, so I thought we could cancel all the join threads and everything would be okay. But it turns out canceling the queue join threads can lead to corruption of the queues, so when we go to drain the queues the task hangs. But it also turns out that we were not properly draining the queues in the task process. We were waiting for all the runners to exit, then draining the queues. This is bad and will cause the queues to fill up and hang and/or drop data or corrupt the queues. The proper fix seems to be to draining the queues in a loop before calling join with a timeout. Also modified the queue drain loops to no block on queue.get() Revert "cancel all queue join threads" This reverts commit 75c0e3a54b8f6e8fd77c7d9d95decab830159929. Revert "duration runner: add teardown and cancel all queue join threads" This reverts commit 7eb6abb6931b24e085b139cc3500f4497cdde57d. Change-Id: Ic4f8e814cf23615621c1250535967716b425ac18 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-10-01cancel all queue join threadsRoss Brattain1-0/+1
In some cases we are blocking in base.Runner join() because the queues are not empty call cancel_join_thread to prevent the Queue from blocking the Process exit https://docs.python.org/3.3/library/multiprocessing.html#all-platforms Joining processes that use queues Bear in mind that a process that has put items in a queue will wait before terminating until all the buffered items are fed by the "feeder" thread to the underlying pipe. (The child process can call the cancel_join_thread() method of the queue to avoid this behaviour.) This means that whenever you use a queue you need to make sure that all items which have been put on the queue will eventually be removed before the process is joined. Otherwise you cannot be sure that processes which have put items on the queue will terminate. Remember also that non-daemonic processes will be joined automatically. Warning As mentioned above, if a child process has put items on a queue (and it has not used JoinableQueue.cancel_join_thread), then that process will not terminate until all buffered items have been flushed to the pipe. This means that if you try joining that process you may get a deadlock unless you are sure that all items which have been put on the queue have been consumed. Similarly, if the child process is non-daemonic then the parent process may hang on exit when it tries to join all its non-daemonic children. cancel_join_thread() Prevent join_thread() from blocking. In particular, this prevents the background thread from being joined automatically when the process exits – see join_thread(). A better name for this method might be allow_exit_without_flush(). It is likely to cause enqueued data to lost, and you almost certainly will not need to use it. It is really only there if you need the current process to exit immediately without waiting to flush enqueued data to the underlying pipe, and you don’t care about lost data. Change-Id: I345c722a752bddf9f0824a11cdf52ae9f04669af Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-09-21bugfix: tc025 should use ipmi to poweroffroot2-31/+36
if it use shutdown, it'll take several minutes to shutdown, leads to the ipmi power on command fails Change-Id: I74b61325cbcc3a6ec070d2fa103accf84f29b0fa Signed-off-by: root <limingjiang@huawei.com>
2017-09-01Bugfix: ha test case criteria pass when sla not passrexlee87765-3/+23
ha test cases didn't store moniter info and report fail when sla didn't pass Change-Id: I0e5637e37a66e1bf03b47fe09d17e0a1acfa11c1 Signed-off-by: rexlee8776 <limingjiang@huawei.com>
2017-08-26Raise Exception if HA test case failedJingLu52-0/+10
Change-Id: Ia3677724075c1c1408f50bbfcebd3cbcde251d66 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-08-23Add test case file, document and related scripts of yardsticktjuyinkanglin8-1/+72
tc057(HA_TC014) JIRA: YARDSTICK-779 Change-Id: I6a812b1c88229b20a0dd0ce5bc135c9ba15266db Signed-off-by: tjuyinkanglin <14_ykl@tongji.edu.cn>
2017-08-23Merge "Add test case file, document and related scripts of yardstick ↵Jing Lu3-1/+50
tc058(HA_TC015)"
2017-08-15YAML fixesRoss Brattain4-8/+9
There are multiple issues wiht YAML loading. 1. Jinja2 renders None values as a string 'None'. This is not valid YAML we need to render None values to '~' or 'null' which is the native YAML None value. 2. Jinja2 renders dict and lists that contain unicode with u'foo' values. This is not value YAML syntax. Because we are serializing dict and lists into YAML, we need to encode them as valid YAML. We can override Jinja2 finalize to use yaml.dump to dump inline YAML. We use yaml.safe_dump(elem, default_flow_style=True).replace('\n', '') to generate valid single-line YAML dict and list values. But this problem highlights the general difficulties with templating and loading files. We could avoid this Python->Jinja2->YAML->Python issue by directly injecting the list or dict after the YAML is loaded. I'm not sure of the real utility of these templates. 3. On Python 2 YAML loader is rendering all strings as unicode. This does not work for Trex because Trex is broken and badly coded. Trex does type checking against str() which is different for Python 2 and Python 3. The default YAML loader will return native string types, str() or unicode() for Python 2 and Python 3 respectively. The bad Trex codes is in convert_val: https://github.com/cisco-system-traffic-generator/trex-core/blob/master/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py#L674 def convert_val (val): if is_integer(val): return val if type(val) == str: return ipv4_str_to_num (is_valid_ipv4(val)) raise CTRexPacketBuildException(-11,("init val invalid %s ") % val ); This code is doing type(val) == str. This is bad and broken. We can't fix Trex, so we have to render all strings as native str() types The bug here was that the Heat template loader template_format.py was overriding the global YAML loader to always return unicode. We don't want this global override. To fix this we have to use local subclasses of the yaml.SafeLoader class. But in order to dynamically subclass from CSafeLoader or SafeLoader we have to use the type() builtin to define a new class at runtime. Once we have new classes defined, we can safely isolate different YAML constructors and return unicode or not depending on the case. To be consistent we implement a new yaml_loader.py module to centralize all non-Heat template yaml loading to ensure correct uncode/str conversion Change-Id: Iebf9cf78fbda390977c390436b0869e7bbf503eb Signed-off-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Deepak S <deepak.s@linux.intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-11Add test case file, document and related scripts of yardsticktjuyinkanglin3-1/+50
tc058(HA_TC015) JIRA: YARDSTICK-780 Change-Id: I4406776cb6b91265a0d2674b5dd200ca7d13ef14 Signed-off-by: tjuyinkanglin <14_ykl@tongji.edu.cn>
2017-08-09bugfix: tc025 and tc054 failrexlee87761-0/+1
also modify tc025 an tc054 to be able to pass paras JIRA: YARDSTICK-772 Change-Id: Ibeba931804cccfd74fc70fcf4fdb6af9d5c8ab77 Signed-off-by: rexlee8776 <limingjiang@huawei.com>
2017-08-01replace yaml.load with yaml.safe_loadRoss Brattain4-4/+4
yaml.safe_load is safer, obviously. anteater will check for this template_format use specialized constructor based on yaml.SafeLoader JIRA: YARDSTICK-760 Change-Id: Ia3b0b3aa0765385a0ee472a4d83f49d424b5a77f Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-25Add intermediate variable for HA testqiujuan6-17/+52
JIRA: YARDSTICK-397 Change-Id: I3489893caa5b8194b63cb844325ec0b2c554aecc Signed-off-by: qiujuan <juan_qiu@tongji.edu.cn>
2017-07-24Merge "HA testcase containerized Compass support"Jing Lu8-4/+188
2017-07-20HA testcase containerized Compass supportJingLu58-4/+188
Compass will be containerized in Euphrates release. This work is about support HA testcase in a containerized environment. Change-Id: Ibb668c81f046d6400293f8cd58181b9f20aeebe3 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-07-17Merge "attacker_process: fix typo s/envrioment/environment/"Rex Lee1-2/+2
2017-07-17Merge "test_attacker_baremetal: don't run local commands"Ross Brattain1-4/+1
2017-07-14attacker_process: fix typo s/envrioment/environment/Ross Brattain1-2/+2
Change-Id: I1e5db657eb88c73b5d9223c47e2d97dc79eec1f1 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-13test_attacker_baremetal: don't run local commandsRoss Brattain1-4/+1
these tests were failing to mock subprocess.check_output and thus were trying to run sudo commands on the local system. This is dangerous. Add the subprocess mock. Also mock the LOG object so we don't print bogus Runtime error tracebacks in the unittest logs when we test assertRaises() Change-Id: I01535f9952fbd95ce2f5972b641c51ff836e7e8c Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-13test_monitor_command: mock LOG so we don't output errorRoss Brattain1-4/+1
Don't print fake tracebacks to the unittest logs Change-Id: I8a468b8c6566f02be88a9dd222567c14c66b0956 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-06-30Use "OS_INSECURE" variable as the insecure mode indicatorJingLu54-5/+5
Now we use "OS_CACERT" as the insecure mode indicator, it is better to use "OS_INSECURE". Change-Id: I1406193e27510390b4b8fd8f4751d8361560172f Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-06-30Bugfix: remove test.dbf file in recovery scriptzshi1-1/+1
JIRA: YARDSTICK-696 Change-Id: I09b73079ff828c43040723794115bb07f74242e8 Signed-off-by: zshi <zshi@redhat.com>
2017-06-22HA testcase improvementJingLu58-8/+52
This patch improve HA test case in the following aspects: 1. the "GeneralHA" type now will check if the target service process in the controller node. 2. support ignore server certificate 3. add debug log for recovering service failed 4. improve method to kill keystone process Change-Id: I9ae7ab54391fe41d5d7f3e4951a7ac2e3ba75968 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-05-27Imporve monitor_process pass criteriaJingLu57-15/+37
JIRA: YARDSTICK-660 The monitor func()'s criteria in the monitor_process.py now is whether at least one process of the specific controller node service is recovered. But in reality is more resonable to use whether processes have been recoverd to it's original amount. This patch is aiming at improving the isssue Change-Id: I950ce2a89555801b96092735b0d670e892049927 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-05-25Terminate openstack service process using kill command in HA test casesJingLu51-2/+5
JIRA: YARDSTICK-659 In some openstack environment, the service process cannot be killed by killall command but can be terminate by kill command. This patch is about to switch to use kill command in the fault_process_kill.bash to kill processes. Change-Id: Iec455ee56d3f31fb5c16de5994870d1acd33f41a Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-05-24fix bug: multi monitorHuanLi1-6/+15
JIRA: YARDSTICK-657 Change-Id: I77223cc43d529828cf3f763529019590c35b2fcb Signed-off-by: HuanLi <lihuansse@tongji.edu.cn>
2017-05-16Merge "Add a new monitor type: MultiMonitor that can run any number of other ↵Ross Brattain2-0/+78
monitors at the same time."
2017-05-06Bugfix: Support HA test cases in TripleOJingLu59-23/+48
Change-Id: Ib1f6f45677e66ca88fb546ea0662f52588e9d336 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-05-04Merge "Bugfix: Local Openstack Operation in HA test frameworks"Jing Lu3-40/+104
2017-05-04Bugfix: Local Openstack Operation in HA test frameworkstjuyinkanglin3-40/+104
JIRA: YARDSTICK-635 Change-Id: Ic27517714db9325e7a3b1ef623c49af61c36b2b5 Signed-off-by: tjuyinkanglin <14_ykl@tongji.edu.cn>
2017-05-04Merge "Bugfix: fix HA test case tc046"Jing Lu3-3/+11
2017-05-04Merge "Modify HA test cases and HA test script to support other installers"Jing Lu3-6/+0
2017-05-04Modify HA test cases and HA test script to support other installerstjuyinkanglin3-6/+0
JIRA: YARDSTICK-633 Change-Id: I65fd1ba11504dc61485f83c3bcc93bec4d41883b Signed-off-by: tjuyinkanglin <14_ykl@tongji.edu.cn>
2017-05-04Bugfix: fix HA test case tc046JingLu53-3/+11
The original way to kill keystone service didn't work anymore. this patch uses killall -u to kill keystone processes. Change-Id: I553b716f17a5ab7e57630468517642a92f06dd27 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-05-03fix ha issue when run tc050~tc054 in cirexlee87762-9/+12
JIRA: YARDSTICK-634 Change-Id: I46681c7e8afe391eef9c5309470028167e911950 Signed-off-by: rexlee8776 <limingjiang@huawei.com>
2017-04-27bugfix: fix HA testcasesJingLu51-1/+1
Change-Id: Ib38e94610a108ff7195cefdfaf048e0f4fd894e8 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-04-27Bugfix: fix HA testcasesJingLu53-11/+3
Change-Id: Ic930c59fcf3d7e53d385016051596b6563dca0d7 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-04-24Merge "operation_general: fix logging to use %s"Rex Lee1-1/+1
2017-04-12Add a new monitor type: MultiMonitor that can run any number of other ↵LiHuan2-0/+78
monitors at the same time. JIRA: YARDSTICK-397 Change-Id: Ic5cb79f0820029e306373abead1ea43fac9abee2 Signed-off-by: HuanLi <lihuansse@tongji.edu.cn>
2017-04-11standardize ssh authRoss Brattain8-59/+19
we need to be following defautl paramiko rules, first use pkey, then key_filenames (autodetecting ~/.ssh/ keys), then password We have too much boilerplate redudant code everywhere, we need to standardize on a factory function that takes a node dict. Using Python3 ChainMap we can layer overrides and defaults. VNF descriptors have to default key_filename, password to Python None. The only way to do this is to omit key values if the variable is not defined, this way the dict will not have the value and it will default to Python None Add python2 chainmap backport Updated unittest mocking to use ssh.SSH.from_node Change-Id: I80b0cb606e593b33e317c9e5e8ed0b74da591514 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-04-04attacker_general: fix logging to use %sRoss Brattain1-11/+10
Change-Id: Ib451d7883eb5df13cfe95477cea43c076ac0452a Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-04-04operation_general: fix logging to use %sRoss Brattain1-1/+1
Change-Id: I1b37cbf07e8858ca3e75bb74c57fe84485ff4989 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-02-17Update missing license headersDeepak S4-0/+32
Change-Id: I063fd37fe25754c94d164ae5a209d15b69322093 Signed-off-by: Deepak S <deepak.s@linux.intel.com>
2017-02-14Update Openstack CLI Command in yardstick ha test framework configuration ↵tjuyinkanglin2-2/+2
files and TC052 JIRA: YARDSTICK-547 Change-Id: Idde2dc56436c9cf4b8696bfd0056ab4e47c97c9a Signed-off-by: tjuyinkanglin <14_ykl@tongji.edu.cn>
2017-02-07more logging fixesRoss Brattain3-23/+21
don't use .format() with logging, use regular %s logginer formatter Change-Id: I1ce0d81cc3f81c35003ef453e82c57faeb46c49f Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-01-16Use """ to replace ''' in docstringchenjiankun7-9/+9
JIRA: YARDSTICK-525 For consistency, we always use """triple double quotes""" around docstrings. Change-Id: I47a20bbd8b55bc544b4841ea4006929af0a044ac Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-01-12Add support for Python 3Ross Brattain16-21/+50
Porting to Python3 using Openstack guidelines: https://wiki.openstack.org/wiki/Python3 This passes unittests on Python 3.5 and passes opnfv_smoke suite Updates: use six for urlparse and urlopen fix exception.message attribute removal run unittests on python3 use unitest.mock on python 3 fix open mock for vsperf fix float division by using delta/eplison comparison use unicode in StringIO use plugin/sample_config.yaml relative path from test case fixed apexlake unittests upgraded to mock 2.0.0 to match python3 unittest.mock features fixed flake8 issues implement safe JSON decode with oslo_serialization.jsonutils.dump_as_bytes() implement safe unicode encode/decode with oslo_utils.encodeutils heat: convert pub key file from bytes to unicode pkg_resources returns raw bytes, in python3 we have to decode this to utf-8 unicode so JSON can encode it for heat template JIRA: YARDSTICK-452 Change-Id: Ib80dd1d0c0eb0592acd832b82f6a7f8f7c20bfda Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2016-12-05use context manager for stdin files and use _put_file_shellRoss Brattain8-58/+77
requires https://gerrit.opnfv.org/gerrit/#/c/25183/ use new ssh method _put_file_shell to upload files. We have to use _put_file_shell because we rely on ~/ path expansions. Eventually we should move to remote absolute paths so we can use sftp upload. For ssh.execute() replace open() with context manager context managers were invented partly to control freeing resources. Opening files without closing them will leak file descriptors. The old standard method for closing files: f = open('data.txt') try: data = f.read() finally: f.close() was replaced with a context manager with open('data.txt') as f: data = f.read() Reference: Raymond Hettinger's Pycon 2013 presentation: https://speakerdeck.com/pyconslides/transforming-code-into-beautiful-idiomatic-python-by-raymond-hettinger-1 Video: https://youtu.be/OSGv2VnC0go?t=2522 Always use context managers for files Update: rebased now that _put_file_shell was merged Change-Id: Iabfc0e43aa3b7766d7c658115e13d21c31efb2a9 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2016-11-30switch logging to proper usageRoss Brattain16-47/+47
The logging methods do string interpolation themselves From the reference: https://docs.python.org/2/library/logging.html#logging.Logger.debug Logger.debug(msg, *args, **kwargs) Logs a message with level DEBUG on this logger. The msg is the message format string, and the args are the arguments which are merged into msg using the string formatting operator. (Note that this means that you can use keywords in the format string, together with a single dictionary argument.) There are two keyword arguments in kwargs which are inspected: exc_info which, if it does not evaluate as false, causes exception information to be added to the logging message. If an exception tuple (in the format returned by sys.exc_info()) is provided, it is used; otherwise, sys.exc_info() is called to get the exception informatio The reason logging does string interpolation itselfs is to implement deferred interpolation. String interpolation involves evaluating arguments, so it can introduce significant computation. The logging module tries to be smart about deferring interpolation until the last possible moment. The logging methods check isEnabledFor for the log level and won't interpolate if the level is not enabled. https://github.com/python/cpython/blob/2.7/Lib/logging/__init__.py#L1178 def warning(self, msg, *args, **kwargs): if self.isEnabledFor(WARNING): self._log(WARNING, msg, args, **kwargs) logging actually waits to interpolate the string in LogRecord.getMessage() https://github.com/python/cpython/blob/2.7/Lib/logging/__init__.py#L328 if self.args: msg = msg % self.args Change-Id: Ie09efe0a66881e19bd8119caa376075e605627a2 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2016-11-10add option to connect to non-standard ssh portRoss Brattain8-11/+27
not all enviroments have port 22 enabled for SSH. In particular for network isolation NAT and port forwarding may be used. example pod.yaml: nodes: - ip: 10.2.45.145 name: node1 password: '' role: Controller ssh_port: 5000 user: root - ip: 10.2.45.145 name: node2 password: '' role: Controller ssh_port: 5001 user: root - ip: 10.2.45.145 name: node3 password: '' role: Controller ssh_port: 5002 user: root JIRA: YARDSTICK-407 Change-Id: I8f9d6e388f31d291dd15cb900d7f71f347e41ef6 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>