some cleanup. VSA flag status changes. returned some files

This commit is contained in:
vladimir.p
2011-07-25 16:26:23 -07:00
parent 53d54234dd
commit c5c621bbe6
10 changed files with 33 additions and 34 deletions

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright (c) 2011 Zadara Storage Inc.
# Copyright (c) 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -18,10 +18,6 @@
# under the License.
"""Starter script for Nova VSA."""
import eventlet
eventlet.monkey_patch()
import gettext
import os
import sys

View File

@@ -378,20 +378,6 @@ DEFINE_integer('max_vcs_in_vsa', 32,
DEFINE_integer('vsa_part_size_gb', 100,
'default partition size for shared capacity')
DEFINE_string('vsa_status_creating', 'creating',
'VSA creating (not ready yet)')
DEFINE_string('vsa_status_launching', 'launching',
'Launching VCs (all BE volumes were created)')
DEFINE_string('vsa_status_created', 'created',
'VSA fully created and ready for use')
DEFINE_string('vsa_status_partial', 'partial',
'Some BE storage allocations failed')
DEFINE_string('vsa_status_failed', 'failed',
'Some BE storage allocations failed')
DEFINE_string('vsa_status_deleting', 'deleting',
'VSA started the deletion procedure')
# The service to use for image search and retrieval
DEFINE_string('image_service', 'nova.image.glance.GlanceImageService',
'The service to use for retrieving and searching for images.')

View File

@@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Zadara Storage Inc.
# Copyright (c) 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -24,6 +25,7 @@ from nova import rpc
from nova import db
from nova import flags
from nova import utils
from nova.vsa.api import VsaState
from nova.volume import api as volume_api
from nova.scheduler import driver
from nova.scheduler import simple
@@ -301,7 +303,7 @@ class VsaScheduler(simple.SimpleScheduler):
except:
if vsa_id:
db.vsa_update(context, vsa_id,
dict(status=FLAGS.vsa_status_failed))
dict(status=VsaState.FAILED))
for vol in volume_params:
if 'capabilities' in vol:
@@ -346,7 +348,7 @@ class VsaScheduler(simple.SimpleScheduler):
except:
if volume_ref['to_vsa_id']:
db.vsa_update(context, volume_ref['to_vsa_id'],
dict(status=FLAGS.vsa_status_failed))
dict(status=VsaState.FAILED))
raise
#return super(VsaScheduler, self).schedule_create_volume(context,
# volume_id, *_args, **_kwargs)

View File

@@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Zadara Storage Inc.
# Copyright (c) 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Zadara Storage Inc.
# Copyright (c) 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Zadara Storage Inc.
# Copyright (c) 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -19,12 +20,10 @@
Handles all requests relating to Virtual Storage Arrays (VSAs).
"""
#import datetime
import sys
import base64
from xml.etree import ElementTree
from xml.etree.ElementTree import Element, SubElement
from nova import db
from nova import exception
@@ -47,6 +46,15 @@ flags.DEFINE_boolean('vsa_multi_vol_creation', True,
LOG = logging.getLogger('nova.vsa')
class VsaState:
CREATING = 'creating' # VSA creating (not ready yet)
LAUNCHING = 'launching' # Launching VCs (all BE volumes were created)
CREATED = 'created' # VSA fully created and ready for use
PARTIAL = 'partial' # Some BE storage allocations failed
FAILED = 'failed' # Some BE storage allocations failed
DELETING = 'deleting' # VSA started the deletion procedure
class API(base.Base):
"""API for interacting with the VSA manager."""
@@ -160,7 +168,7 @@ class API(base.Base):
'instance_type_id': instance_type['id'],
'image_ref': vc_image_href,
'vc_count': vc_count,
'status': FLAGS.vsa_status_creating,
'status': VsaState.CREATING,
}
LOG.info(_("Creating VSA: %s") % options)
@@ -178,7 +186,7 @@ class API(base.Base):
storage, shared)
except exception.ApiError:
self.update_vsa_status(context, vsa_id,
status=FLAGS.vsa_status_failed)
status=VsaState.FAILED)
raise
# after creating DB entry, re-check and set some defaults
@@ -227,7 +235,7 @@ class API(base.Base):
availability_zone=availability_zone)
except:
self.update_vsa_status(context, vsa_id,
status=FLAGS.vsa_status_partial)
status=VsaState.PARTIAL)
raise
if len(volume_params) == 0:
@@ -369,7 +377,9 @@ class API(base.Base):
return self.db.vsa_get_all_by_project(context, context.project_id)
def generate_user_data(self, context, vsa, volumes):
e_vsa = Element("vsa")
SubElement = ElementTree.SubElement
e_vsa = ElementTree.Element("vsa")
e_vsa_detail = SubElement(e_vsa, "id")
e_vsa_detail.text = str(vsa['id'])

View File

@@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Zadara Storage Inc.
# Copyright (c) 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Zadara Storage Inc.
# Copyright (c) 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Zadara Storage Inc.
# Copyright (c) 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Zadara Storage Inc.
# Copyright (c) 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -30,6 +31,7 @@ from nova import exception
from nova import compute
from nova import volume
from nova import vsa
from nova.vsa.api import VsaState
from nova.compute import instance_types
@@ -114,9 +116,9 @@ class VsaManager(manager.SchedulerDependentManager):
"""Start VCs for VSA """
vsa_id = vsa['id']
if vsa['status'] == FLAGS.vsa_status_creating:
if vsa['status'] == VsaState.CREATING:
self.vsa_api.update_vsa_status(context, vsa_id,
FLAGS.vsa_status_launching)
VsaState.LAUNCHING)
else:
return
@@ -144,8 +146,7 @@ class VsaManager(manager.SchedulerDependentManager):
if has_failed_volumes:
LOG.info(_("VSA ID %(vsa_id)d: Delete all BE volumes"), locals())
self.vsa_api.delete_be_volumes(context, vsa_id, force_delete=True)
self.vsa_api.update_vsa_status(context, vsa_id,
FLAGS.vsa_status_failed)
self.vsa_api.update_vsa_status(context, vsa_id, VsaState.FAILED)
return
# create user-data record for VC
@@ -170,5 +171,4 @@ class VsaManager(manager.SchedulerDependentManager):
user_data=storage_data,
vsa_id=vsa_id)
self.vsa_api.update_vsa_status(context, vsa_id,
FLAGS.vsa_status_created)
self.vsa_api.update_vsa_status(context, vsa_id, VsaState.CREATED)