Commit 9ff54821 authored by Thiago Paiva's avatar Thiago Paiva
Browse files

Service installation with the alias autonomic-actuator

parent 958a5f58
......@@ -17,9 +17,18 @@ classifier =
Topic :: Software Development :: Libraries :: Python Modules
[files]
data_files =
etc/autonomic-actuator =
conf/actuator.conf.example
conf/servers.yml.example
packages =
src
[entry_points]
console_scripts =
autonomic-actuator = src.cmd:main
[pbr]
warnerrors = True
......
......@@ -182,7 +182,7 @@ class Waker(NotificationEndpoint):
os.system(cmd)
class Morpheus(NotificationEndpoint):
class Sleeper(NotificationEndpoint):
filter_rule = oslo_messaging.NotificationFilter(
# publisher_id='^compute.*',
event_type='^compute\.instance\.delete\.end$',
......@@ -250,34 +250,3 @@ class Morpheus(NotificationEndpoint):
% (mgmt_if_addr, username, password))
LOG.info("Shutting down '%s'" % server.hypervisor_hostname)
os.system(cmd)
if __name__ == "__main__":
CONF(default_config_files=['actuator.conf'])
transport = oslo_messaging.get_notification_transport(CONF)
targets = [
oslo_messaging.Target(
topic='notifications',
exchange="/nova"
),
oslo_messaging.Target(
topic='versioned_notifications',
exchange="/nova"
),
]
endpoints = [
Morpheus(),
Waker(),
]
pool = "autonomic-listener"
server = oslo_messaging.get_notification_listener(
transport,
targets,
endpoints,
executor='threading',
# pool=pool
)
server.start()
server.wait()
# Copyright 2017 Universidade Federal de Campina Grande
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import logging
from oslo_config import cfg
import oslo_messaging
from src import actuator
LOG = logging.getLogger(__name__)
AUTH_OPTS = [
cfg.StrOpt('auth_url'),
cfg.StrOpt('username'),
cfg.StrOpt('password'),
cfg.StrOpt('project_name'),
cfg.StrOpt('project_domain_name'),
cfg.StrOpt('user_domain_name'),
cfg.BoolOpt('insecure'),
]
THRESH_OPTS = [
cfg.IntOpt("vcpus"),
cfg.IntOpt("free_ram_mb"),
cfg.IntOpt("free_disk_gb"),
]
CONF = cfg.CONF
CONF.register_opts(AUTH_OPTS, group="keystone_authtoken")
CONF.register_opts(THRESH_OPTS, group="thresholds")
SERVERS_FILE = "/etc/autonomic-actuator/servers.yml"
def main():
CONF(default_config_files=['/etc/autonomic-actuator/actuator.conf'])
transport = oslo_messaging.get_notification_transport(CONF)
targets = [
oslo_messaging.Target(
topic='notifications',
exchange="/nova"
),
oslo_messaging.Target(
topic='versioned_notifications',
exchange="/nova"
),
]
endpoints = [
actuator.Sleeper(),
actuator.Waker(),
]
# pool = "autonomic-listener"
server = oslo_messaging.get_notification_listener(
transport,
targets,
endpoints,
executor='threading'
# pool=pool
)
server.start()
server.wait()
if __name__ == "__main__":
main()
'''
Created on 19/12/2017
# Copyright 2017 Universidade Federal de Campina Grande
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
@author: thiagop
'''
import unittest
......@@ -25,4 +35,3 @@ class TestMorpheus(unittest.TestCase):
def test_sleep_server(self):
self.fail("TODO")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment