分享

openstack【Kilo】入门 【网络篇】十七:创建实例

pig2 发表于 2015-8-6 16:35:21 [显示全部楼层] 只看大图 回帖奖励 阅读模式 关闭右栏 14 59305


问题导读

1.创建实例需要哪些条件?
2.创建实例使用的是哪个网络ID?
3.如何不安装dasboard,访问创建实例?







1.生效认证
[mw_shl_code=bash,true]source demo-openrc.sh[/mw_shl_code]

2.生成并添加一个密钥对:

[mw_shl_code=bash,true]nova keypair-add demo-key[/mw_shl_code]

3.验证密钥对
[mw_shl_code=bash,true]nova keypair-list[/mw_shl_code]


创建实例

列出flavors


[mw_shl_code=bash,true]nova flavor-list[/mw_shl_code]


[mw_shl_code=bash,true]+-----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID  | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+-----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1   | m1.tiny   | 512       | 1    | 0         |      | 1     | 1.0         | True      |
| 2   | m1.small  | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
| 3   | m1.medium | 4096      | 40   | 0         |      | 2     | 1.0         | True      |
| 4   | m1.large  | 8192      | 80   | 0         |      | 4     | 1.0         | True      |
| 5   | m1.xlarge | 16384     | 160  | 0         |      | 8     | 1.0         | True      |
+-----+-----------+-----------+------+-----------+------+-------+-------------+-----------+[/mw_shl_code]


列出镜像

[mw_shl_code=bash,true]nova image-list
+--------------------------------------+---------------------+--------+--------+
| ID                                   | Name                | Status | Server |
+--------------------------------------+---------------------+--------+--------+
| acafc7c0-40aa-4026-9673-b879898e1fc2 | cirros-0.3.4-x86_64 | ACTIVE |        |
+--------------------------------------+---------------------+--------+--------+[/mw_shl_code]


3.列出网络

[mw_shl_code=bash,true]neutron net-list[/mw_shl_code]

[mw_shl_code=bash,true]+--------------------------------------+----------+-----------------------------------------------------+
| id                                   | name     | subnets                                             |
+--------------------------------------+----------+-----------------------------------------------------+
| 64da5fe4-c3a3-4aa7-a685-a5a9446aac13 | demo-net | 199ec974-e536-4814-93fc-af09efcc7014 192.168.1.0/24 |
| c88d8856-7ecf-4bbc-bae1-3cc65d2724e6 | ext-net  | cd1c51f1-5d22-407d-9f08-cc774ed9c2e4 10.0.0.0/24    |
+--------------------------------------+----------+-----------------------------------------------------+[/mw_shl_code]
1.png

列出安全组

[mw_shl_code=bash,true]nova secgroup-list[/mw_shl_code]

[mw_shl_code=bash,true]+--------------------------------------+---------+------------------------+
| Id                                   | Name    | Description            |
+--------------------------------------+---------+------------------------+
| 0a44b60c-49c7-425c-ac27-7167c8388cf8 | default | Default security group |
+--------------------------------------+---------+------------------------+[/mw_shl_code]

创建实例
nova boot --flavor m1.tiny --image cirros-0.3.4-x86_64 --nic net-id=DEMO_NET_ID \
  --security-group default --key-name demo-key demo-instance1


替换为
nova boot --flavor m1.tiny --image cirros-0.3.4-x86_64 --nic net-id=64da5fe4-c3a3-4aa7-a685-a5a9446aac13 \
  --security-group default --key-name demo-key demo-instance1


6.列出实例

[mw_shl_code=bash,true] nova list[/mw_shl_code]


[mw_shl_code=bash,true]+--------------------------------------+----------------+--------+------------+-------------+----------------------+
| ID                                   | Name           | Status | Task State | Power State | Networks             |
+--------------------------------------+----------------+--------+------------+-------------+----------------------+
| 02caa2ca-d6e6-46fd-b4a9-e432bcde2e6a | demo-instance1 | ACTIVE | -          | Running     | demo-net=192.168.1.3 |
+--------------------------------------+----------------+--------+------------+-------------+----------------------+[/mw_shl_code]
1.png


