Bug 1747319 - Incorrect parameter is used between Network.pm and NetworkPort.pm
Summary: Incorrect parameter is used between Network.pm and NetworkPort.pm
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: perl-Sys-Virt
Version: 8.1
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: 8.1
Assignee: Daniel Berrangé
QA Contact: Dan Zheng
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-30 06:21 UTC by Dan Zheng
Modified: 2020-11-14 05:38 UTC (History)
3 users (show)

Fixed In Version: perl-Sys-Virt-5.6.0-2.module+el8.1.0+4140+e3893fe6
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-06 07:19:01 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:3723 0 None None None 2019-11-06 07:19:24 UTC

Description Dan Zheng 2019-08-30 06:21:53 UTC
Description of problem:
Parameter 'network' is used in NetworkPort.pm, but Network.pm get_port_by_uuid() and create_port() pass 'net' to  NetworkPort.pm by mistake.

Version-Release number of selected component (if applicable):
perl-Sys-Virt-5.6.0-1.module+el8.1.0+3908+8a8c5ed4.x86_64

How reproducible:
100%

Steps to Reproduce:
1.
# cat lib/Sys/Virt/Network.pm
sub create_port {
    my $self = shift;
    my $xml = shift;
    my $flags = shift || 0;

    return Sys::Virt::NetworkPort->_new(net => $self, xml => $xml, flags => $flags);
}


=item $port = $net->get_port_by_uuid($uuid);

...

=cut

sub get_port_by_uuid {
    my $self = shift;
    my $uuid = shift;

    return Sys::Virt::NetworkPort->_new(net => $self, uuid => $uuid);
}

# cat lib/Sys/Virt/NetworkPort.pm
sub _new {
    my $proto = shift;
    my $class = ref($proto) || $proto;
    my %params = @_;

    my $net = exists $params{network} ? $params{network} : die "network parameter is required";
    my $self;
...
}


2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Daniel Berrangé 2019-09-02 14:35:27 UTC
Fixed upstream in

commit 5c1d7aa2ad4817f8705da9ba0216fc4f59fd939f
Author: Daniel P. Berrangé <berrange>
Date:   Mon Sep 2 10:23:12 2019 +0100

    Fix Sys::Virt::NetworkPort creation
    
    Signed-off-by: Daniel P. Berrangé <berrange>

Comment 3 Dan Zheng 2019-09-19 07:38:14 UTC
Package:
perl-Sys-Virt-5.6.0-2.module+el8.1.0+4140+e3893fe6.x86_64

Check source code and patch files. Verified

Comment 4 Dan Zheng 2019-09-19 07:47:23 UTC
# libvirt-tck --testdir 141-net-port.t -v --force 141-net-port.t .. 
1..18
Downloading RHEL disk
Convert the RHEL image to raw format
# Running the first boot
# Add two controllers for hotplugging
# Creating a new transient domain
ok 1 - created permanent domain object
# Creating a new transient network
ok 2 - created transient network object
# Attaching the new interface 00:11:22:33:44:66 to guest
ok 3 - interface has been attached to guest
# Retrieve network port of new created network net-active
ok 4 - Get 1 network port
ok 5 - The network port is deleted
ok 6 - Get 0 network port
ok 7 - Get correct port by uuid
ok 8 - Get correct port uuid string 22222222-2222-2222-2222-222222222222
# <networkport>
#   <uuid>22222222-2222-2222-2222-222222222222</uuid>
#   <owner>
#     <name>tck</name>
#     <uuid>231bfc0d-aeb4-41a2-afb6-f29bda580b69</uuid>
#   </owner>
#   <mac address='00:11:22:33:44:66'/>
#   <bandwidth>
#     <inbound average='500' peak='2000' floor='200' burst='2560'/>
#     <outbound average='128' peak='256' burst='256'/>
#   </bandwidth>
#   <plug type='network' bridge='virbr1'/>
# </networkport>
ok 9 - Get port xml description
ok 10 - Get correct bandwidth inbound average 500
ok 11 - Get correct bandwidth inbound burst 2560
ok 12 - Get correct bandwidth inbound peak 2000
ok 13 - Get correct bandwidth inbound floor 200
ok 14 - Get correct bandwidth outbound average 128
ok 15 - Get correct bandwidth outbound average 256
ok 16 - Get correct bandwidth outbound average 256
# Detaching the new interface 00:11:22:33:44:66
ok 17 - interface has been detached
# Destroy net-active network
ok 18 - network net-active has been destoryed
ok
All tests successful.
Files=1, Tests=18, 69 wallclock secs ( 0.02 usr  0.00 sys +  5.55 cusr  2.28 csys =  7.85 CPU)
Result: PASS

Comment 6 errata-xmlrpc 2019-11-06 07:19:01 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:3723


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