跳转到: 导航, 搜索

Trove/trove-integration

Trove-Integration/redstack 设置

在运行 ./redstack install 之前,ubuntu 14.04 的要求

  • sudo apt-get install python-pip
  • sudo apt-get install python-dev
  • sudo apt-get install mysql-server (将 mysql 服务器 root 密码设置为 e1a2c042c828d3566d0a,与 devstack/localrc 中的密码相同)
  • 克隆 Trove-integration git clone https://github.com/openstack/trove-integration.git
  • 现在运行 ./redstack install
  • 如果 redstack install 成功,现在可以运行 ./redstack kick-start mysql 来添加 ubuntu-mysql 镜像
  • 要确认 redstack kick-start mysql 构建了镜像,请运行命令 "nova image-list" (确保运行命令 "source devstack/openrc admin admin" 以获取 nova 和 trove 命令的凭据),它应该输出如下表格
ID | Name | Status | Server
e5000bf0-f835-4bb0-aba9-59fa75fdddea | Fedora-x86_64-20-20140618-sda | ACTIVE |
f772bb58-d67a-49a2-9aae-86aed749b7f2 | cirros-0.3.2-x86_64-uec | ACTIVE |
03ae7b12-a05b-4882-b809-e3544a0e612f | cirros-0.3.2-x86_64-uec-kernel | ACTIVE | 
65e856b0-82bb-4cde-a025-2ab02acb858f | cirros-0.3.2-x86_64-uec-ramdisk | ACTIVE |
f0fa6de7-d3da-459d-8908-00ed724c325e | mysql | ACTIVE |
d0881709-15b8-4c41-bc0a-d9357670d1ec | ubuntu_mysql | ACTIVE |

如果 ubuntu_mysql 不在列表中,则表示在用 ./redstack kick-start mysql 构建镜像时出现错误,您需要再次运行 ./redstack kick-start mysql。


redstack 运行后会自动生成 devstack/localrc 文件并启用 trove 服务

 ENABLED_SERVICES+=,trove,tr-api,tr-tmgr,tr-cond

在 Trove-Integration/redstack 上启用 Neutron 支持

  • 在 redstack.rc 中设置 ENABLE_NEUTRON=true,这将设置启用的 neutron 服务并禁用 nova 网络
  • 在 redstack 上启用 neutron 后,devstack/localrc 现在将包含以下内容
 ENABLED_SERVICES+=,neutron,q-svc,q-agt,q-dhcp,q-l3,q-meta
 disable_service n-net


将 TripleO-Image-Elements 添加到 Trove-Integration/redstack 镜像

当您运行 ./redstack kick-start mysql 时,它会在 ~/images/ubuntu-mysql 下创建一个镜像,该镜像来自 Trove-Integration/scripts/elements/ubuntu-mysql。 如果您想添加一个元素到 ubuntu-mysql,例如 os-apply-config (https://github.com/openstack/tripleo-image-elements/tree/master/elements/os-apply-config),您需要在 trove-integration/scripts/redstack.rc 文件中添加变量 EXTRA_ELEMENTS。 默认情况下,redstack kick-start 应该能够找到 os-apply-config,因为它克隆了所有 tripleo-image-elements。 redstack kick-start 使用的 Elements 路径是 ELEMENTS_PATH=$REDSTACK_SCRIPTS/files/elements:$PATH_TRIPLEO_ELEMENTS/elements

  • 例如:EXTRA_ELEMENTS="os-apply-config" # 添加单个元素
  • 例如:EXTRA_ELEMENTS="os-apply-config os-refresh-config" # 添加多个元素用空格分隔


现在,当运行 ./redstack kick-start mysql 时,它会将 os-apply-config 元素添加到 ubuntu-mysql 镜像。

  • 现在您可以将 os-apply-config 文件夹添加到 Trove-Integration/scripts/elements/ubuntu-mysql 镜像中,以添加自定义配置文件等。
  • 将文件 (foo.conf) 和文件夹 (os-apply-config/etc/init) 添加到 ubuntu-mysql 元素 (ubuntu-mysql/os-apply-config/etc/init/foo.conf) 将在用新的镜像 ./redstack kick-start mysql 构建的 trove 创建时将文件 foo.conf 添加到 /etc/init。


重建镜像

创建镜像后,您需要执行 nova image-delete 并删除 ~/images/ubuntu-mysql 文件,以便让 ./redstack kick-start mysql 重新构建镜像。 如果不这样做,将再次使用现有的 ubuntu-mysql 镜像。


常见错误

  • trove-api (tr-api 来自 screen) 无法启动,出现错误
 2015-01-15 10:29:07.214 TRACE root RuntimeError: Could not bind to 0.0.0.0:8779 after trying for 30 seconds
 2015-01-15 10:29:07.214 TRACE root

这通常意味着有多个 trove-api 进程正在运行,并且之前的 unstack 没有清理干净。 要解决此问题

  1. 从 screen -x stack 按下 ctrl-c 杀死 tr-api 进程
  2. 退出 screen 并运行 ps afx | grep trove-api
  3. 如果有任何 trove-api 进程,则杀死所有 trove-api 进程 (kill <process-id>)
  4. 返回 screen -x stack,导航到 tr-api 进程并重新启动进程 (按向上箭头获取上一次运行的命令,这将是重新启动 tr-api 的命令)


  • Trove 实例显示 ERROR 状态,并且在运行 "trove create" 后任务管理器显示 PollTimeOut 异常

此错误有几个原因
1. 客户镜像 "ubuntu-mysql" 在运行 ./redstack kick-start mysql 时没有正确构建,导致 trove 使用默认的 "mysql" 镜像,而该镜像没有运行 trove guest agent。

Run nova image-list and confirm "ubuntu-mysql" is in the list. If not, you will need to run ./redstack kick-start mysql again

2. trove guest agent 没有正确启动或没有连接性来下载 trove 源代码。

To diagnose this you will need to do a "nova list" and ssh into the instance that your trove instance with ERROR state is using. After you ssh into the instance you will need to run "sudo cat /var/log/upstart/trove-guest.log" which will show you logging information for what the error is.