Manage the size of the partition

Now we can choose the size of the partition. Currently you can only use
three disks and the size is in GB. If the size of the disk is not
provided we use all the remaining free space available on the disk. If
you are asking for a size that doesn't fit, installation will fail.

Currently we create a volume and we mount it on /opt/influxdb.

Change-Id: I3db2ad4f2fff874bcacccb3a27df2686d30ac9b1
This commit is contained in:
Guillaume Thouvenin 2015-04-18 11:29:18 +02:00
parent 5bebbb6975
commit d125f8c81c
7 changed files with 166 additions and 2 deletions

View File

@ -81,6 +81,14 @@ User Guide
- The name of the database where you want to store your metrics.
- The username and the password for this specific database.
You can select up to 3 physical disks that will be mounted as a single logical
volume to store the InfluxDB data. If you specify no disk, the data will
be stored on the root filesystem. In all cases, InfluxDB data will be
located in the */opt/influxdb* directory.
For each disk, you can also specify the allocated size (in GB). If you don't
specify a value, the plugin will use all the free space of the disk.
Here is a screenshot of the fields
![InfluxDB-Grafana fields](./figures/influxdb-grafana-plugin.png "InfluxDB-Grafana fields")

View File

@ -0,0 +1,27 @@
$influxdb_grafana = hiera('influxdb_grafana')
if $influxdb_grafana['node_name'] == hiera('user_node_name') {
class { 'disk_management': }
if ($influxdb_grafana['disk1']) {
disk_management::partition { "/dev/${influxdb_grafana['disk1']}":
size => $influxdb_grafana['disk1_size'],
require => Class['disk_management'],
}
}
if ($influxdb_grafana['disk2']) {
disk_management::partition { "/dev/${influxdb_grafana['disk2']}":
size => $influxdb_grafana['disk2_size'],
require => Class['disk_management'],
}
}
if ($influxdb_grafana['disk3']) {
disk_management::partition { "/dev/${influxdb_grafana['disk3']}":
size => $influxdb_grafana['disk3_size'],
require => Class['disk_management'],
}
}
}

View File

@ -0,0 +1,33 @@
$influxdb_grafana = hiera('influxdb_grafana')
if $influxdb_grafana['node_name'] == hiera('user_node_name') {
$directory = $influxdb_grafana['data_dir']
$disks = split($::unallocated_pvs, ',')
validate_array($disks)
user { 'influxdb':
ensure => present,
system => true,
shell => '/sbin/nologin',
}
if empty($disks) {
file { $directory:
ensure => 'directory',
owner => 'influxdb',
group => 'influxdb',
require => User['influxdb'],
}
} else {
disk_management::lvm_fs { $directory:
owner => 'influxdb',
group => 'influxdb',
disks => $disks,
lv_name => 'influxdb-data',
vg_name => 'influxdb',
require => User['influxdb'],
}
}
}

View File

@ -49,3 +49,69 @@ attributes:
regex:
source: '^[\S]{4,}$'
error: "You must provide a password with at least 4 characters"
# Parameter hidden in the UI on purpose
data_dir:
value: '/opt/influxdb'
label: 'InfluxDB storage directory'
description: 'Directory used by InfluxDB to store data'
weight: 70
type: "text"
restrictions:
- condition: true
action: hide
disk1:
value: ''
label: 'Disk 1'
description: 'Disk device used to store InfluxDB data (for instance sda or sdb or another device). Leave it empty to use "/".'
weight: 80
type: "text"
disk1_size:
value: ''
label: 'Size'
description: 'in GB. Leave it empty to use all free space.'
weight: 90
type: "text"
disk2:
value: ''
label: 'Disk 2'
description: 'Disk device used to store InfluxDB data (for instance sdb).'
weight: 100
type: "text"
restrictions:
- condition: "settings:influxdb_grafana.disk1.value == ''"
action: "disable"
disk2_size:
value: ''
label: 'Size'
description: 'in GB. Leave it empty to use all free space.'
weight: 110
type: "text"
restrictions:
- condition: "settings:influxdb_grafana.disk1.value == ''"
action: "disable"
disk3:
value: ''
label: 'Disk 3'
description: 'Disk device used to store InfluxDB data (for instance sdc).'
weight: 120
type: "text"
restrictions:
- condition: "settings:influxdb_grafana.disk2.value == ''"
action: "disable"
disk3_size:
value: ''
label: 'Size'
description: 'in GB. Leave it empty to use all free space.'
weight: 130
type: "text"
restrictions:
- condition: "settings:influxdb_grafana.disk2.value == ''"
action: "disable"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -17,6 +17,9 @@ NGINX_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/jfryman-nginx-0.2.2.
FUEL_LIB_VERSION="6.0"
FUEL_LIB_TARBALL_URL="https://github.com/stackforge/fuel-library/archive/${FUEL_LIB_VERSION}.tar.gz"
# Get the disk_management from fuel-plugin-elasticsearch-kibana
MODULE_DISK_MANAGEMENT="https://github.com/stackforge/fuel-plugin-elasticsearch-kibana/archive/master.tar.gz"
# Downloads needed RPM or DEB packages
function download {
case "$1" in
@ -37,7 +40,7 @@ download rpm http://get.influxdb.org/influxdb-0.8.8-1.x86_64.rpm
# Install puppet manifests
# Clean-up first
rm -rf ${MODULES}/{influxdb,nginx,staging,stdlib,concat,inifile}
rm -rf ${MODULES}/{influxdb,nginx,staging,stdlib,concat,inifile,disk_management,lvm}
mkdir -p ${MODULES}/{influxdb,nginx,staging}
# Include influxdb manifests, its dependendy and nginx.
@ -48,7 +51,12 @@ wget -qO- "${NGINX_TARBALL_URL}" | tar -C "${MODULES}/nginx" --strip-components=
# Include dependent manifests from fuel-library
wget -qO- "${FUEL_LIB_TARBALL_URL}" | \
tar -C "${MODULES}" --strip-components=3 -zxvf - \
fuel-library-${FUEL_LIB_VERSION}/deployment/puppet/{stdlib,concat,inifile}
fuel-library-${FUEL_LIB_VERSION}/deployment/puppet/{stdlib,concat,inifile,lvm}
# Include disk_management
wget -qO- "${MODULE_DISK_MANAGEMENT}" | \
tar -C "${MODULES}" --strip-components=4 -xzvf - \
fuel-plugin-elasticsearch-kibana-master/deployment_scripts/puppet/modules/disk_management
# We need to embed grafana sources into the lma_monitoring_analytics module.
GRAFANA_TARBALL_URL="http://grafanarel.s3.amazonaws.com/grafana-1.9.1.tar.gz"

View File

@ -7,6 +7,28 @@
puppet_modules: /etc/puppet/modules
timeout: 720
- role: ['base-os']
stage: post_deployment
type: puppet
parameters:
puppet_manifest: puppet/manifests/setup_disks.pp
puppet_modules: puppet/modules
timeout: 600
- role: ['base-os']
stage: post_deployment
type: reboot
parameters:
timeout: 600
- role: ['base-os']
stage: post_deployment
type: puppet
parameters:
puppet_manifest: puppet/manifests/setup_influxdir.pp
puppet_modules: puppet/modules
timeout: 600
- role: ['base-os']
stage: post_deployment
type: puppet