cleared all unresolved references

This commit is contained in:
Thijs Metsch 2012-10-08 15:08:53 +02:00
parent d5f562e934
commit e719f92b6b
7 changed files with 28 additions and 26 deletions

View File

@ -40,6 +40,9 @@ class OCCIRegistry(occi_registry.NonePersistentRegistry):
self.transient = {}
def set_hostname(self, hostname):
"""
Set the hostname.
"""
if FLAGS.occi_custom_location_hostname:
hostname = FLAGS.occi_custom_location_hostname
super(OCCIRegistry, self).set_hostname(hostname)
@ -95,7 +98,7 @@ class OCCIRegistry(occi_registry.NonePersistentRegistry):
"""
# TODO: move to pyssf!
if self.resources[key].extras is not None and self.resources[key]\
.extras != self.get_extras(extras):
.extras != self.get_extras(extras):
raise KeyError
return self.resources[key]

View File

@ -27,8 +27,8 @@ import logging
from nova import flags
from nova import wsgi
from nova import context
from nova import image
from nova import db
from nova.image import glance
from nova.compute import instance_types
from nova.network import api
from nova.openstack.common import cfg
@ -66,9 +66,8 @@ OCCI_OPTS = [
default=8787,
help="Port OCCI interface will listen on."),
cfg.StrOpt("occi_custom_location_hostname",
default=None,
help="Override OCCI location hostname with custom value")
default=None,
help="Override OCCI location hostname with custom value")
]
FLAGS = flags.FLAGS
@ -223,7 +222,7 @@ class OCCIApplication(occi_wsgi.Application, wsgi.Application):
information retrieved from glance (shared and user-specific).
"""
template_schema = 'http://schemas.openstack.org/template/os#'
image_service = image.get_default_image_service()
image_service = glance.get_default_image_service()
images = image_service.detail(extras['nova_ctx'])
filter_kernel_and_ram_images = \

View File

@ -19,19 +19,18 @@
Security related 'glue'
"""
from nova import compute
from nova import db
from nova import utils
from nova.flags import FLAGS
from nova.openstack.common import importutils
# connect to nova
from occi import exceptions
COMPUTE_API = compute.API()
SEC_HANDLER = utils.import_object(FLAGS.security_group_handler)
#SEC_HANDLER = importutils.import_object(FLAGS.security_group_handler)
# SEC_HANDLER = utils.import_object(FLAGS.security_group_handler)
SEC_HANDLER = importutils.import_object(FLAGS.security_group_handler)
def create_group(name, description, context):

View File

@ -109,8 +109,8 @@ def create_vm(entity, context):
raise AttributeError('Please provide a valid OS Template.')
if resource_template:
inst_type = compute.instance_types.get_instance_type_by_name\
(resource_template.term)
inst_type = compute.instance_types.\
get_instance_type_by_name(resource_template.term)
else:
inst_type = compute.instance_types.get_default_instance_type()
msg = ('No resource template was found in the request. '
@ -190,8 +190,6 @@ def resize_vm(uid, flavor_name, context):
**kwargs)
except exception.FlavorNotFound:
raise AttributeError('Unable to locate requested flavor.')
except exception.CannotResizeToSameSize:
raise AttributeError('Resize requires a change in size.')
except exception.InstanceInvalidState as error:
raise error
#raise AttributeError('VM is in an invalid state.')
@ -387,8 +385,8 @@ def get_vnc(uid, context):
instance = get_vm(uid, context)
try:
console = COMPUTE_API.get_vnc_console(context, instance, 'novnc')
except Exception as error:
LOG.warn('Console info is not available yet!')
except exception.ConsoleTypeInvalid:
LOG.warn('Console info is not availabl!')
return None
return console
@ -461,8 +459,7 @@ def get_occi_state(uid, context):
state = 'inactive'
actions = []
if instance['vm_state'] in [vm_states.ACTIVE,
vm_states.RESIZING]:
if instance['vm_state'] in [vm_states.ACTIVE]:
state = 'active'
actions.append(infrastructure.STOP)
actions.append(infrastructure.SUSPEND)
@ -474,7 +471,7 @@ def get_occi_state(uid, context):
state = 'inactive'
actions.append(infrastructure.START)
elif instance['vm_state'] in [vm_states.RESCUED,
vm_states.ERROR, vm_states.SOFT_DELETE,
vm_states.ERROR,
vm_states.DELETED]:
state = 'inactive'

View File

@ -21,8 +21,9 @@ Storage related glue :-)
import random
from nova import image, exception
from nova import exception
from nova import volume
from nova.image import glance
from occi import exceptions
@ -31,7 +32,7 @@ from nova_glue import vm
VOLUME_API = volume.API()
IMAGE_API = image.get_default_image_service()
IMAGE_API = glance.get_default_image_service()
def create_storage(size, context, name=None, description=None):

View File

@ -1,4 +1,6 @@
#!/usr/bin/env python
# coding=utf-8
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Licensed under the Apache License, Version 2.0 (the "License");
@ -27,16 +29,14 @@ TOPDIR = os.path.normpath(os.path.join(os.path.abspath(
if os.path.exists(os.path.join(TOPDIR, "nova", "__init__.py")):
sys.path.insert(0, TOPDIR)
from nova import flags
from nova import log as logging
from nova import service
from nova import utils
from nova.openstack.common import log as logging
if __name__ == '__main__':
utils.default_flagfile()
flags.FLAGS(sys.argv)
logging.setup()
flags.parse_args(sys.argv)
logging.setup("nova")
utils.monkey_patch()
SERVER = service.WSGIService('occiapi')
service.serve(SERVER)

View File

@ -173,6 +173,9 @@ class SystemTest(unittest.TestCase):
def setUp(self):
"""
Setup the test.
"""
# Get a security token:
self.token = get_os_token('admin', 'os4all')
LOG.info('security token is: ' + self.token)