libvirt/libvirt-virsh-Make-domif-setlink-work-more-than-once.patch
Jiri Denemark ff5db98bff libvirt-9.0.0-3.el9
- src: Don't use virReportSystemError() on virProcessGetStatInfo() failure (rhbz#2148266)
- qemu: Provide virDomainGetCPUStats() implementation for session connection (rhbz#2148266)
- virsh: Make domif-setlink work more than once (rhbz#2165466)
- qemu_fd: Remove declaration for 'qemuFDPassNewDirect' (rhbz#2040272)
- qemuStorageSourcePrivateDataFormat: Rename 'tmp' to 'objectsChildBuf' (rhbz#2040272)
- qemu: command: Handle FD passing commandline via qemuBuildBlockStorageSourceAttachDataCommandline (rhbz#2040272)
- qemuFDPassTransferCommand: Mark that FD was passed (rhbz#2040272)
- qemu: fd: Add helpers allowing storing FD set data in status XML (rhbz#2040272)
- qemu: domain: Store fdset ID for disks passed to qemu via FD (rhbz#2040272)
- qemu: block: Properly handle FD-passed disk hot-(un-)plug (rhbz#2040272)

Resolves: rhbz#2040272, rhbz#2148266, rhbz#2165466
2023-02-01 13:33:57 +01:00

48 lines
1.8 KiB
Diff

From f895d23743a65141a2db7f816e56d18c9c4de6df Mon Sep 17 00:00:00 2001
Message-Id: <f895d23743a65141a2db7f816e56d18c9c4de6df@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 30 Jan 2023 10:55:22 +0100
Subject: [PATCH] virsh: Make domif-setlink work more than once
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 6f3f6c0f763b9ffd8ef93eb124c88dd0b79138fc)
https://bugzilla.redhat.com/show_bug.cgi?id=2165466
---
tools/virsh-domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 6b431bd1e5..59b2b3ce60 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -3209,7 +3209,7 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd)
}
}
- if (xmlHasProp(linkNode, BAD_CAST "link"))
+ if (xmlHasProp(linkNode, BAD_CAST "state"))
stateAttr = xmlSetProp(linkNode, BAD_CAST "state", BAD_CAST state);
else
stateAttr = xmlNewProp(linkNode, BAD_CAST "state", BAD_CAST state);
--
2.39.1