Bug 1395893 - Installing rhn-virtualization-host on Fedora 23+ clients breaks rhn-profile-sync
Summary: Installing rhn-virtualization-host on Fedora 23+ clients breaks rhn-profile-sync
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Client
Version: 580
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
Assignee: Tomáš Kašpárek
QA Contact: Pavel Studeník
URL:
Whiteboard:
Depends On: 1379891
Blocks: spacewalk-review sat580-spw-retest
TreeView+ depends on / blocked
 
Reported: 2016-11-16 21:20 UTC by Jan Hutař
Modified: 2017-06-21 12:06 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1379891
Environment:
Last Closed: 2017-06-21 12:06:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jan Hutař 2016-11-16 21:20:16 UTC
We have tested (or attempted to test) bug like this when Spacewalk 2.6 was to be released. This is a clone of that bug to get it re-tested on Satellite 5.8.0. In some cases bug can be completely irrelevant (in such cases I suggest to close the bug as NOTABUG), in some cases it might be wise to take the bug as a note that something changed in a given area and we might want to sanity-test that area (and mark the bug as VERIFIED with "SanityOnly" keyword) and in some cases bug might be totally relevant to Satellite.



+++ This bug was initially created as a clone of Bug #1379891 +++

Description of problem:
Much of the python in the rhn-virtualization-common and rhn-virtualization-host packages is still of the era of python2.

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

How reproducible:
100%

Steps to Reproduce:
1. install Fedora 23 or 24
2. Add the corresponding spacewalk-client repos
3. install rhn-virtualization-common and rhn-virtualization-host
4. run rhn-profile-sync

Actual results:

[root@provisioner rhn]# rhn-profile-sync
Traceback (most recent call last):
  File "/usr/sbin/rhn-profile-sync", line 29, in <module>
    from virtualization import support
  File "/usr/share/rhn/virtualization/support.py", line 230
    print _retrieve_virtual_domain_list()
                                      ^


Expected results:
[root@provisioner rhn]# rhn-profile-sync 
Updating package profile...
Updating hardware profile...


Additional info:
While not great, using 2to3 solves the outright breakage of the functions but does not resolve the propagation of VM information:

2to3 -w  /usr/share/rhn/virtualization/support.py
2to3 -w  /usr/share/rhn/virtualization/domain_control.py
2to3 -w  /usr/share/rhn/virtualization/poller.py
2to3 -w  /usr/share/rhn/virtualization/notification.py
2to3 -w  /usr/share/rhn/virtualization/poller_state_cache.py
2to3 -w  /usr/share/rhn/virtualization/domain_directory.py
2to3 -w  /usr/share/rhn/virtualization/domain_config.py
2to3 -w  /usr/share/rhn/virtualization/start_domain.py

--- Additional comment from Grant Gainey on 2016-10-14 13:21:38 EDT ---

Ugh - nice catch. 

To (continue) working around the problem, you will also need to:

# sudo dnf install libvirt-python3
# sudo 2to3 -w /usr/share/rhn/virtualization/schedule_poller.py

and make the following changes (in addition to the effects of 2to3):

# diff ORIG/domain_config.py /usr/share/rhn/virtualization/domain_config.py
17d16
< import string
67c66
<         if string.find(uuid, ".xml") > 1 and os.path.exists(uuid):
---
>         if uuid.decode('utf-8').find(".xml") > 1 and os.path.exists(uuid):
250c245
<                     (string.join(tag_path, '/'), self.__file_name)), None, sys.exc_info()[2]
---
>                     (tag_path.join('/'), self.__file_name)).with_traceback(sys.exc_info()[2])



# diff ORIG/domain_directory.py /usr/share/rhn/virtualization/domain_directory.py
214c212
<         cfg_file.write(string.strip(xml))
---
>         cfg_file.write(xml.strip())


# diff ORIG/util.py /usr/share/rhn/virtualization/util.py
45c45
<     return uuid.replace('-', '')
---
>     return uuid.decode('utf-8').replace('-', '')


# diff ORIG/schedule_poller.py /usr/share/rhn/virtualization/schedule_poller.py
18d17
< import string
41,50c40,49
<     if type(minute) != types.StringType:
<         minute = string.strip(str(minute))
<     if type(hour) != types.StringType:
<         hour = string.strip(str(hour))
<     if type(dom) != types.StringType:
<         dom = string.strip(str(dom))
<     if type(month) != types.StringType:
<         month = string.strip(str(month))
<     if type(dow) != types.StringType:
<         dow = string.strip(str(dow))
---
>     if type(minute) != bytes:
>         minute = str(minute).strip()
>     if type(hour) != bytes:
>         hour = str(hour).strip()
>     if type(dom) != bytes:
>         dom = str(dom).strip()
>     if type(month) != bytes:
>         month = str(month).strip()
>     if type(dow) != bytes:
>         dow = str(dow).strip()


With these changes, I was able to get my F23 host registered correctly. If/as you notice any issues, log them here.

--- Additional comment from Gennadii Altukhov on 2016-10-19 07:57:54 EDT ---

fixed in spacewalk.git:
621f4d1f5a174f2b0df54adbeb2cc96741e01e1a

Switching to modified...

--- Additional comment from Radovan Drazny on 2016-11-11 07:29:13 EST ---

Reproduced on rhn-virtualization-{common,host}-5.4.55-1 using the reproducer from initial report with the same result:

# rhn-profile-sync
Traceback (most recent call last):
  File "/usr/sbin/rhn-profile-sync", line 29, in <module>
    from virtualization import support
  File "/usr/share/rhn/virtualization/support.py", line 230
    print _retrieve_virtual_domain_list()
                                      ^
SyntaxError: invalid syntax

After update to rhn-virtualization-common-5.4.56-1:

# rhn-profile-sync
Updating package profile...
Updating hardware profile...

No errors in /var/log/up2date, and the system has Virtualization tab in the SW WebUI.

VERIFIED

Comment 1 Pavel Studeník 2017-05-17 12:35:57 UTC
Installed package rhn-virtualization-host causes error and sending mails due to missing id. Reason is that system is registered only to rhsm.

I suppose that it is not problem and the package should be installed only if system is registered to Satellite.

>> tail /var/mail/root
Received: by dell-t7400-01.rhts.eng.bos.redhat.com (Postfix, from userid 0)
        id 3EF39804D4; Mon, 15 May 2017 20:54:02 -0400 (EDT)
From: root.eng.bos.redhat.com (Cron Daemon)
To: root.eng.bos.redhat.com
Subject: Cron <root@dell-t7400-01> python < /usr/share/rhn/virtualization/poller.py
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <OPENSSL_ENFORCE_MODULUS_BITS=true>
X-Cron-Env: <LANG=en_US.UTF-8>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
Message-Id: <20170516005402.3EF39804D4.eng.bos.redhat.com>
Date: Mon, 15 May 2017 20:54:02 -0400 (EDT)

Traceback (most recent call last):
  File "<stdin>", line 324, in <module>
  File "<stdin>", line 252, in _send_notifications
  File "/usr/share/rhn/virtualization/notification.py", line 71, in execute
    raise NotRegistered("System ID not found.")
virtualization.errors.NotRegistered: System ID not found.

Comment 3 Pavel Studeník 2017-05-25 16:35:09 UTC
Verified 

 rhn-virtualization-host-5.4.54-2.el6sat.noarch
 rhn-setup-1.0.0.1-43.el6.noarch
 rhn-client-tools-1.0.0.1-43.el6.noarch


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