Bug 1394399 - Check for empty uuid string in get_fully_virt_info()
Summary: Check for empty uuid string in get_fully_virt_info()
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: rhn-client-tools
Version: 6.8
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Tomáš Kašpárek
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-11 20:59 UTC by Neal Kim
Modified: 2019-12-16 07:23 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-13 17:52:53 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Neal Kim 2016-11-11 20:59:28 UTC
Description of problem:

When attempting to register a Xen guest against a Satellite 5 instance, the following error can be observed:

Exception Handler Information
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/spacewalk/server/apacheRequest.py", line 122, in call_function
    response = func(*params)
  File "/usr/share/rhn/server/handlers/xmlrpc/registration.py", line 513, in new_system
    architecture, data)
  File "/usr/share/rhn/server/handlers/xmlrpc/registration.py", line 345, in create_system
    and not rhnVirtualization.is_host_uuid(virt_uuid):
  File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnVirtualization.py", line 839, in is_host_uuid
    uuid = eval('0x%s' % uuid)
  File "<string>", line 1
     0x
      ^

 SyntaxError: invalid token
 
I imagine that it would be possible to encounter this error against upstream RHN as well.

Apparently, it seems that hardware.dmi_system_uuid() can end up returning an empty string thereby breaking the registration process.

/usr/share/rhn/up2date_client/rhnreg.py

def get_fully_virt_info():
    """
    This function looks in the SMBIOS area to determine if this is a 
    fully-virt guest.  It returns a (uuid, virt_type) tuple.
    """
    vendor = hardware.dmi_vendor()
    uuid = hardware.dmi_system_uuid()
    if vendor.lower() == "xen":
        uuid = uuid.lower().replace('-', '')
        virt_type = "fully"
        return (uuid, virt_type)
    else:
        return (None, None)

Notice the UUID value reported by dmidecode on a Xen guest system:
        
Handle 0x0100, DMI type 1, 27 bytes
System Information
        Manufacturer: Xen
        Product Name: HVM domU
        Version: 4.1<denied>
        Serial Number: 00000000-0000-0000-0000-000000000000
        UUID: Not Settable         <====== returns as empty string ''
        Wake-up Type: Power Switch
        SKU Number: Not Specified
        Family: Not Specified

This causes issues for paravirt guests since we may actually never make it to get_para_virt_info()

I'm filing this under RHEL 6 but likely applies to all RHEL releases.


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

rhn-client-tools-1.0.0.1-38.el6


How reproducible:

Easily.


Steps to Reproduce:

1. Register a Xen guest w/ not settable UUID.
2. Let it rain.


Actual results:

SyntaxError: invalid token


Expected results:

No error, able to grab the UUID from /sys/hypervisor/uuid if paravirt


Additional info:

Not comprehensive but good enough...

diff --git a/rhnreg.py b/rhnreg.py
index 7a4735d..18b1e7c 100644
--- a/rhnreg.py
+++ b/rhnreg.py
@@ -222,7 +222,7 @@ def get_fully_virt_info():
     """
     vendor = hardware.dmi_vendor()
     uuid = hardware.dmi_system_uuid()
-    if vendor.lower() == "xen":
+    if vendor.lower() == "xen" and uuid:
         uuid = uuid.lower().replace('-', '')
         virt_type = "fully"
         return (uuid, virt_type)

Comment 4 Chris Williams 2017-06-13 17:52:53 UTC
Red Hat Enterprise Linux 6 transitioned to the Production 3 Phase on May 10, 2017.  During the Production 3 Phase, Critical impact Security Advisories (RHSAs) and selected Urgent Priority Bug Fix Advisories (RHBAs) may be released as they become available.
 
The official life cycle policy can be reviewed here:
 
http://redhat.com/rhel/lifecycle
 
This issue does not appear to meet the inclusion criteria for the Production Phase 3 and will be marked as CLOSED/WONTFIX. If this remains a critical requirement, please contact Red Hat Customer Support to request a re-evaluation of the issue, citing a clear business justification.  Red Hat Customer Support can be contacted via the Red Hat Customer Portal at the following URL:
 
https://access.redhat.com


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