aboutsummaryrefslogtreecommitdiffstats
path: root/samples/ramspeed.yaml
blob: 2b48b95e36e2ba50792b0128017a55dc5788bf2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
##############################################################################
# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
# Sample benchmark task config file
# measure cache and memory bandwidth using Ramspeed

schema: "yardstick:task:0.1"

scenarios:
-
  type: Ramspeed
  options:
    type_id: 1
    load: 16
    block_size: 32
    iteration: 1

  host: kratos.demo

  runner:
    type: Iteration
    iterations: 1

  sla:
    min_bandwidth: 6000
    action: monitor

context:
  name: demo
  image: yardstick-image
  flavor: yardstick-flavor
  user: ubuntu

  servers:
    kratos:
      floating_ip: true

  networks:
    test:
      cidr: '10.0.1.0/24'
an class="n">name, host.ip, self, self.log) self.pinger.start() def stop(self): self.log.info('sample monitor stop......') if self.pinger is not None: self.pinger.stop() self.pinger.join() def report_error(self, hostname): self.log.info('sample monitor report error......') data = { 'time': datetime.now().isoformat(), 'type': self.event_type, 'details': { 'hostname': hostname, 'status': 'down', 'monitor': 'monitor_sample', 'monitor_event_id': 'monitor_sample_event1' }, } auth_token = self.session.get_token() if \ self.conf.inspector.type != 'sample' else None headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-Auth-Token': auth_token, } if self.conf.inspector.type != Inspector.VITRAGE: requests.put(self.inspector_url, data=json.dumps([data]), headers=headers) else: requests.post(self.inspector_url, data=json.dumps(data), headers=headers) class Pinger(Thread): interval = 0.1 # second timeout = 0.1 # second ICMP_ECHO_MESSAGE = bytes([0x08, 0x00, 0xf7, 0xff, 0x00, 0x00, 0x00, 0x00]) def __init__(self, host_name, host_ip, monitor, log): Thread.__init__(self) self.monitor = monitor self.hostname = host_name self.ip_addr = host_ip or socket.gethostbyname(self.hostname) self.log = log self._stopped = False def run(self): self.log.info("Starting Pinger host_name(%s), host_ip(%s)" % (self.hostname, self.ip_addr)) sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_ICMP) sock.settimeout(self.timeout) while True: if self._stopped: return try: sock.sendto(self.ICMP_ECHO_MESSAGE, (self.ip_addr, 0)) sock.recv(4096) except socket.timeout: detected_time = time.time() self.log.info("doctor monitor detected at %s" % detected_time) self.monitor.detected_time = detected_time self.monitor.report_error(self.hostname) self.log.info("ping timeout, quit monitoring...") self._stopped = True return time.sleep(self.interval) def stop(self): self.log.info("Stopping Pinger host_name(%s), host_ip(%s)" % (self.hostname, self.ip_addr)) self._stopped = True