Fix database schema for mysql and switch the gate to testing it
MySQL can't use TEXT fields for primary keys. This change switches all them to VARCHAR(255). This change should not be breaking for SQLite, as it does not distinguish between these two data types. README is updated with up-to-date information about the connection option. Change-Id: I0153855c1827b55067a7c04310bfad7eb71f35fe Closes-Bug: #1501746
This commit is contained in:
parent
9c8c679802
commit
6631b8ffab
@ -145,8 +145,8 @@ Fill in at least these configuration values:
|
||||
* ``os_auth_url``, ``identity_uri`` - Keystone endpoints for validating
|
||||
authentication tokens and checking user roles;
|
||||
|
||||
* ``database`` - where you want **ironic-inspector** SQLite database
|
||||
to be placed;
|
||||
* ``connection`` in the ``database`` section - SQLAlchemy connection string
|
||||
for the database;
|
||||
|
||||
* ``dnsmasq_interface`` - interface on which ``dnsmasq`` (or another DHCP
|
||||
service) listens for PXE boot requests (defaults to ``br-ctlplane`` which is
|
||||
@ -322,7 +322,9 @@ database simply run:
|
||||
ironic-inspector-dbsync --config-file /etc/ironic-inspector/inspector.conf upgrade
|
||||
|
||||
If you have previously run a version of **ironic-inspector** earlier than
|
||||
2.2.0, to ensure your database will work with the migrations, you'll need to
|
||||
2.2.0, the safest thing is to delete the existing SQLite database and run
|
||||
``upgrade`` as shown above. If you, however, want to save the existing
|
||||
database, to ensure your database will work with the migrations, you'll need to
|
||||
run an extra step before upgrading the database. You only need to do this the
|
||||
first time running version 2.2.0 or later.
|
||||
|
||||
|
@ -8,7 +8,6 @@ IRONIC_INSPECTOR_CONF_FILE=$IRONIC_INSPECTOR_CONF_DIR/inspector.conf
|
||||
IRONIC_INSPECTOR_CMD="$IRONIC_INSPECTOR_BIN_FILE --config-file $IRONIC_INSPECTOR_CONF_FILE"
|
||||
IRONIC_INSPECTOR_DHCP_CONF_FILE=$IRONIC_INSPECTOR_CONF_DIR/dnsmasq.conf
|
||||
IRONIC_INSPECTOR_ROOTWRAP_CONF_FILE=$IRONIC_INSPECTOR_CONF_DIR/rootwrap.conf
|
||||
IRONIC_INSPECTOR_DATA_DIR=$DATA_DIR/ironic-inspector
|
||||
IRONIC_INSPECTOR_ADMIN_USER=${IRONIC_INSPECTOR_ADMIN_USER:-ironic-inspector}
|
||||
IRONIC_INSPECTOR_MANAGE_FIREWALL=$(trueorfalse True $IRONIC_INSPECTOR_MANAGE_FIREWALL)
|
||||
IRONIC_INSPECTOR_HOST=$HOST_IP
|
||||
@ -115,7 +114,6 @@ EOF
|
||||
|
||||
function configure_inspector {
|
||||
mkdir_chown_stack "$IRONIC_INSPECTOR_CONF_DIR"
|
||||
mkdir_chown_stack "$IRONIC_INSPECTOR_DATA_DIR"
|
||||
|
||||
create_service_user "$IRONIC_INSPECTOR_ADMIN_USER" "admin"
|
||||
|
||||
@ -137,7 +135,7 @@ function configure_inspector {
|
||||
|
||||
inspector_iniset firewall manage_firewall $IRONIC_INSPECTOR_MANAGE_FIREWALL
|
||||
inspector_iniset firewall dnsmasq_interface $IRONIC_INSPECTOR_INTERFACE
|
||||
inspector_iniset database connection sqlite:///$IRONIC_INSPECTOR_DATA_DIR/inspector.sqlite
|
||||
inspector_iniset database connection `database_connection_url ironic_inspector`
|
||||
|
||||
is_service_enabled swift && configure_inspector_swift
|
||||
|
||||
@ -201,7 +199,6 @@ function prepare_environment {
|
||||
}
|
||||
|
||||
function cleanup_inspector {
|
||||
rm -rf $IRONIC_INSPECTOR_DATA_DIR
|
||||
rm -f $IRONIC_TFTPBOOT_DIR/pxelinux.cfg/default
|
||||
rm -f $IRONIC_TFTPBOOT_DIR/ironic-inspector.*
|
||||
sudo rm -f /etc/sudoers.d/ironic-inspector-rootwrap
|
||||
@ -222,6 +219,7 @@ function cleanup_inspector {
|
||||
}
|
||||
|
||||
function sync_inspector_database {
|
||||
recreate_database ironic_inspector
|
||||
$IRONIC_INSPECTOR_DBSYNC_BIN_FILE --config-file $IRONIC_INSPECTOR_CONF_FILE upgrade
|
||||
}
|
||||
|
||||
|
@ -44,15 +44,15 @@ class Node(Base):
|
||||
|
||||
class Attribute(Base):
|
||||
__tablename__ = 'attributes'
|
||||
name = Column(Text, primary_key=True)
|
||||
value = Column(Text, primary_key=True)
|
||||
name = Column(String(255), primary_key=True)
|
||||
value = Column(String(255), primary_key=True)
|
||||
uuid = Column(String(36), ForeignKey('nodes.uuid'))
|
||||
|
||||
|
||||
class Option(Base):
|
||||
__tablename__ = 'options'
|
||||
uuid = Column(String(36), ForeignKey('nodes.uuid'), primary_key=True)
|
||||
name = Column(Text, primary_key=True)
|
||||
name = Column(String(255), primary_key=True)
|
||||
value = Column(Text)
|
||||
|
||||
|
||||
|
@ -43,8 +43,8 @@ def upgrade():
|
||||
|
||||
op.create_table(
|
||||
'attributes',
|
||||
sa.Column('name', sa.Text, primary_key=True),
|
||||
sa.Column('value', sa.Text, primary_key=True),
|
||||
sa.Column('name', sa.String(255), primary_key=True),
|
||||
sa.Column('value', sa.String(255), primary_key=True),
|
||||
sa.Column('uuid', sa.String(36), sa.ForeignKey('nodes.uuid'))
|
||||
)
|
||||
|
||||
@ -52,7 +52,7 @@ def upgrade():
|
||||
'options',
|
||||
sa.Column('uuid', sa.String(36), sa.ForeignKey('nodes.uuid'),
|
||||
primary_key=True),
|
||||
sa.Column('name', sa.Text, primary_key=True),
|
||||
sa.Column('name', sa.String(255), primary_key=True),
|
||||
sa.Column('value', sa.Text)
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user