Tag Archives: Api

今天上午刚把Keystone装利索了,做了几个简单实验,因为实验室虚拟机紧张,也没拿别的机器去做测试,然后跑虚拟机的服务器又是个Windows Server,用起来不爽,自己机器和虚拟机不是一个网段的,ping都ping不同所以只能放弃别的实验了。

安装Keystone基本上很正常,按着官方的 OpenStack Installation Guide for Red Hat Enterprise Linux, CentOS, and Fedora – havana 在 CentOS6.5 上装没有遇到什么问题,唯一的问题就是设置了hostname为controller后,有几个设置操作涉及到这个controller,比如:
openstack-config --set /etc/keystone/keystone.conf \
sql connection mysql://keystone:KEYSTONE_DBPASS@controller/keystone

还有:
export OS_SERVICE_ENDPOINT=http://controller:35357/v2.0
请各位看官们注意,如果你没有设置hosts的话,这里是必然会有问题的,我开始不知道怎么图样图森破居然丧心病狂的以为OpenStack是不是如此牛X,居然能用hostname直接访问,就像loaclhost?后来才想起来localhost也是在hostname里定义的……所以不要忘了在hosts文件里加这么一行:
192.168.0.1 controller
这样后面的操作才能正常啊。当然,你也可以在操作时都用127.0.0.1,不过用controller显然更加赏心悦目啊。

然后,每跑完命令都可以在MySQL里看一看,正常的来说,走完Manual的整个keystone部分后 table status 应该是这样的:


+------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-------------------+----------+----------------+---------+
| Name                   | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time         | Update_time         | Check_time | Collation         | Checksum | Create_options | Comment |
+------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-------------------+----------+----------------+---------+
| credential             | InnoDB |      10 | Compact    |    0 |              0 |       16384 |               0 |            0 |  11534336 |           NULL | 2014-01-13 21:11:29 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| domain                 | InnoDB |      10 | Compact    |    1 |          16384 |       16384 |               0 |        16384 |  11534336 |           NULL | 2014-01-13 21:11:28 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| endpoint               | InnoDB |      10 | Compact    |    3 |           5461 |       16384 |               0 |        16384 |  11534336 |           NULL | 2014-01-13 21:11:28 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| group                  | InnoDB |      10 | Compact    |    0 |              0 |       16384 |               0 |        16384 |  11534336 |           NULL | 2014-01-13 21:11:28 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| group_domain_metadata  | InnoDB |      10 | Compact    |    0 |              0 |       16384 |               0 |        16384 |  11534336 |           NULL | 2014-01-13 21:11:28 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| group_project_metadata | InnoDB |      10 | Compact    |    0 |              0 |       16384 |               0 |        16384 |  11534336 |           NULL | 2014-01-13 21:11:28 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| migrate_version        | MyISAM |      10 | Dynamic    |    1 |            104 |         104 | 281474976710655 |         4096 |         0 |           NULL | 2014-01-13 21:11:26 | 2014-01-13 21:11:30 | NULL       | latin1_swedish_ci |     NULL |                |         |
| policy                 | InnoDB |      10 | Compact    |    0 |              0 |       16384 |               0 |            0 |  11534336 |           NULL | 2014-01-13 21:11:28 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| project                | InnoDB |      10 | Compact    |    2 |           8192 |       16384 |               0 |        16384 |  11534336 |           NULL | 2014-01-13 21:11:28 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| role                   | InnoDB |      10 | Compact    |    2 |           8192 |       16384 |               0 |        16384 |  11534336 |           NULL | 2014-01-13 21:11:29 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| service                | InnoDB |      10 | Compact    |    1 |          16384 |       16384 |               0 |            0 |  11534336 |           NULL | 2014-01-13 21:11:29 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| token                  | InnoDB |      10 | Compact    |   13 |           8822 |      114688 |               0 |        32768 |  11534336 |           NULL | 2014-01-13 21:11:29 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| trust                  | InnoDB |      10 | Compact    |    0 |              0 |       16384 |               0 |            0 |  11534336 |           NULL | 2014-01-13 21:11:29 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| trust_role             | InnoDB |      10 | Compact    |    0 |              0 |       16384 |               0 |            0 |  11534336 |           NULL | 2014-01-13 21:11:29 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| user                   | InnoDB |      10 | Compact    |    1 |          16384 |       16384 |               0 |        16384 |  11534336 |           NULL | 2014-01-13 21:11:30 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| user_domain_metadata   | InnoDB |      10 | Compact    |    0 |              0 |       16384 |               0 |        16384 |  11534336 |           NULL | 2014-01-13 21:11:29 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| user_group_membership  | InnoDB |      10 | Compact    |    0 |              0 |       16384 |               0 |        16384 |  11534336 |           NULL | 2014-01-13 21:11:29 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
| user_project_metadata  | InnoDB |      10 | Compact    |    1 |          16384 |       16384 |               0 |        16384 |  11534336 |           NULL | 2014-01-13 21:11:29 | NULL                | NULL       | utf8_general_ci   |     NULL |                |         |
+------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-------------------+----------+----------------+---------+
 

你可以把表里面的值都翻出来看一看,与 kestone user-list 、 keystone tenant-list 什么的做个对比,可以看到 keystone 确实就是一直在搞数据库。然后假设你退出了(Verify 那一页的两个 unset),再登陆可以这样:
keystone --os-username=admin --os-password=ADMIN_PASS \
--os-auth-url=http://controller:35357/v2.0 token-get

或者:
keystone --os-username=admin --os-password=ADMIN_PASS \
--os-tenant-name=admin --os-auth-url=http://controller:35357/v2.0 token-get

不过最简单的:建立一个keystonerc,里面设置好:
export OS_USERNAME=admin
export OS_PASSWORD=ADMIN_PASS
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://controller:35357/v2.0

这样再登入只需要 source keystonerc 即可。 Read More →