Move vpn_image_id to pipelib

Apart from checking whether a given image is the cloudpipe image, the
vpn_image_id option is only used within pipelib itself.

Add a is_vpn_image() helper method and move the option into pipelib.
Some rejiggering of how pipelib imports ec2 opts is required to avoid
circular imports.

blueprint: scope-config-opts
Change-Id: Ie984b2bb81681c24d3cee803082960083992a535
This commit is contained in:
Mark McLoughlin
2013-01-08 08:13:12 +00:00
parent 41ef13a34c
commit 39a46f48bf
8 changed files with 35 additions and 25 deletions

View File

@@ -31,7 +31,6 @@ from nova.openstack.common import timeutils
from nova import utils
CONF = cfg.CONF
CONF.import_opt('vpn_image_id', 'nova.config')
LOG = logging.getLogger(__name__)
authorize = extensions.extension_authorizer('compute', 'cloudpipe')
@@ -77,7 +76,7 @@ class CloudpipeController(object):
instances = self.compute_api.get_all(context,
search_opts={'deleted': False})
return [instance for instance in instances
if instance['image_ref'] == str(CONF.vpn_image_id)
if pipelib.is_vpn_image(instance['image_ref'])
and instance['vm_state'] != vm_states.DELETED]
def _get_cloudpipe_for_project(self, context, project_id):