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: | libvirt | Assignee: | John Ferlan <jferlan> |
| Status: | CLOSED ERRATA | QA Contact: | yisun |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 7.6 | CC: | jdenemar, yalzhang |
| Target Milestone: | rc | Keywords: | 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
[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
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 |