openstack--Build of instance aborted: Volume resource quota exceeded

前言

创建虚拟机出错,报错日志如下
openstack--Build of instance aborted: Volume resource quota exceeded_第1张图片

2020-02-17 14:30:04.667 17107 WARNING nova.compute.manager [req-c2eab55a-7588-4191-9a97-eaac21b16553 ee34dd53da7b4ceaa62f0c2667edb4d6 921ac80ffd364fc0b347ecc4e68ba5c5 - - -] [instance: 5f02407d-c620-45f4-9015-54c0ebc13393] Failed to create block device for instance due to being over volume resource quota
2020-02-17 14:30:05.338 17107 ERROR nova.compute.manager [req-c2eab55a-7588-4191-9a97-eaac21b16553 ee34dd53da7b4ceaa62f0c2667edb4d6 921ac80ffd364fc0b347ecc4e68ba5c5 - - -] [instance: 5f02407d-c620-45f4-9015-54c0ebc13393] Build of instance 5f02407d-c620-45f4-9015-54c0ebc13393 aborted: Volume resource quota exceeded

这是由于卷volume的数量超过配额引起的,之前创建了不少volume作为存储端的虚拟机,删除了虚拟机,但是volume没有删除。

[root@controller03 iso]# nova volume-list
WARNING: Command volume-list is deprecated and will be removed after Nova 13.0.0 is released. Use python-cinderclient or openstackclient instead.
+--------------------------------------+-----------+--------------+------+-------------+--------------------------------------+
| ID                                   | Status    | Display Name | Size | Volume Type | Attached to                          |
+--------------------------------------+-----------+--------------+------+-------------+--------------------------------------+
| cd4a3249-5608-40af-8b00-a718db35a894 | available |              | 20   | -           |                                      |
| 2c7f536b-972d-47ab-853e-bc327d4408cb | available |              | 20   | -           |                                      |
| e90b69d1-dc01-42c7-ad8e-b605652be1a8 | available |              | 20   | -           |                                      |
| a4345881-2010-4650-8cfb-d612a5e9fa71 | available |              | 20   | -           |                                      |
| 8f33330b-89b6-4d58-be8c-754436e780c9 | available |              | 20   | -           |                                      |
| 55a469a2-112c-4577-bdf7-5954a84296ef | available |              | 20   | -           |                                      |
| 12ac4ac0-5546-45da-ba6a-cbbbb32c8cfa | available |              | 20   | -           |                                      |
| 82d641fa-3bf1-4ad3-97e0-a95d30401832 | available |              | 20   | -           |                                      |
| 44284a66-926b-4912-a2c8-d448d0ccbe2c | available |              | 20   | huayun      |                                      |
| 995e701a-f772-4758-8c51-f41825e55040 | in-use    |              | 20   | -           | f25b5641-e049-4de1-9ad0-f3b7c2a9d84b |
+--------------------------------------+-----------+--------------+------+-------------+--------------------------------------+

用命令行查看确实有很多僵尸卷。
解决的办法是从volume启动虚拟机时,加上shutdown=remove的参数,这样删除虚拟机时,默认也删除卷。

#!/usr/bin/env bash
source /root/admin-openrc

system_image_id=4e26cfb0-7539-46ca-af93-40af43cea2cf

vm_name=$1

nova boot \
  --min-count 1 \
  --max-count 1 \
  --flavor  2  \
  --block-device source=blank,dest=volume,size=20,bootindex=0,shutdown=remove \
  --availability-zone nova:controller02 \
  --nic net-id=15445b21-3a06-4e54-8815-88f2c04cdb10  \
  $vm_name

  #--image $system_image_id \

[root@controller03 iso]# nova show win10
+--------------------------------------+---------------------------------------------------------------------------------+
| Property                             | Value                                                                           |
+--------------------------------------+---------------------------------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                                          |
| OS-EXT-AZ:availability_zone          | nova                                                                            |
| OS-EXT-SRV-ATTR:host                 | controller02                                                                    |
| OS-EXT-SRV-ATTR:hostname             | win10                                                                           |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | controller02                                                                    |
| OS-EXT-SRV-ATTR:instance_name        | instance-000000ad                                                               |
| OS-EXT-SRV-ATTR:kernel_id            |                                                                                 |
| OS-EXT-SRV-ATTR:launch_index         | 0                                                                               |
| OS-EXT-SRV-ATTR:ramdisk_id           |                                                                                 |
| OS-EXT-SRV-ATTR:reservation_id       | r-61pk3nyf                                                                      |
| OS-EXT-SRV-ATTR:root_device_name     | /dev/vda                                                                        |
| OS-EXT-SRV-ATTR:user_data            | -                                                                               |
| OS-EXT-STS:power_state               | 1                                                                               |
| OS-EXT-STS:task_state                | -                                                                               |
| OS-EXT-STS:vm_state                  | active                                                                          |
| OS-SRV-USG:launched_at               | 2020-02-17T08:40:44.000000                                                      |
| OS-SRV-USG:terminated_at             | -                                                                               |
| accessIPv4                           |                                                                                 |
| accessIPv6                           |                                                                                 |
| config_drive                         |                                                                                 |
| created                              | 2020-02-17T08:40:29Z                                                            |
| description                          | -                                                                               |
| flavor                               | m1.small (2)                                                                    |
| hostId                               | bd0c4cf41265f5e1e5411d45a3ba93aa309314b704539d31f63bcb2b                        |
| host_status                          | UP                                                                              |
| id                                   | 28145220-fe4a-477b-991c-506de5234c5e                                            |
| image                                | Attempt to boot from volume - no image supplied                                 |
| iso                                  |                                                                                 |
| key_name                             | -                                                                               |
| locked                               | False                                                                           |
| metadata                             | {}                                                                              |
| name                                 | win10                                                                           |
| net02 network                        | 10.0.53.216                                                                     |
| os-extended-volumes:volumes_attached | [{"id": "024bb78f-c8d6-4135-b95f-4da8bb750fe0", "delete_on_termination": true}] |
| os-pci:pci_devices                   | []                                                                              |
| progress                             | 0                                                                               |
| security_groups                      | default                                                                         |
| status                               | ACTIVE                                                                          |
| tenant_id                            | 921ac80ffd364fc0b347ecc4e68ba5c5                                                |
| updated                              | 2020-02-17T08:40:44Z                                                            |
| user_id                              | ee34dd53da7b4ceaa62f0c2667edb4d6                                                |
+--------------------------------------+---------------------------------------------------------------------------------+

可以看到"delete_on_termination": true,删除虚拟机时,卷也会删除。

你可能感兴趣的:(openstack,linux,openstack)