Giter VIP home page Giter VIP logo

libvirt-formula's Introduction

libvirt

Travis CI Build Status Semantic Release

Formula to setup and configure libvirt.

See the full SaltStack Formulas installation and usage instructions.

If you are interested in writing or contributing to formulas, please pay attention to the Writing Formula Section.

If you want to use this formula, please pay attention to the FORMULA file and/or git tag, which contains the currently released version. This formula is versioned according to Semantic Versioning.

See Formula Versioning Section for more details.

More information SALT AS A CLOUD CONTROLLER.

Commit message formatting is significant!!

Please see How to contribute for more details.

Meta-state (This is a state that includes other states).

Install libvirt, qemu and extra packages; configure and start the libvirtd service, and creates the certificates for migration.

Meta-state (This is a state that includes other states).

Clean the extra and qemu packages, the server and the python package.

Meta-state (This is a state that includes other states).

Install libvirt packages; configure and start the libvirtd service, and creates the certificates for migration.

Meta-state (This is a state that includes other states).

Clean the service, the configuration files and the packages. Any generated certificates is not handled.

This state install the libvirt package only.

This state remove the libvirt package only and depends on libvirt.server.config.clean.

Configures libvirtd.conf and /etc/sysconfig, /etc/default, /etc/conf.d daemon files.

Delete libvirtd.conf and /etc/sysconfig, /etc/default, /etc/conf.d daemon files and depends on libvirt.server.service.clean.

Starts the libvirtd service

Disable and stop the libvirtd service.

Installs the libvirt certificates to allow virtual machine migration.

This state install the qemu package only.

This state remove the qemu package only.

This state install the extra packages only.

This state remove the extra packages only.

Installs the python bindings for libvirt

This state remove the python bindings package for libvirt only.

Linux testing is done with kitchen-salt.

Requirements

  • Ruby
  • Docker
$ gem install bundler
$ bundle install
$ bin/kitchen test [platform]

Where [platform] is the platform name defined in kitchen.yml, e.g. debian-9-2019-2-py3.

bin/kitchen converge

Creates the docker instance and runs the libvirt main state, ready for testing.

bin/kitchen verify

Runs the inspec tests on the actual instance.

bin/kitchen destroy

Removes the docker instance.

bin/kitchen test

Runs all of the stages above in one go: i.e. destroy + converge + verify + destroy.

bin/kitchen login

Gives you SSH access to the instance for manual testing.

libvirt-formula's People

Contributors

aboe76 avatar andrew-vant avatar baby-gnu avatar bebehei avatar dafyddj avatar daks avatar damon-atkins avatar edusperoni avatar eliasp avatar evasdk avatar gravyboat avatar matthew-parlette avatar myii avatar nmadhok avatar noelmcloughlin avatar puneetk avatar semantic-release-bot avatar stasjok avatar stooj avatar sylvainfaivre avatar thatch45 avatar ukretschmer avatar whiteinge avatar wwentland avatar zauberfisch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libvirt-formula's Issues

State 'virt.keys' was not found in SLS 'libvirt.keys' for Salt 2017.7.3.0

----------
          ID: libvirt.keys
    Function: virt.keys
        Name: libvirt_keys
      Result: False
     Comment: State 'virt.keys' was not found in SLS 'libvirt.keys'
              Reason: 'virt' __virtual__ returned False
     Changes: 

My minion is running Ubuntu 17.10, and this is failing because the python-libvirt package has not been installed.

My top file simply includes libvirt, and extra_pkgs returns correctly.

----------
          ID: extra_pkgs
    Function: pkg.installed
      Result: True
     Comment: All specified packages are already installed
     Started: 22:51:39.869064
    Duration: 5.806 ms
     Changes:

State 'libvirt.keys' was not found in SLS 'libvirt.keys' for Salt 2016.11.0

          ID: libvirt.keys
    Function: libvirt.keys
        Name: libvirt_keys
      Result: False
     Comment: State 'libvirt.keys' was not found in SLS 'libvirt.keys'
              Reason: 'libvirt.keys' is not available.

