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 a719befe3e
commit c500eac458
22 changed files with 54 additions and 63 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

View File

1
nova/CA/projects/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*

View File

1
nova/CA/reqs/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*

View File

View File

@ -902,7 +902,6 @@ class CloudController(object):
image_name = kwargs.get('image_name')
availability_zone = kwargs.get('placement', {}).get(
'AvailabilityZone')
#storage = ast.literal_eval(kwargs.get('storage', '[]'))
storage = kwargs.get('storage', [])
shared = kwargs.get('shared', False)

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
@ -118,7 +119,6 @@ class DriveTypeController(object):
drive_types.delete(context, id)
except exception.NotFound:
return faults.Fault(exc.HTTPNotFound())
# return exc.HTTPAccepted()
class Drive_types(extensions.ExtensionDescriptor):

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
@ -153,7 +154,6 @@ class VsaController(object):
self.vsa_api.delete(context, vsa_id=id)
except exception.NotFound:
return faults.Fault(exc.HTTPNotFound())
# return exc.HTTPAccepted()
class VsaVolumeDriveController(volumes.VolumeController):
@ -193,6 +193,7 @@ class VsaVolumeDriveController(volumes.VolumeController):
d = translation(context, vol)
d['vsaId'] = vol[self.direction]
d['name'] = vol['name']
return d
def _check_volume_ownership(self, context, vsa_id, id):
@ -265,15 +266,17 @@ class VsaVolumeDriveController(volumes.VolumeController):
return faults.Fault(exc.HTTPBadRequest())
vol = body[self.object]
updatable_fields = ['display_name',
'display_description',
'status',
'provider_location',
'provider_auth']
updatable_fields = [{'displayName': 'display_name'},
{'displayDescription': 'display_description'},
{'status': 'status'},
{'providerLocation': 'provider_location'},
{'providerAuth': 'provider_auth'}]
changes = {}
for field in updatable_fields:
if field in vol:
changes[field] = vol[field]
key = field.keys()[0]
val = field[key]
if key in vol:
changes[val] = vol[key]
obj = self.object
LOG.audit(_("Update %(obj)s with id: %(id)s, changes: %(changes)s"),

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

@ -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

@ -234,6 +234,7 @@ def _get_default_volume_param():
'availability_zone': 'nova',
'created_at': None,
'attach_status': 'detached',
'name': 'vol name',
'display_name': 'Default vol name',
'display_description': 'Default vol description',
'from_vsa_id': None,
@ -386,7 +387,8 @@ class VSAVolumeApiTest(test.TestCase):
def test_vsa_volume_update(self):
obj_num = 234 if self.test_objs == "volumes" else 345
update = {"status": "available"}
update = {"status": "available",
"displayName": "Test Display name"}
body = {self.test_obj: update}
req = webob.Request.blank('/v1.1/zadr-vsa/123/%s/%s' % \
(self.test_objs, obj_num))

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

@ -507,15 +507,7 @@ class ISCSIDriver(VolumeDriver):
iscsi_properties = self._get_iscsi_properties(volume)
if not iscsi_properties['target_discovered']:
# zadara-begin: Bug in cactus. _run_iscsiadm() cannot accept
# multiple args for iscsi-command. Like in --op new. Hence
# using a local version here which does the same thing
(out, err) = self._execute('sudo', 'iscsiadm', '--op', 'new',
'-m', 'node',
'-T', iscsi_properties['target_iqn'],
'-p', iscsi_properties['target_portal'])
# self._run_iscsiadm(iscsi_properties, ('--op', 'new'))
# zadara-end
self._run_iscsiadm(iscsi_properties, ('--op', 'new'))
if iscsi_properties.get('auth_method'):
self._iscsiadm_update(iscsi_properties,
@ -567,15 +559,7 @@ class ISCSIDriver(VolumeDriver):
iscsi_properties = self._get_iscsi_properties(volume)
self._iscsiadm_update(iscsi_properties, "node.startup", "manual")
self._run_iscsiadm(iscsi_properties, "--logout")
# zadara-begin: Bug in cactus. _run_iscsiadm() cannot accept
# multiple args for iscsi-command. Like in --op delete. Hence
# using a local version here which does the same thing
(out, err) = self._execute('sudo', 'iscsiadm', '--op', 'delete',
'-m', 'node',
'-T', iscsi_properties['target_iqn'],
'-p', iscsi_properties['target_portal'])
#self._run_iscsiadm(iscsi_properties, ('--op', 'delete'))
# zadara-end
self._run_iscsiadm(iscsi_properties, ('--op', 'delete'))
def check_for_export(self, context, volume_id):
"""Make sure volume is exported."""
@ -916,6 +900,7 @@ class ZadaraBEDriver(ISCSIDriver):
ret = self._common_be_export(context, volume, iscsi_target)
except:
raise exception.ProcessExecutionError
return ret
def remove_export(self, context, volume):
"""Removes BE export for a volume."""

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)