• This repository has been archived on 07/Jan/2022
  • Stars
    star
    332
  • Rank 126,957 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 8 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-go

libvirt-go

Build Status API Documentation

Go bindings for libvirt.

Make sure to have libvirt-dev package (or the development files otherwise somewhere in your include path)

Version Support

The libvirt go package provides API coverage for libvirt versions from 1.2.0 onwards, through conditional compilation of newer APIs.

By default the binding will support APIs in libvirt.so, libvirt-qemu.so and libvirt-lxc.so. Coverage for the latter two libraries can be dropped from the build using build tags 'without_qemu' or 'without_lxc' respectively.

Development status

The Go API is considered to be production ready and aims to be kept stable across future versions. Note, however, that the following changes may apply to future versions:

  • Existing structs can be augmented with new fields, but no existing fields will be changed / removed. New fields are needed when libvirt defines new typed parameters for various methods
  • Any method with an 'flags uint32' parameter will have its parameter type changed to a specific typedef, if & when the libvirt API defines constants for the flags. To avoid breakage, always pass a literal '0' to any 'flags uint32' parameter, since this will auto-cast to any future typedef that is introduced.

Documentation

Contributing

The libvirt project aims to add support for new APIs to libvirt-go as soon as they are added to the main libvirt C library. If you are submitting changes to the libvirt C library API, please submit a libvirt-go change at the same time. Bug fixes and other improvements to the libvirt-go library are welcome at any time.

For more information, see the CONTRIBUTING file.

Testing

The core API unit tests are all written to use the built-in test driver (test:///default), so they have no interaction with the host OS environment.

Coverage of libvirt C library APIs / constants is verified using automated tests. These can be run by passing the 'api' build tag. eg go test -tags api

For areas where the test driver lacks functionality, it is possible to use the QEMU or LXC drivers to exercise code. Such tests must be part of the 'integration_test.go' file though, which is only run when passing the 'integration' build tag. eg go test -tags integration

In order to run the unit tests, libvirtd should be configured to allow your user account read-write access with no passwords. This can be easily done using polkit config files

# cat > /etc/polkit-1/localauthority/50-local.d/50-libvirt.pkla  <<EOF
[Passwordless libvirt access]
Identity=unix-group:berrange
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
ResultActive=yes
EOF

(Replace 'berrange' with your UNIX user name).

Two of the integration tests also requires that libvirtd is listening for TCP connections on localhost, with sasl auth This can be setup by editing /etc/libvirt/libvirtd.conf to set

listen_tls=0
listen_tcp=1
auth_tcp=sasl
listen_addr="127.0.0.1"

and then start libvirtd with the --listen flag (this can be set in /etc/sysconfig/libvirtd to make it persistent).

sasl authentication must be configured to use either digest-md5 or scram-sha-1, and the needed sasl modules must be installed on the system.

Then create a sasl user

$ saslpasswd2 -a libvirt user

and enter "pass" as the password.

Alternatively a Vagrantfile, requiring use of virtualbox, is included to run the integration tests:

  • cd ./vagrant
  • vagrant up to provision the virtual machine
  • vagrant ssh to login to the virtual machine

Once inside, sudo su - and go test -tags integration libvirt.

More Repositories

1

libvirt

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt
C
1,382
star
2

libvirt-python

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-python
C
168
star
3

libvirt-rust

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-rust
Rust
94
star
4

libvirt-go-xml

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-go-xml
Go
75
star
5

libvirt-java

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-java
Java
45
star
6

libvirt-go-module

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-go-module
Go
43
star
7

libvirt-php

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-php
C
35
star
8

libvirt-console-proxy

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-console-proxy
Go
20
star
9

libvirt-csharp

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-csharp
C#
17
star
10

libvirt-ruby

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-ruby
C
16
star
11

libvirt-perl

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-perl
Perl
13
star
12

libvirt-test-API

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-test-API
Python
12
star
13

libvirt-sandbox

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-sandbox
C
11
star
14

libvirt-go-xml-module

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-go-xml-module
Go
10
star
15

libvirt-glib

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-glib
C
10
star
16

php-virt-control

[ARCHIVED] Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/php-virt-control
PHP
9
star
17

libvirt-snmp

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-snmp
C
7
star
18

libvirt-dbus

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-dbus
C
6
star
19

libvirt-tck

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-tck
Perl
6
star
20

libvirt-designer

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-designer
C
6
star
21

libvirt-cim

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-cim
C
5
star
22

libvirt-ocaml

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-ocaml
OCaml
4
star
23

libvirt-gitlab-executor

Python
4
star
24

autotest

[ARCHIVED] Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/autotest
Python
3
star
25

libvirt-ci

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-ci
Python
3
star
26

libvirt-appdev-guide

[ARCHIVED] Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-appdev-guide
Makefile
3
star
27

libvirt-autobuild

[ARCHIVED] Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-autobuild
Shell
2
star
28

virttools-web

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/virttools-web
HTML
2
star
29

libvirt-media

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-media
2
star
30

libvirt-security-notice

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-security-notice
XSLT
2
star
31

libvirt-builder

[ARCHIVED] Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-builder
Makefile
2
star
32

virttools-planet

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/virttools-planet
Python
2
star
33

libvirt-dockerfiles

[ARCHIVED] Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-dockerfiles
Python
2
star
34

libvirt-wiki

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-wiki
CSS
2
star
35

libvirt-virshcmdref

[ARCHIVED] Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-virshcmdref
HTML
2
star
36

scripts

[ARCHIVED] Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/scripts
Shell
2
star
37

libvirt-publican

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-publican
Dockerfile
2
star
38

libvirt-appdev-guide-python

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-appdev-guide-python
Python
1
star
39

libcmpiutil

[ARCHIVED] Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libcmpiutil
C
1
star
40

cimtest

[ARCHIVED] Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/cimtest
Python
1
star
41

libvirt-qpid

[ARCHIVED] Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-qpid
C++
1
star
42

libvirt-sandbox-image

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt-sandbox-image
Python
1
star