Bug 883214

Summary: CPU speed filtering in hostRequires does not work when it's float value
Product: [Retired] Beaker Reporter: Qixiang Wan <qwan>
Component: schedulerAssignee: Qixiang Wan <qwan>
Status: CLOSED CURRENTRELEASE QA Contact: Dan Callaghan <dcallagh>
Severity: low Docs Contact:
Priority: low    
Version: 0.10CC: asaha, dcallagh, mishin, qwan, rglasz, rmancy
Target Milestone: 0.11   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-17 04:34:20 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 Qixiang Wan 2012-12-04 03:58:21 UTC
Description of problem:

Typo in XmlCpuSpeed class (bkr.server.needpropertyxml):

value = self.get_xml_attr('value', int, None)

where 'int' should be float.

mysql> describe cpu speed;
+-------+-------+------+-----+---------+-------+
| Field | Type  | Null | Key | Default | Extra |
+-------+-------+------+-----+---------+-------+
| speed | float | YES  |     | NULL    |       |
+-------+-------+------+-----+---------+-------+

Traceback while using float value in cpu speed filtering:

Traceback (most recent call last):
  File "/root/devel/beaker/IntegrationTests/src/bkr/inttest/server/test_model.py", line 53, in test_cpu_speed
    """))
  File "/root/devel/beaker/Server/bkr/server/model.py", line 3056, in systems_filter
    systems = apply_system_filter(filter, systems)
  File "/root/devel/beaker/Server/bkr/server/needpropertyxml.py", line 907, in apply_system_filter
    (query, clause) = child.filter(query)
  File "/root/devel/beaker/Server/bkr/server/needpropertyxml.py", line 105, in filter
    (joins, query) = child.filter(joins)
  File "/root/devel/beaker/Server/bkr/server/needpropertyxml.py", line 667, in filter
    value = self.get_xml_attr('value', int, None)
  File "/root/devel/beaker/Server/bkr/server/needpropertyxml.py", line 81, in get_xml_attr
    return typeCast(attributes[attr])
ValueError: invalid literal for int() with base 10: '1500.0'



Version-Release number of selected component (if applicable):
beaker-0.10

How reproducible:
100%

Steps to Reproduce:
1. submit a job with float value of cpu speed in hostRequires, like
    <hostRequires>
        <cpu>
            <speed value="1500.0"/>
        </cpu>
    </hostRequires>


  
Actual results:

error message:

Failed to import job because of: "Error in hostRequires: invalid literal for int() with base 10: '1500.0'"

Expected results:
float value in cpu speed filtering should work.

Additional info:

Comment 1 Qixiang Wan 2012-12-04 04:05:20 UTC
patch post:

http://gerrit.beaker-project.org/1534

Comment 3 Dan Callaghan 2012-12-20 06:29:16 UTC
Verified that

			<hostRequires>
				<system_type value="Machine"/>
				<cpu>
					<speed op="&gt;=" value="1198.5"/>
				</cpu>
			</hostRequires>

includes a system with CPU speed 1199.0 and that

			<hostRequires>
				<system_type value="Machine"/>
				<cpu>
					<speed op="&gt;=" value="1199.5"/>
				</cpu>
			</hostRequires>

excludes it.

Comment 4 Dan Callaghan 2013-01-17 04:34:20 UTC
Beaker 0.11.0 has been released.