Bug 1483527 - kvm_stat should run with Python 2, not Python 3.
Summary: kvm_stat should run with Python 2, not Python 3.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-21 10:59 UTC by Yaniv Kaul
Modified: 2018-05-31 12:06 UTC (History)
19 users (show)

Fixed In Version: kernel-4.12.9-300.fc26 kernel-4.12.9-200.fc25
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-19 01:59:51 UTC
Type: Bug


Attachments (Terms of Use)

Description Yaniv Kaul 2017-08-21 10:59:53 UTC
Description of problem:
Although it says:
#!/usr/bin/python3

It fails with Python 3. Switching to:
#!/usr/bin/python2

Fixes it and it runs well.

Version-Release number of selected component (if applicable):
kernel-tools-4.12.5-300.fc26.x86_64

How reproducible:
Always

Steps to Reproduce:
1. run kvm_stat when a VM is running.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Cole Robinson 2017-08-21 13:58:52 UTC
It's definitely python2 only at the moment. Upstream has #!/usr/bin/python, but the version in the RPM has #!/usr/bin/python3, maybe something in the spec changes it automatically? But I couldn't find anything. Can probably just change upstream to have explicit #!/usr/bin/python2 (or #!/usr/bin/env python2 and then overwrite that in the spec file)

Comment 2 Chuck Ebbert 2017-08-21 15:05:15 UTC
It's this Fedora patch: force-python3-in-kvm_stat.patch

commit f73ee7240d1ddb1923e93ff9674b51bcfe2e61eb
Author: Fedora Kernel Team <kernel-team@fedoraproject.org>
Date:   Tue Jul 25 12:38:46 2017 -0500

    Force python3 in kvm_stat

Comment 3 Justin M. Forbes 2017-08-22 14:41:36 UTC
Right, so this is a fairly significant problem, and the short term solution will likely be kernel dropping kvm_stat for a bit until it works with python 3. I understand the reasoning behind moving it into the kernel tree, but Fedora's default python is python3 at this point. By putting a package which requires python2 in the kernel tools package, you end up with a lot of pissed off people who don't want python2 on their system.

Comment 4 Cole Robinson 2017-08-22 14:48:39 UTC
Ah interesting. It's probably not too hard to port to python3, I'll try and take a look.

Another option could be to switch it to explicit python2 but not have an explicit python2 dep. Then anyone that wants to use kvm_stat will just have to manually install python2. I think that's probably fine in the short term since I don't think kvm_stat has many users, and python2 will be installed on a lot of systems anyways

Comment 5 Fedora Update System 2017-08-25 21:13:38 UTC
kernel-4.12.9-300.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-78c4c71539

Comment 6 Fedora Update System 2017-08-25 21:15:09 UTC
kernel-4.12.9-200.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-4b4c022807

Comment 7 Justin M. Forbes 2017-08-26 15:16:01 UTC
So the short term work around, I simply removed the dep, and the patch. This is technically incorrect packaging, but it seemed the better short term solution. Longer term, kvm_stat needs to be ported to support python3, and the dep needs to go back in.

Comment 8 Fedora Update System 2017-08-26 22:36:11 UTC
kernel-4.12.9-300.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-78c4c71539

Comment 9 Fedora Update System 2017-08-26 22:37:15 UTC
kernel-4.12.9-200.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-4b4c022807

Comment 10 Fedora Update System 2017-08-31 22:52:59 UTC
kernel-4.12.9-300.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2017-09-01 03:23:07 UTC
kernel-4.12.9-200.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 12 Yaniv Kaul 2018-05-03 21:12:22 UTC
Fedora 28, same story: it doesn't work with Python 3, only with Python 2:
[ykaul@ykaul ovirt-system-tests]$ sudo kvm_stat
  File "/usr/bin/kvm_stat", line 1137
    def sortkey((_k, v)):
                ^
SyntaxError: invalid syntax


Switching to Python 2, all good (at least it seems to be running).

Comment 13 Cole Robinson 2018-05-07 13:19:54 UTC
It's fixed upstream and in v4.17-rc1

commit 6ade1ae84c9236cbb58de4b17f770f2791106676
Author: Cole Robinson <crobinso@redhat.com>
Date:   Fri Mar 23 18:07:16 2018 -0400

    tools/kvm_stat: Fix python3 syntax

Comment 14 Fedora Update System 2018-05-07 13:27:09 UTC
kernel-tools-4.16.0-201.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-b8d768a079

Comment 15 Fedora Update System 2018-05-07 13:27:38 UTC
kernel-tools-4.16.0-301.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-420e68c0af

Comment 16 Jeremy Cline 2018-05-07 13:41:33 UTC
Sorry about that, someone reported this on the Bodhi update and I got as far as building the new version with the backport, but forgot to submit it as an update. Testing and providing karma on the updates would be very helpful.

Comment 17 Fedora Update System 2018-05-09 23:30:02 UTC
kernel-tools-4.16.0-201.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-b8d768a079

Comment 18 Fedora Update System 2018-05-10 01:27:52 UTC
kernel-tools-4.16.0-301.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-420e68c0af

Comment 19 Fedora Update System 2018-05-19 01:59:51 UTC
kernel-tools-4.16.0-301.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2018-05-19 03:36:20 UTC
kernel-tools-4.16.0-201.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 21 Villy Kruse 2018-05-20 08:32:16 UTC
$ rpm -qf /usr/bin/kvm_stat
kernel-tools-4.16.0-301.fc28.x86_64

$ kvm_stat 
Traceback (most recent call last):
  File "/usr/bin/kvm_stat", line 1668, in <module>
    main()
  File "/usr/bin/kvm_stat", line 1639, in main
    assign_globals()
  File "/usr/bin/kvm_stat", line 1618, in assign_globals
    for line in file('/proc/mounts'):
NameError: name 'file' is not defined

Comment 22 Fedora Update System 2018-05-22 17:52:37 UTC
kernel-tools-4.16.0-302.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-00f7901c1b

Comment 23 Fedora Update System 2018-05-22 17:52:49 UTC
kernel-tools-4.16.0-202.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-d28f60724e

Comment 24 Fedora Update System 2018-05-23 16:20:11 UTC
kernel-tools-4.16.0-202.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-d28f60724e

Comment 25 Fedora Update System 2018-05-23 17:37:28 UTC
kernel-tools-4.16.0-302.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-00f7901c1b

Comment 26 Fedora Update System 2018-05-26 20:43:03 UTC
kernel-tools-4.16.0-302.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 27 Fedora Update System 2018-05-31 12:06:08 UTC
kernel-tools-4.16.0-202.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.