'mkfs': fields.String,
'mount_point': fields.String,
'file_size': fields.String,
- 'file_count': fields.String
+ 'nrfiles': fields.String,
+ 'numjobs': fields.String,
}
import logging
from threading import Thread
import paramiko
+from storperf.utilities import ip_helper
class FIOInvoker(object):
def _ssh_client(self):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
+ address, port = ip_helper.parse_address_and_port(self.remote_host)
if 'username' in self.metadata and 'password' in self.metadata:
- ssh.connect(self.remote_host,
+ ssh.connect(address,
+ port=port,
username=self.metadata['username'],
- password=self.metadata['password'])
+ password=self.metadata['password'],
+ timeout=5)
return ssh
elif 'username' in self.metadata and 'ssh_key' in self.metadata:
- ssh.connect(self.remote_host,
+ ssh.connect(address,
+ port=port,
username=self.metadata['username'],
- pkey=self.metadata['ssh_key'])
+ pkey=self.metadata['ssh_key'],
+ timeout=5)
return ssh
else:
- ssh.connect(self.remote_host, username='storperf',
+ ssh.connect(address,
+ port=port,
+ username='storperf',
key_filename='storperf/resources/ssh/storperf_rsa',
- timeout=2)
+ timeout=5)
return ssh
##############################################################################
-from _io import StringIO
from datetime import datetime
+from io import StringIO
from multiprocessing.pool import ThreadPool
from scp import SCPClient
from snaps.config.stack import StackConfig
from snaps.thread_utils import worker_pool
from storperf.db.job_db import JobDB
from storperf.test_executor import TestExecutor
+from storperf.utilities import ip_helper
from time import sleep
import json
import logging
def ssh_key(self):
if self._ssh_key is None:
return None
- key = StringIO.StringIO(self._ssh_key)
+ key = StringIO(self._ssh_key)
pkey = paramiko.RSAKey.from_private_key(key)
key.close()
return pkey
timer = 10
while not alive:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- result = s.connect_ex((slave, 22))
+ host, port = ip_helper.parse_address_and_port(slave)
+ result = s.connect_ex((host, port))
s.close()
if result:
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
if self.username and self.password:
ssh.connect(
- slave,
+ host,
+ port=port,
username=self.username,
password=self.password,
timeout=2)
elif self.username and self.ssh_key:
ssh.connect(
- slave,
+ host,
+ port=port,
username=self.username,
pkey=self.ssh_key,
timeout=2)
else:
ssh.connect(
slave,
+ port=port,
username='storperf',
key_filename='storperf/resources/ssh/storperf_rsa',
timeout=2)
--- /dev/null
+##############################################################################
+# Copyright (c) 2019 VMware 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
+##############################################################################
+
+
+def parse_address_and_port(address):
+ port = 22
+ if '.' in address:
+ # this is IPv4
+ if ':' in address:
+ host = address.split(':')[0]
+ port = int(address.split(':')[1])
+ else:
+ host = address
+ else:
+ if ']' in address:
+ # this is IPv6
+ host = address.split(']')[0].split('[')[1]
+ port = int(address.split(']')[1].split(':')[1])
+ else:
+ host = address
+ return (host, port)
--- /dev/null
+##############################################################################
+# Copyright (c) 2017 Dell EMC 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
+##############################################################################
+
+import unittest
+
+from storperf.utilities import ip_helper
+
+
+class Test(unittest.TestCase):
+
+ def testNoPortInIPv4(self):
+ host, port = ip_helper.parse_address_and_port("127.0.0.1")
+ self.assertEqual("127.0.0.1", host)
+ self.assertEqual(22, port)
+
+ def testPortInIPv4(self):
+ host, port = ip_helper.parse_address_and_port("127.0.0.1:2222")
+ self.assertEqual("127.0.0.1", host)
+ self.assertEqual(2222, port)
+
+ def testNoPortInIPv6(self):
+ host, port = ip_helper.parse_address_and_port(
+ "1fe80::58bb:c8b:f2f2:c888")
+ self.assertEqual("1fe80::58bb:c8b:f2f2:c888",
+ host)
+ self.assertEqual(22, port)
+
+ def testPortInIPv6(self):
+ host, port = ip_helper.parse_address_and_port(
+ "[1fe80::58bb:c8b:f2f2:c888]:2222")
+ self.assertEqual("1fe80::58bb:c8b:f2f2:c888",
+ host)
+ self.assertEqual(2222, port)
--- /dev/null
+##############################################################################
+# Copyright (c) 2019 VMware 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
+##############################################################################
+# Docker container for workload
+#
+# Purpose: docker image for Storperf to control as a synthetic workload
+#
+# Maintained by Mark Beierl
+# Build:
+# $ docker build -t opnfv/storperf-workloadagent:tag .
+#
+
+ARG ARCH=x86_64
+ARG ALPINE_VERSION=v3.10
+FROM multiarch/alpine:$ARCH-$ALPINE_VERSION
+
+RUN apk add --no-cache --upgrade \
+ logrotate \
+ openssh-client \
+ openssh-server \
+ sudo
+
+RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/g' /etc/ssh/sshd_config
+RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
+
+RUN echo "root ALL=(ALL) ALL" >> /etc/sudoers
+RUN ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
+RUN ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
+
+RUN echo root:password | chpasswd
+
+CMD /usr/sbin/sshd -D -e
\ No newline at end of file
allows for performing RADOS or RDB performance tests using the appropriate
FIO engine.
+If the slave SSH server is listening to a port other than 22, the port number
+can be specified as part of the address as follows:
+IPv4 example for port 2222:
+
+.. code-block::
+ 192.168.1.10:2222
+
+IPv6 example for port 2222:
+
+.. code-block::
+ [1fe80::58bb:c8b:f2f2:c888]:2222
+
+Helper Container Image for Workloads
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+A new docker container is provided with StorPerf that can be used to test
+under docker or Kubernetes environments. It has hard coded credentials
+of root/password with an SSH server built it, so be cautious about security
+concerns when using this image. It listens internally on port 22, so that
+port must be exposed to a free port on the host in order for StorPerf to
+reach the synthetic workload container.
+
+.. code-block:: bash
+
+ docker run --name=storperf-workloadagent -p 2222:22
+ opnfv/storperf-workloadagent:latest
Initialize the Target Volumes
=============================