skip unreachable/misconfigured deployments in sync_nodes
diff --git a/planetstack/openstack_observer/steps/sync_nodes.py b/planetstack/openstack_observer/steps/sync_nodes.py
index 740b5e1..d648b7d 100644
--- a/planetstack/openstack_observer/steps/sync_nodes.py
+++ b/planetstack/openstack_observer/steps/sync_nodes.py
@@ -1,12 +1,15 @@
import os
import base64
import random
-from datetime import datetime
+from datetime import datetime
from django.db.models import F, Q
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models.node import Node
from core.models.site import Site, Deployment
+from util.logger import Logger, logging
+
+logger = Logger(level=logging.INFO)
class SyncNodes(OpenStackSyncStep):
provides=[Node]
@@ -23,12 +26,17 @@
nodes = Node.objects.all()
node_hostnames = [node.name for node in nodes]
- # fetch all nodes from each deployment
+ # fetch all nodes from each deployment
deployments = Deployment.objects.all()
new_nodes = []
for deployment in deployments:
- driver = self.driver.admin_driver(deployment=deployment.name)
- compute_nodes = driver.shell.nova.hypervisors.list()
+ try:
+ driver = self.driver.admin_driver(deployment=deployment.name)
+ compute_nodes = driver.shell.nova.hypervisors.list()
+ except:
+ logger.log_exc("Failed to get nodes from deployment %s" % str(deployment))
+ continue
+
for compute_node in compute_nodes:
if compute_node.hypervisor_hostname not in node_hostnames:
# XX TODO:figure out how to correctly identify a node's site.