summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-05-20 05:24:13 +0000
committerGerrit Code Review <review@openstack.org>2013-05-20 05:24:13 +0000
commit5c3113b066e61cbc5d8d4d464f8200d4cb5e8395 (patch)
tree7b925f456bd1b5047a2da5504ef7dd1947dd136c /nova
parenta64532f11381547b3b5ea3bc007df724566a75e1 (diff)
parent48bd75998a9e68d7dafdeab47fd6c70adb3113f6 (diff)
downloadnova-5c3113b066e61cbc5d8d4d464f8200d4cb5e8395.tar.gz
nova-5c3113b066e61cbc5d8d4d464f8200d4cb5e8395.tar.xz
nova-5c3113b066e61cbc5d8d4d464f8200d4cb5e8395.zip
Merge "baremetal: drop 'prov_mac_address' column"
Diffstat (limited to 'nova')
-rw-r--r--nova/tests/baremetal/db/utils.py1
-rw-r--r--nova/tests/baremetal/test_pxe.py1
-rwxr-xr-xnova/tests/baremetal/test_tilera.py1
-rw-r--r--nova/tests/baremetal/test_virtual_power_driver.py5
-rw-r--r--nova/tests/test_migrations.py5
-rw-r--r--nova/virt/baremetal/db/sqlalchemy/migrate_repo/versions/007_drop_prov_mac_address.py36
-rw-r--r--nova/virt/baremetal/db/sqlalchemy/models.py1
7 files changed, 42 insertions, 8 deletions
diff --git a/nova/tests/baremetal/db/utils.py b/nova/tests/baremetal/db/utils.py
index f50abd2e6..c3b3cff5f 100644
--- a/nova/tests/baremetal/db/utils.py
+++ b/nova/tests/baremetal/db/utils.py
@@ -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:
diff --git a/nova/tests/baremetal/test_pxe.py b/nova/tests/baremetal/test_pxe.py
index 50fe16715..994a8ee35 100644
--- a/nova/tests/baremetal/test_pxe.py
+++ b/nova/tests/baremetal/test_pxe.py
@@ -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',
diff --git a/nova/tests/baremetal/test_tilera.py b/nova/tests/baremetal/test_tilera.py
index f92e9b270..a30732a3d 100755
--- a/nova/tests/baremetal/test_tilera.py
+++ b/nova/tests/baremetal/test_tilera.py
@@ -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',
diff --git a/nova/tests/baremetal/test_virtual_power_driver.py b/nova/tests/baremetal/test_virtual_power_driver.py
index d6d615194..5f4b5f0cb 100644
--- a/nova/tests/baremetal/test_virtual_power_driver.py
+++ b/nova/tests/baremetal/test_virtual_power_driver.py
@@ -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()
diff --git a/nova/tests/test_migrations.py b/nova/tests/test_migrations.py
index d7ef3da2f..de5eb1b40 100644
--- a/nova/tests/test_migrations.py
+++ b/nova/tests/test_migrations.py
@@ -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)
diff --git a/nova/virt/baremetal/db/sqlalchemy/migrate_repo/versions/007_drop_prov_mac_address.py b/nova/virt/baremetal/db/sqlalchemy/migrate_repo/versions/007_drop_prov_mac_address.py
new file mode 100644
index 000000000..eb6ae756c
--- /dev/null
+++ b/nova/virt/baremetal/db/sqlalchemy/migrate_repo/versions/007_drop_prov_mac_address.py
@@ -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.
diff --git a/nova/virt/baremetal/db/sqlalchemy/models.py b/nova/virt/baremetal/db/sqlalchemy/models.py
index 61063f031..dbc9386ec 100644
--- a/nova/virt/baremetal/db/sqlalchemy/models.py
+++ b/nova/virt/baremetal/db/sqlalchemy/models.py
@@ -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)