通过浏览器访问实例

nova get-vnc-console demo-instance1 novnc

[mw_shl_code=bash,true]+-------+---------------------------------------------------------------------------------+
| Type  | Url                                                                             |
+-------+---------------------------------------------------------------------------------+
| novnc | http://controller:6080/vnc_auto.html?token=83c12cef-1fa8-4fd4-a69a-8ea58984a003 |
+-------+---------------------------------------------------------------------------------+[/mw_shl_code]


把http://controller:6080/vnc_auto.html?token=83c12cef-1fa8-4fd4-a69a-8ea58984a003输入浏览器即可看到实例

2.png

相关内容

openstack【Kilo】入门 【准备篇】零:整体介绍

openstack【Kilo】入门 【准备篇】一: Ubuntu14.04远程连接(ssh安装)

openstack【Kilo】入门 【准备篇】二:NTP安装

openstack【Kilo】入门 【准备篇】三:mysql(MariaDB)安装【控制节点】

openstack【Kilo】入门 【准备篇】四:RabbitMQ 安装

openstack【Kilo】入门 【keystone篇】五:keystone安装与配置

openstack【Kilo】入门 【keystone篇】六:创建服务实例和 API endpoint

openstack【Kilo】入门 【keystone篇】七:创建租户、用户、角色

openstack【Kilo】入门 【keystone篇】八:验证keystone安装部署

openstack【Kilo】入门 【keystone篇】九: 创建openstack客户端环境变量脚本

openstack【Kilo】入门 【glance篇】十:glance安装配置【控制节点】

openstack【Kilo】入门 【glance篇】十一:glance安装验证

openstack【Kilo】入门 【nova篇】十二:安装配置nova

openstack【Kilo】入门 【网络篇】十三:安装配置【控制节点】

openstack【Kilo】入门 【网络篇】十四:安装配置【网络节点】

openstack【Kilo】入门 【网络篇】十五:安装配置【计算节点】

openstack【Kilo】入门 【网络篇】十六:实例化网络

openstack【Kilo】入门 【网络篇】十七:创建实例









已有(15)人评论

跳转到指定楼层
a_zhen 发表于 2015-8-7 16:16:05
感觉挺复杂的啊
回复

使用道具 举报

zwl0621 发表于 2015-9-9 21:25:45
我这样配置了,但是虚拟机还是无法上外网,是否还有其它配置?
回复

使用道具 举报

liuwanbing1985 发表于 2015-9-24 14:50:21
本帖最后由 liuwanbing1985 于 2015-9-24 14:51 编辑

命令创建实例后后 “Status” 是”error“,请各位给看下再排查下哪里。。。。???
过程如下:
1、创建实例
nova boot --flavor m1.tiny --image cirros-0.3.4-x86_64 --nic net-id=cdc7c1f0-09e5-4318-a0c3-4220b942c8f2 \
--security-group default --key-name demo-key demo-instance1
结果见附件1.png
2、检查实例
nova list
结果见附件2.png
3、查看nova-conductor.log有错误

tail nova-conductor.log

  File "/usr/lib/python2.7/dist-packages/nova/scheduler/manager.py", line 86, in select_destinations
    filter_properties)

  File "/usr/lib/python2.7/dist-packages/nova/scheduler/filter_scheduler.py", line 80, in select_destinations
    raise exception.NoValidHost(reason=reason)

NoValidHost: No valid host was found. There are not enough hosts available.

2015-09-24 14:18:36.411 18341 WARNING nova.scheduler.utils [req-1498035f-5ef0-4739-93a6-a83da23db121 ac085401728d464799df823d34b5a52a 1e28f0ce637d4b83857d2a6538bfa194 - - -] [instance: 53f842df-474b-47a0-b5f9-e5deb61c5a1d] Setting instance to ERROR state.

检查openstack服务如下:





1.png
2.png

检查

检查

检查

检查

检查

检查
回复

使用道具 举报

