libvirt unix_sock_dir 控制三种 socket 所在目录
目前我测试的 libvird.conf
bash
▶ cat /etc/kube-host-vm/libvirtd.conf
listen_tcp = 1
listen_tls = 0
auth_tcp = "none"
tcp_port = "16509"
ca_file = ""
log_level = 1
log_outputs = "1:file:/var/log/libvirtd.log"
listen_addr = "0.0.0.0"
unix_sock_dir = "/run/libvirt2host"
进程启动后,可以看到三种 sock 均已创建
bash
root@debian:/kube-ovn# ll /run/libvirt2host/
total 8
drwxr-xr-x 2 root root 4096 Jun 1 13:24 ./
drwxr-xr-x 1 root root 4096 Jun 1 13:24 ../
srwx------ 1 root root 0 Jun 1 13:24 libvirt-admin-sock=
srwxrwxrwx 1 root root 0 Jun 1 13:24 libvirt-sock=
srwxrwxrwx 1 root root 0 Jun 1 13:24 libvirt-sock-ro=
基于 sock 的连接方式
bash
virsh -c qemu+unix:///system?socket=/run/libvirt2host/libvirt-sock list
# 或者
export LIBVIRT_DEFAULT_URI=qemu+unix:///system?socket=/run/libvirt2host/libvirt-sock
virsh list