because in keys.sls line 6 a comparison is made as text, where it needs to be numeric:

{% if salt['grains.get']('saltversion', '') < '2016.3.0' %}

Here is my grains data:

sudo salt c89 grains.items | grep --after-context=1 saltversion:
    saltversion:
        2016.11.0

[BUG] Formula not compatible with Debian 11

Your setup

Formula commit hash / release tag

master / e7f31e1

Versions reports (master & minion)

3004.1 from Kitchen setup

Pillar / config used

Those from kitchen


Bug details

Describe the bug

packages qemu-kvm and virt-top are not installable.

Steps to reproduce the bug

./bin/kitchen converge default-debian-11-3004-1-py3

[...]
                ID: libvirt-qemu-install-pkg-installed
           Function: pkg.installed
               Name: qemu-kvm
             Result: False
            Comment: The following packages failed to install/update: qemu-kvm
            Started: 16:00:27.469081
           Duration: 1887.718 ms
            Changes:   
[...]
                 ID: libvirt-extra-install-pkg-installed
           Function: pkg.installed
             Result: False
            Comment: Problem encountered installing package(s). Additional info follows:
              
              errors:
                  - Running scope as unit: run-ra546c40648ec45c3b3ae236b7924c792.scope
                    E: Unable to locate package virt-top
            Started: 16:00:29.357027
           Duration: 617.833 ms
            Changes:   
       
       Summary for local
       ------------
       Succeeded: 7
       Failed:    2

Expected behaviour

No errors

Attempts to fix the bug

none for now

Additional context

libvirt expected a string for 'tls_port' & 'tcp_port' in libvirtd.conf

journalctl -u libvirtd.service -f
[...]
Jul 23 03:40:23 localhost.local libvirtd[23914]: 2018-07-23 03:40:23.824+0000: 23914: error : main:1195 : Can't load config file: internal error: /etc/libvirt/libvirtd.conf: expected a string for 'tcp_port' parameter: /etc/libvirt/libvirtd.conf
[...]

The solution seems easy enough: I replaced 16514 with '16514' and 16509 with '16509' in the pilar file. I'd also be happy to make a pull request to add this fix to the repo.
However, I'm wondering, is there some reason this was int before? Perhaps other versions of libvirt expect int?

System info:

[zauberfisch@localhost ~]$ libvirtd --version
libvirtd (libvirt) 3.9.0

[zauberfisch@localhost ~]$ salt-minion --versions-report 
Salt Version:
           Salt: 2018.3.2
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Jul 13 2018, 13:06:57)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: centos 7.5.1804 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-862.3.3.el7.x86_64
         system: Linux
        version: CentOS Linux 7.5.1804 Core

[zauberfisch@localhost ~]$ cat /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

libvirt Service Name Incorrect on Ubuntu 16.10

libvirt/map.jinja has it that

'libvirt_service': 'libvirtd' if grains.get('osmajorrelease', 0)|float >= 8 else 'libvirt-bin',

However, checking the grains:

sudo salt [minionid] grains.items | less
…
   os:
        Ubuntu
    os_family:
        Debian
    osarch:
        amd64
    oscodename:
        yakkety
    osfinger:
        Ubuntu-16.10
    osfullname:
        Ubuntu
    osrelease:
        16.10
    osrelease_info:
        - 16
        - 10

so the unit name used is libvirt-bin, where the correct name is libvirtd
This produces the error

      ID: libvirt.service
Function: service.running
    Name: libvirt-bin
  Result: False
 Comment: Failed to get information on unit 'libvirt-bin'

Verifying on the minion:

systemctl status libvirtd.service 
● libvirtd.service - Virtualization daemon

get-around
edit map.jinja and make the line 11:
'libvirt_service': 'libvirtd',

Breaks when the osmajorrelease grain is missing.

The error message is:

Rendering SLS 'base:libvirt' failed: Jinja variable 'dict object' has no attribute 'osmajorrelease

This is on Ubuntu 14.04 with salt version 2015.8.1. The offending line is here. I think the check it's performing was just added recently.