modestyong 发表于 2015-9-28 18:27:59
liuwanbing1985 发表于 2015-9-24 14:50
命令创建实例后后 “Status” 是”error“,请各位给看下再排查下哪里。。。。???
过程如下:
1、创建 ...

你的net_id是ext-net的还是demo-net的~同时在创建的时候也要看你是source的是admin-openrc.sh还是demo-openrc.sh文件。
回复

使用道具 举报

modestyong 发表于 2015-9-28 19:19:13
你好,创建实例时,我用demo-net能够创建成功,但如果使用ext-net就会错误。是什么原因呢?
回复

使用道具 举报

xiaohuihui 发表于 2015-10-21 15:05:20
你好,创建实例时出现ERROR (ClientException): The server has either erred or is incapable of performing the requested operation. (HTTP 500)  怎么回事
回复

使用道具 举报

pig2 发表于 2015-10-21 15:35:21
xiaohuihui 发表于 2015-10-21 15:05
你好,创建实例时出现ERROR (ClientException): The server has either erred or is incapable of performi ...

neutron-server出问题了,检测相关配置
回复

使用道具 举报

xiaohuihui 发表于 2015-10-21 16:05:42
pig2 发表于 2015-10-21 15:35
neutron-server出问题了,检测相关配置

谢谢啊 你这样的配置可以安装all in one么?

点评

all in one建议找专门的教程  发表于 2015-12-23 18:01
回复

使用道具 举报

zwn8801 发表于 2016-1-19 17:37:04
创建实例出现这个问题该怎么解决啊版主大大。

QQ图片20160119173526.png

