Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RDO tickets are now tracked in Jira https://issues.redhat.com/projects/RDO/issues/

Bug 1154152

Summary: [nova] hw:numa_nodes=0 causes divide by zero
Product: [Community] RDO Reporter: Joe Talerico <jtaleric>
Component: openstack-novaAssignee: Eoghan Glynn <eglynn>
Status: CLOSED EOL QA Contact: Shai Revivo <srevivo>
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: berrange, dasmith, eglynn, jtaleric, kchamart, rbryant, sbauza, sferdjao, sgordon, srevivo, vromanso
Target Milestone: ---   
Target Release: Juno   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-19 15:40:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joe Talerico 2014-10-17 16:47:38 UTC
Description of problem:
Setting flavor to use hw:numa_nodes=0 causes nova boot error. 

Version-Release number of selected component (if applicable):
rdo-juno

How reproducible:
100%

Steps to Reproduce:
1. nova flavor-key m1.medium set hw:numa_nodes=0
2. launch a guest using m1.medium


Actual results:
2014-10-17 11:50:47.091 14413 ERROR nova.api.openstack [req-9e0efd58-56e4-4810-9547-5e21c3dcc287 None] Caught error: long division or modulo by zero
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack Traceback (most recent call last):
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/nova/api/openstack/__init__.py", line 124, in __call__
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     return req.get_response(self.application)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/webob/request.py", line 1296, in send
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     application, catch_exc_info=False)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/webob/request.py", line 1260, in call_application
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     app_iter = application(self.environ, start_response)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/webob/dec.py", line 144, in __call__
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     return resp(environ, start_response)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/keystonemiddleware/auth_token.py", line 748, in __call__
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     return self._call_app(env, start_response)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/keystonemiddleware/auth_token.py", line 684, in _call_app
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     return self._app(env, _fake_start_response)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/webob/dec.py", line 144, in __call__
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     return resp(environ, start_response)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/webob/dec.py", line 144, in __call__
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     return resp(environ, start_response)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/routes/middleware.py", line 131, in __call__
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     response = self.app(environ, start_response)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/webob/dec.py", line 144, in __call__
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     return resp(environ, start_response)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     resp = self.call_func(req, *args, **self.kwargs)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     return self.func(req, *args, **kwargs)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/nova/api/openstack/wsgi.py", line 908, in __call__
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     content_type, body, accept)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/nova/api/openstack/wsgi.py", line 973, in _process_stack
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     action_result = self.dispatch(meth, request, action_args)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/nova/api/openstack/wsgi.py", line 1057, in dispatch
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     return method(req=request, **action_args)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/servers.py", line 958, in create
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     check_server_group_quota=check_server_group_quota)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/nova/hooks.py", line 131, in inner
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     rv = f(*args, **kwargs)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1447, in create
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     check_server_group_quota=check_server_group_quota)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1069, in _create_instance
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     max_count)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 787, in _validate_and_build_base_options
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     instance_type, boot_meta.get('properties', {}))
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/nova/virt/hardware.py", line 824, in get_constraints
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     nodes, flavor, image_meta)
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack   File "/usr/lib/python2.7/site-packages/nova/virt/hardware.py", line 781, in _get_constraints_auto
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack     if ((flavor['vcpus'] % nodes) > 0 or
2014-10-17 11:50:47.091 14413 TRACE nova.api.openstack ZeroDivisionError: long division or modulo by zero

Expected results:
ERROR when setting flavor to numa_nodes=0

Comment 1 Kashyap Chamarthy 2014-12-15 15:11:35 UTC
I just tested with Nova git master

  $ git describe
  2014.2-1435-gbb16f77

And, seems like it *does* allow me to boot a Nova instance successfully with hw:numa_nodes=0, with a Nova guest XML like that[*]. But talking with Daniel Berrnage and Nikola Dipanov on IRC:

  <danpb> hmm, i'm not convinced we should allow nodes=0 at all
  <danpb> we should default  1 node if nothing is specified
  <danpb> We should refuse a vlaue of 0, in case we wish to make use 
   of that as a special value at a later date
  <danpb> we don't want people relying on  numa_nodes=0  accidentally
   working for them now
  <nikola> danpb, correct


I filed an upstream bug with a link to this bug

  https://bugs.launchpad.net/nova/+bug/1402709 -- Report an error when booting an instance with a flavor which has NUMA nodes is set to 0 (hw:numa_nodes=0)


[*] Nova guest XML with an instance booted with hw:numa_nodes=0
-----------------------------------------------------------------------------
<domain type='kvm' id='3'>
  <name>instance-00000004</name>
  <uuid>593f8388-ac9c-4673-b1c7-aa49b1ce83f0</uuid>
  <metadata>
    <nova:instance xmlns:nova="http://openstack.org/xmlns/libvirt/nova/1.0">
      <nova:package version="2015.1"/>
      <nova:name>cirrvm4</nova:name>
      <nova:creationTime>2014-12-15 14:41:43</nova:creationTime>
      <nova:flavor name="m1.tiny">
        <nova:memory>512</nova:memory>
        <nova:disk>1</nova:disk>
        <nova:swap>0</nova:swap>
        <nova:ephemeral>0</nova:ephemeral>
        <nova:vcpus>1</nova:vcpus>
      </nova:flavor>
      <nova:owner>
        <nova:user uuid="0d5623bdae83445ba3a6209ea849fffe">admin</nova:user>
        <nova:project uuid="f9ecf22769cf4ab98543f5ade1454664">admin</nova:project>
      </nova:owner>
      <nova:root type="image" uuid="5bc9a92b-6cda-4916-9bb0-dd9751880cde"/>
    </nova:instance>
  </metadata>
  <memory unit='KiB'>524288</memory>
  <currentMemory unit='KiB'>524288</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0-3'/>
    <emulatorpin cpuset='0-3'/>
  </cputune>
  <numatune>
    <memory mode='strict' nodeset='0'/>
    <memnode cellid='0' mode='strict' nodeset='0'/>
  </numatune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <sysinfo type='smbios'>
    <system>
      <entry name='manufacturer'>OpenStack Foundation</entry>
      <entry name='product'>OpenStack Nova</entry>
      <entry name='version'>2015.1</entry>
      <entry name='serial'>bf6b5391-2390-df4f-b3dc-aa80d05468bb</entry>
      <entry name='uuid'>593f8388-ac9c-4673-b1c7-aa49b1ce83f0</entry>
    </system>
  </sysinfo>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.2'>hvm</type>
    <boot dev='hd'/>
    <smbios mode='sysinfo'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu>
    <topology sockets='1' cores='1' threads='1'/>
    <numa>
      <cell id='0' cpus='0' memory='524288' unit='KiB'/>
    </numa>
  </cpu>
  <clock offset='utc'>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/home/kashyapc/src/cloud/data/nova/instances/593f8388-ac9c-4673-b1c7-aa49b1ce83f0/disk'/>
      <backingStore type='file' index='1'>
        <format type='raw'/>
        <source file='/home/kashyapc/src/cloud/data/nova/instances/_base/03a663c2a1c649fe0854f01c82c0ddb3871cf691'/>
        <backingStore/>
      </backingStore>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/home/kashyapc/src/cloud/data/nova/instances/593f8388-ac9c-4673-b1c7-aa49b1ce83f0/disk.config'/>
      <backingStore/>
      <target dev='hdd' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-1'/>
      <address type='drive' controller='0' bus='1' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='fa:16:3e:79:6c:b8'/>
      <source bridge='qbr7584d9fb-e1'/>
      <target dev='tap7584d9fb-e1'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </interface>
    <serial type='file'>
      <source path='/home/kashyapc/src/cloud/data/nova/instances/593f8388-ac9c-4673-b1c7-aa49b1ce83f0/console.log'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <serial type='pty'>
      <source path='/dev/pts/19'/>
      <target port='1'/>
      <alias name='serial1'/>
    </serial>
    <console type='file'>
      <source path='/home/kashyapc/src/cloud/data/nova/instances/593f8388-ac9c-4673-b1c7-aa49b1ce83f0/console.log'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
      <stats period='10'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>system_u:system_r:svirt_t:s0:c79,c658</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c79,c658</imagelabel>
  </seclabel>
</domain>
-----------------------------------------------------------------------------

Comment 4 Chandan Kumar 2016-05-19 15:40:02 UTC
This bug is against a Version which has reached End of Life.
If it's still present in supported release (http://releases.openstack.org), please update Version and reopen.