Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1667329

Summary: when create vhba without indicating wwpn/wwnn, libvirt will generate duplicated ones [rhel-7.6.z]
Product: Red Hat Enterprise Linux 7 Reporter: RAD team bot copy to z-stream <autobot-eus-copy>
Component: libvirtAssignee: John Ferlan <jferlan>
Status: CLOSED ERRATA QA Contact: yisun
Severity: high Docs Contact:
Priority: high    
Version: 7.6CC: jdenemar, yalzhang
Target Milestone: rcKeywords: Automation, Regression, ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-4.5.0-10.el7_6.5 Doc Type: Bug Fix
Doc Text:
Cause: An improper mathematical shift within a 64 bit space resulted in an improper and less than random value of 0 (zero). Consequence: libvirt did not generate very random numbers for vHBA WWNN/WWPN pair. This also affects random UUID generation. Fix: Perform proper mathematical shifts to move an unsigned long long value (64 bit) rather than just a unsigned int (32 bit) value. Result: More randomly generated WWNN, WWPN, and UUID values.
Story Points: ---
Clone Of: 1652894 Environment:
Last Closed: 2019-03-13 18:47:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1652894    
Bug Blocks:    

Description RAD team bot copy to z-stream 2019-01-18 07:41:20 UTC
This bug has been copied from bug #1652894 and has been proposed to be backported to 7.6 z-stream (EUS).

Comment 6 yisun 2019-02-22 10:29:28 UTC
[root@dell-per730-58 ~]# rpm -qa | grep libvirt-4
libvirt-4.5.0-10.virtcov.el7_6.6.x86_64


1. Code update to date
root@yisun ~/libvirt-rhel/src  ## git branch
* (detached from origin/rhel-7.6)
  rhel-7.7
root@yisun ~/libvirt-rhel/src  ## cat util/virrandom.c | grep "uint64_t virRandomBits(int nbits)" -A15
uint64_t virRandomBits(int nbits)
{
    uint64_t ret = 0;

    if (virRandomBytes((unsigned char *) &ret, sizeof(ret)) < 0) {
        /* You're already hosed, so this particular non-random value
         * isn't any worse.  */
        return 0;
    }

    if (nbits < 64)
        ret &= (1ULL << nbits) - 1;

    return ret;
}


2. Try the random number generator with scenario as comment 0
[root@dell-per730-58 ~]# cat vhba.xml 
<device><capability type="scsi_host"><capability type="fc_host"><wwnn /><wwpn /></capability></capability><parent>scsi_host11</parent></device>


[root@dell-per730-58 ~]# for i in {63..163}; do virsh nodedev-create vhba.xml >> /dev/null 2>&1; echo $i; virsh nodedev-dumpxml scsi_host$i | egrep "wwpn|wwnn"; done
63
      <wwnn>5001a4a6c3760b1f</wwnn>
      <wwpn>5001a4a985482b07</wwpn>
64
      <wwnn>5001a4a77396629a</wwnn>
      <wwpn>5001a4a4fb2a6084</wwpn>
65
      <wwnn>5001a4adf0bdaccb</wwnn>
      <wwpn>5001a4a23b1f2ada</wwpn>
66
      <wwnn>5001a4a00b4e2197</wwnn>
      <wwpn>5001a4a30058f906</wwpn>
...
162
      <wwnn>5001a4a20c9321d3</wwnn>
      <wwpn>5001a4af5f03bcce</wwpn>
163
      <wwnn>5001a4a676ad0673</wwnn>
      <wwpn>5001a4a061b2c24a</wwpn>
<==== all numbers are random, as expected

Comment 8 errata-xmlrpc 2019-03-13 18:47:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:0521