cloudpulse support for podman

Change-Id: I3023dbd5a0070bff67562a717638202f2a3fd07a
This commit is contained in:
jjmccann-cisco 2021-01-29 10:05:57 -05:00
parent 9eb90a8678
commit e04a8e2206
1 changed files with 22 additions and 10 deletions

View File

@ -34,6 +34,10 @@ TESTS_OPTS = [
cfg.BoolOpt('containerized',
default=True,
help='enable if the processes are running as containers'),
cfg.StrOpt('container_type',
default='docker',
choices=['docker', 'podman'],
help='container type'),
cfg.StrOpt('rabbit_container',
default='rabbitmq',
help='name of the rabitmq container'),
@ -102,8 +106,9 @@ def execute(command):
return {'status': p.returncode, 'output': stdout.decode('utf-8')}
def get_container_name(name):
cmd = "ansible -o all -i 127.0.0.1, -a 'docker ps' -u root"
def get_container_name(name, container_command='docker'):
cmd = ("ansible -o all -i 127.0.0.1, -a '%s ps' -u root"
% container_command)
op = execute(cmd)
if op['status']:
return None
@ -141,6 +146,7 @@ class operator_scenario(base.Scenario):
def load(self):
self.os_node_info_obj = openstack_node_info_reader(
cfg.CONF.operator_test.operator_setup_file)
self.container_command = cfg.CONF.operator_test.container_type
@base.scenario(admin_only=False, operator=True)
def rabbitmq_check(self):
@ -150,8 +156,10 @@ class operator_scenario(base.Scenario):
is_containerized = cfg.CONF.operator_test.containerized
if is_containerized:
rabbit_container = get_container_name('rabbitmq')
cmd = ("'docker exec %s %s'" % (rabbit_container, cmd))
rabbit_container = get_container_name('rabbitmq',
self.container_command)
cmd = ("'%s exec %s %s'"
% (self.container_command, rabbit_container, cmd))
cmd = anscmd + cmd + " -u root "
@ -200,9 +208,11 @@ class operator_scenario(base.Scenario):
is_containerized = cfg.CONF.operator_test.containerized
if is_containerized:
galera_container = get_container_name('mariadb')
galera_container = get_container_name('mariadb',
self.container_command)
cmd = ("'docker exec %s %s'" % (galera_container, cmd))
cmd = ("'%s exec %s %s'"
% (self.container_command, galera_container, cmd))
cmd = anscmd + cmd + ' -u root'
res = execute(cmd)
@ -229,8 +239,8 @@ class operator_scenario(base.Scenario):
nodeip_list = [node.ip for node in node_list]
anscmd = "ansible -o all -i %s -a " % ','.join(nodeip_list)
cmd = "'docker ps -a --format \{\{.Names\}\} --filter %s '" \
% "status=exited"
cmd = ("'%s ps -a --format \{\{.Names\}\} --filter %s '"
% (self.container_command, "status=exited"))
cmd = anscmd + cmd + ' -u root'
res = execute(cmd)
@ -305,8 +315,10 @@ class operator_scenario(base.Scenario):
cmd = (r"ceph -f json status")
is_containerized = cfg.CONF.operator_test.containerized
if is_containerized:
ceph_container = get_container_name("cephmon")
cmd = ("'docker exec %s %s'" % (ceph_container, cmd))
ceph_container = get_container_name("cephmon",
self.container_command)
cmd = ("'%s exec %s %s'"
% (self.container_command, ceph_container, cmd))
anscmd = "ansible -o all -i 127.0.0.1, -a "
cmd = anscmd + cmd + ' -u root'