本帖最后由 pig2 于 2015-3-19 13:59 编辑
问题导读
1.如何创建实例?
2.openstack默认几个flavor?
3.如何查看虚拟机状态?
1.生成密钥对
大多数 cloud images支持公钥授权而不是传统的用户名密码授权。在创建公钥前,你必须使用ssh-keygen生成公/私钥对。添加公钥到openstack环境中。
1.生效demo租户凭据
复制代码
内容如下:export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=ADMIN_PASS
export OS_AUTH_URL=http://controller:35357/v2.0 复制代码
2.生成密钥对
复制代码
3.添加公玥到openstack环境
nova keypair-add --pub-key ~/.ssh/id_rsa.pub demo-key 复制代码
4.核实添加的公玥
复制代码
输出下列内容:
root@controller:~# nova keypair-list
+----------+-------------------------------------------------+
| Name | Fingerprint |
+----------+-------------------------------------------------+
| demo-key | a1:23:cb:63:c6:0e:67:14:da:7e:89:a2:97:a4:3f:f9 |
+----------+-------------------------------------------------+ 复制代码
创建一个实例
创建实例,你至少指定flavor,镜像名称, 网络,安全组, key, 和实例名称.
1.一个flavor指定一个虚拟资源分配文件包括处理器、内存、存储
列出可用flavor
复制代码
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 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 |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ 复制代码
第一个实例,可以使用m1.tinyflavor.
2.列出可用镜像
复制代码
+--------------------------------------+---------------------+--------+--------+
| ID | Name | Status | Server |
+--------------------------------------+---------------------+--------+--------+
| 9ec0ceec-0629-406a-9069-159a8b59ea78 | cirros-0.3.3-x86_64 | ACTIVE | |
+--------------------------------------+---------------------+--------+--------+ 复制代码
第一个实例使用 cirros-0.3.3-x86_64镜像。
3.列出可用网络
复制代码
+--------------------------------------+----------+-----------------------------------------------------+
| id | name | subnets |
+--------------------------------------+----------+-----------------------------------------------------+
| 0028b1d7-07c9-468c-abf2-ccd4dc17b240 | ext-net | e6fab309-a8ff-4385-8b32-c942434414cf |
| 299e4203-135e-4305-8a9f-cdd4f4bda185 | demo-net | dfb5a684-e837-4556-8c29-c7e01ada590a 192.168.1.0/24 |
+--------------------------------------+----------+-----------------------------------------------------+ 复制代码
第一个实例使用demo-net 租户网络,尽管如此,你需要使用id,而不是使用name
4.列出有效安全组
复制代码
+--------------------------------------+---------+-------------+
| Id | Name | Description |
+--------------------------------------+---------+-------------+
| 177deb74-7479-40c3-a332-4811bc9326bf | default | default |
+--------------------------------------+---------+-------------+ 复制代码
第一个实例,使用默认安全组,这个安全组类似防火墙,阻止远程访问实例。如果拒绝远程访问实例,创建它,然后配置远程访问
5.创建实例
格式如下
nova boot --flavor m1.tiny --image cirros-0.3.3-x86_64 --nic net-id=DEMO_NET_ID \
--security-group default --key-name demo-key demo-instance1 复制代码
需要替换的内容:
DEMO_NET_ID 这里为:
nova boot --flavor m1.tiny --image cirros-0.3.3-x86_64 --nic net-id=6e0c30ab-1c32-4e8e-b08f-84cdf2521713 \
--security-group default --key-name demo-key demo-instance1 复制代码
6.检测实例状态
复制代码
这里遇到了创建实例不成功,并且ip地址也并没有显示。在后面会做一些相关说明
7.使用虚拟控制台访问实例
为实例获取一个 Virtual Network Computing (VNC) session url,并通过浏览器访问
nova get-vnc-console demo-instance1 novnc 复制代码
由于我这里有多个 demo-instance1,所以这里获取不到,使用id的方式获取。
nova get-vnc-console instance-ID novnc 复制代码
nova get-vnc-console 29e13b8a-9105-44aa-9b24-4cd9bef9a912 novnc 复制代码
+-------+---------------------------------------------------------------------------------+
| Type | Url |
+-------+---------------------------------------------------------------------------------+
| novnc | http://controller:6080/vnc_auto.html?token=58707002-24c3-4c3f-adc7-6ecbd1c97a53 |
+-------+---------------------------------------------------------------------------------+ 复制代码
获取的url为 http://controller:6080/vnc_auto.html?token=58707002-24c3-4c3f-adc7-6ecbd1c97a53 ,这里需要注意本地一定要配置host
否则不能访问,获知直接使用ip为
http://10.0.0.11 :6080/vnc_auto.html?token=58707002-24c3-4c3f-adc7-6ecbd1c97a53
也可以通过界面登录:
http://10.0.0.11/horizon
找到实例,如果控制台没有相应,则单击,下面图标即可
登录的用户名和密码都会有提示:用户名为:
cirros
密码为:
cubswin:)
验证 demo-net租户网关
复制代码
复制代码
############################################################
问题:
1.创建实例失败
Status处于BUILD状态,TASK State处于Scheduling状态,
由于实例的创建是由nova主要来完成的,因此nova的各个进程,一定要起来。
所以通过,查看有5个进程,结果好几个出了问题。
复制代码
这时候,就找到了问题的症结,剩下的就是到/var/log/nova下面查看日志了。
service nova-api restart
service nova-cert restart
service nova-consoleauth restart
service nova-scheduler restart
service nova-conductor restart
service nova-novncproxy restart
复制代码
然后重启,上面的服务。下面服务都正常,才可创建实例
2.openstack创建实例,获取不到ip地址,不能ping通网关
ping -c 4 192.168.1.1
ping不通网关,这里的原因很多,通过查看日志
应该是
ERROR neutron.plugins.openvswitch.agent.ovs_neutron_agent [req-54efa1c5-7808-4d75-a047-522c0e6ee052 None] Error while processing VIF ports 复制代码
错误,更多内容:
2015-02-23 18:22:12.346 1979 ERROR neutron.plugins.openvswitch.agent.ovs_neutron_agent [req-54efa1c5-7808-4d75-a047-522c0e6ee052 None] Error while processing VIF ports
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent Traceback (most recent call last):
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py", line 1406, in rpc_loop
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent ovs_restarted)
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py", line 1205, in process_network_ports
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent port_info.get('updated', set()))
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/neutron/agent/securitygroups_rpc.py", line 333, in setup_port_filters
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent self.prepare_devices_filter(new_devices)
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/neutron/agent/securitygroups_rpc.py", line 202, in decorated_function
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent return func(self, *args, **kwargs)
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/neutron/agent/securitygroups_rpc.py", line 210, in prepare_devices_filter
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent if self.use_enhanced_rpc:
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/neutron/agent/securitygroups_rpc.py", line 178, in use_enhanced_rpc
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent self._check_enhanced_rpc_is_supported_by_server())
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/neutron/agent/securitygroups_rpc.py", line 184, in _check_enhanced_rpc_is_supported_by_server
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent self.context, devices=[])
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/neutron/agent/securitygroups_rpc.py", line 103, in security_group_info_for_devices
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent version='1.2')
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/neutron/common/log.py", line 34, in wrapper
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent return method(*args, **kwargs)
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/neutron/common/rpc.py", line 161, in call
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent context, msg, rpc_method='call', **kwargs)
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/neutron/common/rpc.py", line 187, in __call_rpc_method
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent return func(context, msg['method'], **msg['args'])
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/oslo/messaging/rpc/client.py", line 152, in call
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent retry=self.retry)
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/oslo/messaging/transport.py", line 90, in _send
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent timeout=timeout, retry=retry)
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/oslo/messaging/_drivers/amqpdriver.py", line 408, in send
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent retry=retry)
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/oslo/messaging/_drivers/amqpdriver.py", line 397, in _send
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent result = self._waiter.wait(msg_id, timeout)
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/oslo/messaging/_drivers/amqpdriver.py", line 285, in wait
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent reply, ending = self._poll_connection(msg_id, timeout)
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/dist-packages/oslo/messaging/_drivers/amqpdriver.py", line 235, in _poll_connection
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent % msg_id)
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent MessagingTimeout: Timed out waiting for a reply to message ID cef18a2f5cea4036967ddef86eed4cf1
2015-02-23 18:22:12.346 1979 TRACE neutron.plugins.openvswitch.agent.ovs_neutron_agent
2015-02-23 18:22:12.404 1979 INFO neutron.plugins.openvswitch.agent.ovs_neutron_agent [req-54efa1c5-7808-4d75-a047-522c0e6ee052 None] Agent out of sync with plugin!
2015-02-23 18:22:12.708 1979 INFO neutron.agent.securitygroups_rpc [req-54efa1c5-7808-4d75-a047-522c0e6ee052 None] Preparing filters for devices set([u'92df61ad-21b3-4697-9658-7299193ebc97'])
2015-02-23 18:22:14.019 1979 INFO neutron.plugins.openvswitch.agent.ovs_neutron_agent [req-54efa1c5-7808-4d75-a047-522c0e6ee052 None] Port 92df61ad-21b3-4697-9658-7299193ebc97 updated. Details: {u'profile': {}, u'admin_state_up': True, u'network_id': u'299e4203-135e-4305-8a9f-cdd4f4bda185', u'segmentation_id': 1, u'device_owner': u'compute:None', u'physical_network': None, u'mac_address': u'fa:16:3e:50:2d:43', u'device': u'92df61ad-21b3-4697-9658-7299193ebc97', u'port_id': u'92df61ad-21b3-4697-9658-7299193ebc97', u'fixed_ips': [{u'subnet_id': u'dfb5a684-e837-4556-8c29-c7e01ada590a', u'ip_address': u'192.168.1.2'}], u'network_type': u'gre'}
2015-02-23 18:22:14.021 1979 INFO neutron.plugins.openvswitch.agent.ovs_neutron_agent [req-54efa1c5-7808-4d75-a047-522c0e6ee052 None] Assigning 1 as local vlan for net-id=299e4203-135e-4305-8a9f-cdd4f4bda185
2015-02-23 18:22:14.467 1979 INFO neutron.plugins.openvswitch.agent.ovs_neutron_agent [req-54efa1c5-7808-4d75-a047-522c0e6ee052 None] Configuration for device 92df61ad-21b3-4697-9658-7299193ebc97 completed. 复制代码
为什么会产生上面的问题,原因真不少。
比如你的网卡ip地址是否有问题。你的dhpc agent是否有问题,RabbitMQ 是否正常。
这些都会产生获取不到ip的情况。
我这里则是dhcp agent的问题。
进行下面配置(网络节点)
1.编辑文件 /etc/neutron/dhcp_agent.ini,完成下面内容。
a.在 [DEFAULT] 部分,配置驱动,启用命名空间和启用删除废弃的命名空间
[DEFAULT]
...
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
use_namespaces = True
dhcp_delete_namespaces = True 复制代码
更多内容参考
openstack【juno】入门 【网络篇】十六:neutron安装部署(网络节点)
相关内容:
openstack【juno】入门 【准备篇】零:整体介绍
openstack【juno】入门 【准备篇】一: Ubuntu14.04远程连接(ssh安装)
openstack【juno】入门 【准备篇】二::NTP安装
openstack【juno】入门 【准备篇】三:mysql(MariaDB)安装
openstack【juno】入门 【准备篇】四::RabbitMQ 安装
openstack【juno】入门 【keystone篇】五::Keystone部署及介绍
openstack【juno】入门 【keystone篇】六::Keystone使用及遇到问题解决办法
openstack【juno】入门 【keystone篇】七:创建 service entity 和 API endpoint
openstack【juno】入门 【keystone篇】八:新手操作篇(验证操作篇)
openstack【juno】入门 【keystone篇】九:创建openstack客户端环境变量脚本
openstack【juno】入门 【glance 篇】十:glance初步介绍
openstack【juno】入门 【glance 篇】十一:glance安装配置
openstack【juno】入门 【glance 篇】十二:glance安装配置验证及相关操作
openstack【juno】入门 【nova 篇】十三(1):nova简单介绍
openstack【juno】入门 【nova 篇】十三(2):安装配置计算服务
openstack【juno】入门 【网络篇】十四:neutron介绍
openstack【juno】入门 【网络篇】十五:neutron安装部署(控制节点)
openstack【juno】入门 【网络篇】十六:neutron安装部署(网络节点)
openstack【juno】入门 【网络篇】十七:neutron安装部署(计算节点)
openstack【juno】入门 【网络篇】十八:创建实例化网络
openstack【juno】入门 【dashboard篇】十九:添加dashboard
openstack【juno】入门 【cinder篇】二十:cinder介绍及安装配置【控制节点】
openstack【juno】入门 【cinder篇】二十一:安装配置块存储节点(cinder)
openstack【juno】入门 【swift篇】二十二:对象存储安装配置【控制节点】
openstack【juno】入门 【swift篇】二十三:安装配置swift节点
openstack【juno】入门 【swift篇】二十四:创建初始rings
openstack【juno】入门 【swift篇】二十五:验证安装(控制节点)
openstack【juno】入门 【实例篇】二十六:创建实例(neutron)
openstack【juno】入门 【总结篇】二十七:openstack排除故障及常见问题记录
openstack【juno】入门 【总结篇】二十八:keystone及网络总结