作者:用途回家 | 来源:互联网 | 2014-05-27 20:14
实验目标:为OpenStackNova数据库增加一个表test实验环境:CentOS6.464-bitOpenStackGrizzy操作流程:1、在/nova/db/sqlalchemy/migrate_repo/versions/133_folsom.py的upgrade方法下增加如下:testTable(test,
实验目标:
为OpenStack Nova 数据库增加一个表 test
实验环境:
CentOS6.4 64-bit
OpenStack Grizzy
操作流程:
1、在 /nova/db/sqlalchemy/migrate_repo/versions/133_folsom.py
的upgrade方法下增加如下:
test = Table('test',meta,
Column('id', Integer, primary_key=True, nullable=False, autoincrement=True),
Column('created_at',DateTime),
Column('deleted', Boolean)
)
2、在/nova/db/sqlalchemy/migrate_repo/versions/133_folsom.py
的upgrade方法下tables列表增加一个项test:
tables = [aggregates, console_pools, instance_types,
security_groups, sm_flavors, sm_backend_config,
snapshots, volume_types,
volumes,
# those that are children and others later
agent_builds, aggregate_hosts, aggregate_metadata,
block_device_mapping, bw_usage_cache, cells,
certificates, compute_node_stats, compute_nodes, consoles,
dns_domains, fixed_ips, floating_ips,
instance_faults, instance_id_mappings, instance_info_caches,
instance_metadata, instance_system_metadata,
instance_type_extra_specs, instance_type_projects,
iscsi_targets, key_pairs, migrations, networks,
provider_fw_rules, quota_classes, quota_usages, quotas,
reservations, s3_images, security_group_instance_association,
security_group_rules, services, sm_volume,
snapshot_id_mappings, task_log,
virtual_interfaces,
virtual_storage_arrays, volume_id_mappings, volume_metadata,
volume_type_extra_specs,
test]
3、如果是在已经搭建好的OpenStack环境中修改,需要在mysql中drop掉nova数据库,然后执行:
nova-manage db sync
实验结果:
登录mysql,可以看到nova数据库中增加了一个test表:
root@cc]#mysql -uroot -p
mysql>use nova;
mysql>show tables;