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, parallels Defaults to ‘kvm’

modular_libvirt

(optional) Whether to enable modular libvirt daemons or use monolithic libvirt daemon. Defaults to $::nova::params::modular_libvirt

virtsecret_service_name

(optional) virtsecret service name. Defaults to $::nova::params::virtsecret_service_name

virtnodedev_service_name

(optional) virtnodedev service name. Defaults to $::nova::params::virtnodedevd_service_name

virtqemu_service_name

(optional) virtqemu service name. Defaults to $::nova::params::virtqemu_service_name

virtproxy_service_name

(optional) virtproxy service name. Defaults to $::nova::params::virtproxy_service_name

virtstorage_service_name

(optional) virtstorage service name. Defaults to $::nova::params::virtstorage_service_name

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')
  • modular_libvirt (Any) (defaults to: $::nova::params::modular_libvirt)
  • virtsecret_service_name (Any) (defaults to: $::nova::params::virtsecret_service_name)
  • virtnodedev_service_name (Any) (defaults to: $::nova::params::virtnodedev_service_name)
  • virtqemu_service_name (Any) (defaults to: $::nova::params::virtqemu_service_name)
  • virtproxy_service_name (Any) (defaults to: $::nova::params::virtproxy_service_name)
  • virtstorage_service_name (Any) (defaults to: $::nova::params::virtstorage_service_name)


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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'manifests/compute/libvirt/services.pp', line 48

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',
  $modular_libvirt          = $::nova::params::modular_libvirt,
  $virtsecret_service_name  = $::nova::params::virtsecret_service_name,
  $virtnodedev_service_name = $::nova::params::virtnodedev_service_name,
  $virtqemu_service_name    = $::nova::params::virtqemu_service_name,
  $virtproxy_service_name   = $::nova::params::virtproxy_service_name,
  $virtstorage_service_name = $::nova::params::virtstorage_service_name
) 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'],
    }

    # Stop and disable libvirt service when modular_libvirt is enabled
    if $modular_libvirt {
      $libvirt_service_ensure = 'stopped'
      $libvirt_service_enable = false
    } else {
      $libvirt_service_ensure = 'running'
      $libvirt_service_enable = true
    }

    service { 'libvirt':
      ensure  => $libvirt_service_ensure,
      enable  => $libvirt_service_enable,
      name    => $libvirt_service_name,
      require => Anchor['nova::install::end'],
    }

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

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

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

  if ! $modular_libvirt {
    Service<| title == 'messagebus' |> -> Service<| title == 'libvirt' |>

    Service<| title == 'virtlogd' |>
    -> Service<| title == 'libvirt' |>
    -> Service<| title == 'nova-compute'|>

  } else {
    # NOTE(tkajinam): libvirt should be stopped before starting modular daemons
    Service<| title == 'libvirt' |> -> Service<| tag == 'libvirt-modular-service' |>

    Service<| title == 'messagebus' |> -> Service<| tag == 'libvirt-modular-service' |>

    Service<| title == 'virtlogd' |>
    -> Service<| tag == 'libvirt-modular-service' |>
    -> Service<| title == 'nova-compute'|>

    if $virtsecret_service_name {
      package { 'virtsecret':
        ensure => present,
        name   => "${::nova::params::libvirt_daemon_package_prefix}driver-secret"
      }
      service { 'virtsecretd':
        ensure  => running,
        enable  => true,
        name    => $virtsecret_service_name,
        require => Package['virtsecret'],
        tag     => 'libvirt-modular-service',
      }
    }

    if $virtnodedev_service_name {
      package { 'virtnodedev':
        ensure => present,
        name   => "${::nova::params::libvirt_daemon_package_prefix}driver-nodedev"
      }
      service { 'virtnodedevd':
        ensure  => running,
        enable  => true,
        name    => $virtnodedev_service_name,
        require => Package['virtnodedev'],
        tag     => 'libvirt-modular-service',
      }
    }

    if $virtqemu_service_name {
      package { 'virtqemu':
        ensure => present,
        name   => "${::nova::params::libvirt_daemon_package_prefix}driver-qemu"
      }
      service { 'virtqemud':
        ensure  => running,
        enable  => true,
        name    => $virtqemu_service_name,
        require => Package['virtqemu'],
        tag     => 'libvirt-modular-service',
      }
    }

    if $virtproxy_service_name {
      service { 'virtproxyd':
        ensure => running,
        enable => true,
        name   => $virtproxy_service_name,
        tag    => 'libvirt-modular-service',
      }
      Package<| title == 'libvirt' |> -> Service['virtproxyd']
    }

    if $virtstorage_service_name {
      package { 'virtstorage':
        ensure => present,
        name   => "${::nova::params::libvirt_daemon_package_prefix}driver-storage"
      }
      service { 'virtstoraged':
        ensure  => running,
        enable  => true,
        name    => $virtstorage_service_name,
        require => Package['virtstorage'],
        tag     => 'libvirt-modular-service',
      }
    }
  }
}