cannot assume default admin tenant will be named 'admin'. Get default admin tenant name from controller instance
diff --git a/xos/openstack/driver.py b/xos/openstack/driver.py
index 02d49f9..15668b9 100644
--- a/xos/openstack/driver.py
+++ b/xos/openstack/driver.py
@@ -45,6 +45,8 @@
def admin_driver(self, tenant=None, controller=None):
if isinstance(controller, int):
controller = Controller.objects.get(id=controller.id)
+ if not tenant:
+ tenant = controller.admin_tenant
client = OpenStackClient(tenant=tenant, controller=controller, cacert=self.config.nova_ca_ssl_cert)
driver = OpenStackDriver(client=client)
driver.admin_user = client.keystone.users.find(name=controller.admin_user)
diff --git a/xos/openstack_observer/steps/sync_ports.py b/xos/openstack_observer/steps/sync_ports.py
index 18e0d00..6b1be57 100644
--- a/xos/openstack_observer/steps/sync_ports.py
+++ b/xos/openstack_observer/steps/sync_ports.py
@@ -50,7 +50,7 @@
logger.info("controller %s has no admin_tenant" % controller)
continue
try:
- driver = self.driver.admin_driver(controller = controller,tenant='admin')
+ driver = self.driver.admin_driver(controller = controller)
ports = driver.shell.quantum.list_ports()["ports"]
except:
logger.log_exc("failed to get ports from controller %s" % controller)