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 1837495 - [detach-device][s390x] can't detach virtio interface device by its address only (no mac)
Summary: [detach-device][s390x] can't detach virtio interface device by its address on...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: libvirt
Version: 8.3
Hardware: s390x
OS: Linux
medium
low
Target Milestone: rc
: 8.4
Assignee: Ján Tomko
QA Contact: smitterl
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-19 14:46 UTC by smitterl
Modified: 2021-05-18 15:21 UTC (History)
8 users (show)

Fixed In Version: libvirt-6.0.0-29.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-18 15:21:15 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
libvirtd debug log (5.89 KB, text/plain)
2020-05-19 14:46 UTC, smitterl
no flags Details

Description smitterl 2020-05-19 14:46:49 UTC
Created attachment 1689905 [details]
libvirtd debug log

Description of problem:
Can't detach interface specified by its address but not mac


Version-Release number of selected component (if applicable):
libvirt-6.0.0-19.module+el8.2.1+6538+c148631f.s390x

How reproducible:
100%

Preconditions
Guest has two interfaces of same type but on different addresses, e.g.
A. Given iface.xml = 
<interface type='network'>
      <source network='default'/>
      <model type='virtio'/>
</interface>
B. Run virsh attach-device vm iface.xml twice on vm (previously without any interface devices).

Steps to Reproduce:
1. Add iface address of one of the interfaces to iface.xml, e.g.
<interface type='network'>
      <source network='default'/>
      <model type='virtio'/>
      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0009'/>
</interface>
2. virsh detach-device vm iface.xml

Actual results:
error: Failed to detach device from iface.xml
error: operation failed: multiple matching devices found

Expected results:
Device detached successfully

Additional info:
1. The ccw addresses in dumpxml after B. were confirmed to be different (interfaces correctly attached)
2. Expected result can be established when running steps on x86_64 using pci type address.
3. Using <mac/> instead of <address/> in step 1. leads to correct results
4. libvirtd.log indicates src/conf/domain_conf.c->virDomainNetFindIdx is involved but that code makes explicit reference only to PCI:
int
virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net)
{
...
    bool PCIAddrSpecified = virDomainDeviceAddressIsValid(&net->info,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI);
 
    for (i = 0; i < def->nnets; i++) {
...
        if (PCIAddrSpecified &&
            !virPCIDeviceAddressEqual(&def->nets[i]->info.addr.pci,
                                      &net->info.addr.pci))
            continue;
 
        if (matchidx >= 0) {
            /* there were multiple matches on mac address, and no
             * qualifying guest-side PCI address was given, so we must
             * fail (NB: a USB address isn't adequate, since it may
             * specify only vendor and product ID, and there may be
             * multiples of those.
             */
            if (MACAddrSpecified) {
                virReportError(VIR_ERR_OPERATION_FAILED,
                               _("multiple devices matching MAC address %s found"),
                               virMacAddrFormat(&net->mac, mac));
            } else {
                virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                               _("multiple matching devices found"));
            }
 
            return -1;
        }
 
        matchidx = i;
    }
 
    if (matchidx < 0) {
        if (MACAddrSpecified && PCIAddrSpecified) {
            virReportError(VIR_ERR_DEVICE_MISSING,
...
        } else if (PCIAddrSpecified) {
            virReportError(VIR_ERR_DEVICE_MISSING,
...
        } else if (MACAddrSpecified) {
            virReportError(VIR_ERR_DEVICE_MISSING,
                           _("no device matching MAC address %s found"),
                           virMacAddrFormat(&net->mac, mac));
        } else {
            virReportError(VIR_ERR_DEVICE_MISSING, "%s",
                           _("no matching device found"));
        }
    }
    return matchidx;
}

Comment 2 Cornelia Huck 2020-09-24 12:11:34 UTC
Proposed upstream patch:
https://www.redhat.com/archives/libvir-list/2020-September/msg01359.html

Comment 3 Ján Tomko 2020-09-24 12:18:34 UTC
Pushed upstream:
commit 2fefbd03ab09f32b1b15d093096fa44870817751
Author:     Cornelia Huck <cohuck>
CommitDate: 2020-09-24 13:48:31 +0200

    virDomainNetFindIdx: add support for CCW addresses
    
    Allow to match with CCW addresses in addition to PCI addresses
    (and MAC addresses).
    
    Signed-off-by: Cornelia Huck <cohuck>
    Reviewed-by: Ján Tomko <jtomko>
    Signed-off-by: Ján Tomko <jtomko>

git describe: v6.7.0-344-g2fefbd03ab

Comment 9 smitterl 2020-11-04 16:46:38 UTC
Verified with:
libvirt-6.0.0-29.module+el8.4.0+8389+a260c754.s390x

Manual:

Steps:
s. Description

Actual result:

stdout: Device detached successfully
virsh dumpxml confirms correct iface (out of the two) was detached


Automation (name includes "pci" but is actually type agnostic, i.e. ccw type is used):

# avocado run --vt-type libvirt --vt-machine-type s390-virtio --vt-connect-uri qemu:///system virtual_network.iface_hotplug.at_device.iface_attach.model_virtio.detach_match_test
JOB ID     : 21d192389b6e69bf50f44d450685f16b13b74b89
JOB LOG    : /root/avocado/job-results/job-2020-11-04T11.32-21d1923/job.log
 (1/5) type_specific.io-github-autotest-libvirt.virtual_network.iface_hotplug.at_device.iface_attach.model_virtio.detach_match_test.by_pci: PASS (88.74 s)
 (2/5) type_specific.io-github-autotest-libvirt.virtual_network.iface_hotplug.at_device.iface_attach.model_virtio.detach_match_test.by_mac_pci: PASS (89.00 s)
 (3/5) type_specific.io-github-autotest-libvirt.virtual_network.iface_hotplug.at_device.iface_attach.model_virtio.detach_match_test.by_mac: PASS (92.14 s)
 (4/5) type_specific.io-github-autotest-libvirt.virtual_network.iface_hotplug.at_device.iface_attach.model_virtio.detach_match_test.by_wrong_mac: PASS (91.04 s)
 (5/5) type_specific.io-github-autotest-libvirt.virtual_network.iface_hotplug.at_device.iface_attach.model_virtio.detach_match_test.by_wrong_pci: PASS (90.38 s)
RESULTS    : PASS 5 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB TIME   : 452.94 s

Comment 11 errata-xmlrpc 2021-05-18 15:21:15 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 (Moderate: virt:rhel and virt-devel:rhel security, bug fix, and enhancement update), 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/RHSA-2021:1762


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