2016-01-19 17:24:18.006 2229 INFO nova.service [-] Starting conductor node (version 2015.1.2)
2016-01-19 17:24:18.246 2227 WARNING oslo_db.sqlalchemy.session [req-3eec857e-ce75-4f82-8441-94bdf3fe7672 - - - - -] SQL connection failed. 10 attempts left.
2016-01-19 17:24:18.248 2226 WARNING oslo_db.sqlalchemy.session [req-ab2515c3-2101-4846-a98d-e73902406b49 - - - - -] SQL connection failed. 10 attempts left.
2016-01-19 17:24:18.248 2229 WARNING oslo_db.sqlalchemy.session [req-ce3e7d4c-45b7-4e2f-9eba-736497253790 - - - - -] SQL connection failed. 10 attempts left.
2016-01-19 17:24:18.248 2228 WARNING oslo_db.sqlalchemy.session [req-cd09f225-b633-4aa7-81f7-c36f33e2c495 - - - - -] SQL connection failed. 10 attempts left.
2016-01-19 17:24:28.541 2227 INFO oslo_messaging._drivers.impl_rabbit [req-3eec857e-ce75-4f82-8441-94bdf3fe7672 - - - - -] Connecting to AMQP server on controller:5672
2016-01-19 17:24:28.548 2229 INFO oslo_messaging._drivers.impl_rabbit [req-ce3e7d4c-45b7-4e2f-9eba-736497253790 - - - - -] Connecting to AMQP server on controller:5672
2016-01-19 17:24:28.552 2227 INFO oslo_messaging._drivers.impl_rabbit [req-3eec857e-ce75-4f82-8441-94bdf3fe7672 - - - - -] Connected to AMQP server on controller:5672
2016-01-19 17:24:28.561 2229 INFO oslo_messaging._drivers.impl_rabbit [req-ce3e7d4c-45b7-4e2f-9eba-736497253790 - - - - -] Connected to AMQP server on controller:5672
2016-01-19 17:24:28.584 2226 INFO oslo_messaging._drivers.impl_rabbit [req-ab2515c3-2101-4846-a98d-e73902406b49 - - - - -] Connecting to AMQP server on controller:5672
2016-01-19 17:24:28.625 2228 INFO oslo_messaging._drivers.impl_rabbit [req-cd09f225-b633-4aa7-81f7-c36f33e2c495 - - - - -] Connecting to AMQP server on controller:5672
2016-01-19 17:24:28.627 2226 INFO oslo_messaging._drivers.impl_rabbit [req-ab2515c3-2101-4846-a98d-e73902406b49 - - - - -] Connected to AMQP server on controller:5672
2016-01-19 17:24:28.634 2228 INFO oslo_messaging._drivers.impl_rabbit [req-cd09f225-b633-4aa7-81f7-c36f33e2c495 - - - - -] Connected to AMQP server on controller:5672
2016-01-19 17:24:34.477 2227 INFO oslo_messaging._drivers.impl_rabbit [req-5638e0b0-2f41-4711-83f9-f2ecd36bbc43 - - - - -] Connecting to AMQP server on controller:5672
2016-01-19 17:24:34.483 2227 INFO oslo_messaging._drivers.impl_rabbit [req-5638e0b0-2f41-4711-83f9-f2ecd36bbc43 - - - - -] Connected to AMQP server on controller:5672
2016-01-19 17:24:44.684 2229 INFO oslo_messaging._drivers.impl_rabbit [req-00e54367-3780-42fb-a006-fc2deaefd057 - - - - -] Connecting to AMQP server on controller:5672
2016-01-19 17:24:44.690 2229 INFO oslo_messaging._drivers.impl_rabbit [req-00e54367-3780-42fb-a006-fc2deaefd057 - - - - -] Connected to AMQP server on controller:5672
2016-01-19 17:24:54.487 2226 INFO oslo_messaging._drivers.impl_rabbit [req-b6965a95-95ca-41ac-95c9-36954323b320 - - - - -] Connecting to AMQP server on controller:5672
2016-01-19 17:24:54.493 2226 INFO oslo_messaging._drivers.impl_rabbit [req-b6965a95-95ca-41ac-95c9-36954323b320 - - - - -] Connected to AMQP server on controller:5672
2016-01-19 17:25:04.494 2228 INFO oslo_messaging._drivers.impl_rabbit [req-4bdadc8e-29e8-4093-a21a-6de4dd25b485 - - - - -] Connecting to AMQP server on controller:5672
2016-01-19 17:25:04.500 2228 INFO oslo_messaging._drivers.impl_rabbit [req-4bdadc8e-29e8-4093-a21a-6de4dd25b485 - - - - -] Connected to AMQP server on controller:5672
2016-01-19 17:32:12.232 2229 INFO oslo_messaging._drivers.impl_rabbit [req-e1f1a6a5-5c46-4043-b3dd-b4fd2c7c0cd4 f1dd01b7533f445e85b187854ed9b632 4b9dba4f1fa143149fef89f103d7a620 - - -] Connecting to AMQP server on controller:5672
2016-01-19 17:32:12.238 2229 INFO oslo_messaging._drivers.impl_rabbit [req-e1f1a6a5-5c46-4043-b3dd-b4fd2c7c0cd4 f1dd01b7533f445e85b187854ed9b632 4b9dba4f1fa143149fef89f103d7a620 - - -] Connected to AMQP server on controller:5672
2016-01-19 17:32:13.308 2229 WARNING nova.scheduler.utils [req-e1f1a6a5-5c46-4043-b3dd-b4fd2c7c0cd4 f1dd01b7533f445e85b187854ed9b632 4b9dba4f1fa143149fef89f103d7a620 - - -] Failed to compute_task_build_instances: Remote error: OperationalError (OperationalError) no such table: services u'SELECT services.created_at AS services_created_at, services.updated_at AS services_updated_at, services.deleted_at AS services_deleted_at, services.deleted AS services_deleted, services.id AS services_id, services.host AS services_host, services.binary AS services_binary, services.topic AS services_topic, services.report_count AS services_report_count, services.disabled AS services_disabled, services.disabled_reason AS services_disabled_reason \nFROM services \nWHERE services.deleted = ? AND services.disabled = 0 AND services.binary = ?' (0, 'nova-compute')
[u'Traceback (most recent call last):\n', u'  File "/usr/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 142, in _dispatch_and_reply\n    executor_callback))\n', u'  File "/usr/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 186, in _dispatch\n    executor_callback)\n', u'  File "/usr/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 130, in _do_dispatch\n    result = func(ctxt, **new_args)\n', u'  File "/usr/lib/python2.7/dist-packages/oslo_messaging/rpc/server.py", line 142, in inner\n    return func(*args, **kwargs)\n', u'  File "/usr/lib/python2.7/dist-packages/nova/scheduler/manager.py", line 86, in select_destinations\n    filter_properties)\n', u'  File "/usr/lib/python2.7/dist-packages/nova/scheduler/filter_scheduler.py", line 67, in select_destinations\n    filter_properties)\n', u'  File "/usr/lib/python2.7/dist-packages/nova/scheduler/filter_scheduler.py", line 131, in _schedule\n    hosts = self._get_all_host_states(elevated)\n', u'  File "/usr/lib/python2.7/dist-packages/nova/scheduler/filter_scheduler.py", line 176, in _get_all_host_states\n    return self.host_manager.get_all_host_states(context)\n', u'  File "/usr/lib/python2.7/dist-packages/nova/scheduler/host_manager.py", line 533, in get_all_host_states\n    context, \'nova-compute\')}\n', u'  File "/usr/lib/python2.7/dist-packages/nova/objects/base.py", line 163, in wrapper\n    result = fn(cls, context, *args, **kwargs)\n', u'  File "/usr/lib/python2.7/dist-packages/nova/objects/service.py", line 223, in get_by_binary\n    db_services = db.service_get_all_by_binary(context, binary)\n', u'  File "/usr/lib/python2.7/dist-packages/nova/db/api.py", line 125, in service_get_all_by_binary\n    return IMPL.service_get_all_by_binary(context, binary)\n', u'  File "/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/api.py", line 498, in service_get_all_by_binary\n    filter_by(binary=binary).\\\n', u'  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2320, in all\n    return list(self)\n', u'  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2438, in __iter__\n    return self._execute_and_instances(context)\n', u'  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2453, in _execute_and_instances\n    result = conn.execute(querycontext.statement, self._params)\n', u'  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 729, in execute\n    return meth(self, multiparams, params)\n', u'  File "/usr/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py", line 322, in _execute_on_connection\n    return connection._execute_clauseelement(self, multiparams, params)\n', u'  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 826, in _execute_clauseelement\n    compiled_sql, distilled_params\n', u'  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 958, in _execute_context\n    context)\n', u'  File "/usr/lib/python2.7/dist-packages/oslo_db/sqlalchemy/compat/handle_error.py", line 261, in _handle_dbapi_exception\n    e, statement, parameters, cursor, context)\n', u'  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1155, in _handle_dbapi_exception\n    util.raise_from_cause(newraise, exc_info)\n', u'  File "/usr/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause\n    reraise(type(exception), exception, tb=exc_tb)\n', u'  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 951, in _execute_context\n    context)\n', u'  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 436, in do_execute\n    cursor.execute(statement, parameters)\n', u"OperationalError: (OperationalError) no such table: services u'SELECT services.created_at AS services_created_at, services.updated_at AS services_updated_at, services.deleted_at AS services_deleted_at, services.deleted AS services_deleted, services.id AS services_id, services.host AS services_host, services.binary AS services_binary, services.topic AS services_topic, services.report_count AS services_report_count, services.disabled AS services_disabled, services.disabled_reason AS services_disabled_reason \\nFROM services \\nWHERE services.deleted = ? AND services.disabled = 0 AND services.binary = ?' (0, 'nova-compute')\n"].
2016-01-19 17:32:13.309 2229 WARNING nova.scheduler.utils [req-e1f1a6a5-5c46-4043-b3dd-b4fd2c7c0cd4 f1dd01b7533f445e85b187854ed9b632 4b9dba4f1fa143149fef89f103d7a620 - - -] [instance: 6490b2c7-e1c2-4e1d-b14e-4a33adad6bcc] Setting instance to ERROR state.
root@controll-H81-M1:/var/log/nova#


回复

使用道具 举报

12下一页
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条