A ServerStackFixture that inherits from AffinityServerGroupStackFixture
or AntiAffinityServerGroupStackFixture will be scheduled in affinity or
anti-affinity groups.
Change-Id: I8427dcc2fff3cf326d22d337f7a0d1468eb9f296
In nova's client code there is constant
MAX_SERVER_CONSOLE_OUTPUT_LENGTH which is used if parameter
"length" is not passed to the "get_console_output" function.
But it wasn't used as max possible length of console output to
fetch but rather like default length and there was possibility to
call "get_console_output" function with length parameter set to
some value higher than MAX_SERVER_CONSOLE_OUTPUT_LENGTH.
Now it will always be limited to MAX_SERVER_CONSOLE_OUTPUT_LENGTH,
even if "length" passed to the "get_console_output" function will be
higher.
Change-Id: Iafee632e7c8487372bbe6bfbae91b5fa53150c21
We have to pass ssh_client object to tobiko/podman/_shell.py/discover_podman_socket
otherwise that methid has no way to get the actual socket url:
In [27]: import six
...:
...: import tobiko
...: from tobiko.tripleo import overcloud
...: from tobiko.shell import sh
...:
...:
In [28]: ssh_client = overcloud.overcloud_ssh_client('controller-0')
In [30]: cmd = "systemctl list-sockets | grep podman | awk '{print $1}'"
...:
In [31]: result = sh.execute(cmd, stdin=False, stdout=True, stderr=True,expect_exit_status=None)
...:
...:
In [32]: result
Out[32]: <tobiko.shell.sh._execute.ShellExecuteResult at 0x7f3a232f2b70>
In [33]: result.stdout
Out[33]: '0 sockets listed.\nPass --all to see loaded but inactive sockets, too.\n'
In [35]: ssh_client = overcloud.overcloud_ssh_client('controller-1')
...:
...:
In [36]: output = sh.execute("systemctl list-sockets | grep podman | awk '{print $1}'" ,ssh_client=ssh_cli
...: ent).stdout
In [37]: output
Out[37]: '/run/podman/io.podman\n'
import six
if six.PY3:
from podman import client as podman_client
from podman.libs import containers
from tobiko import podman
from tobiko.openstack import topology
six.PY3
ssh_client = None
for node in topology.list_openstack_nodes(group='controller'):
ssh_client = node.ssh_client
client = podman.get_podman_client(
ssh_client=ssh_client).connect()
from tobiko.podman import _exception
from tobiko.podman import _shell
from tobiko.shell import ssh
import podman
Now we get this error:
~/tobiko/test/lib/python3.6/site-packages/podman/client.py in factory(cls, uri, interface, *args, **kwargs)
55 local_path = urlparse(uri).path
56 if local_path == '':
---> 57 raise ValueError('path is required for uri,'
58 ' expected format "unix://path_to_socket"')
59
this is because :
uri=_shell.discover_podman_socket(ssh_client=ssh_client)
uri = ssh.get_port_forward_url(ssh_client=ssh_client, url=uri)
uri
Out[18]: 'tcp://127.0.0.1:38005'
the Base client checks for 'path' in : urlparse(uri2)
Out[27]: ParseResult(scheme='tcp', netloc='localhost:38005', path='', params='', query='', fragment='')
and throws an error because uri is a net link, not file.
even If I use socat to create a file link :
[stack@undercloud-0 ~]$ socat PIPE:/tmp/podman_tunnel TCP:127.0.0.1:38005
It still gives me an error becsause of permissions :
uri_via_socat='unix:/tmp/podman_tunnel'
In [34]: client = podman.Client(uri=uri_via_socat)
...:
~/tobiko/test/lib/python3.6/site-packages/varlink/client.py in open_unix()
510 s = socket.socket(socket.AF_UNIX)
511 s.setblocking(True)
--> 512 s.connect(address)
513 return s
514
ConnectionRefusedError: [Errno 111] Connection refused
This just works :
import podman
podman_client = podman.Client(uri='unix:/tmp/podman.sock', remote_uri='ssh://heat-admin@controller-0/run/podman/io.podman',identity_file='~/.ssh/id_rsa')
list(map(print, podman_client.images.list()))
[...]
{'id': 'c076fddbbcb3a1b7aa8765a51bb315938a9964849c5a09753b4f3596cddb7b87',
suggestion:
not to go through loops to make podman client use the netcat tunnel
and let it use it's native podman clients' ssh tunnel instead , thus reducing code vulnerability
podman.Client(uri='unix:/tmp/podman.sock', remote_uri='ssh://{}@{}/run/podman/io.podman'.format(ssh_client.connect_parameters['username'],ssh_client.host),identity_file='~/.ssh/id_rsa')
this works :
In [78]: list(map(print, podman_client.images.list()))
debug1: Connection to port -2 forwarding to /run/podman/io.podman port -2 requested.
debug1: channel 1: new [direct-streamlocal@openssh.com]
{'id': 'c076fddbbcb3a1b7aa8765a51bb315938a9964849c5a09753b4f3596cddb7b87',
lastly :
fix the list containers test in :
tobiko/tests/functional/podman/test_client.py
this will always return true , if the for loop
comes up with an empty list then there will nothing to fail this test on,
so we have to verify we get an actual container list first...
Change-Id: If069a640f0fc5251e5879cb2fd65115e299337f3
Introduces a new centos-7 unit test job:
tobiko-tox-py36-centos-7
This renames existing py38 unit test job:
tobiko-tox-py38 -> tobiko-tox-py38-centos-7
Change-Id: Ice1dc9e8d0f48598f2051c828b96205b8836272f
Below tox environment allows to verify if all binary packages required
by tobiko have been installed. It would print missing ones.
tox -e bindep
A job for this would be rendundant as upstread unit test jobs are
already executing bindep zuul base job that performs this verification
just after installing packages and running test cases.
Change-Id: Icf9e8bf00f798354da7cf4d816f68cd9ff89a55e
It adds missing RHEL repo (*-server-opt) before installing tobiko
binary deps (python3, python3-devel, etc):
This has been tested on below distros:
- RHEL 7.5 (provisioned by OSP-10)
- RHEL 7.7 (provisioned by OSP-13)
- CENTOS 7.7 (provisioned by Vagrant)
Change-Id: I5e632b7734ce2ac60b1f8d1070e439584e8b521a
Pass tobiko.conf via a dictionary where
sections are sub-dictionaries like below:
section-1:
option-1-1: value-1-1
option-1-2: value-1-2
section-2:
option-2-1: value-2-1
Dictionary is flattered to a list before being
consumed to update tobiko.conf file like below:
- section: section-1
option: option-1-1
value: value-1-1
- section: section-1
option: option-1-2
value: value-1-2
# etc.
Change-Id: I997a44de9ad4841197c8264a84039c034c823fe9
Design and implement the podman client module
These changes introduce:
- the podman module
- the podman requirement setup to python-podman version 1.6.0
- related unit tests
- related functional tests
Change-Id: I9f81d086d66812ff3e7c2493d68e6cedb7f7d9bd
Co-authored-by: pkomarov <pkomarov@redhat.com>
Last Nova has stopped supporting python versions smaller
than version 3.6. This is creating troubles to use
CentOS 7 with devstack because support for Python 3 and
CentOS 7 is still not merged
This has been required as below change is still not merged:
- https://review.opendev.org/688799/
Change-Id: Ia3a15b8fe2badbcb0831136a85eeddc7c65fb524
Last released python-subunit (version 1.3.0) has
can't generate xml report file when running on Python 3
We need XML report for downstream CI as Jenkins
parse them for viewing detailed test case results.
As we are dropping down Python 2 support we must
use master branch version of python-subunit package
to generate reports until bug fix is not released
under via Pip.
Required python-subunit change:
- 58c3d36426
Change-Id: I393855fbc81aad4d917e527a935bdb8ce6df13cb
* Restructure the role to move logic out of main tasks file.
* Use /usr/local as default prefix for python commands
as expected by DevStack
* Use 4 cores in Vagrant to compile python faster
Change-Id: I87024f4397649000d168a444ba091fef9671f8bd