Bug 2165466
Summary: | Can not update interface link state by domif-setlink | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 9 | Reporter: | yalzhang <yalzhang> |
Component: | libvirt | Assignee: | Michal Privoznik <mprivozn> |
libvirt sub component: | General | QA Contact: | yalzhang <yalzhang> |
Status: | CLOSED ERRATA | Docs Contact: | |
Severity: | unspecified | ||
Priority: | unspecified | CC: | jdenemar, pkrempa, virt-maint |
Version: | 9.2 | Keywords: | Automation, Regression, Triaged |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | libvirt-9.0.0-3.el9 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2023-05-09 07:27:45 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
yalzhang@redhat.com
2023-01-30 07:23:56 UTC
Fixed upstream by: commit 6f3f6c0f763b9ffd8ef93eb124c88dd0b79138fc Author: Michal Prívozník <mprivozn> Date: Mon Jan 30 10:55:22 2023 +0100 virsh: Make domif-setlink work more than once In virsh, we have this convenient domif-setlink command, which is just a wrapper over virDomainUpdateDeviceFlags() and which allows setting link state of given guest NIC. It does so by fetching corresponding <interface/> XML snippet and either putting <link state=''/> into it, OR if the element already exists setting the attribute to desired value. The XML is then fed into the update API. There's, however, a small bug in detecting the pre-existence of the element and its attribute. The code looks at "link" attribute, while in fact, the attribute is called "state". Resolves: https://gitlab.com/libvirt/libvirt/-/issues/426 Fixes: e575bf082ed4889280be07c986375f1ca15bb7ee Signed-off-by: Michal Privoznik <mprivozn> Reviewed-by: Ján Tomko <jtomko> Test on libvirt-9.0.0-3.el9.x86_64, the result is as expected. # virsh dumpxml rhel --xpath //interface <interface type="network"> <mac address="52:54:00:60:8a:32"/> <source network="default" portid="c6ec8acd-ddb8-46b6-ab45-f0f949b2a3e6" bridge="virbr0"/> <target dev="vnet0"/> <model type="virtio"/> <link state="up"/> <alias name="net0"/> <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/> </interface> # virsh domif-setlink rhel vnet0 down Device updated successfully # virsh dumpxml rhel --xpath //interface <interface type="network"> <mac address="52:54:00:60:8a:32"/> <source network="default" portid="c6ec8acd-ddb8-46b6-ab45-f0f949b2a3e6" bridge="virbr0"/> <target dev="vnet0"/> <model type="virtio"/> <link state="down"/> <alias name="net0"/> <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/> </interface> Run auto cases "virsh.domif_setlink_getlink", no such issue any more. 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 (libvirt 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/RHBA-2023:2171 |