util: Remove '\n' from vhostuser ifname

When deleting the vhostuserclient interface, OVS prompts that the interface does not exist,
Through the XML file, I found that the "target dev" has a '\n', results in an XML parsing error.

XML file:

<target dev='vm-20ac9c030a47
'/>

That is because 'ovs-vsctl' returns a newline result, always come with a '\n',
and the vircommandrun function puts it in ifname.

So virNetDevOpenvswitchGetVhostuserIfname should remove '\n' from ifname.

Signed-off-by: Yalei Li <liyl43@chinatelecom.cn>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Yalei Li 2021-02-05 11:10:51 +08:00 committed by Michal Privoznik
parent c0ae2ca081
commit b29c86ae10

View File

@ -575,6 +575,7 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path,
return 0;
}
virStringTrimOptionalNewline(*ifname);
if (virNetDevOpenvswitchMaybeUnescapeReply(*ifname) < 0) {
VIR_FREE(*ifname);
return -1;