summaryrefslogtreecommitdiff
path: root/libvirt/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'libvirt/config.go')
-rw-r--r--libvirt/config.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/libvirt/config.go b/libvirt/config.go
new file mode 100644
index 00000000..ca4e63a8
--- /dev/null
+++ b/libvirt/config.go
@@ -0,0 +1,30 @@
+package libvirt
+
+import (
+ "log"
+ libvirt "gopkg.in/alexzorin/libvirt-go.v2"
+)
+
+type Config struct {
+ Uri string
+}
+
+type Client struct {
+ libvirt libvirt.VirConnection
+}
+
+func (c *Config) Client() (*Client, error) {
+ conn, err := libvirt.NewVirtConnection(c.Uri)
+
+ if err != nil {
+ return nil, err
+ }
+
+ client := &Client {
+ libvirt: conn,
+ }
+
+ log.Println("[INFO] Created libvirt client")
+
+ return client, nil
+}