Permalink
Browse files

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
  • Loading branch information...
1 parent e164f3f commit eb03d47fecd3bfc24243da29ee01679b334a08fe @vishvananda vishvananda committed Sep 23, 2011
View
@@ -12,6 +12,7 @@ Anthony Young <sleepsonthefloor@gmail.com>
Antony Messerli <ant@openstack.org>
Armando Migliaccio <Armando.Migliaccio@eu.citrix.com>
Arvind Somya <asomya@cisco.com>
+Ben McGraw <ben@pistoncloud.com>
Bilal Akhtar <bilalakhtar@ubuntu.com>
Brad Hall <brad@nicira.com>
Brad McConnell <bmcconne@rackspace.com>
View
@@ -962,9 +962,8 @@ class VmCommands(object):
msg = _('Only KVM and QEmu are supported for now. Sorry!')
raise exception.Error(msg)
- if (FLAGS.volume_driver != 'nova.volume.driver.AOEDriver' and \
- FLAGS.volume_driver != 'nova.volume.driver.ISCSIDriver'):
- msg = _("Support only AOEDriver and ISCSIDriver. Sorry!")
+ if FLAGS.volume_driver != 'nova.volume.driver.ISCSIDriver':
+ msg = _("Support only ISCSIDriver. Sorry!")
raise exception.Error(msg)
rpc.call(ctxt,
View
0 bin/nova-spoolsentry 100644 → 100755
No changes.
@@ -73,7 +73,6 @@ External unix tools that are required:
* dnsmasq
* vlan
* open-iscsi and iscsitarget (if you use iscsi volumes)
-* aoetools and vblade-persist (if you use aoe-volumes)
Nova uses cutting-edge versions of many packages. There are ubuntu packages in
the nova-core trunk ppa. You can use add this ppa to your sources list on an
View
@@ -37,7 +37,6 @@
from nova.compute import power_state
from nova.compute import task_states
from nova.compute import vm_states
-from nova.compute.utils import terminate_volumes
from nova.scheduler import api as scheduler_api
from nova.db import base
@@ -790,7 +789,6 @@ def soft_delete(self, context, instance_id):
else:
LOG.warning(_("No host for instance %s, deleting immediately"),
instance_id)
- terminate_volumes(self.db, context, instance_id)
self.db.instance_destroy(context, instance_id)
def _delete(self, context, instance):
@@ -804,7 +802,6 @@ def _delete(self, context, instance):
self._cast_compute_message('terminate_instance', context,
instance['id'], host)
else:
- terminate_volumes(self.db, context, instance['id'])
self.db.instance_destroy(context, instance['id'])
@scheduler_api.reroute_compute("delete")
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,29 +0,0 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright (c) 2011 VA Linux Systems Japan K.K
-# Copyright (c) 2011 Isaku Yamahata
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from nova import volume
-
-
-def terminate_volumes(db, context, instance_id):
- """delete volumes of delete_on_termination=True in block device mapping"""
- volume_api = volume.API()
- for bdm in db.block_device_mapping_get_all_by_instance(context,
- instance_id):
- #LOG.debug(_("terminating bdm %s") % bdm)
- if bdm['volume_id'] and bdm['delete_on_termination']:
- volume_api.delete(context, bdm['volume_id'])
- db.block_device_mapping_destroy(context, bdm['id'])
View
@@ -56,18 +56,13 @@
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)
View
@@ -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()
@@ -0,0 +1,51 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2011 University of Southern California
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer
+from sqlalchemy import MetaData, String, Table
+from nova import log as logging
+
+meta = MetaData()
+
+# Table definition
+export_devices = Table('export_devices', meta,
+ Column('created_at', DateTime(timezone=False)),
+ Column('updated_at', DateTime(timezone=False)),
+ Column('deleted_at', DateTime(timezone=False)),
+ Column('deleted', Boolean(create_constraint=True, name=None)),
+ Column('id', Integer(), primary_key=True, nullable=False),
+ Column('shelf_id', Integer()),
+ Column('blade_id', Integer()),
+ Column('volume_id',
+ Integer(),
+ ForeignKey('volumes.id'),
+ nullable=True),
+ )
+
+
+def downgrade(migrate_engine):
+ meta.bind = migrate_engine
+ try:
+ export_devices.create()
+ except Exception:
+ logging.info(repr(export_devices))
+ logging.exception('Exception while creating table')
+ raise
+
+
+def upgrade(migrate_engine):
+ meta.bind = migrate_engine
+ export_devices.drop()
@@ -0,0 +1,35 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2011 OpenStack LLC.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.from sqlalchemy import *
+
+from sqlalchemy import Column, MetaData, Table, Text
+
+
+meta = MetaData()
+
+new_column = Column('connection_info', Text())
+
+
+def upgrade(migrate_engine):
+ meta.bind = migrate_engine
+ table = Table('block_device_mapping', meta, autoload=True)
+ table.create_column(new_column)
+
+
+def downgrade(migrate_engine):
+ meta.bind = migrate_engine
+ table = Table('block_device_mapping', meta, autoload=True)
+ table.c.connection_info.drop()
@@ -470,21 +470,7 @@ class BlockDeviceMapping(BASE, NovaBase):
# for no device to suppress devices.
no_device = Column(Boolean, nullable=True)
-
-class ExportDevice(BASE, NovaBase):
- """Represates a shelf and blade that a volume can be exported on."""
- __tablename__ = 'export_devices'
- __table_args__ = (schema.UniqueConstraint("shelf_id", "blade_id"),
- {'mysql_engine': 'InnoDB'})
- id = Column(Integer, primary_key=True)
- shelf_id = Column(Integer)
- blade_id = Column(Integer)
- volume_id = Column(Integer, ForeignKey('volumes.id'), nullable=True)
- volume = relationship(Volume,
- backref=backref('export_device', uselist=False),
- foreign_keys=volume_id,
- primaryjoin='and_(ExportDevice.volume_id==Volume.id,'
- 'ExportDevice.deleted==False)')
+ connection_info = Column(Text, nullable=True)
class IscsiTarget(BASE, NovaBase):
View
@@ -394,10 +394,6 @@ class VolumeIsBusy(Error):
message = _("deleting volume %(volume_name)s that has snapshot")
-class ExportDeviceNotFoundForVolume(NotFound):
- message = _("No export device found for volume %(volume_id)s.")
-
-
class ISCSITargetNotFoundForVolume(NotFound):
message = _("No target id found for volume %(volume_id)s.")
@@ -406,6 +402,10 @@ class DiskNotFound(NotFound):
message = _("No disk at %(location)s")
+class VolumeDriverNotFound(NotFound):
+ message = _("Could not find a handler for %(driver_type)s volume.")
+
+
class InvalidImageRef(Invalid):
message = _("Invalid image href %(image_href)s.")
Oops, something went wrong.

0 comments on commit eb03d47

Please sign in to comment.