如何通过libvirtd热插拔接口?



我试图通过以下命令将接口热插拔到正在运行的域:

bash-4.4# virsh attach-interface 1 --type network --source net1 --model virtio-non-transitional --target /sys/devices/virtual/net/net1/tap603053 --mac  ac:de:48:77:a2:32 --config --live
Authorization not available. Check if polkit service is running or see debug message for more information.
error: Failed to attach interface
error: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory

如你所见,我得到了这个错误。

根据libvirt daemons,有两个arch "Monolithic daemon"以及模块化守护进程。所以我想如果我使用"单片守护进程"如果热插拔一个接口,那么virsh不会连接到virtnetworkd,而是连接到libvirtd(libvirtd存在)。所以我将命令修改为:

bash-4.4# virsh -c qemu:///system attach-interface 1 --type network --source net1 --model virtio-non-transitional --target /sys/devices/virtual/net/net1/tap603053 --mac  ac:de:48:77:a2:32 --config --live
Authorization not available. Check if polkit service is running or see debug message for more information.
error: Failed to attach interface
error: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory

正如你所看到的,我仍然得到了与第一个命令相同的错误。

我的问题是:如何在没有运行virtnetworkd的情况下热插拔接口?

如果没有virnetworkd,您将无法定义由libvirt管理的网络支持的任何接口(例如,在具有virtnetworkd). This means that类型网络的主机上virsh net-list输出中的那些接口将无法工作)。

然而,您可以使用其他不需要virtnetwork的模式,如以下文档位所描述的:

https://libvirt.org/formatdomain.html direct-attachment-to-physical-interface

https://libvirt.org/formatdomain.html bridge-to-lan

https://libvirt.org/formatdomain.html userspace-slirp-or-passt-connection

https://libvirt.org/formatdomain.html generic-ethernet-connection

请注意,您需要自己决定要使用哪种模式,而您的描述没有提供足够的信息让我推荐一种模式。

最新更新