您好,登錄后才能下訂單哦!
一、查看信息
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。