1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
# Copyright (c) 2012 NTT DOCOMO, INC.
6
# Licensed under the Apache License, Version 2.0 (the "License"); you may
7
# not use this file except in compliance with the License. You may obtain
8
# a copy of the License at
10
# http://www.apache.org/licenses/LICENSE-2.0
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
# License for the specific language governing permissions and limitations
19
SQLAlchemy models for baremetal data.
22
from sqlalchemy.orm import relationship, backref, object_mapper
23
from sqlalchemy import Column, Integer, BigInteger, String, schema
24
from sqlalchemy import ForeignKey, DateTime, Boolean, Text, Float, Index
25
from sqlalchemy.exc import IntegrityError
26
from sqlalchemy.ext.declarative import declarative_base
27
from sqlalchemy.schema import ForeignKeyConstraint
29
from nova.db.sqlalchemy import models
32
BASE = declarative_base()
35
class BareMetalNode(BASE, models.NovaBase):
36
"""Represents a bare metal node."""
38
__tablename__ = 'bm_nodes'
39
id = Column(Integer, primary_key=True)
40
service_host = Column(String(255))
41
instance_uuid = Column(String(36), nullable=True)
42
cpus = Column(Integer)
43
memory_mb = Column(Integer)
44
local_gb = Column(Integer)
45
pm_address = Column(Text)
46
pm_user = Column(Text)
47
pm_password = Column(Text)
48
prov_mac_address = Column(Text)
49
registration_status = Column(String(16))
50
task_state = Column(String(255))
51
prov_vlan_id = Column(Integer)
52
terminal_port = Column(Integer)
55
class BareMetalPxeIp(BASE, models.NovaBase):
56
__tablename__ = 'bm_pxe_ips'
57
id = Column(Integer, primary_key=True)
58
address = Column(String(255), unique=True)
59
server_address = Column(String(255), unique=True)
60
bm_node_id = Column(Integer, ForeignKey('bm_nodes.id'), nullable=True)
63
class BareMetalInterface(BASE, models.NovaBase):
64
__tablename__ = 'bm_interfaces'
65
id = Column(Integer, primary_key=True)
66
bm_node_id = Column(Integer, ForeignKey('bm_nodes.id'), nullable=True)
67
address = Column(String(255), unique=True)
68
datapath_id = Column(String(255))
69
port_no = Column(Integer)
70
vif_uuid = Column(String(36), unique=True)
73
class BareMetalDeployment(BASE, models.NovaBase):
74
__tablename__ = 'bm_deployments'
75
id = Column(Integer, primary_key=True)
76
key = Column(String(255))
77
image_path = Column(String(255))
78
pxe_config_path = Column(String(255))
79
root_mb = Column(Integer)
80
swap_mb = Column(Integer)