db sync fails to create cinder.volumes
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cinder |
Fix Released
|
Undecided
|
Cao ShuFeng |
Bug Description
New deployments of cinder from the master branch fail to create the volumes table when running `cinder-manage db sync` with the error "Foreign key constraint is incorrectly formed"
It looks like the consistencygroups table is initially created with the utf8 character set, while the volumes table is not.
https:/
https:/
Can't create table `cinder`.`volumes` (errno: 150 "Foreign key constraint is incorrectly formed")') [SQL: u'
CREATE TABLE volumes (
created_at DATETIME,
updated_at DATETIME,
deleted_at DATETIME,
deleted BOOL,
id VARCHAR(36) NOT NULL,
ec2_id VARCHAR(255),
user_id VARCHAR(255),
project_id VARCHAR(255),
host VARCHAR(255),
size INTEGER,
availability_zone VARCHAR(255),
status VARCHAR(255),
attach_status VARCHAR(255),
scheduled_at DATETIME,
launched_at DATETIME,
terminated_at DATETIME,
display_name VARCHAR(255),
display_
provider_location VARCHAR(256),
provider_auth VARCHAR(256),
snapshot_id VARCHAR(36),
volume_type_id VARCHAR(36),
source_volid VARCHAR(36),
bootable BOOL,
provider_geometry VARCHAR(255),
_name_id VARCHAR(36),
encryption_key_id VARCHAR(36),
migration_status VARCHAR(255),
replication_status VARCHAR(255),
replication_
replication_
consistencygro
provider_id VARCHAR(255),
multiattach BOOL,
PRIMARY KEY (id),
CHECK (deleted IN (0, 1)),
CHECK (bootable IN (0, 1)),
FOREIGN KEY(consistency
CHECK (multiattach IN (0, 1))
)ENGINE=InnoDB
# mysql --version
mysql Ver 15.1 Distrib 10.0.25-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Changed in cinder: | |
assignee: | nobody → Cao ShuFeng (caosf-fnst) |
Hi, Jimmy:
This may caused because you didn't create database cinder with charset utf8.
In my opinion, the reproduce steps of this bug should be:
cinder- manage db sync
1. drop database cinder if exist.
mysql -uroot -pxxxxxxxx -h127.0.0.1 -e 'DROP DATABASE IF EXISTS cinder;'
2. create database cinder with non-utf-8 charset(gbk for example).
mysql -uroot -pxxxxxxxx -h127.0.0.1 -e 'CREATE DATABASE cinder CHARACTER SET gbk;
3. sync the cinder tables.