'Number of netperf processes to run. Netperf '
    'will run once for each value in the list.')
flags.DEFINE_integer('netperf_thinktime', 0,
                     'Time in nanoseconds to do work for each request.')
flags.DEFINE_integer('netperf_thinktime_array_size', 0,
                     'The size of the array to traverse for thinktime.')
flags.DEFINE_integer(
    'netperf_thinktime_run_length', 0,
    'The number of contiguous numbers to sum at a time in the '
    'thinktime array.')

ALL_BENCHMARKS = ['TCP_RR', 'TCP_CRR', 'TCP_STREAM', 'UDP_RR']
flags.DEFINE_list('netperf_benchmarks', ALL_BENCHMARKS,
                  'The netperf benchmark(s) to run.')
flags.RegisterValidator(
    'netperf_benchmarks',
    lambda benchmarks: benchmarks and set(benchmarks).issubset(ALL_BENCHMARKS))

FLAGS = flags.FLAGS

BENCHMARK_NAME = 'netperf'
BENCHMARK_CONFIG = """
netperf:
  description: Run TCP_RR, TCP_CRR, UDP_RR and TCP_STREAM
  vm_groups:
    vm_1:
      vm_spec: *default_single_core
    vm_2:
      vm_spec: *default_single_core
"""
        if option == MEASUREMENTS_NONE and len(options_list) != 1:
            raise flags_validators.Error(
                '%s: Cannot combine with other --%s options' %
                (option, MEASUREMENTS_FLAG_NAME))
    return True


flags.DEFINE_list(
    MEASUREMENTS_FLAG_NAME, MEASUREMENTS_END_TO_END_RUNTIME,
    'Comma-separated list of values from <%s> that selects which timing '
    'measurements to enable. Measurements will be included as samples in the '
    'benchmark results. %s' % ('|'.join(MEASUREMENTS_ALL), ' '.join([
        '%s: %s' % (option, description)
        for option, description in MEASUREMENTS_ALL.iteritems()
    ])))
flags.RegisterValidator(MEASUREMENTS_FLAG_NAME, ValidateMeasurementsFlag)


def _GenerateIntervalSamples(interval, include_timestamps):
    """Generates Samples for a single interval timed by IntervalTimer.Measure.

  Args:
    interval: A (name, start_time, stop_time) tuple from a call to
      IntervalTimer.Measure.
    include_timestamps: A Boolean that controls whether Samples containing the
      start and stop timestamps are added to the generated list.

  Returns:
    A list of 0 to 3 Samples as specified by the args. When included, the
    Samples appear in the order of runtime, start timestamp, stop timestamp.
  """
# TODO (ferneyhough): write a validator
flags.DEFINE_string('database_version', None,
                    'Version of the database flavor selected, e.g. 5.7')
flags.DEFINE_boolean('high_availability', False,
                     'Specifies if the database should be high availability')
flags.DEFINE_boolean('database_backup_enabled', True,
                     'Whether or not to enable automated backups')
flags.DEFINE_string('database_backup_start_time', '07:00',
                    'Time in UTC that automated backups (if enabled) '
                    'will be scheduled. In the form HH:MM UTC. '
                    'Defaults to 07:00 UTC')

BACKUP_TIME_REGULAR_EXPRESSION = '^\d\d\:\d\d$'
flags.RegisterValidator('database_backup_start_time',
                        lambda value: re.search(BACKUP_TIME_REGULAR_EXPRESSION,
                                                value) is not None,
                        message=('--database_backup_start_time must be in the '
                                 'form HH:MM'))

MYSQL = 'mysql'
POSTGRES = 'postgres'

_MANAGED_RELATIONAL_DB_REGISTRY = {}
FLAGS = flags.FLAGS


# TODO: Implement DEFAULT BACKUP_START_TIME for instances.


def generateRandomDbPassword():
  """Generate a random password 10 characters in length."""
Beispiel #4
0
            warned_on.add(val)
        else:
            values.add(val)


def IODepthsValidator(string):
    try:
        WarnIODepths(GetIODepths(string))
        return True
    except ValueError:
        return False


flags.RegisterValidator('io_depths',
                        IODepthsValidator,
                        message='--io_depths must be an integer, '
                        'range of integers, or a list of '
                        'integers and ranges, all > 0')


def FillDevice(vm, disk, fill_size):
    """Fill the given disk on the given vm up to fill_size.

  Args:
    vm: a virtual_machine.VirtualMachine object.
    disk: a disk.BaseDisk attached to the given vm.
    fill_size: amount of device to fill, in fio format.
  """

    command = (('sudo %s --filename=%s --ioengine=libaio '
                '--name=fill-device --blocksize=512k --iodepth=64 '