openstackcreatevm步骤-创新互联

一、查看信息

站在用户的角度思考问题,与客户深入沟通,找到大安市网站设计与大安市网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都网站设计、网站制作、企业官网、英文网站、手机端网站、网站推广、域名申请、虚拟空间、企业邮箱。业务覆盖大安市地区。

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)]#

openstack create vm步骤
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)]#

openstack create vm步骤
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 |
+--------------------------------------+-----------+--------+

openstack create vm步骤
由于默认的镜像大小不对,创建虚拟机会报错,这里上传了新的镜像,具体操作请看“故障处理”。
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 |
+--------------------------------------+---------+--------------------------------------+

openstack create vm步骤
二、创建虚拟机
1)通过openstack界面创建
openstack create vm步骤

openstack create vm步骤

openstack create vm步骤
2)查看虚拟机
openstack create vm步骤

3)通过VNC进入虚拟机操作系统
openstack create vm步骤

openstack create vm步骤

三、故障排除
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 create vm步骤
通过命令上传:

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)]#

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网页名称:openstackcreatevm步骤-创新互联
文章URL:http://csdahua.cn/article/dppjec.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流