一、查看信息
1)鉴权
[root@rong ~]# cat keystonerc_admin
unset OS_SERVICE_TOKEN
export OS_USERNAME=admin
export OS_PASSWORD='8d07f364025d414e'
export OS_REGION_NAME=RegionOne
export OS_AUTH_URL=http://192.168.222.128:5000/v3
export PS1='[\u@\h \W(keystone_admin)]\$ '
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_IDENTITY_API_VERSION=3
[root@rong ~]# source keystonerc_admin
[root@rong ~(keystone_admin)]#
2)查看规格,下列规格是默认有的
[root@rong ~(keystone_admin)]# openstack flavor list
+----+-----------+-------+------+-----------+-------+-----------+
| ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+-----------+-------+------+-----------+-------+-----------+
| 1 | m1.tiny | 512 | 1 | 0 | 1 | True |
| 2 | m1.small | 2048 | 20 | 0 | 1 | True |
| 3 | m1.medium | 4096 | 40 | 0 | 2 | True |
| 4 | m1.large | 8192 | 80 | 0 | 4 | True |
| 5 | m1.xlarge | 16384 | 160 | 0 | 8 | True |
+----+-----------+-------+------+-----------+-------+-----------+
[root@rong ~(keystone_admin)]#
3)查看镜像
[root@rong ~(keystone_admin)]# openstack image list
+--------------------------------------+-----------+--------+
| ID | Name | Status |
+--------------------------------------+-----------+--------+
| fd04d446-f1cb-4aa8-9f72-f414a71faefc | cirros | active |
| 587655c8-87ea-4c3f-bdba-41a763667d57 | cirrosnew | active |
+--------------------------------------+-----------+--------+
由于默认的镜像大小不对,创建虚拟机会报错,这里上传了新的镜像,具体操作请看“故障处理”。
4)查看网络
[root@rong ~(keystone_admin)]# openstack network list
+--------------------------------------+---------+--------------------------------------+
| ID | Name | Subnets |
+--------------------------------------+---------+--------------------------------------+
| 573ad869-aa73-4c8c-a57c-033590c4f8f1 | private | 1f5a428e-e7f4-430b-9bdd-adedf2692d5b |
| 6aa84627-9631-4c2c-8549-2fc7880d8d18 | public | ae58274e-eaf3-467f-adc1-dec7b39a3084 |
+--------------------------------------+---------+--------------------------------------+
二、创建虚拟机
1)通过openstack界面创建
2)查看虚拟机
3)通过VNC进入虚拟机操作系统
三、故障排除
1)OpenStack报错:Host is not mapped to any cell
通过命令创建虚拟机报错:Host is not mapped to any cell,通过执行nova-manage cell_v2 discover_hosts --verbose后,可以创建虚拟机。
参考:https://blog.51cto.com/3241766/2328408
2)openstack vnc报错:failed to connect to server (code: 1006)
在vmware中使用火狐登陆openstack,通过VNC登陆,报错failed to connect to server (code: 1006),通过在/etc/hosts中添加主机名和IP地址解析后,可以打开VNC。
参考:https://blog.51cto.com/01000/1926756
3)默认的cirror镜像有问题导致创建虚拟机报错
故障排除思路:刚开始通过命令创建虚拟机可以运行,但通过界面创建虚拟机报did not finish being created even after we waited 22 seconds的错误,查看磁盘也是错误的,还以为cinder没配置好,但单独创建磁盘又是正常的,再看了cinder的日志,发现lvm': Image is not in qcow2 format,查看默认的镜像,发现镜像只有4k,而cirros正常应该是13M左右,于是上传新的cirros,再次创建虚拟机,问题解决。
grep ERROR /var/log/nova/nova-compute.log
2020-03-07 01:08:45.770 39342 ERROR nova.compute.manager [req-bb578158-d197-49c6-b175-3aea0c9c5dad 25fccd945563495ba21acd0abea6fdbe 7f63d6be4a7c446a831f4a4d0bcc8201 - default default] [instance: e4234603-8aee-45f2-90ac-948761dd5b2a] Build of instance e4234603-8aee-45f2-90ac-948761dd5b2a aborted: Volume 3c39cc33-dd25-4eef-bd1c-b51dc9caa724 did not finish being created even after we waited 22 seconds or 7 attempts. And its status is error.: BuildAbortException: Build of instance e4234603-8aee-45f2-90ac-948761dd5b2a aborted: Volume 3c39cc33-dd25-4eef-bd1c-b51dc9caa724 did not finish being created even after we waited 22 seconds or 7 attempts. And its status is error.
grep ERROR /var/log/cinder/volume.log
2020-03-07 01:20:43.686 4216 ERROR cinder.volume.flows.manager.create_volume [req-2bdb180a-5236-4c78-b9f9-45a55dae1784 25fccd945563495ba21acd0abea6fdbe 7f63d6be4a7c446a831f4a4d0bcc8201 - default default] Volume 8a015ea9-b34a-47a8-86b7-f40721b279cd: create failed
2020-03-07 01:20:43.708 4216 ERROR oslo_messaging.rpc.server [req-2bdb180a-5236-4c78-b9f9-45a55dae1784 25fccd945563495ba21acd0abea6fdbe 7f63d6be4a7c446a831f4a4d0bcc8201 - default default] Exception during message handling: ImageCopyFailure: Failed to copy image to volume: qemu-img: Could not open '/var/lib/cinder/conversion/tmpx_Egn4rong@lvm': Image is not in qcow2 format
通过winscp上传新镜像cirros-0.4.0-x86_64-disk.img:
通过命令上传:
openstack image create "cirrosnew" \
--file cirros-0.3.5-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--public
[root@rong ~(keystone_admin)]# openstack image show cirrosnew
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum | 443b7623e27ecf03dc9e01ee93f67afe |
| container_format | bare |
| created_at | 2020-03-07T10:11:31Z |
| disk_format | qcow2 |
| file | /v2/images/587655c8-87ea-4c3f-bdba-41a763667d57/file |
| id | 587655c8-87ea-4c3f-bdba-41a763667d57 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirrosnew |
| owner | 7f63d6be4a7c446a831f4a4d0bcc8201 |
| properties | os_hash_algo='sha512', os_hash_value='6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78', os_hidden='False' |
| protected | False |
| schema | /v2/schemas/image |
| size | 12716032 |
| status | active |
| tags | |
| updated_at | 2020-03-07T10:11:33Z |
| virtual_size | None |
| visibility | public |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@rong ~(keystone_admin)]#
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。