Remove copypasted export_location field from snapshots
Field export_location in snapshots db table and models is leftover from Cinder, which should be removed. - Remove export_location field from share_snapshots table in manila_init migration - Create db migration which removes export_location field from share_snapshots in db - Remove usages of export_location in snapshots related code - Update functional and unit tests Change-Id: I7566e74479cd7474d5576edae0e21b6eca18c394
This commit is contained in:
parent
e7dbd4cbcf
commit
8a80f126d9
@ -322,7 +322,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
|
||||
|
||||
# verify keys
|
||||
expected_keys = ["status", "links", "share_id", "name",
|
||||
"export_location", "share_proto", "created_at",
|
||||
"share_proto", "created_at",
|
||||
"description", "id", "share_size"]
|
||||
actual_keys = get.keys()
|
||||
[self.assertIn(key, actual_keys) for key in expected_keys]
|
||||
@ -369,7 +369,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
|
||||
|
||||
# verify keys
|
||||
keys = ["status", "links", "share_id", "name",
|
||||
"export_location", "share_proto", "created_at",
|
||||
"share_proto", "created_at",
|
||||
"description", "id", "share_size"]
|
||||
[self.assertIn(key, sn.keys()) for sn in snaps for key in keys]
|
||||
|
||||
|
@ -66,7 +66,7 @@ class SharesNFSTest(base.BaseSharesTest):
|
||||
# create snapshot
|
||||
resp, snap = self.create_snapshot_wait_for_active(self.share["id"])
|
||||
self.assertIn(int(resp["status"]), self.HTTP_SUCCESS)
|
||||
detailed_elements = {'name', 'id', 'description', 'export_location',
|
||||
detailed_elements = {'name', 'id', 'description',
|
||||
'created_at', 'share_proto', 'size', 'share_size',
|
||||
'share_id', 'status', 'links'}
|
||||
self.assertTrue(detailed_elements.issubset(snap.keys()),
|
||||
|
@ -266,7 +266,7 @@ class SharesActionsTest(base.BaseSharesTest):
|
||||
|
||||
# verify keys
|
||||
expected_keys = ["status", "links", "share_id", "name",
|
||||
"export_location", "share_proto", "created_at",
|
||||
"share_proto", "created_at",
|
||||
"description", "id", "share_size"]
|
||||
actual_keys = get.keys()
|
||||
[self.assertIn(key, actual_keys) for key in expected_keys]
|
||||
@ -313,7 +313,7 @@ class SharesActionsTest(base.BaseSharesTest):
|
||||
|
||||
# verify keys
|
||||
keys = ["status", "links", "share_id", "name",
|
||||
"export_location", "share_proto", "created_at",
|
||||
"share_proto", "created_at",
|
||||
"description", "id", "share_size"]
|
||||
[self.assertIn(key, sn.keys()) for sn in snaps for key in keys]
|
||||
|
||||
|
@ -33,8 +33,7 @@ LOG = log.getLogger(__name__)
|
||||
|
||||
def make_snapshot(elem):
|
||||
attrs = ['id', 'size', 'status', 'name', 'description', 'share_proto',
|
||||
'export_location', 'links', 'share_id', 'created_at',
|
||||
'share_size']
|
||||
'links', 'share_id', 'created_at', 'share_size']
|
||||
for attr in attrs:
|
||||
elem.set(attr)
|
||||
|
||||
|
@ -52,7 +52,6 @@ class ViewBuilder(common.ViewBuilder):
|
||||
'description': snapshot.get('display_description'),
|
||||
'size': snapshot.get('size'),
|
||||
'share_proto': snapshot.get('share_proto'),
|
||||
'export_location': snapshot.get('export_location'),
|
||||
'links': self._get_links(request, snapshot['id'])
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
# Copyright 2015 Mirantis Inc.
|
||||
# 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.
|
||||
|
||||
"""Remove share_snapshots.export_location
|
||||
|
||||
Revision ID: 4ee2cf4be19a
|
||||
Revises: 17115072e1c3
|
||||
Create Date: 2015-02-26 11:11:55.734663
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4ee2cf4be19a'
|
||||
down_revision = '17115072e1c3'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sql
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.drop_column('share_snapshots', 'export_location')
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.add_column('share_snapshots',
|
||||
sql.Column('export_location', sql.String(255)))
|
@ -291,7 +291,6 @@ class ShareSnapshot(BASE, ManilaBase):
|
||||
display_description = Column(String(255))
|
||||
share_size = Column(Integer)
|
||||
share_proto = Column(String(255))
|
||||
export_location = Column(String(255))
|
||||
share = orm.relationship(Share, backref="snapshots",
|
||||
foreign_keys=share_id,
|
||||
primaryjoin='and_('
|
||||
|
@ -308,8 +308,7 @@ class API(base.Base):
|
||||
'share_size': share['size'],
|
||||
'display_name': name,
|
||||
'display_description': description,
|
||||
'share_proto': share['share_proto'],
|
||||
'export_location': share['export_location']}
|
||||
'share_proto': share['share_proto']}
|
||||
|
||||
try:
|
||||
snapshot = self.db.share_snapshot_create(context, options)
|
||||
|
@ -72,7 +72,6 @@ class ShareSnapshotApiTest(test.TestCase):
|
||||
'size': 1,
|
||||
'description': 'fake_share_description',
|
||||
'share_proto': 'fakesnapproto',
|
||||
'export_location': 'fakesnaplocation',
|
||||
'links': [
|
||||
{
|
||||
'href': 'http://localhost/v1/fake/snapshots/200',
|
||||
@ -125,7 +124,6 @@ class ShareSnapshotApiTest(test.TestCase):
|
||||
'size': 1,
|
||||
'description': 'displaysnapdesc',
|
||||
'share_proto': 'fakesnapproto',
|
||||
'export_location': 'fakesnaplocation',
|
||||
'links': [
|
||||
{
|
||||
'href': 'http://localhost/v1/fake/snapshots/200',
|
||||
@ -300,7 +298,6 @@ class ShareSnapshotApiTest(test.TestCase):
|
||||
'name': 'displaysnapname',
|
||||
'description': 'displaysnapdesc',
|
||||
'share_proto': 'fakesnapproto',
|
||||
'export_location': 'fakesnaplocation',
|
||||
'links': [
|
||||
{
|
||||
'href': 'http://localhost/v1/fake/snapshots/'
|
||||
|
@ -46,7 +46,6 @@ class ZFSSAShareDriverTestCase(test.TestCase):
|
||||
'name': 'fakesnapshotname',
|
||||
'share_size': 1,
|
||||
'share_proto': 'NFS',
|
||||
'export_location': '127.0.0.1:/mnt/nfs/volume-00002',
|
||||
}
|
||||
|
||||
access = {
|
||||
|
@ -79,7 +79,6 @@ def fake_snapshot(id, **kwargs):
|
||||
'display_name': 'fakename',
|
||||
'display_description': 'fakedesc',
|
||||
'share_proto': 'nfs',
|
||||
'export_location': 'fake_location',
|
||||
'progress': 'fakeprogress99%',
|
||||
'scheduled_at': datetime.datetime(1, 1, 1, 1, 1, 1),
|
||||
'launched_at': datetime.datetime(1, 1, 1, 1, 1, 1),
|
||||
@ -489,7 +488,6 @@ class ShareAPITestCase(test.TestCase):
|
||||
'display_name': fake_name,
|
||||
'display_description': fake_desc,
|
||||
'share_proto': share['share_proto'],
|
||||
'export_location': share['export_location'],
|
||||
}
|
||||
with mock.patch.object(db_driver, 'share_snapshot_create',
|
||||
mock.Mock(return_value=snapshot)):
|
||||
|
Loading…
Reference in New Issue
Block a user