Heat templates for deploying OpenStack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

nova-libvirt.yaml 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. heat_template_version: rocky
  2. description: >
  3. Libvirt service configured with Puppet
  4. parameters:
  5. ServiceData:
  6. default: {}
  7. description: Dictionary packing service data
  8. type: json
  9. ServiceNetMap:
  10. default: {}
  11. description: Mapping of service_name -> network name. Typically set
  12. via parameter_defaults in the resource registry. This
  13. mapping overrides those in ServiceNetMapDefaults.
  14. type: json
  15. DefaultPasswords:
  16. default: {}
  17. type: json
  18. RoleName:
  19. default: ''
  20. description: Role name on which the service is applied
  21. type: string
  22. RoleParameters:
  23. default: {}
  24. description: Parameters specific to the role
  25. type: json
  26. EndpointMap:
  27. default: {}
  28. description: Mapping of service endpoint -> protocol. Typically set
  29. via parameter_defaults in the resource registry.
  30. type: json
  31. CephClusterName:
  32. type: string
  33. default: ceph
  34. description: The Ceph cluster name.
  35. constraints:
  36. - allowed_pattern: "[a-zA-Z0-9]+"
  37. description: >
  38. The Ceph cluster name must be at least 1 character and contain only
  39. letters and numbers.
  40. CephClientUserName:
  41. default: openstack
  42. type: string
  43. CephClientKey:
  44. description: The Ceph client key. Can be created with ceph-authtool --gen-print-key.
  45. type: string
  46. hidden: true
  47. CephClusterFSID:
  48. type: string
  49. description: The Ceph cluster FSID. Must be a UUID.
  50. CinderEnableRbdBackend:
  51. default: false
  52. description: Whether to enable or not the Rbd backend for Cinder
  53. type: boolean
  54. NovaComputeLibvirtType:
  55. type: string
  56. default: kvm
  57. LibvirtEnabledPerfEvents:
  58. type: comma_delimited_list
  59. default: []
  60. description: This is a performance event list which could be used as monitor.
  61. For example - ``enabled_perf_events = cmt, mbml, mbmt``
  62. The supported events list can be found in
  63. https://libvirt.org/html/libvirt-libvirt-domain.html ,
  64. which you may need to search key words ``VIR_PERF_PARAM_*``
  65. MonitoringSubscriptionNovaLibvirt:
  66. default: 'overcloud-nova-libvirt'
  67. type: string
  68. EnableInternalTLS:
  69. type: boolean
  70. default: false
  71. UseTLSTransportForLiveMigration:
  72. type: boolean
  73. default: true
  74. description: If set to true and if EnableInternalTLS is enabled, it will
  75. set the libvirt URI's transport to tls and configure the
  76. relevant keys for libvirt.
  77. UseTLSTransportForVnc:
  78. type: boolean
  79. default: true
  80. description: If set to true and if EnableInternalTLS is enabled, it will
  81. enable TLS transaport for libvirt VNC and configure the
  82. relevant keys for libvirt.
  83. InternalTLSCAFile:
  84. default: '/etc/ipa/ca.crt'
  85. type: string
  86. description: Specifies the default CA cert to use if TLS is used for
  87. services in the internal network.
  88. InternalTLSVncCAFile:
  89. default: '/etc/pki/CA/certs/vnc.crt'
  90. type: string
  91. description: Specifies the CA cert to use for VNC TLS.
  92. LibvirtCACert:
  93. type: string
  94. default: ''
  95. description: This specifies the CA certificate to use for TLS in libvirt.
  96. This file will be symlinked to the default CA path in libvirt,
  97. which is /etc/pki/CA/cacert.pem. Note that due to limitations
  98. GNU TLS, which is the TLS backend for libvirt, the file must
  99. be less than 65K (so we can't use the system's CA bundle).
  100. This parameter should be used if the default (which comes from
  101. the InternalTLSCAFile parameter) is not desired. The current
  102. default reflects TripleO's default CA, which is FreeIPA.
  103. It will only be used if internal TLS is enabled.
  104. LibvirtVncCACert:
  105. type: string
  106. default: ''
  107. description: This specifies the CA certificate to use for VNC TLS.
  108. This file will be symlinked to the default CA path,
  109. which is /etc/pki/libvirt-vnc/ca-cert.pem.
  110. This parameter should be used if the default (which comes from
  111. the InternalTLSVncCAFile parameter) is not desired. The current
  112. default reflects TripleO's default CA, which is FreeIPA.
  113. It will only be used if internal TLS is enabled.
  114. MigrationSshKey:
  115. type: json
  116. description: >
  117. SSH key for migration.
  118. Expects a dictionary with keys 'public_key' and 'private_key'.
  119. Values should be identical to SSH public/private key files.
  120. default:
  121. public_key: ''
  122. private_key: ''
  123. MigrationSshPort:
  124. default: 2022
  125. description: Target port for migration over ssh
  126. type: number
  127. LibvirtTLSPassword:
  128. description: The password for the libvirt service when TLS is enabled
  129. type: string
  130. hidden: true
  131. LibvirtLogFilters:
  132. description: Defines a filter to select a different logging level
  133. for a given category log outputs, as specified in
  134. https://libvirt.org/logging.html .
  135. type: string
  136. default: '1:libvirt 1:qemu 1:conf 1:security 3:event 3:json 3:file 3:object 1:util'
  137. conditions:
  138. use_tls_for_live_migration:
  139. and:
  140. - equals:
  141. - {get_param: EnableInternalTLS}
  142. - true
  143. - equals:
  144. - {get_param: UseTLSTransportForLiveMigration}
  145. - true
  146. libvirt_specific_ca_unset:
  147. equals:
  148. - {get_param: LibvirtCACert}
  149. - ''
  150. use_tls_for_vnc:
  151. and:
  152. - equals:
  153. - {get_param: EnableInternalTLS}
  154. - true
  155. - equals:
  156. - {get_param: UseTLSTransportForVnc}
  157. - true
  158. libvirt_vnc_specific_ca_unset:
  159. equals:
  160. - {get_param: LibvirtVncCACert}
  161. - ''
  162. resources:
  163. NovaBase:
  164. type: ./nova-base.yaml
  165. properties:
  166. ServiceData: {get_param: ServiceData}
  167. ServiceNetMap: {get_param: ServiceNetMap}
  168. DefaultPasswords: {get_param: DefaultPasswords}
  169. EndpointMap: {get_param: EndpointMap}
  170. RoleName: {get_param: RoleName}
  171. RoleParameters: {get_param: RoleParameters}
  172. outputs:
  173. role_data:
  174. description: Role data for the Libvirt service.
  175. value:
  176. service_name: nova_libvirt
  177. monitoring_subscription: {get_param: MonitoringSubscriptionNovaLibvirt}
  178. config_settings:
  179. map_merge:
  180. - get_attr: [NovaBase, role_data, config_settings]
  181. # we include ::nova::compute::libvirt::services in nova/libvirt profile
  182. - nova::compute::libvirt::manage_libvirt_services: false
  183. # we manage migration in nova common puppet profile
  184. nova::compute::libvirt::migration_support: false
  185. nova::compute::rbd::libvirt_images_rbd_ceph_conf:
  186. list_join:
  187. - ''
  188. - - '/etc/ceph/'
  189. - {get_param: CephClusterName}
  190. - '.conf'
  191. nova::compute::rbd::libvirt_rbd_user: {get_param: CephClientUserName}
  192. nova::compute::rbd::rbd_keyring:
  193. list_join:
  194. - '.'
  195. - - 'client'
  196. - {get_param: CephClientUserName}
  197. nova::compute::rbd::libvirt_rbd_secret_key: {get_param: CephClientKey}
  198. nova::compute::rbd::libvirt_rbd_secret_uuid: {get_param: CephClusterFSID}
  199. tripleo::profile::base::nova::migration::client::libvirt_enabled: true
  200. tripleo::profile::base::nova::migration::client::ssh_private_key: {get_param: [ MigrationSshKey, private_key ]}
  201. tripleo::profile::base::nova::migration::client::ssh_port: {get_param: MigrationSshPort}
  202. nova::compute::libvirt::services::libvirt_virt_type: {get_param: NovaComputeLibvirtType}
  203. nova::compute::libvirt::libvirt_virt_type: {get_param: NovaComputeLibvirtType}
  204. nova::compute::libvirt::libvirt_enabled_perf_events: {get_param: LibvirtEnabledPerfEvents}
  205. nova::compute::libvirt::qemu::configure_qemu: true
  206. nova::compute::libvirt::qemu::max_files: 32768
  207. nova::compute::libvirt::qemu::max_processes: 131072
  208. nova::migration::qemu::configure_qemu: true
  209. nova::migration::qemu::migration_port_min: 61152
  210. nova::migration::qemu::migration_port_max: 61215
  211. nova::compute::libvirt::vncserver_listen:
  212. str_replace:
  213. template:
  214. "%{hiera('$NETWORK')}"
  215. params:
  216. $NETWORK: {get_param: [ServiceNetMap, NovaLibvirtNetwork]}
  217. nova::compute::libvirt::log_filters: {get_param: LibvirtLogFilters}
  218. rbd_persistent_storage: {get_param: CinderEnableRbdBackend}
  219. tripleo.nova_libvirt.firewall_rules:
  220. '200 nova_libvirt':
  221. dport:
  222. - 16514
  223. - '61152-61215'
  224. - '5900-6923'
  225. -
  226. if:
  227. - use_tls_for_live_migration
  228. -
  229. generate_service_certificates: true
  230. tripleo::profile::base::nova::migration::client::libvirt_tls: true
  231. tripleo::profile::base::nova::libvirt::tls_password: {get_param: [LibvirtTLSPassword]}
  232. nova::migration::libvirt::listen_address:
  233. str_replace:
  234. template:
  235. "%{hiera('$NETWORK')}"
  236. params:
  237. $NETWORK: {get_param: [ServiceNetMap, NovaLibvirtNetwork]}
  238. nova::migration::libvirt::live_migration_inbound_addr:
  239. str_replace:
  240. template:
  241. "%{hiera('fqdn_$NETWORK')}"
  242. params:
  243. $NETWORK: {get_param: [ServiceNetMap, NovaLibvirtNetwork]}
  244. tripleo::certmonger::ca::libvirt::origin_ca_pem:
  245. if:
  246. - libvirt_specific_ca_unset
  247. - get_param: InternalTLSCAFile
  248. - get_param: LibvirtCACert
  249. tripleo::certmonger::libvirt_dirs::certificate_dir: '/etc/pki/libvirt'
  250. tripleo::certmonger::libvirt_dirs::key_dir: '/etc/pki/libvirt/private'
  251. libvirt_certificates_specs:
  252. libvirt-server-cert:
  253. service_certificate: '/etc/pki/libvirt/servercert.pem'
  254. service_key: '/etc/pki/libvirt/private/serverkey.pem'
  255. hostname:
  256. str_replace:
  257. template: "%{hiera('fqdn_NETWORK')}"
  258. params:
  259. NETWORK: {get_param: [ServiceNetMap, NovaLibvirtNetwork]}
  260. principal:
  261. str_replace:
  262. template: "libvirt/%{hiera('fqdn_NETWORK')}"
  263. params:
  264. NETWORK: {get_param: [ServiceNetMap, NovaLibvirtNetwork]}
  265. libvirt-client-cert:
  266. service_certificate: '/etc/pki/libvirt/clientcert.pem'
  267. service_key: '/etc/pki/libvirt/private/clientkey.pem'
  268. hostname:
  269. str_replace:
  270. template: "%{hiera('fqdn_NETWORK')}"
  271. params:
  272. NETWORK: {get_param: [ServiceNetMap, NovaLibvirtNetwork]}
  273. principal:
  274. str_replace:
  275. template: "libvirt/%{hiera('fqdn_NETWORK')}"
  276. params:
  277. NETWORK: {get_param: [ServiceNetMap, NovaLibvirtNetwork]}
  278. -
  279. nova::migration::libvirt::live_migration_inbound_addr:
  280. str_replace:
  281. template:
  282. "%{hiera('fqdn_$NETWORK')}"
  283. params:
  284. $NETWORK: {get_param: [ServiceNetMap, NovaLibvirtNetwork]}
  285. -
  286. if:
  287. - use_tls_for_vnc
  288. -
  289. nova::compute::libvirt::qemu::vnc_tls: true
  290. nova::compute::libvirt::qemu::vnc_tls_verify: true
  291. generate_service_certificates: true
  292. tripleo::certmonger::ca::libvirt_vnc::origin_ca_pem:
  293. if:
  294. - libvirt_vnc_specific_ca_unset
  295. - get_param: InternalTLSVncCAFile
  296. - get_param: LibvirtVncCACert
  297. tripleo::certmonger::libvirt_vnc_dirs::certificate_dir: '/etc/pki/libvirt-vnc'
  298. libvirt_vnc_certificates_specs:
  299. libvirt-vnc-server-cert:
  300. cacertfile:
  301. if:
  302. - libvirt_vnc_specific_ca_unset
  303. - get_param: InternalTLSVncCAFile
  304. - null
  305. service_certificate: '/etc/pki/libvirt-vnc/server-cert.pem'
  306. service_key: '/etc/pki/libvirt-vnc/server-key.pem'
  307. hostname:
  308. str_replace:
  309. template: "%{hiera('fqdn_NETWORK')}"
  310. params:
  311. NETWORK: {get_param: [ServiceNetMap, NovaLibvirtNetwork]}
  312. principal:
  313. str_replace:
  314. template: "libvirt-vnc/%{hiera('fqdn_NETWORK')}"
  315. params:
  316. NETWORK: {get_param: [ServiceNetMap, NovaLibvirtNetwork]}
  317. - {}
  318. step_config: |
  319. include tripleo::profile::base::nova::libvirt
  320. metadata_settings:
  321. list_concat:
  322. - if:
  323. - use_tls_for_live_migration
  324. -
  325. - service: libvirt
  326. network: {get_param: [ServiceNetMap, NovaLibvirtNetwork]}
  327. type: node
  328. - null
  329. - if:
  330. - use_tls_for_vnc
  331. -
  332. - service: libvirt-vnc
  333. network: {get_param: [ServiceNetMap, NovaLibvirtNetwork]}
  334. type: node
  335. - null