File: qemu.pp

package info (click to toggle)
puppet-module-nova 25.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,100 kB
  • sloc: ruby: 11,433; python: 38; sh: 10; makefile: 10
file content (124 lines) | stat: -rw-r--r-- 3,735 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# == Class: nova::compute::libvirt::qemu
#
# Configures qemu limits for use by libvirt
#
# === Parameters:
#
# [*configure_qemu*]
#   (optional) Whether or not configure qemu bits.
#   Defaults to false.
#
# [*user*]
#   (optional) User for qemu processes run by the system instance.
#   Defaults to undef.
#
# [*group*]
#   (optional) Group under which the qemu should run.
#   Defaults to undef.
#
# [*max_files*]
#   (optional) Maximum number of opened files, per process.
#   Defaults to 1024.
#
# [*max_processes*]
#   (optional) Maximum number of processes that can be run by qemu user.
#   Defaults to 4096.
#
# [*vnc_tls*]
#   (optional) Enables TLS for vnc connections.
#   Defaults to false.
#
# [*vnc_tls_verify*]
#   (optional) Enables TLS client cert verification when vnc_tls is enabled.
#   Defaults to true.
#
# [*default_tls_verify*]
#   (optional) Enables TLS client cert verification.
#   Defaults to true.
#
# [*memory_backing_dir*]
#   (optional) This directory is used for memoryBacking source if configured as file.
#   NOTE: big files will be stored here
#   Defaults to undef.
#
# [*nbd_tls*]
#   (optional) Enables TLS for nbd connections.
#   Defaults to false.
#
# [*libvirt_version*]
#   (optional) installed libvirt version. Default is automatic detected depending
#   of the used OS installed via ::nova::compute::libvirt::version::default .
#   Defaults to ::nova::compute::libvirt::version::default
#
class nova::compute::libvirt::qemu(
  Boolean $configure_qemu     = false,
  $user                       = undef,
  $group                      = undef,
  $max_files                  = 1024,
  $max_processes              = 4096,
  Boolean $vnc_tls            = false,
  Boolean $vnc_tls_verify     = true,
  Boolean $default_tls_verify = true,
  $memory_backing_dir         = undef,
  Boolean $nbd_tls            = false,
  $libvirt_version            = $::nova::compute::libvirt::version::default,
) inherits nova::compute::libvirt::version {

  include nova::deps

  if versioncmp($libvirt_version, '4.5') < 0 {
    fail('libvirt version < 4.5 is no longer supported')
  }

  Qemu_config<||> ~> Service<| tag == 'libvirt-qemu-service' |>

  if $configure_qemu {

    if $vnc_tls {
      $vnc_tls_verify_real = $vnc_tls_verify
    } else {
      $vnc_tls_verify_real = false
    }

    qemu_config {
      'max_files':               value => $max_files;
      'max_processes':           value => $max_processes;
      'vnc_tls':                 value => $vnc_tls;
      'vnc_tls_x509_verify':     value => $vnc_tls_verify_real;
      'default_tls_x509_verify': value => $default_tls_verify;
    }

    if $user and !empty($user) {
      qemu_config { 'user': value => $user, quote =>true }
    } else {
      qemu_config { 'user': ensure => absent }
    }

    if $group and !empty($group) {
      qemu_config { 'group': value => $group, quote =>true }
    } else {
      qemu_config { 'group': ensure => absent }
    }

    if $memory_backing_dir and !empty($memory_backing_dir) {
      qemu_config { 'memory_backing_dir': value => $memory_backing_dir, quote =>true }
    } else {
      qemu_config { 'memory_backing_dir': ensure => absent }
    }

    qemu_config { 'nbd_tls': value => $nbd_tls }

  } else {
    qemu_config {
      'max_files':               ensure => absent;
      'max_processes':           ensure => absent;
      'vnc_tls':                 ensure => absent;
      'vnc_tls_x509_verify':     ensure => absent;
      'default_tls_x509_verify': ensure => absent;
      'user':                    ensure => absent;
      'group':                   ensure => absent;
      'memory_backing_dir':      ensure => absent;
      'nbd_tls':                 ensure => absent;
    }
  }
}