diff options
| author | Jeff Carr <[email protected]> | 2024-10-26 02:31:52 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-26 02:31:52 -0500 |
| commit | f42091a2ce37f54bb8ad365b31ae2395a9af1372 (patch) | |
| tree | 03f9d127bb388483d7ea03d3bd997cf59a9ac7c7 /libvirtxml.go | |
| parent | 7320fceb8d8cf6ed32dd139fb91667ed3b84c4f2 (diff) | |
network is maybe correct as virtio. pci needed?
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'libvirtxml.go')
| -rw-r--r-- | libvirtxml.go | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/libvirtxml.go b/libvirtxml.go index b702a1c..6d8aee8 100644 --- a/libvirtxml.go +++ b/libvirtxml.go @@ -173,14 +173,23 @@ func clearEthernet(domcfg *libvirtxml.Domain) { // add a new ethernet interface with mac assigned to bridge name func addEthernet(domcfg *libvirtxml.Domain, mac string, brname string) { // Define a new disk with "mynew.qcow2" - type DomainInterfaceType string + // type DomainInterfaceType string + + var ib *libvirtxml.DomainInterfaceSourceBridge + ib = new(libvirtxml.DomainInterfaceSourceBridge) + ib.Bridge = brname newNet := libvirtxml.DomainInterface{ MAC: &libvirtxml.DomainInterfaceMAC{ Address: mac, }, + Source: &libvirtxml.DomainInterfaceSource{ + Bridge: ib, + }, + Model: &libvirtxml.DomainInterfaceModel{ + Type: "virtio", + }, Target: &libvirtxml.DomainInterfaceTarget{ - Dev: brname, }, } @@ -759,6 +768,22 @@ func dumpLibvirtxmlDomainNames() { field := t.Field(i) fmt.Println("DomainInterface:", field.Name) } + + var isource libvirtxml.DomainInterfaceSource + listFields(isource, "libvirtxml.DomainInterfaceSource") + + var ibridge libvirtxml.DomainInterfaceSourceBridge + listFields(ibridge, "libvirtxml.DomainInterfaceSourceBridge") +} + +func listFields(a any, name string) { + t := reflect.TypeOf(a) + + fmt.Println("Fields in", name) + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + fmt.Println(name, field.Name) + } } // dump out all the fields in libvirtxml.DomainDeviceList |
