forked from ovh/pci-test
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d7709cd0d0 | ||
|
1ff264100d | ||
|
cf24853205 | ||
|
3fcdfa03ca | ||
|
cb8c71a99e | ||
|
849ef266c7 | ||
|
372c155800 | ||
|
edc8ed73b4 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
*/__pycache__
|
||||
**/.terraform/*
|
||||
**/*.tfstate
|
||||
**/*.tfstate.*
|
174
README.md
174
README.md
@ -1,173 +1 @@
|
||||
# Intro
|
||||
|
||||
We created this set of exercises to give you the opportunity to express yourself technically. Do as much as you can in
|
||||
the time you have. Feel free to ask us questions, if any. No worries if you can't make it all by lack of time or
|
||||
understanding of what we're asking. We'll defrief it with you during our next call.
|
||||
|
||||
**Have fun!**
|
||||
|
||||
## Fork
|
||||
|
||||
Register an account and fork this repo.
|
||||
|
||||
You will push your results to your fork.
|
||||
|
||||
# Ex. 1 - python
|
||||
|
||||
This exercise will be split into multiple smaller ones. For each one
|
||||
you can create files named `a.py`, `b.py` and `c.py`. You maybe resuse the same
|
||||
environment for all sub-exercises
|
||||
|
||||
Guidelines:
|
||||
- Use python version python3.7+.
|
||||
- Unless specified otherwise you can only use builtin modules.
|
||||
|
||||
### python - A
|
||||
|
||||
Write a script that prints out whatever text input is passed as argument
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
$ python a.py ping ping ping
|
||||
ping ping ping
|
||||
```
|
||||
|
||||
### python - B
|
||||
|
||||
Write a script take takes one argument (-t/--target) which can only
|
||||
accept the following values `titi`, `toto`, `tata`. When called with a valid
|
||||
target, the script should print out the target text to stdout (`titi`, `toto` or `tata`).
|
||||
When an invalid target is provided an error message should be printed to stderr
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
$ python b.py --target titi
|
||||
titi
|
||||
|
||||
$ python b.py -t tutu
|
||||
usage: b.py [-h] [-t {titi,toto,tata}]
|
||||
b.py: error: argument -t/--target: invalid choice: 'tutu' (choose from 'titi', 'toto', 'tata')
|
||||
```
|
||||
|
||||
### python - C
|
||||
|
||||
Write a script that creates ascii art equivalent of text passed as argument.
|
||||
For this exercise you may use a 3rd party module.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
$ python c.py 'Hello buddies'
|
||||
_ _ _ _ _ _ _ _
|
||||
| | | | ___ | || | ___ | |__ _ _ __| | __| |(_) ___ ___
|
||||
| |_| | / _ \| || | / _ \ | '_ \ | | | | / _` | / _` || | / _ \/ __|
|
||||
| _ || __/| || || (_) | | |_) || |_| || (_| || (_| || || __/\__ \
|
||||
|_| |_| \___||_||_| \___/ |_.__/ \__,_| \__,_| \__,_||_| \___||___/
|
||||
|
||||
```
|
||||
|
||||
# Ex. 2 - docker
|
||||
|
||||
In ex2 folder, you will find a `app` binary.
|
||||
|
||||
Can you build very lighweight docker image that contains ONLY `app` binary, and that execute `app` by default?
|
||||
|
||||
Push your Dockerfile in the ex2 folder.
|
||||
|
||||
# Ex. 3 - terraform
|
||||
|
||||
In ex3 folder, you will find an incomplete `openrc` file.
|
||||
|
||||
You will need to amend the file to configure the correct `OS_USERNAME`, `OS_PASSWORD` and `OS_REGION_NAME` with the one that we gave to you.
|
||||
|
||||
Then, using `terraform`, can you write a plan to boot a `d2-4` with a floating IP.
|
||||
|
||||
Bonus, on that instance, make sure a web server (`nginx`) is running.
|
||||
|
||||
Push your `main.tf` file in ex3 folder.
|
||||
|
||||
# Ex. 4 - git
|
||||
|
||||
In this repo, there are two branches:
|
||||
|
||||
- stein
|
||||
- queens
|
||||
|
||||
Stein contains the following commits:
|
||||
|
||||
- 1ff2641 (stein) G
|
||||
- cf24853 F
|
||||
- 3fcdfa0 E
|
||||
- cb8c71a D
|
||||
- 849ef26 C
|
||||
- 372c155 B
|
||||
- edc8ed7 A
|
||||
|
||||
Queens contains the following commits:
|
||||
|
||||
- 2624c16 (queens) F
|
||||
- 5e3521b B
|
||||
- edc8ed7 A
|
||||
|
||||
So the common ancestor is A (same commit ID).
|
||||
|
||||
B has been cherry-picked from stein to queens, without conflicts.
|
||||
|
||||
F has also been cherry-picked but with conflicts (solved, of course).
|
||||
|
||||
## Exercice
|
||||
|
||||
You will need to create two branches:
|
||||
|
||||
- merged
|
||||
- rebased
|
||||
|
||||
### Merged
|
||||
|
||||
Create the merged branch first:
|
||||
|
||||
```bash
|
||||
git checkout -b merged origin/queens
|
||||
```
|
||||
|
||||
Then merge the stein branch into your branch
|
||||
|
||||
```bash
|
||||
git merge origin/stein
|
||||
```
|
||||
|
||||
You will have a conflict to solved.
|
||||
|
||||
Solve it, then push your `merged` branch to your repo.
|
||||
|
||||
### Rebased
|
||||
|
||||
Now create the rebased branch:
|
||||
|
||||
```bash
|
||||
git checkout -b rebased origin/queens
|
||||
```
|
||||
|
||||
Now rebase it on top of stein:
|
||||
|
||||
```bash
|
||||
git rebase -i origin/stein
|
||||
```
|
||||
|
||||
You will have a conflict to solved.
|
||||
|
||||
Solve it, then push your `rebased` branch to your repo.
|
||||
|
||||
## Check diff
|
||||
|
||||
Now check the diff between your two branches `merged` and `rebased`.
|
||||
|
||||
```bash
|
||||
git diff merged..rebased
|
||||
```
|
||||
|
||||
Can you explain why you have a diff?
|
||||
|
||||
Write down the explanation in ex4 folder (like in a `README.md` file)
|
||||
# merge-vs-rebase
|
||||
|
9
ex1/a.py
9
ex1/a.py
@ -1,9 +0,0 @@
|
||||
import sys
|
||||
|
||||
|
||||
def print_args():
|
||||
return " ".join(sys.argv[1:])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(print_args())
|
13
ex1/b.py
13
ex1/b.py
@ -1,13 +0,0 @@
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-t", "--target", choices=["titi", "toto", "tata"])
|
||||
args = parser.parse_args()
|
||||
return args.target
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(main())
|
10
ex1/c.py
10
ex1/c.py
@ -1,10 +0,0 @@
|
||||
from a import print_args
|
||||
from art import text2art
|
||||
|
||||
|
||||
def main():
|
||||
return text2art(print_args())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(main())
|
@ -1,3 +0,0 @@
|
||||
FROM scratch
|
||||
COPY app /
|
||||
ENTRYPOINT ["/app"]
|
@ -1,23 +0,0 @@
|
||||
# This file is maintained automatically by "terraform init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.terraform.io/terraform-provider-openstack/openstack" {
|
||||
version = "1.42.0"
|
||||
constraints = "~> 1.42.0"
|
||||
hashes = [
|
||||
"h1:hpQ+kc+S2Nwcqqt0TtBdiLKJpaLxq5z2eKrA+kjoMq4=",
|
||||
"zh:116e297f03eb304819f8cffd66f25b77638435db2d612c2b1d56205cbbef485f",
|
||||
"zh:332411f8425caaa9ca799cc60ccbab188c6108fa2765032a5cb22a5df36b5fc5",
|
||||
"zh:3843cf3c563ae0348bcd41107508399df997a7293b2a3a79e73264be81dc456c",
|
||||
"zh:4d16af37327d36bb86913220b763ed6e599b47db7702948f019e535c5b9413d4",
|
||||
"zh:9557b325e4617977f0fec913673d2542556174811415417be7dee20f7ab2fec1",
|
||||
"zh:95b4754370eda28624f7dfcfdfc4016775bf6433535b60a8f3d99fd651e71afa",
|
||||
"zh:97c240eba6a179e5910c0afdee97f916ab4537b360db21143ab2dfb0919087e3",
|
||||
"zh:b231c1c988914f4f0be3115a432f50cf43c410867f8b3aff7e3bf7c31739c940",
|
||||
"zh:b3b105ee70e440d350d8fecf50d458ad7d4b9b4a3ab580e9b8ff1e3fec9a6b76",
|
||||
"zh:b531f02dca64486c302046d959770a6b32ac26fc6d1830582e9959d0384dbe20",
|
||||
"zh:b80a2e60dae300217f44318a74b7e45cfe7009a11b937f06fb07f677863cec59",
|
||||
"zh:f18e8dada1e2941585893c579d169bc908c68cb7b71406c47cafc0a3bdcddbe8",
|
||||
"zh:fbdc031f496fa1f80fcab41f1e3cf2e2f99b0266b685079b4a4c4c61720c914c",
|
||||
]
|
||||
}
|
58
ex3/main.tf
58
ex3/main.tf
@ -1,58 +0,0 @@
|
||||
resource "openstack_networking_router_v2" "rt" {
|
||||
name = "rt"
|
||||
admin_state_up = "true"
|
||||
external_network_id = var.network_external_id
|
||||
}
|
||||
|
||||
resource "openstack_networking_network_v2" "network_internal" {
|
||||
name = var.network_lan
|
||||
admin_state_up = "true"
|
||||
}
|
||||
|
||||
resource "openstack_networking_subnet_v2" "network_subnet" {
|
||||
name = var.network_lan
|
||||
network_id = openstack_networking_network_v2.network_internal.id
|
||||
cidr = var.network_subnet_cidr
|
||||
ip_version = 4
|
||||
enable_dhcp = true
|
||||
dns_nameservers = ["1.1.1.1"]
|
||||
}
|
||||
|
||||
resource "openstack_networking_router_interface_v2" "network_router_interface" {
|
||||
router_id = openstack_networking_router_v2.rt.id
|
||||
subnet_id = openstack_networking_subnet_v2.network_subnet.id
|
||||
}
|
||||
|
||||
resource "openstack_networking_floatingip_v2" "d2_fip" {
|
||||
pool = "Ext-Net"
|
||||
}
|
||||
|
||||
resource "openstack_compute_keypair_v2" "instance_keypair" {
|
||||
provider = openstack.ovh
|
||||
name = "instance_keypair"
|
||||
public_key = file(var.ssh_pubkey)
|
||||
}
|
||||
|
||||
resource "openstack_compute_instance_v2" "instance" {
|
||||
name = "d2_test"
|
||||
provider = openstack.ovh
|
||||
image_name = "Debian 12"
|
||||
flavor_name = "d2-4"
|
||||
key_pair = openstack_compute_keypair_v2.instance_keypair.name
|
||||
user_data = var.cloudinit_script
|
||||
network {
|
||||
name = var.network_lan
|
||||
}
|
||||
|
||||
depends_on = [ openstack_networking_subnet_v2.network_subnet ]
|
||||
}
|
||||
|
||||
data "openstack_networking_port_v2" "port" {
|
||||
device_id = openstack_compute_instance_v2.instance.id
|
||||
network_id = openstack_compute_instance_v2.instance.network.0.uuid
|
||||
}
|
||||
|
||||
resource "openstack_networking_floatingip_associate_v2" "fip_associate" {
|
||||
floating_ip = openstack_networking_floatingip_v2.d2_fip.address
|
||||
port_id = data.openstack_networking_port_v2.port.id
|
||||
}
|
@ -1 +0,0 @@
|
||||
# Placeholder
|
@ -1,13 +0,0 @@
|
||||
terraform {
|
||||
required_version = ">= 0.14.0"
|
||||
required_providers {
|
||||
openstack = {
|
||||
source = "terraform-provider-openstack/openstack"
|
||||
version = "~> 1.42.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "openstack" {
|
||||
alias = "ovh"
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
variable "network_external_id" {
|
||||
type = string
|
||||
default = "bcf59eb2-9d83-41cc-b4f5-0435ed594833"
|
||||
}
|
||||
|
||||
variable "network_lan" {
|
||||
type = string
|
||||
default = "lan_d2_demo"
|
||||
}
|
||||
|
||||
variable "network_subnet_cidr" {
|
||||
type = string
|
||||
default = "10.10.0.0/24"
|
||||
}
|
||||
|
||||
variable "ssh_pubkey" {
|
||||
type = string
|
||||
default = "~/.ssh/id_ed25519.pub"
|
||||
}
|
||||
|
||||
variable "cloudinit_script" {
|
||||
type = string
|
||||
default = "#!/bin/bash\nsudo apt update && sudo apt install -y nginx"
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
# Check diff
|
||||
|
||||
We have a diff between merged and rebased branches because merge and rebase are two different process that will not necessarily end in the same result. With merge we retrieve the remote branch at current stage (HEAD points to latest commit from the remote branch) so we will end up with exactly the same code than on the remote branch. With checkout we retrieve all commits we don't have from remote branch onto the common ancestor and other commits from our local branch are put after. In our case, our local branch was A => B => F so afer the merge we end up with A => B => F => merge commit wheareas after the rebase we end up with A => B => C => D => E => F => G => B" => F" since the common ancestor is A. Although B and F from our local branch were cherry-picked from stein branch applying them on top of stein commits (A => B => C => D => E => F => G) made new changes. More precisely, some hunks modified by B are overriden by new commits from stein branch (C, D, E or G) therefore since the rebase process reapplied the B commit these hunks have been modified once more hence the diff we have between merged and rebased branches. Finally, hunks modified by F were not overriden by G thus reapplying F didn't make any new change that's why rebased branch git tree is A => B => C => D => E => F => G => B".
|
350
libvirt.pp
Normal file
350
libvirt.pp
Normal file
@ -0,0 +1,350 @@
|
||||
# == Class: nova::compute::libvirt
|
||||
#
|
||||
# Install and manage nova-compute guests managed
|
||||
# by libvirt
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*ensure_package*]
|
||||
# (optional) The state of nova packages
|
||||
# Defaults to 'present'
|
||||
#
|
||||
# [*libvirt_virt_type*]
|
||||
# (optional) Libvirt domain type. Options are: kvm, lxc, qemu, uml, xen
|
||||
# Defaults to 'kvm'
|
||||
#
|
||||
# [*vncserver_listen*]
|
||||
# (optional) IP address on which instance vncservers should listen
|
||||
# Defaults to '127.0.0.1'
|
||||
#
|
||||
# [*migration_support*]
|
||||
# (optional) Whether to support virtual machine migration
|
||||
# Defaults to false
|
||||
#
|
||||
# [*libvirt_cpu_mode*]
|
||||
# (optional) The libvirt CPU mode to configure. Possible values
|
||||
# include custom, host-model, none, host-passthrough.
|
||||
# Defaults to 'host-model' if libvirt_virt_type is set to kvm,
|
||||
# otherwise defaults to 'none'.
|
||||
#
|
||||
# [*libvirt_cpu_model*]
|
||||
# (optional) The named libvirt CPU model (see names listed in
|
||||
# /usr/share/libvirt/cpu_map.xml). Only has effect if
|
||||
# cpu_mode="custom" and virt_type="kvm|qemu".
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*libvirt_cpu_model_extra_flags*]
|
||||
# (optional) This allows specifying granular CPU feature flags when
|
||||
# specifying CPU models. Only valid, if cpu_mode and cpu_model
|
||||
# attributes are specified and only if cpu_mode="custom".
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*libvirt_snapshot_image_format*]
|
||||
# (optional) Format to save snapshots to. Some filesystems
|
||||
# have a preference and only operate on raw or qcow2
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*libvirt_disk_cachemodes*]
|
||||
# (optional) A list of cachemodes for different disk types, e.g.
|
||||
# ["file=directsync", "block=none"]
|
||||
# If an empty list is specified, the disk_cachemodes directive
|
||||
# will be removed from nova.conf completely.
|
||||
# Defaults to an empty list
|
||||
#
|
||||
# [*libvirt_hw_disk_discard*]
|
||||
# (optional) Discard option for nova managed disks. Need Libvirt(1.0.6)
|
||||
# Qemu1.5 (raw format) Qemu1.6(qcow2 format).
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*libvirt_hw_machine_type*]
|
||||
# (optional) Option to specify a default machine type per host architecture.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*libvirt_inject_password*]
|
||||
# (optional) Inject the admin password at boot time, without an agent.
|
||||
# Defaults to false
|
||||
#
|
||||
# [*libvirt_inject_key*]
|
||||
# (optional) Inject the ssh public key at boot time.
|
||||
# Defaults to false
|
||||
#
|
||||
# [*libvirt_inject_partition*]
|
||||
# (optional) The partition to inject to : -2 => disable, -1 => inspect
|
||||
# (libguestfs only), 0 => not partitioned, >0 => partition
|
||||
# number (integer value)
|
||||
# Defaults to -2
|
||||
#
|
||||
# [*libvirt_enabled_perf_events*]
|
||||
# (optional) This is a performance event list which could be used as monitor.
|
||||
# A string list. For example: ``enabled_perf_events = cmt, mbml, mbmt``
|
||||
# The supported events list can be found in
|
||||
# https://libvirt.org/html/libvirt-libvirt-domain.html ,
|
||||
# which you may need to search key words ``VIR_PERF_PARAM_*``
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*remove_unused_base_images*]
|
||||
# (optional) Should unused base images be removed?
|
||||
# If undef is specified, remove the line in nova.conf
|
||||
# otherwise, use a boolean to remove or not the base images.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*remove_unused_resized_minimum_age_seconds*]
|
||||
# (optional) Unused resized base images younger
|
||||
# than this will not be removed
|
||||
# If undef is specified, remove the line in nova.conf
|
||||
# otherwise, use a integer or a string to define after
|
||||
# how many seconds it will be removed.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*remove_unused_original_minimum_age_seconds*]
|
||||
# (optional) Unused unresized base images younger
|
||||
# than this will not be removed
|
||||
# If undef is specified, remove the line in nova.conf
|
||||
# otherwise, use a integer or a string to define after
|
||||
# how many seconds it will be removed.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*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
|
||||
#
|
||||
# [*compute_driver*]
|
||||
# (optional) Compute driver.
|
||||
# Defaults to 'libvirt.LibvirtDriver'
|
||||
#
|
||||
# [*preallocate_images*]
|
||||
# (optional) The image preallocation mode to use.
|
||||
# Valid values are 'none' or 'space'.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*manage_libvirt_services*]
|
||||
# (optional) Whether or not deploy Libvirt services.
|
||||
# In the case of micro-services, set it to False and use
|
||||
# nova::compute::libvirt::services + hiera to select what
|
||||
# you actually want to deploy.
|
||||
# Defaults to true for backward compatibility.
|
||||
#
|
||||
# [*log_outputs*]
|
||||
# (optional) Defines log outputs, as specified in
|
||||
# https://libvirt.org/logging.html
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*rx_queue_size*]
|
||||
# (optional) virtio-net rx queue size
|
||||
# Valid values are 256, 512, 1024
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*tx_queue_size*]
|
||||
# (optional) virtio-net tx queue size
|
||||
# Valid values are 256, 512, 1024
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*file_backed_memory*]
|
||||
# (optional) Available capacity in MiB for file-backed memory.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*volume_use_multipath*]
|
||||
# (optional) Use multipath connection of the
|
||||
# iSCSI or FC volume. Volumes can be connected in the
|
||||
# LibVirt as multipath devices.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
class nova::compute::libvirt (
|
||||
$ensure_package = 'present',
|
||||
$libvirt_virt_type = 'kvm',
|
||||
$vncserver_listen = '127.0.0.1',
|
||||
$migration_support = false,
|
||||
$libvirt_cpu_mode = false,
|
||||
$libvirt_cpu_model = undef,
|
||||
$libvirt_cpu_model_extra_flags = undef,
|
||||
$libvirt_snapshot_image_format = $::os_service_default,
|
||||
$libvirt_disk_cachemodes = [],
|
||||
$libvirt_hw_disk_discard = $::os_service_default,
|
||||
$libvirt_hw_machine_type = $::os_service_default,
|
||||
$libvirt_inject_password = false,
|
||||
$libvirt_inject_key = false,
|
||||
$libvirt_inject_partition = -2,
|
||||
$libvirt_enabled_perf_events = $::os_service_default,
|
||||
$remove_unused_base_images = undef,
|
||||
$remove_unused_resized_minimum_age_seconds = undef,
|
||||
$remove_unused_original_minimum_age_seconds = undef,
|
||||
$libvirt_service_name = $::nova::params::libvirt_service_name,
|
||||
$virtlock_service_name = $::nova::params::virtlock_service_name,
|
||||
$virtlog_service_name = $::nova::params::virtlog_service_name,
|
||||
$compute_driver = 'libvirt.LibvirtDriver',
|
||||
$preallocate_images = $::os_service_default,
|
||||
$manage_libvirt_services = true,
|
||||
$log_outputs = undef,
|
||||
$rx_queue_size = $::os_service_default,
|
||||
$tx_queue_size = $::os_service_default,
|
||||
$file_backed_memory = undef,
|
||||
$volume_use_multipath = $::os_service_default,
|
||||
) inherits nova::params {
|
||||
|
||||
include ::nova::deps
|
||||
include ::nova::params
|
||||
|
||||
# libvirt_cpu_mode has different defaults depending on hypervisor.
|
||||
if !$libvirt_cpu_mode {
|
||||
case $libvirt_virt_type {
|
||||
'kvm': {
|
||||
$libvirt_cpu_mode_real = 'host-model'
|
||||
}
|
||||
default: {
|
||||
$libvirt_cpu_mode_real = 'none'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$libvirt_cpu_mode_real = $libvirt_cpu_mode
|
||||
}
|
||||
|
||||
if($::osfamily == 'Debian') {
|
||||
package { "nova-compute-${libvirt_virt_type}":
|
||||
ensure => $ensure_package,
|
||||
tag => ['openstack', 'nova-package'],
|
||||
}
|
||||
}
|
||||
|
||||
if $migration_support {
|
||||
include ::nova::migration::libvirt
|
||||
}
|
||||
|
||||
if $log_outputs {
|
||||
libvirtd_config {
|
||||
'log_outputs': value => "\"${log_outputs}\"";
|
||||
}
|
||||
}
|
||||
|
||||
unless $rx_queue_size == $::os_service_default or $rx_queue_size in [256, 512, 1024] {
|
||||
fail("Invalid rx_queue_size parameter: ${rx_queue_size}")
|
||||
}
|
||||
|
||||
unless $tx_queue_size == $::os_service_default or $tx_queue_size in [256, 512, 1024] {
|
||||
fail("Invalid_tx_queue_size parameter: ${tx_queue_size}")
|
||||
}
|
||||
|
||||
# manage_libvirt_services is here for backward compatibility to support
|
||||
# deployments that do not include nova::compute::libvirt::services
|
||||
#
|
||||
# If you're using hiera:
|
||||
# - set nova::compute::libvirt::manage_libvirt_services to false
|
||||
# - include ::nova::compute::libvirt::services in your composition layer
|
||||
# - select which services you want to deploy with
|
||||
# ::nova::compute::libvirt::services:* parameters.
|
||||
#
|
||||
# If you're not using hiera:
|
||||
# - set nova::compute::libvirt::manage_libvirt_services to true (default).
|
||||
# - select which services you want to deploy with
|
||||
# ::nova::compute::libvirt::*_service_name parameters.
|
||||
if $manage_libvirt_services {
|
||||
class { '::nova::compute::libvirt::services':
|
||||
libvirt_service_name => $libvirt_service_name,
|
||||
virtlock_service_name => $virtlock_service_name,
|
||||
virtlog_service_name => $virtlog_service_name,
|
||||
libvirt_virt_type => $libvirt_virt_type,
|
||||
}
|
||||
}
|
||||
|
||||
nova_config {
|
||||
'DEFAULT/compute_driver': value => $compute_driver;
|
||||
'DEFAULT/preallocate_images': value => $preallocate_images;
|
||||
'vnc/vncserver_listen': value => $vncserver_listen;
|
||||
'libvirt/virt_type': value => $libvirt_virt_type;
|
||||
'libvirt/cpu_mode': value => $libvirt_cpu_mode_real;
|
||||
'libvirt/snapshot_image_format': value => $libvirt_snapshot_image_format;
|
||||
'libvirt/inject_password': value => $libvirt_inject_password;
|
||||
'libvirt/inject_key': value => $libvirt_inject_key;
|
||||
'libvirt/inject_partition': value => $libvirt_inject_partition;
|
||||
'libvirt/hw_disk_discard': value => $libvirt_hw_disk_discard;
|
||||
'libvirt/hw_machine_type': value => $libvirt_hw_machine_type;
|
||||
'libvirt/enabled_perf_events': value => join(any2array($libvirt_enabled_perf_events), ',');
|
||||
'libvirt/rx_queue_size': value => $rx_queue_size;
|
||||
'libvirt/tx_queue_size': value => $tx_queue_size;
|
||||
'libvirt/file_backed_memory': value => $file_backed_memory;
|
||||
'libvirt/volume_use_multipath': value => $volume_use_multipath;
|
||||
}
|
||||
|
||||
# cpu_model param is only valid if cpu_mode=custom
|
||||
# otherwise it should be commented out
|
||||
if $libvirt_cpu_mode_real == 'custom' {
|
||||
validate_legacy(String, 'validate_string', $libvirt_cpu_model)
|
||||
nova_config {
|
||||
'libvirt/cpu_model': value => $libvirt_cpu_model;
|
||||
'libvirt/cpu_model_extra_flags': value => $libvirt_cpu_model_extra_flags;
|
||||
}
|
||||
} else {
|
||||
nova_config {
|
||||
'libvirt/cpu_model': ensure => absent;
|
||||
'libvirt/cpu_model_extra_flags': ensure => absent;
|
||||
}
|
||||
if $libvirt_cpu_model {
|
||||
warning('$libvirt_cpu_model requires that $libvirt_cpu_mode => "custom" and will be ignored')
|
||||
}
|
||||
|
||||
if $libvirt_cpu_model_extra_flags {
|
||||
warning('$libvirt_cpu_model_extra_flags requires that $libvirt_cpu_mode => "custom" and will be ignored')
|
||||
}
|
||||
}
|
||||
|
||||
if $libvirt_cpu_mode_real != 'none' {
|
||||
validate_legacy(String, 'validate_string', $libvirt_cpu_model_extra_flags)
|
||||
nova_config {
|
||||
'libvirt/cpu_model_extra_flags': value => $libvirt_cpu_model_extra_flags;
|
||||
}
|
||||
} else {
|
||||
nova_config {
|
||||
'libvirt/cpu_model_extra_flags': ensure => absent;
|
||||
}
|
||||
if $libvirt_cpu_model_extra_flags {
|
||||
warning('$libvirt_cpu_model_extra_flags requires that $libvirt_cpu_mode is not set to "none" and will be ignored')
|
||||
}
|
||||
}
|
||||
|
||||
if size($libvirt_disk_cachemodes) > 0 {
|
||||
nova_config {
|
||||
'libvirt/disk_cachemodes': value => join($libvirt_disk_cachemodes, ',');
|
||||
}
|
||||
} else {
|
||||
nova_config {
|
||||
'libvirt/disk_cachemodes': ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
if $remove_unused_resized_minimum_age_seconds != undef {
|
||||
nova_config {
|
||||
'libvirt/remove_unused_resized_minimum_age_seconds': value => $remove_unused_resized_minimum_age_seconds;
|
||||
}
|
||||
} else {
|
||||
nova_config {
|
||||
'libvirt/remove_unused_resized_minimum_age_seconds': ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
if $remove_unused_base_images != undef {
|
||||
nova_config {
|
||||
'DEFAULT/remove_unused_base_images': value => $remove_unused_base_images;
|
||||
}
|
||||
} else {
|
||||
nova_config {
|
||||
'DEFAULT/remove_unused_base_images': ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
if $remove_unused_original_minimum_age_seconds != undef {
|
||||
nova_config {
|
||||
'DEFAULT/remove_unused_original_minimum_age_seconds': value => $remove_unused_original_minimum_age_seconds;
|
||||
}
|
||||
} else {
|
||||
nova_config {
|
||||
'DEFAULT/remove_unused_original_minimum_age_seconds': ensure => absent;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user