Looking at the grains I do have, my first impulse is to change it to check grains.osrelease_info[0] instead. But I'm not that familiar with what grains exist where. If my configuration is missing osmajorrelease, it's possible others are missing osrelease_info. I'm not sure if there's an os version grain that's guaranteed to always exist.

(also, the service name detection that line is intended to perform gets the wrong result on my ubuntu, but that's easily fixable by populating pillar:libvirt:lookup:service, wheras the failed key lookup makes the state not work at all.)

[python] python packages for opensuse tumbleweed renamed

Your setup

Formula commit hash / release tag

libvirt-formula master branch

Versions reports (master & minion)

Salt Version:
Salt: 3002.2

Dependency Versions:
cffi: 1.14.4
cherrypy: unknown
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.11.2
libgit2: 1.1.0
M2Crypto: 0.37.1
Mako: 1.1.3
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: 1.4.6
pycparser: 2.20
pycrypto: 3.9.9
pycryptodome: 3.9.9
pygit2: 1.3.0
Python: 3.8.6 (default, Nov 09 2020, 12:09:06) [GCC]
python-gnupg: 0.4.6
PyYAML: 5.3.1
PyZMQ: 20.0.0
smmap: 3.0.4
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.3

System Versions:
dist: opensuse-tumbleweed 20210118 n/a
locale: utf-8
machine: x86_64
release: 5.10.7-1-default
system: Linux
version: openSUSE Tumbleweed 20210118 n/a

Pillar / config used

*redacted*:
    ----------
    libvirt:
        ----------
        daemon_opts:
            ----------
            LIBVIRTD_ARGS:
                --timeout 120
            LIBVIRTD_CONFIG:
                /etc/libvirt/libvirtd.conf
            LIBVIRTD_NOFILES_LIMIT:
                2048
        libvirtd:
            ----------
            auth_unix_rw:
                none
            unix_sock_group:
                libvirt
            unix_sock_rw_perms:
                0770
        lookup:
            ----------
            libvirt_service:
                libvirtd-admin.socket
            python3_pkg:
                python38-libvirt-python

Bug details

Describe the bug

opensuse tumbleweed just renamed all of its python3 packages:
correct python3 package: python38-libvirt-python

Steps to reproduce the bug

Expected behaviour

add a parameter yaml file for tumbleweed with the correct default package:

os_family: Suse
oscodename: openSUSE Tumbleweed
osfinger: openSUSE Tumbleweed-20210118
osfullname: openSUSE Tumbleweed

Attempts to fix the bug

added the correct package lookup in pillar

        lookup:
            ----------
            python3_pkg:
                python38-libvirt-python

Additional context

Update this formula to the new standards

Hello.

I started to make this formula compliant with what is done in template-formula.

Here is the list of planned tasks:

  • Add kitchen tests (#35)
  • Add semantic release
  • Manage the python2 / python3 problem for libvirt-python
  • Enforce CI check to be able to merge a pull request
  • Update unsupported OSes
  • Divide the formula in several components (server, client) to address #27
  • Switch to TOFS
  • Running the formula without specific pillar should provide the OS default configuration

[BUG] Formula not compatible with latest Arch

Your setup

Formula commit hash / release tag

master / e7f31e1

Versions reports (master & minion)

3006 from Kitchen setup

Pillar / config used

Those from kitchen


Bug details

Describe the bug

  • qemu package is not installable
  • the formula fails on initial highstate because /etc/conf.d does not exist when
  • Python bindings fail (there is no python2 package for arch any more)

Steps to reproduce the bug

bin/kitchen test default-arch-base-latest-master-py3
[...]
       ----------
                 ID: libvirt-server-config-files-daemonconfig-file-managed
           Function: file.managed
               Name: /etc/conf.d/libvirtd
             Result: False
            Comment: Parent directory not present
            Started: 20:44:01.639995
           Duration: 6.314 ms
            Changes:
       ----------
                 ID: libvirt-server-service-running-service-running
           Function: service.running
               Name: libvirtd
             Result: False
            Comment: One or more requisite failed: libvirt.server.config.files.libvirt-server-config-files-daemonconfig-file-managed
            Started: 20:44:01.646576
           Duration: 0.002 ms
            Changes:
       ----------
                 ID: libvirt-python-install-pkg-installed
           Function: pkg.installed
               Name: libvirt-python3
             Result: False
            Comment: Problem encountered installing package(s). Additional info follows:

              errors:
                  - Running scope as unit: run-r5bc3788d02884e3682a33b96176372b4.scope
                    error: target not found: libvirt-python3
            Started: 20:44:01.656874
           Duration: 17646.426 ms
            Changes:
       ----------
                 ID: libvirt-server-tls-certs-virt-keys
           Function: virt.keys
               Name: libvirt_keys
             Result: False
            Comment: One or more requisite failed: libvirt.python.install.libvirt-python-install-pkg-installed
            Started: 20:44:20.206369
           Duration: 0.005 ms
            Changes:
       ----------
                 ID: libvirt-qemu-install-pkg-installed
           Function: pkg.installed
               Name: qemu
             Result: False
            Comment: The following packages failed to install/update: qemu
            Started: 20:44:20.206440
           Duration: 76274.811 ms
            Changes:
[...]

Expected behaviour

No errors

Attempts to fix the bug

PR incoming 😄

Additional context

[BUG] When salt is installed via pip for python3 separate from system python3, State 'virt.keys' was not found in SLS 'libvirt.server.tls.certs'

Your setup

Formula commit hash / release tag

v3.7.5

Versions reports (master & minion)

Master:

Salt Version:
           Salt: 3000.2

Dependency Versions:
           cffi: 1.14.0
       cherrypy: unknown
       dateutil: 2.6.1
      docker-py: 1.10.6
          gitdb: 4.0.4
      gitpython: 3.1.1
         Jinja2: 2.11.2
        libgit2: 1.0.0
       M2Crypto: 0.35.2
           Mako: 1.0.7
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: 1.4.6
      pycparser: 2.20
       pycrypto: 3.9.7
   pycryptodome: Not Installed
         pygit2: 1.2.0
         Python: 3.7.5 (default, Nov  7 2019, 10:50:52)
   python-gnupg: 0.4.6
         PyYAML: 3.12
          PyZMQ: 19.0.0
          smmap: 3.0.2
        timelib: 0.2.4
        Tornado: 4.5.3
            ZMQ: 4.3.2

System Versions:
           dist: Ubuntu 18.04 bionic
         locale: UTF-8
        machine: x86_64
        release: 4.15.0-99-generic
         system: Linux
        version: Ubuntu 18.04 bionic

Minion:

Salt Version:
           Salt: 3000.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.11.2
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 3.7.7 (default, May  4 2020, 05:28:05)
   python-gnupg: Not Installed
         PyYAML: 5.3.1
          PyZMQ: 19.0.0
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.2

System Versions:
           dist: debian bullseye/sid
         locale: UTF-8
        machine: x86_64
        release: 4.15.0-96-generic
         system: Linux
        version: debian bullseye/sid

Pillar / config used

/etc/salt/master:

file_roots:
  base:
    - /srv/salt
    - /srv/formulas/libvirt-formula

/srv/salt/top.sls:

base:
  '*':
    - libvirt

Bug details

Describe the bug

          ID: libvirt-server-tls-certs-virt-keys
    Function: virt.keys
        Name: libvirt_keys
      Result: False
     Comment: State 'virt.keys' was not found in SLS 'libvirt.server.tls.certs'
              Reason: 'virt' __virtual__ returned False
     Changes:

Steps to reproduce the bug

  1. Install salt via package on Ubuntu
  2. Install Python 3.7.7 manually (Ubuntu 20.04 LTS)
  3. Install salt to latest via pip using Python 3.7.7
  4. Link salt binaries from /usr/local/bin to /usr/bin
  5. Perform config file changes for master/minion
  6. Enable daemons in Ubuntu
  7. Run high state

Expected behaviour

This error does not show up

Attempts to fix the bug

  1. On the minion, install libvirt-dev package
  2. Then install libvirt-python via pip in the same Python interpreter used for Salt.

Additional context

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.