Puppet Class: nova::compute::libvirt::services

Inherits:
nova::params
Defined in:
manifests/compute/libvirt/services.pp

Overview

Class: nova::compute::libvirt::services

Install and manage libvirt services.

Parameters:

libvirt_service_name

(optional) libvirt service name. Defaults to $::nova::params::libvirt_service_name

virtlock_service_name

(optional) virtlock service name. Defaults to $::nova::params::virtlock_service_name

virtlog_service_name

(optional) virtlog service name. Defaults to $::nova::params::virtlog_service_name

libvirt_virt_type

(optional) Libvirt domain type. Options are: kvm, lxc, qemu, uml, xen Defaults to ‘kvm’

Parameters:

  • libvirt_service_name (Any) (defaults to: $::nova::params::libvirt_service_name)
  • virtlock_service_name (Any) (defaults to: $::nova::params::virtlock_service_name)
  • virtlog_service_name (Any) (defaults to: $::nova::params::virtlog_service_name)
  • libvirt_virt_type (Any) (defaults to: 'kvm')


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'manifests/compute/libvirt/services.pp', line 23

class nova::compute::libvirt::services (
  $libvirt_service_name  = $::nova::params::libvirt_service_name,
  $virtlock_service_name = $::nova::params::virtlock_service_name,
  $virtlog_service_name  = $::nova::params::virtlog_service_name,
  $libvirt_virt_type     = 'kvm',
) inherits nova::params {

  include nova::deps
  include nova::params

  if $libvirt_service_name {
    # libvirt-nwfilter
    if $::osfamily == 'RedHat' {
      package { 'libvirt-nwfilter':
        ensure => present,
        name   => $::nova::params::libvirt_nwfilter_package_name,
        before => Service['libvirt'],
        tag    => ['openstack', 'nova-support-package'],
      }
      case $libvirt_virt_type {
        'qemu': {
          $libvirt_package_name_real = "${::nova::params::libvirt_daemon_package_prefix}kvm"
        }
        'parallels': {
          $libvirt_package_name_real = $::nova::params::libvirt_package_name
        }
        default: {
          $libvirt_package_name_real = "${::nova::params::libvirt_daemon_package_prefix}${libvirt_virt_type}"
        }
      }
    } else {
      $libvirt_package_name_real = $::nova::params::libvirt_package_name
    }

    # libvirt
    package { 'libvirt':
      ensure => present,
      name   => $libvirt_package_name_real,
      tag    => ['openstack', 'nova-support-package'],
    }
    service { 'libvirt' :
      ensure   => running,
      enable   => true,
      name     => $libvirt_service_name,
      provider => $::nova::params::special_service_provider,
      require  => Anchor['nova::install::end'],
    }

    # messagebus
    if($::osfamily == 'RedHat' and $::operatingsystem != 'Fedora') {
      service { 'messagebus':
        ensure   => running,
        enable   => true,
        name     => $::nova::params::messagebus_service_name,
        provider => $::nova::params::special_service_provider,
      }
      Package['libvirt'] -> Service['messagebus'] -> Service['libvirt']
    }

    # when nova-compute & libvirt run together
    Service['libvirt'] -> Service<| title == 'nova-compute'|>
  }


  if $virtlock_service_name {
    service { 'virtlockd':
      ensure   => running,
      enable   => true,
      name     => $virtlock_service_name,
      provider => $::nova::params::special_service_provider,
    }
    Package<| name == 'libvirt' |> -> Service['virtlockd']
  }

  if $virtlog_service_name {
    service { 'virtlogd':
      ensure   => running,
      enable   => true,
      name     => $virtlog_service_name,
      provider => $::nova::params::special_service_provider,
    }
    Package<| name == 'libvirt' |> -> Service['virtlogd']
  }

}