mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 14:26:23 -04:00
AB#2114 Add QEMU metadata API (#237)
* Add QEMU metadata API * API server is started automatically when using terraform to deploy a QEMU cluster * Enable QEMU metadata usage for disk-mapper, debugd and the Coordinator Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
b0aafd0c2a
commit
040e498b42
17 changed files with 648 additions and 23 deletions
32
hack/qemu-metadata-api/virtwrapper/virtwrapper.go
Normal file
32
hack/qemu-metadata-api/virtwrapper/virtwrapper.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package virtwrapper
|
||||
|
||||
import "libvirt.org/go/libvirt"
|
||||
|
||||
type Connect struct {
|
||||
Conn *libvirt.Connect
|
||||
}
|
||||
|
||||
func (c *Connect) LookupNetworkByName(name string) (*Network, error) {
|
||||
net, err := c.Conn.LookupNetworkByName(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Network{Net: net}, nil
|
||||
}
|
||||
|
||||
type Network struct {
|
||||
Net virNetwork
|
||||
}
|
||||
|
||||
func (n *Network) GetDHCPLeases() ([]libvirt.NetworkDHCPLease, error) {
|
||||
return n.Net.GetDHCPLeases()
|
||||
}
|
||||
|
||||
func (n *Network) Free() {
|
||||
_ = n.Net.Free()
|
||||
}
|
||||
|
||||
type virNetwork interface {
|
||||
GetDHCPLeases() ([]libvirt.NetworkDHCPLease, error)
|
||||
Free() error
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue