Remove AoE, Clean up volume code

* Removes Ata Over Ethernet
 * Adds drivers to libvirt for volumes
 * Adds initialize_connection and terminate_connection to volume api
 * Passes connection info back through volume api

Change-Id: I1b1626f40bebe8466ab410fb174683293c7c474f
This commit is contained in:
Vishvananda Ishaya 2011-09-23 09:22:32 -07:00
parent ab0ef769e2
commit 427ce26919
2 changed files with 6 additions and 90 deletions
nova/db
api.py
sqlalchemy

@ -56,18 +56,13 @@ IMPL = utils.LazyPluggable(FLAGS['db_backend'],
sqlalchemy='nova.db.sqlalchemy.api')
class NoMoreBlades(exception.Error):
"""No more available blades."""
pass
class NoMoreNetworks(exception.Error):
"""No more available networks."""
pass
class NoMoreTargets(exception.Error):
"""No more available blades"""
"""No more available targets"""
pass
@ -814,25 +809,6 @@ def queue_get_for(context, topic, physical_node_id):
###################
def export_device_count(context):
"""Return count of export devices."""
return IMPL.export_device_count(context)
def export_device_create_safe(context, values):
"""Create an export_device from the values dictionary.
The device is not returned. If the create violates the unique
constraints because the shelf_id and blade_id already exist,
no exception is raised.
"""
return IMPL.export_device_create_safe(context, values)
###################
def iscsi_target_count_by_host(context, host):
"""Return count of export devices."""
return IMPL.iscsi_target_count_by_host(context, host)
@ -908,11 +884,6 @@ def quota_destroy_all_by_project(context, project_id):
###################
def volume_allocate_shelf_and_blade(context, volume_id):
"""Atomically allocate a free shelf and blade from the pool."""
return IMPL.volume_allocate_shelf_and_blade(context, volume_id)
def volume_allocate_iscsi_target(context, volume_id, host):
"""Atomically allocate a free iscsi_target from the pool."""
return IMPL.volume_allocate_iscsi_target(context, volume_id, host)
@ -978,11 +949,6 @@ def volume_get_instance(context, volume_id):
return IMPL.volume_get_instance(context, volume_id)
def volume_get_shelf_and_blade(context, volume_id):
"""Get the shelf and blade allocated to the volume."""
return IMPL.volume_get_shelf_and_blade(context, volume_id)
def volume_get_iscsi_target_num(context, volume_id):
"""Get the target num (tid) allocated to the volume."""
return IMPL.volume_get_iscsi_target_num(context, volume_id)

@ -1164,6 +1164,11 @@ def instance_destroy(context, instance_id):
update({'deleted': True,
'deleted_at': utils.utcnow(),
'updated_at': literal_column('updated_at')})
session.query(models.BlockDeviceMapping).\
filter_by(instance_id=instance_id).\
update({'deleted': True,
'deleted_at': utils.utcnow(),
'updated_at': literal_column('updated_at')})
@require_context
@ -2002,28 +2007,6 @@ def queue_get_for(_context, topic, physical_node_id):
###################
@require_admin_context
def export_device_count(context):
session = get_session()
return session.query(models.ExportDevice).\
filter_by(deleted=can_read_deleted(context)).\
count()
@require_admin_context
def export_device_create_safe(context, values):
export_device_ref = models.ExportDevice()
export_device_ref.update(values)
try:
export_device_ref.save()
return export_device_ref
except IntegrityError:
return None
###################
@require_admin_context
def iscsi_target_count_by_host(context, host):
session = get_session()
@ -2159,24 +2142,6 @@ def quota_destroy_all_by_project(context, project_id):
###################
@require_admin_context
def volume_allocate_shelf_and_blade(context, volume_id):
session = get_session()
with session.begin():
export_device = session.query(models.ExportDevice).\
filter_by(volume=None).\
filter_by(deleted=False).\
with_lockmode('update').\
first()
# NOTE(vish): if with_lockmode isn't supported, as in sqlite,
# then this has concurrency issues
if not export_device:
raise db.NoMoreBlades()
export_device.volume_id = volume_id
session.add(export_device)
return (export_device.shelf_id, export_device.blade_id)
@require_admin_context
def volume_allocate_iscsi_target(context, volume_id, host):
session = get_session()
@ -2243,9 +2208,6 @@ def volume_destroy(context, volume_id):
update({'deleted': True,
'deleted_at': utils.utcnow(),
'updated_at': literal_column('updated_at')})
session.query(models.ExportDevice).\
filter_by(volume_id=volume_id).\
update({'volume_id': None})
session.query(models.IscsiTarget).\
filter_by(volume_id=volume_id).\
update({'volume_id': None})
@ -2364,18 +2326,6 @@ def volume_get_instance(context, volume_id):
return result.instance
@require_admin_context
def volume_get_shelf_and_blade(context, volume_id):
session = get_session()
result = session.query(models.ExportDevice).\
filter_by(volume_id=volume_id).\
first()
if not result:
raise exception.ExportDeviceNotFoundForVolume(volume_id=volume_id)
return (result.shelf_id, result.blade_id)
@require_admin_context
def volume_get_iscsi_target_num(context, volume_id):
session = get_session()