Skip to content

Commit

Permalink
ncm-openstack: add ceilometer service
Browse files Browse the repository at this point in the history
Include ceilometer server

Resolves: #1381
  • Loading branch information
alvarosimon committed Jun 3, 2019
1 parent 2b74cfe commit a79eef3
Show file tree
Hide file tree
Showing 26 changed files with 406 additions and 5 deletions.
5 changes: 5 additions & 0 deletions ncm-openstack/src/main/pan/components/openstack/common.pan
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ type openstack_neutron_service_plugins = choice('router', 'port_forwarding')[];

type openstack_neutron_agent_extensions = choice('port_forwarding')[];

type openstack_keystone_endpoint_type = choice('internalURL', 'publicURL');

@documentation{
OpenStack common domains section
}
Expand All @@ -49,6 +51,9 @@ type openstack_domains_common = {
'username' : string
@{OpenStack service user password}
'password' : string
@{Type of endpoint in Identity service catalog to use for communication with
OpenStack services}
'interface' ? openstack_keystone_endpoint_type = 'internalURL'
};

@documentation{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ type openstack_horizon_config_identity_keystone = {
@{the endpoint type to use for the endpoints in the Keystone service catalog.
The default value for all services except for identity is "publicURL".
The default value for the identity service is "internalURL".}
'openstack_endpoint_type' ? choice('internalURL', 'publicURL')
'openstack_endpoint_type' ? openstack_keystone_endpoint_type
@{Configure the default role for users that you create via the dashboard}
'openstack_keystone_default_role' : string = 'user'
'openstack_keystone_backend' : openstack_horizon_keystone_backend
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
unique template components/openstack/identity/gather/metric/ceilometer;

@{openstack_quattor_ceilometer default value until we can use the schema defaults from value}
prefix "/software/components/openstack/metric/ceilometer/quattor";
prefix "service/internal";
'proto' ?= 'https';
'host' ?= OBJECT;
'port' ?= 8041;
'suffix' ?= '';

# Should be gnocchi user no ceilometer
#prefix "services/gnocchi";
#"type" = "metric";
#"internal/port" ?= 8041;
#"internal/suffix" ?= '';
14 changes: 14 additions & 0 deletions ncm-openstack/src/main/pan/components/openstack/metric.pan
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ${license-info}
# ${developer-info}
# ${author-info}

declaration template components/openstack/metric;

include 'components/openstack/metric/ceilometer';

@documentation{
Type to define OpenStack metric services
}
type openstack_metric_config = {
'ceilometer' ? openstack_ceilometer_config
} with openstack_oneof(SELF, 'ceilometer');
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# ${license-info}
# ${developer-info}
# ${author-info}


declaration template components/openstack/metric/ceilometer;

include 'components/openstack/identity';



@documentation{
list of Gnocchi api section
}
type openstack_ceilometer_gnocchi_api = {
'auth_mode' : string = 'keystone'
};


@documentation{
list of Gnocchi indexer section
}
type openstack_ceilometer_gnocchi_indexer = {
@{The SQLAlchemy connection string to use to connect to the database}
'url' : string
};

@documentation{
list of Gnocchi storage section
}
type openstack_ceilometer_gnocchi_storage = {
@{coordination_url is not required but specifying one will improve
performance with better workload division across workers}
'coordination_url' ? string
'file_basepath' : absolute_file_path = '/var/lib/gnocchi'
'driver' : string = 'file'
};


@documentation{
list of Ceilometer Gnocchi service sections
}
type openstack_ceilometer_gnocchi_config = {
'api' : openstack_ceilometer_gnocchi_api
'indexer' : openstack_ceilometer_gnocchi_indexer
'storage' : openstack_ceilometer_gnocchi_storage
'keystone_authtoken' : openstack_domains_common
};

@documentation{
list of Ceilometer service configuration sections
}
type openstack_ceilometer_service_config = {
'DEFAULT' : openstack_DEFAULTS
'service_credentials' : openstack_domains_common
};

type openstack_quattor_ceilometer = openstack_quattor;

@documentation{
list of Ceilometer service configuration sections
}
type openstack_ceilometer_config = {
'service' ? openstack_ceilometer_service_config
'gnocchi' ? openstack_ceilometer_gnocchi_config
# pipeline in yaml format
#'pipeline' ? openstack_ceilometer_pipeline_config
# default empty dict for pure hypervisor
'quattor' : openstack_quattor_ceilometer = dict()
};
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type openstack_heat_clients_keystone = {
type openstack_heat_clients = {
@{Type of endpoint in Identity service catalog to use for communication with
the OpenStack service}
'endpoint_type' : choice('internalURL', 'publicURL') = 'internalURL'
'endpoint_type' : openstack_keystone_endpoint_type = 'internalURL'
} = dict();

type openstack_quattor_heat = openstack_quattor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ unique template components/${project.artifactId}/rootwrap;

include 'components/sudo/config';

variable ROOTWRAP_SERVICES = list('nova', 'neutron', 'cinder', 'manila');
variable ROOTWRAP_SERVICES = list('nova', 'neutron', 'cinder', 'manila', 'ceilometer');

"/software/components/sudo/privilege_lines" = {

Expand Down
2 changes: 2 additions & 0 deletions ncm-openstack/src/main/pan/components/openstack/schema.pan
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ include 'components/openstack/dashboard';
include 'components/openstack/orchestration';
include 'components/openstack/catalog';
include 'components/openstack/messaging';
include 'components/openstack/metric';

@documentation{
Hypervisor configuration.
Expand Down Expand Up @@ -57,6 +58,7 @@ type openstack_component = {
'messaging' ? openstack_messaging_config
'orchestration' ? openstack_orchestration_config
'catalog' ? openstack_catalog_config
'metric' ? openstack_metric_config
'openrc' ? openstack_openrc_config
@{Hypervisor configuration. Host is a hypervisor when this attribute exists}
'hypervisor' ? openstack_hypervisor_config
Expand Down
79 changes: 79 additions & 0 deletions ncm-openstack/src/main/perl/OpenStack/Ceilometer.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#${PMpre} NCM::Component::OpenStack::Ceilometer${PMpost}

use parent qw(NCM::Component::OpenStack::Service);

use Readonly;
use Data::Dumper;

Readonly our $GNOCCHI_DB_MANAGE_COMMAND => "/usr/bin/gnocchi-upgrade";
Readonly our $CEILOMETER_DB_MANAGE_COMMAND => "/usr/bin/ceilometer-upgrade";

Readonly::Array my @CEILOMETER_DB_BOOTSTRAP => qw(--debug);
Readonly::Array my @CEILOMETER_DB_VERSION => qw(--version);

Readonly::Hash my %CONF_FILE => {
service => "/etc/ceilometer/ceilometer.conf",
gnocchi => "/etc/gnocchi/gnocchi.conf",
#pipeline => "/etc/ceilometer/pipeline.yaml",
#polling => "/etc/ceilometer/polling.yaml",
};

Readonly::Hash my %DAEMON => {
service => ['openstack-ceilometer-notification', 'openstack-ceilometer-central'],
gnocchi => ['openstack-gnocchi-api', 'openstack-gnocchi-metricd'],
};

Readonly::Hash my %DAEMON_HYPERVISOR => {
service => ['openstack-ceilometer-compute', 'openstack-ceilometer-ipmi'],
};


=head2 Methods
=over
=item _attrs
Override C<manage>, C<db> and C<filename> attribute (and set C<daemon_map>)
=cut

sub _attrs
{
my $self = shift;

$self->{manage} = $self->{hypervisor} ? undef : $GNOCCHI_DB_MANAGE_COMMAND;
# Ceilometer has no database parameters
$self->{db_version} = [@CEILOMETER_DB_VERSION];
$self->{db_sync} = [@CEILOMETER_DB_BOOTSTRAP];
$self->{filename} = \%CONF_FILE;
$self->{daemon_map} = $self->{hypervisor} ? \%DAEMON_HYPERVISOR : \%DAEMON;
}


=item post_populate_service_database
Initializes Ceilometer database after Gnocchi setup
for C<Ceilometer> metric service.
=cut

sub post_populate_service_database
{
my ($self) = @_;

my $cmd = [$CEILOMETER_DB_MANAGE_COMMAND];
$self->_do($cmd, "post-populate Ceilometer database", sensitive => 0)
or return;

return 1;
}


=pod
=back
=cut

1;
33 changes: 33 additions & 0 deletions ncm-openstack/src/main/perl/openstack.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ ncm-openstack provides support for OpenStack configuration for:
=back
=head2 Volume
=over
=item * Cinder
=back
=head2 Network
=over
Expand All @@ -62,6 +70,30 @@ ncm-openstack provides support for OpenStack configuration for:
=back
=head2 Metric
=over
=item * Ceilometer
=back
=head2 Orchestration
=over
=item * Heat
=back
=head2 Share
=over
=item * Manila
=back
=head2 Messaging
=over
Expand Down Expand Up @@ -127,6 +159,7 @@ sub Configure
'network',
'orchestration',
'catalog',
'metric',
'dashboard',
];

Expand Down
22 changes: 22 additions & 0 deletions ncm-openstack/src/main/resources/tests/profiles/ceilometer.pan
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
object template ceilometer;

include 'components/openstack/schema';

bind "/metaconfig/contents" = openstack_ceilometer_service_config;

"/metaconfig/module" = "common";

variable OPENSTACK_HOST_SERVER ?= 'controller.mysite.com';

prefix "/metaconfig/contents";

"DEFAULT" = dict(
"transport_url", format("rabbit://openstack:rabbit_pass@%s", OPENSTACK_HOST_SERVER),
);
"service_credentials" = dict(
#"auth_uri", format('http://%s:5000', OPENSTACK_HOST_SERVER),
"auth_url", format('http://%s:5000/v3', OPENSTACK_HOST_SERVER),
"username", "ceilometer",
"password", "ceilometer_good_password",
"interface", "internalURL",
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
object template ceilometer_gnocchi;

include 'components/openstack/schema';

bind "/metaconfig/contents" = openstack_ceilometer_gnocchi_config;

"/metaconfig/module" = "common";

variable OPENSTACK_HOST_SERVER ?= 'controller.mysite.com';

prefix "/metaconfig/contents";

"api" = dict();
"storage" = dict(
'coordination_url', format('redis://%s:6379', OPENSTACK_HOST_SERVER),
);
"keystone_authtoken" = dict(
"auth_url", format('http://%s:5000/v3', OPENSTACK_HOST_SERVER),
"username", "gnocchi",
"password", "gnocchi_good_password",
"interface", "internalURL",
);
"indexer" = dict(
"url", format("mysql+pymysql://gnocchi:gnocchi_db_pass@%s/gnocchi", OPENSTACK_HOST_SERVER),
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
OpenStack test: do not render quattor section
---
---
\[quattor\] ### COUNT 0
15 changes: 15 additions & 0 deletions ncm-openstack/src/main/resources/tests/regexps/ceilometer/simple
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
OpenStack Ceilometer test
---
multiline
---
^\[DEFAULT\]$
^transport_url\s?=\s*.+\s*$

^\[service_credentials\]\s*$
^auth_type\s?=\s*.+\s*$
^auth_url\s?=\s*.+\s*$
^password\s?=\s*.+\s*$
^project_domain_name\s?=\s*.+\s*$
^project_name\s?=\s*.+\s*$
^user_domain_name\s?=\s*.+\s*$
^username\s?=\s*.+\s*$
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
OpenStack test: do not render quattor section
---
---
\[quattor\] ### COUNT 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
OpenStack Ceilometer Gnocchi test
---
multiline
---
^\[api\]\s*$
^auth_mode\s?=\s*.+\s*$

^\[indexer\]\s*$
^url\s?=\s*.+\s*$

^\[keystone_authtoken\]\s*$
^auth_type\s?=\s*.+\s*$
^auth_url\s?=\s*.+\s*$
^password\s?=\s*.+\s*$
^project_domain_name\s?=\s*.+\s*$
^project_name\s?=\s*.+\s*$
^user_domain_name\s?=\s*.+\s*$
^username\s?=\s*.+\s*$

^\[storage\]\s*$
^coordination_url\s?=\s*.+\s*$
^driver\s?=\s*.+\s*$
^file_basepath\s?=\s*.+\s*$
Loading

0 comments on commit a79eef3

Please sign in to comment.