Openstack-Devstack: Can't create instance, There are not enough hosts available [closed]

人盡茶涼 提交于 2019-12-03 20:32:01

Since you say that this is a devstack installation, I'm assuming that you aren't running this in a production environment. Openstack allows users to bump up their over-subscription ratio for the RAM. By default, it is kept at 1.5 times the physical RAM available in the machine. Hence, it should be 12 Gb of usable memory. To change the subscription ratio:

sudo vim /etc/nova/nova.conf
#Add these two lines
ram_allocation_ratio=2
cpu_allocation_ratio=20 # Default value here is 16

These values are just a rough estimate. Change the values around to make them work for your environment. Restart the Devstack.

To check if the changes were made, log into mysql (or whichever DB is supporting devstack) and check:

mysql> use nova;
mysql> select * from compute_nodes \G;
*************************** 1. row ***************************
      created_at: 2015-09-25 13:52:55
      updated_at: 2016-02-03 18:32:49
      deleted_at: NULL
              id: 1
      service_id: 7
           vcpus: 8
       memory_mb: 12007
        local_gb: 446
      vcpus_used: 6
  memory_mb_used: 8832
   local_gb_used: 80
 hypervisor_type: QEMU
    disk_available_least: 240
     free_ram_mb: 3175
    free_disk_gb: 366
    current_workload: 0
     running_vms: 4
       pci_stats: NULL
         metrics: []
.....
1 row in set (0.00 sec)

The Scheduler looks at the free_ram_mb. If you have a free_ram_mb of 3175 and if you want to run a new m1.medium instance with 4096M of memory, the Scheduler will end up with this message in the logs:

WARNING nova.scheduler.manager Failed to schedule_run_instance: No valid host was found.

Hence, make sure to keep an eye out for those when starting a new VM after making those changes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!