From c507ab55e0fa05b50466fd75398e9d34d26e2c2f Mon Sep 17 00:00:00 2001 From: Andrew Lazarev Date: Fri, 25 Jul 2014 18:23:59 -0700 Subject: [PATCH] Removed extra work in case of no volumes Before the change the following actions were performed even if there are no volumes to attach: 1. thread spawn 2. roundtrip to instance to make sure that there are 0 volumes attached 3. roundtrip to nova to get assigned volumes Change-Id: I3f120cb5e60b2c8b2439c7f4acc7b99ce4964895 --- sahara/service/volumes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sahara/service/volumes.py b/sahara/service/volumes.py index 8088e2c1..a18ad9ad 100644 --- a/sahara/service/volumes.py +++ b/sahara/service/volumes.py @@ -40,8 +40,10 @@ CONF.register_opt(detach_timeout_opt) def attach_to_instances(instances): with context.ThreadGroup() as tg: for instance in instances: - tg.spawn('attach-volumes-for-instance-%s' % instance.instance_name, - _attach_volumes_to_node, instance.node_group, instance) + if instance.node_group.volumes_per_node > 0: + tg.spawn( + 'attach-volumes-for-instance-%s' % instance.instance_name, + _attach_volumes_to_node, instance.node_group, instance) def _await_attach_volumes(instance, devices):