Custom Search

Wednesday, May 14, 2014

SOLVED:OpenStack raise exception.NoValidHost(reason=msg)

Error
======
 File "/opt/stack/nova/nova/scheduler/manager.py", line 147, in run_instance
    legacy_bdm_in_spec)
  File "/opt/stack/nova/nova/scheduler/filter_scheduler.py", line 85, in schedule_run_instance
    filter_properties, instance_uuids)
  File "/opt/stack/nova/nova/scheduler/filter_scheduler.py", line 306, in _schedule
    self._populate_retry(filter_properties, properties)
  File "/opt/stack/nova/nova/scheduler/filter_scheduler.py", line 275, in _populate_retry
    raise exception.NoValidHost(reason=msg)

Debug
========
a)
Please check the log of nova scheduler
#vim ~/openstack/screen_dir/screen-n-sch.log
OR
Run "#screen -x" and look for the log of "n-sch"

Example of Error from nova scheduler with instance type "m1.small"
------------------------------------------------------------
2014-05-14 18:33:24.289 ^[[01;31mERROR nova.scheduler.filter_scheduler [^[[01;36mreq-663c07af-9897-4a18-9845-3d6ab3e2051d ^[[00;36mdemo demo^[[01;31m] ^[[01;35m[instance: 69414072-8dc9-4be8-9439-c145ee4b4f42] ^[[01;31mError from last host: ubuntu (node ubuntu): [u'Traceback (most recent call last):\n', u'  File "/opt/stack/nova/nova/compute/manager.py", line 1044, in _build_instance\n    set_access_ip=set_access_ip)\n', u'  File "/opt/stack/nova/nova/compute/manager.py", line 1427, in _spawn\n    LOG.exception(_(\'Instance failed to spawn\'), instance=instance)\n', u'  File "/opt/stack/nova/nova/compute/manager.py", line 1424, in _spawn\n    block_device_info)\n', u'  File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 2091, in spawn\n    block_device_info, context=context)\n', u'  File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 3249, in _create_domain_and_network\n    domain = self._create_domain(xml, instance=instance, power_on=power_on)\n', u'  File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 3192, in _create_domain\n    domain.XMLDesc(0))\n', u'  File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 3187, in _create_domain\n    domain.createWithFlags(launch_flags)\n', u'  File "/usr/local/lib/python2.7/dist-packages/eventlet/tpool.py", line 179, in doit\n    result = proxy_call(self._autowrap, f, *args, **kwargs)\n', u'  File "/usr/local/lib/python2.7/dist-packages/eventlet/tpool.py", line 139, in proxy_call\n    rv = execute(f,*args,**kwargs)\n', u'  File "/usr/local/lib/python2.7/dist-packages/eventlet/tpool.py", line 77, in tworker\n    rv = meth(*args,**kwargs)\n', u'  File "/usr/lib/python2.7/dist-packages/libvirt.py", line 581, in createWithFlags\n    if ret == -1: raise libvirtError (\'virDomainCreateWithFlags() failed\', dom=self)\n', u'libvirtError: internal error Process exited while reading console log output: char device redirected to /dev/pts/49\nFailed to allocate 2147483648 B: Cannot allocate memory\n\n']^[[00m
2014-05-14 18:33:24.290 ^[[01;33mWARNING nova.scheduler.utils [^[[01;36mreq-663c07af-9897-4a18-9845-3d6ab3e2051d ^[[00;36mdemo demo^[[01;33m] ^[[01;35m^[[01;33mFailed to scheduler_run_instance: No valid host was found. Exceeded max scheduling attempts 3 for instance 69414072-8dc9-4be8-9439-c145ee4b4f42^[[00m
2014-05-14 18:33:24.293 ^[[00;32mDEBUG stevedore.extension [^[[00;36m-^[[00;32m] ^[[01;35m^[[00;32mfound extension EntryPoint.parse('file = nova.image.download.file')^[[00m ^[[00;33mfrom (pid=19203) _load_plugins /usr/local/lib/python2.7/dist-packages/stevedore/extension.py:156^[[00m
2014-05-14 18:33:24.294 ^[[00;32mDEBUG stevedore.extension [^[[00;36m-^[[00;32m] ^[[01;35m^[[00;32mfound extension EntryPoint.parse('file = nova.image.download.file')^[[00m ^[[00;33mfrom (pid=19203) _load_plugins /usr/local/lib/python2.7/dist-packages/stevedore/extension.py:156^[[00m
2014-05-14 18:33:24.294 ^[[01;33mWARNING nova.scheduler.utils [^[[01;36mreq-663c07af-9897-4a18-9845-3d6ab3e2051d ^[[00;36mdemo demo^[[01;33m] ^[[01;35m[instance: 69414072-8dc9-4be8-9439-c145ee4b4f42] ^[[01;33mSetting instance to ERROR state.^[[00m

b)
Location of code
Open /opt/stack/nova/nova/scheduler/filter_scheduler.py
and check the methods "def schedule_run_instance" and "def _schedule" 


Solution
=======
If the memory of Host is: <= 2048 MB, try with InstanceType: m1.micro

saju@ubuntu:~/openstack$ nova flavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1  | m1.tiny   | 512       | 1    | 0         |      | 1     | 1.0         | True      |
| 2  | m1.small  | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
| 3  | m1.medium | 4096      | 40   | 0         |      | 2     | 1.0         | True      |
| 4  | m1.large  | 8192      | 80   | 0         |      | 4     | 1.0         | True      |
| 42 | m1.nano   | 64        | 0    | 0         |      | 1     | 1.0         | True      |
| 5  | m1.xlarge | 16384     | 160  | 0         |      | 8     | 1.0         | True      |
| 84 | m1.micro  | 128       | 0    | 0         |      | 1     | 1.0         | True      |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
saju@ubuntu:~/openstack$

Notes
======
* Usually means that the instance trying to be launched can't be scheduled to
any nova-compute nodes. The log message should include a reason why though.

* nova-scheduler has lots of filters to check if nova-compute node fit
the requirement of the instance you wanna launch.
Like availability-zone filter, RAM filter, cpu core filter, etc. If all the
compute node failed to pass those filters, it raise this exception.

No comments:

Post a Comment