summaryrefslogtreecommitdiffstats
path: root/doctor_tests/installer/common
diff options
context:
space:
mode:
authorTomi Juvonen <tomi.juvonen@nokia.com>2018-11-28 11:48:27 +0200
committerTomi Juvonen <tomi.juvonen@nokia.com>2018-12-18 12:40:53 +0200
commite6708c869855ab69f9b53959befd82bb2f32f9ad (patch)
tree549f91d138d0dc796047fbefa70ceef1d467b5f8 /doctor_tests/installer/common
parente1c5dd0158d5168738fcc9918d24c04ca724b056 (diff)
Bug - Testing in Apex with OpenStack master fails
Support yet another path to find config files. Tune config changes to take effect properly for maintenance. transport_url parcing enhanced. Nova reset state to error takes well over 1 second these days and at the end it then sends notification that we use. Only reasonable thing is to send notification straight from the Inspector as it should have been done in the first place. Now we can do 200ms as total time, with just a few millisends actuallly spent on sending the notification. Further one could improve this by having node specific Inspector agent to react even in more Telco grade speed. Change-Id: I787f8e9dd6484842c6c568b15767018d11b36862 Signed-off-by: Tomi Juvonen <tomi.juvonen@nokia.com>
Diffstat (limited to 'doctor_tests/installer/common')
-rw-r--r--doctor_tests/installer/common/restore_compute_config.py22
-rw-r--r--doctor_tests/installer/common/set_compute_config.py30
2 files changed, 19 insertions, 33 deletions
diff --git a/doctor_tests/installer/common/restore_compute_config.py b/doctor_tests/installer/common/restore_compute_config.py
index 0e9939fd..82e10a66 100644
--- a/doctor_tests/installer/common/restore_compute_config.py
+++ b/doctor_tests/installer/common/restore_compute_config.py
@@ -11,18 +11,16 @@ import shutil
def restore_cpu_allocation_ratio():
- nova_base = "/var/lib/config-data/puppet-generated/nova"
- if not os.path.isdir(nova_base):
- nova_base = ""
- nova_file = nova_base + '/etc/nova/nova.conf'
- nova_file_bak = nova_base + '/etc/nova/nova.bak'
-
- if not os.path.isfile(nova_file_bak):
- print('Bak_file:%s does not exist.' % nova_file_bak)
- else:
- print('restore: %s' % nova_file)
- shutil.copyfile(nova_file_bak, nova_file)
- os.remove(nova_file_bak)
+ for nova_file_bak in ["/var/lib/config-data/puppet-generated/nova_libvirt/etc/nova/nova.bak", # noqa
+ "/var/lib/config-data/puppet-generated/nova/etc/nova/nova.bak", # noqa
+ "/etc/nova/nova.bak"]:
+ if os.path.isfile(nova_file_bak):
+ nova_file = nova_file_bak.replace(".bak", ".conf")
+ print('restoring nova.bak.')
+ shutil.copyfile(nova_file_bak, nova_file)
+ os.remove(nova_file_bak)
+ return
+ print('nova.bak does not exist.')
return
restore_cpu_allocation_ratio()
diff --git a/doctor_tests/installer/common/set_compute_config.py b/doctor_tests/installer/common/set_compute_config.py
index 86266085..76ac649b 100644
--- a/doctor_tests/installer/common/set_compute_config.py
+++ b/doctor_tests/installer/common/set_compute_config.py
@@ -10,29 +10,17 @@ import os
import shutil
-def make_initial_config(service, dest):
- for mk in ["", "/etc", "/%s" % service]:
- dest += mk
- os.mkdir(dest)
- src = "/etc/%s/%s.conf" % (service, service)
- dest += "/%s.conf" % service
- shutil.copyfile(src, dest)
-
-
def set_cpu_allocation_ratio():
- docker_conf_base_dir = "/var/lib/config-data/puppet-generated"
- if not os.path.isdir(docker_conf_base_dir):
- nova_base = ""
- else:
- nova_base = "%s/nova" % docker_conf_base_dir
- if not os.path.isdir(nova_base):
- # nova.conf to be used might not exist
- make_initial_config("nova", nova_base)
- nova_file = nova_base + '/etc/nova/nova.conf'
- nova_file_bak = nova_base + '/etc/nova/nova.bak'
+ nova_file_bak = None
+ for nova_file in ["/var/lib/config-data/puppet-generated/nova_libvirt/etc/nova/nova.conf", # noqa
+ "/var/lib/config-data/puppet-generated/nova/etc/nova/nova.conf", # noqa
+ "/etc/nova/nova.conf"]:
+ if os.path.isfile(nova_file):
+ nova_file_bak = nova_file.replace(".conf", ".bak")
+ break
- if not os.path.isfile(nova_file):
- raise Exception("File doesn't exist: %s." % nova_file)
+ if nova_file_bak is None:
+ raise Exception("Could not find nova.conf")
# TODO (tojuvone): Unfortunately ConfigParser did not produce working conf
fcheck = open(nova_file)
found_list = ([ca for ca in fcheck.readlines() if "cpu_allocation_ratio"