Add nova comp libvirt resource

Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
Bogdan Dobrelya 2015-08-03 10:23:08 +02:00
parent c02055cc20
commit 09b3bd147b
4 changed files with 204 additions and 0 deletions

View File

@ -0,0 +1,84 @@
# Nova compute libvirt resource for puppet handler
Install and manage nova-compute guests managed by libvirt.
Cannot be used separately from nova compute resource and
should share the same node.
Libvirt service name defaults are given for Debian OS family.
# Parameters
source https://github.com/openstack/puppet-nova_compute_libvirt/blob/5.1.0/manifests/compute/libvirt.pp
``libvirt_virt_type``
(optional) Libvirt domain type. Options are: kvm, lxc, qemu, uml, xen
Replaces libvirt_type
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 either
kvm or qemu, otherwise defaults to 'none'.
``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_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
``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_kernels``
(optional) Should unused kernel images be removed?
This is only safe to enable if all compute nodes
have been updated to support this option.
If undef is specified, remove the line in nova.conf
otherwise, use a boolean to remove or not the kernels.
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

View File

@ -0,0 +1 @@
notify { 'Remove action is not supported upstream': }

View File

@ -0,0 +1,56 @@
$resource = hiera($::resource_name)
$libvirt_virt_type = $resource['input']['libvirt_virt_type']['value']
$vncserver_listen = $resource['input']['vncserver_listen']['value']
$migration_support = $resource['input']['migration_support']['value']
$libvirt_cpu_mode = $resource['input']['libvirt_cpu_mode']['value']
$libvirt_disk_cachemodes = $resource['input']['libvirt_disk_cachemodes']['value']
$libvirt_inject_password = $resource['input']['libvirt_inject_password']['value']
$libvirt_inject_key = $resource['input']['libvirt_inject_key']['value']
$libvirt_inject_partition = $resource['input']['libvirt_inject_partition']['value']
$remove_unused_base_images = $resource['input']['remove_unused_base_images']['value']
$remove_unused_kernels = $resource['input']['remove_unused_kernels']['value']
$remove_unused_resized_minimum_age_seconds = $resource['input']['remove_unused_resized_minimum_age_seconds']['value']
$remove_unused_original_minimum_age_seconds = $resource['input']['remove_unused_original_minimum_age_seconds']['value']
$libvirt_service_name = $resource['input']['libvirt_service_name']['value']
$libvirt_type = $resource['input']['libvirt_type']['value']
class { 'nova::compute::libvirt':
libvirt_virt_type => $libvirt_virt_type,
vncserver_listen => $vncserver_listen,
migration_support => $migration_support,
libvirt_cpu_mode => $libvirt_cpu_mode,
libvirt_disk_cachemodes => $libvirt_disk_cachemodes,
libvirt_inject_password => $libvirt_inject_password,
libvirt_inject_key => $libvirt_inject_key,
libvirt_inject_partition => $libvirt_inject_partition,
remove_unused_base_images => $remove_unused_base_images,
remove_unused_kernels => $remove_unused_kernels,
remove_unused_resized_minimum_age_seconds => $remove_unused_resized_minimum_age_seconds,
remove_unused_original_minimum_age_seconds => $remove_unused_original_minimum_age_seconds,
libvirt_service_name => $libvirt_service_name,
libvirt_type => $libvirt_type,
}
#exec { 'networking-refresh':
# command => '/sbin/ifdown -a ; /sbin/ifup -a',
#}
#exec { 'post-nova_config':
# command => '/bin/echo "Nova config has changed"',
#}
include nova::params
service { 'nova-compute':
name => $::nova::params::compute_service_name,
}
package { 'nova-compute':
name => $::nova::params::compute_package_name,
}
package { 'nova-common':
name => $nova::params::common_package_name,
ensure => $ensure_package,
}

View File

@ -0,0 +1,63 @@
id: nova_compute_libvirt
handler: puppet
puppet_module: nova
version: 1.0.0
input:
libvirt_virt_type:
schema: str
value: 'kvm'
vncserver_listen:
schema: str
value: '127.0.0.1'
migration_support:
schema: bool
value: false
libvirt_cpu_mode:
schema: str
value: ''
libvirt_disk_cachemodes:
schema: [str]
value: []
libvirt_inject_password:
schema: str!
value: 'changeme'
libvirt_inject_key:
schema: bool
value: false
libvirt_inject_partition:
schema: str
value: '-2'
remove_unused_base_images:
schema: str
value: ''
remove_unused_kernels:
schema: str
value: ''
remove_unused_resized_minimum_age_seconds:
schema: str
value: ''
remove_unused_original_minimum_age_seconds:
schema: str
value: ''
libvirt_service_name:
schema: str
value: 'libvirt-bin'
libvirt_type:
schema: bool
value: false
git:
schema: {repository: str!, branch: str!}
value: {repository: 'https://github.com/openstack/puppet-nova', branch: '5.1.0'}
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
tags: [resource/nova_compute_libvirt_service, resources/nova_compute_libvirt, resources/nova_compute, resources/nova]