baremetal: drop 'prov_mac_address' column

bm_nodes.prov_mac_address is no longer used. So drop it.

Change-Id: I3c7294da8f62581aba8c948171cb02f80cf054ef
This commit is contained in:
Arata Notsu 2013-04-03 19:32:34 +09:00
parent 1d5d58c969
commit 48bd75998a
7 changed files with 42 additions and 8 deletions

View File

@ -31,7 +31,6 @@ def new_bm_node(**kwargs):
h.pm_address = kwargs.pop('pm_address', '192.168.1.1')
h.pm_user = kwargs.pop('pm_user', 'ipmi_user')
h.pm_password = kwargs.pop('pm_password', 'ipmi_password')
h.prov_mac_address = kwargs.pop('prov_mac_address', '12:34:56:78:90:ab')
h.task_state = kwargs.pop('task_state', None)
h.terminal_port = kwargs.pop('terminal_port', 8000)
if len(kwargs) > 0:

View File

@ -74,7 +74,6 @@ class BareMetalPXETestCase(bm_db_base.BMDBTestCase):
service_host='test_host',
cpus=4,
memory_mb=2048,
prov_mac_address='11:11:11:11:11:11',
)
self.nic_info = [
{'address': '22:22:22:22:22:22', 'datapath_id': '0x1',

View File

@ -70,7 +70,6 @@ class BareMetalTileraTestCase(bm_db_base.BMDBTestCase):
service_host='test_host',
cpus=4,
memory_mb=2048,
prov_mac_address='11:11:11:11:11:11',
)
self.nic_info = [
{'address': '22:22:22:22:22:22', 'datapath_id': '0x1',

View File

@ -71,7 +71,6 @@ class BareMetalVPDTestCase(bm_db_base.BMDBTestCase):
service_host='test_host',
cpus=2,
memory_mb=2048,
prov_mac_address='aa:bb:cc:dd:ee:ff',
)
self.nic_info = [
{'address': '11:11:11:11:11:11', 'datapath_id': '0x1',
@ -200,9 +199,7 @@ class VPDClassMethodsTestCase(BareMetalVPDTestCase):
self.mox.StubOutWithMock(self.pm, '_run_command')
cmd = self.pm._vp_cmd.get_node_macs.replace('{_NodeName_}', 'testNode')
# aa:bb:cc:dd:ee:ff is prov_mac_adress. Check it is not used to
# find the node.
self.pm._run_command(cmd).AndReturn(["aabbccddeeff", "ffeeddccbbaa"])
self.pm._run_command(cmd).AndReturn(["ffeeddccbbaa"])
self.mox.ReplayAll()
name = self.pm._check_for_node()

View File

@ -1425,3 +1425,8 @@ class TestBaremetalMigrations(BaseMigrationTestCase, CommonTestsMixIn):
rows = ifs.select().where(ifs.c.bm_node_id == 2).execute().fetchall()
self.assertEqual(len(rows), 0)
def _check_007(self, engine, data):
bm_nodes = db_utils.get_table(engine, 'bm_nodes')
columns = [c.name for c in bm_nodes.columns]
self.assertNotIn(u'prov_mac_address', columns)

View File

@ -0,0 +1,36 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 NTT DOCOMO, INC.
#
# 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 Column, MetaData, String, Table
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
nodes = Table('bm_nodes', meta, autoload=True)
nodes.drop_column('prov_mac_address')
def downgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
nodes = Table('bm_nodes', meta, autoload=True)
nodes.create_column(Column('prov_mac_address', String(length=255)))
# NOTE(arata): The values held by prov_mac_address are lost in upgrade.
# So downgrade has no other choice but to set the column to NULL.

View File

@ -45,7 +45,6 @@ class BareMetalNode(BASE, models.NovaBase):
pm_address = Column(Text)
pm_user = Column(Text)
pm_password = Column(Text)
prov_mac_address = Column(Text)
task_state = Column(String(255))
terminal_port = Column(Integer)
image_path = Column(String(255), nullable=True)