Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1416218

Summary: ovirt-engine-hosts-ansible-inventory fails with: TypeError: datetime.datetime(...) is not JSON serializable
Product: [oVirt] ovirt-engine Reporter: Yedidyah Bar David <didi>
Component: Setup.EngineAssignee: Yedidyah Bar David <didi>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Kubica <pkubica>
Severity: high Docs Contact:
Priority: unspecified    
Version: futureCC: bugs, lsvaty
Target Milestone: ovirt-4.1.0-rcFlags: rule-engine: ovirt-4.1+
Target Release: 4.1.0.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-01 14:51:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yedidyah Bar David 2017-01-24 21:53:44 UTC
Description of problem:

If one or more hosts were recently in cpu overcommit state, the inventory script will fail with:

# /usr/share/ovirt-engine/setup/bin/ovirt-engine-hosts-ansible-inventory
Traceback (most recent call last):
  File "/usr/share/ovirt-engine/setup/bin/ovirt-engine-hosts-ansible-inventory", line 223, in <module>
    main()
  File "/usr/share/ovirt-engine/setup/bin/ovirt-engine-hosts-ansible-inventory", line 217, in main
    indent=(4 if args.pretty else None),
  File "/usr/lib64/python2.7/json/__init__.py", line 243, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib64/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib64/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib64/python2.7/json/encoder.py", line 184, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: datetime.datetime(2017, 1, 24, 23, 41, 24, 317019, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=120, name=None)) is not JSON serializable

This specifically happens when the column cpu_over_commit_time_stamp in the table vds_statistics is not empty for one or more rows.

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

current master/4.1

How reproducible:

Always

Steps to Reproduce:
1. See above
2.
3.

Actual results:
Fails

Expected results:

Succeeds. Still not sure what should be put in that field, but it does not seem very important for the scope of this script.

Additional info:

A workaround is to get out of this state, by lowering the load on all hosts (e.g. by adding a host and migrating some VMs, or by stopping VMs) and then waiting a bit until the engine updates this column.

Comment 1 Sandro Bonazzola 2017-01-26 07:42:22 UTC
Moved to 4.1.0rc since it's included in ovirt-engine-4.1.0.3 tag

Comment 2 Petr Kubica 2017-01-31 18:56:48 UTC
Verified in ovirt-engine-hosts-ansible-inventory-4.1.0.3-0.1.el7.noarch