cleared all unresolved references
This commit is contained in:
@@ -40,6 +40,9 @@ class OCCIRegistry(occi_registry.NonePersistentRegistry):
|
|||||||
self.transient = {}
|
self.transient = {}
|
||||||
|
|
||||||
def set_hostname(self, hostname):
|
def set_hostname(self, hostname):
|
||||||
|
"""
|
||||||
|
Set the hostname.
|
||||||
|
"""
|
||||||
if FLAGS.occi_custom_location_hostname:
|
if FLAGS.occi_custom_location_hostname:
|
||||||
hostname = FLAGS.occi_custom_location_hostname
|
hostname = FLAGS.occi_custom_location_hostname
|
||||||
super(OCCIRegistry, self).set_hostname(hostname)
|
super(OCCIRegistry, self).set_hostname(hostname)
|
||||||
|
@@ -27,8 +27,8 @@ import logging
|
|||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import wsgi
|
from nova import wsgi
|
||||||
from nova import context
|
from nova import context
|
||||||
from nova import image
|
|
||||||
from nova import db
|
from nova import db
|
||||||
|
from nova.image import glance
|
||||||
from nova.compute import instance_types
|
from nova.compute import instance_types
|
||||||
from nova.network import api
|
from nova.network import api
|
||||||
from nova.openstack.common import cfg
|
from nova.openstack.common import cfg
|
||||||
@@ -68,7 +68,6 @@ OCCI_OPTS = [
|
|||||||
cfg.StrOpt("occi_custom_location_hostname",
|
cfg.StrOpt("occi_custom_location_hostname",
|
||||||
default=None,
|
default=None,
|
||||||
help="Override OCCI location hostname with custom value")
|
help="Override OCCI location hostname with custom value")
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
FLAGS = flags.FLAGS
|
FLAGS = flags.FLAGS
|
||||||
@@ -223,7 +222,7 @@ class OCCIApplication(occi_wsgi.Application, wsgi.Application):
|
|||||||
information retrieved from glance (shared and user-specific).
|
information retrieved from glance (shared and user-specific).
|
||||||
"""
|
"""
|
||||||
template_schema = 'http://schemas.openstack.org/template/os#'
|
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'])
|
images = image_service.detail(extras['nova_ctx'])
|
||||||
filter_kernel_and_ram_images = \
|
filter_kernel_and_ram_images = \
|
||||||
|
@@ -19,19 +19,18 @@
|
|||||||
Security related 'glue'
|
Security related 'glue'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
from nova import compute
|
from nova import compute
|
||||||
from nova import db
|
from nova import db
|
||||||
from nova import utils
|
|
||||||
from nova.flags import FLAGS
|
from nova.flags import FLAGS
|
||||||
|
from nova.openstack.common import importutils
|
||||||
|
|
||||||
# connect to nova
|
# connect to nova
|
||||||
from occi import exceptions
|
from occi import exceptions
|
||||||
|
|
||||||
COMPUTE_API = compute.API()
|
COMPUTE_API = compute.API()
|
||||||
|
|
||||||
SEC_HANDLER = utils.import_object(FLAGS.security_group_handler)
|
# SEC_HANDLER = utils.import_object(FLAGS.security_group_handler)
|
||||||
#SEC_HANDLER = importutils.import_object(FLAGS.security_group_handler)
|
SEC_HANDLER = importutils.import_object(FLAGS.security_group_handler)
|
||||||
|
|
||||||
|
|
||||||
def create_group(name, description, context):
|
def create_group(name, description, context):
|
||||||
|
@@ -109,8 +109,8 @@ def create_vm(entity, context):
|
|||||||
raise AttributeError('Please provide a valid OS Template.')
|
raise AttributeError('Please provide a valid OS Template.')
|
||||||
|
|
||||||
if resource_template:
|
if resource_template:
|
||||||
inst_type = compute.instance_types.get_instance_type_by_name\
|
inst_type = compute.instance_types.\
|
||||||
(resource_template.term)
|
get_instance_type_by_name(resource_template.term)
|
||||||
else:
|
else:
|
||||||
inst_type = compute.instance_types.get_default_instance_type()
|
inst_type = compute.instance_types.get_default_instance_type()
|
||||||
msg = ('No resource template was found in the request. '
|
msg = ('No resource template was found in the request. '
|
||||||
@@ -190,8 +190,6 @@ def resize_vm(uid, flavor_name, context):
|
|||||||
**kwargs)
|
**kwargs)
|
||||||
except exception.FlavorNotFound:
|
except exception.FlavorNotFound:
|
||||||
raise AttributeError('Unable to locate requested flavor.')
|
raise AttributeError('Unable to locate requested flavor.')
|
||||||
except exception.CannotResizeToSameSize:
|
|
||||||
raise AttributeError('Resize requires a change in size.')
|
|
||||||
except exception.InstanceInvalidState as error:
|
except exception.InstanceInvalidState as error:
|
||||||
raise error
|
raise error
|
||||||
#raise AttributeError('VM is in an invalid state.')
|
#raise AttributeError('VM is in an invalid state.')
|
||||||
@@ -387,8 +385,8 @@ def get_vnc(uid, context):
|
|||||||
instance = get_vm(uid, context)
|
instance = get_vm(uid, context)
|
||||||
try:
|
try:
|
||||||
console = COMPUTE_API.get_vnc_console(context, instance, 'novnc')
|
console = COMPUTE_API.get_vnc_console(context, instance, 'novnc')
|
||||||
except Exception as error:
|
except exception.ConsoleTypeInvalid:
|
||||||
LOG.warn('Console info is not available yet!')
|
LOG.warn('Console info is not availabl!')
|
||||||
return None
|
return None
|
||||||
return console
|
return console
|
||||||
|
|
||||||
@@ -461,8 +459,7 @@ def get_occi_state(uid, context):
|
|||||||
state = 'inactive'
|
state = 'inactive'
|
||||||
actions = []
|
actions = []
|
||||||
|
|
||||||
if instance['vm_state'] in [vm_states.ACTIVE,
|
if instance['vm_state'] in [vm_states.ACTIVE]:
|
||||||
vm_states.RESIZING]:
|
|
||||||
state = 'active'
|
state = 'active'
|
||||||
actions.append(infrastructure.STOP)
|
actions.append(infrastructure.STOP)
|
||||||
actions.append(infrastructure.SUSPEND)
|
actions.append(infrastructure.SUSPEND)
|
||||||
@@ -474,7 +471,7 @@ def get_occi_state(uid, context):
|
|||||||
state = 'inactive'
|
state = 'inactive'
|
||||||
actions.append(infrastructure.START)
|
actions.append(infrastructure.START)
|
||||||
elif instance['vm_state'] in [vm_states.RESCUED,
|
elif instance['vm_state'] in [vm_states.RESCUED,
|
||||||
vm_states.ERROR, vm_states.SOFT_DELETE,
|
vm_states.ERROR,
|
||||||
vm_states.DELETED]:
|
vm_states.DELETED]:
|
||||||
state = 'inactive'
|
state = 'inactive'
|
||||||
|
|
||||||
|
@@ -21,8 +21,9 @@ Storage related glue :-)
|
|||||||
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from nova import image, exception
|
from nova import exception
|
||||||
from nova import volume
|
from nova import volume
|
||||||
|
from nova.image import glance
|
||||||
|
|
||||||
from occi import exceptions
|
from occi import exceptions
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ from nova_glue import vm
|
|||||||
|
|
||||||
VOLUME_API = volume.API()
|
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):
|
def create_storage(size, context, name=None, description=None):
|
||||||
|
10
runme.py
10
runme.py
@@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# coding=utf-8
|
||||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# 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")):
|
if os.path.exists(os.path.join(TOPDIR, "nova", "__init__.py")):
|
||||||
sys.path.insert(0, TOPDIR)
|
sys.path.insert(0, TOPDIR)
|
||||||
|
|
||||||
|
|
||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import log as logging
|
|
||||||
from nova import service
|
from nova import service
|
||||||
from nova import utils
|
from nova import utils
|
||||||
|
from nova.openstack.common import log as logging
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
utils.default_flagfile()
|
flags.parse_args(sys.argv)
|
||||||
flags.FLAGS(sys.argv)
|
logging.setup("nova")
|
||||||
logging.setup()
|
|
||||||
utils.monkey_patch()
|
utils.monkey_patch()
|
||||||
SERVER = service.WSGIService('occiapi')
|
SERVER = service.WSGIService('occiapi')
|
||||||
service.serve(SERVER)
|
service.serve(SERVER)
|
||||||
|
@@ -173,6 +173,9 @@ class SystemTest(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
"""
|
||||||
|
Setup the test.
|
||||||
|
"""
|
||||||
# Get a security token:
|
# Get a security token:
|
||||||
self.token = get_os_token('admin', 'os4all')
|
self.token = get_os_token('admin', 'os4all')
|
||||||
LOG.info('security token is: ' + self.token)
|
LOG.info('security token is: ' + self.token)
|
||||||
|
Reference in New Issue
Block a user