Defined Type: openstack::nova::compute::partition

Defined in:
modules/openstack/manifests/nova/compute/partition.pp

Overview

creates a xfs partition for openstack nova

This is applied selectively on Compute nodes, depending on
what kind of a drive setup they have.

Parameters:

  • partition_nr (Any) (defaults to: '1')


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
# File 'modules/openstack/manifests/nova/compute/partition.pp', line 4

define openstack::nova::compute::partition(
    $partition_nr='1',
) {

    if ($title !~ /^\/dev\/([hvs]d[a-z]+|md[0-9]+)$/) {
        fail("unable to init ${title} for nova")
    }

    $dev           = "${title}${partition_nr}"
    $dev_suffix    = regsubst($dev, '^\/dev\/(.*)$', '\1')
    $fs_label      = "virt-${dev_suffix}"
    $parted_cmd    = "parted --script --align optimal ${title}"
    $parted_script = "mklabel gpt mkpart ${fs_label} 4096s 100%"

    package { 'parted':
        ensure => 'present',
    }

    exec { "parted-${title}":
        path    => '/usr/bin:/bin:/usr/sbin:/sbin',
        command => "${parted_cmd} ${parted_script}",
        creates => $dev,
        require => Package['parted'],
    }

    exec { "mkfs-${dev}":
        command => "mkfs -t xfs -L ${fs_label} -i size=512 ${dev}",
        path    => '/sbin/:/usr/sbin/',
        unless  => "xfs_admin -l ${dev}",
        require => [Package['xfsprogs'], Exec["parted-${title}"]],
    }
}