libvirtxmlDomainInterface结构体中网卡名是哪个属性值给个golang示例
libvirtxml.DomainInterface结构体中网卡名是Name属性值。
以下是一个示例:
import (
"github.com/libvirt/libvirt-go-xml"
)
func main() {
iface := &libvirtxml.DomainInterface{
Type: "network",
Source: &libvirtxml.DomainInterfaceSource{
Network: &libvirtxml.DomainInterfaceSourceNetwork{
Network: "default",
},
},
Model: &libvirtxml.DomainInterfaceModel{
Type: "virtio",
},
Name: "eth0", // 网卡名为 eth0
}
}
``
原文地址: https://www.cveoy.top/t/topic/ho5a 著作权归作者所有。请勿转载和采集!