DevStack support
[doctor.git] / doctor_tests / installer / common / set_compute_config.py
index 07db1e1..615f189 100644 (file)
@@ -11,19 +11,24 @@ import shutil
 
 
 def set_cpu_allocation_ratio():
-    nova_file = '/etc/nova/nova.conf'
-    nova_file_bak = '/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"
                   in ca])
     fcheck.close()
+    change = False
+    found = False
     if found_list and len(found_list):
-        change = False
-        found = False
         for car in found_list:
             if car.startswith('#'):
                 continue