refactor-at-the-very-early-age

Change-Id: I327d1d646cae065896ad2caa40b68a951f9405ee
This commit is contained in:
LingxianKong 2015-05-08 12:06:56 +08:00
parent dbb69e5e51
commit e7a701446b
6 changed files with 63 additions and 11 deletions

View File

@ -57,6 +57,14 @@ debug = False
auth_enable = True
[global_manager]
# The message topic that the global_manager listens on. (string value)
#topic=global_manager
# Name of the global_manager node. This can be an opaque identifier.
# It is not necessarily a hostname, FQDN, or IP address.
# (string value)
#host=0.0.0.0
# The directory, where the VM instance data are stored
vm_instance_directory = /var/lib/nova/instances
@ -96,6 +104,14 @@ algorithm_vm_placement_factory = terracotta.globals.vm_placement.bin_packing.bes
algorithm_vm_placement_parameters = {"cpu_threshold": 0.8, "ram_threshold": 0.95, "last_n_vm_cpu": 2}
[local_manager]
# The message topic that the local_manager listens on. (string value)
#topic=local_manager
# Name of the local_manager node. This can be an opaque identifier.
# It is not necessarily a hostname, FQDN, or IP address.
# (string value)
#host=0.0.0.0
# The time interval between subsequent invocations of the local
# manager in seconds
local_manager_interval = 300
@ -142,6 +158,14 @@ algorithm_vm_selection_parameters = {"last_n": 2}
# This is used for logging host overloads into the database.
host_cpu_overload_threshold = 0.8
# The message topic that the collector listens on. (string value)
#topic=collector
# Name of the collector node. This can be an opaque identifier.
# It is not necessarily a hostname, FQDN, or IP address.
# (string value)
#host=0.0.0.0
[database]
# The host name and credentials for connecting to the MySQL database
# specified in the format supported by SQLAlchemy

View File

@ -1,18 +1,28 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
amqplib>=0.6.1 # This is not in global requirements (master branch)
kombu>=3.0.7
pbr>=0.6,!=0.7,<1.0
eventlet>=0.17.3
pecan>=0.8.0
WSME>=0.6
WebOb>=1.2.3
Babel>=1.3
kombu>=3.0.7
oslo.config>=1.11.0 # Apache-2.0
oslo.db>=1.7.0 # Apache-2.0
oslo.log>=1.0.0 # Apache-2.0
oslo.messaging>=1.8.0 # Apache-2.0
oslo.utils>=1.4.0 # Apache-2.0
python-novaclient>=2.22.0
python-keystoneclient>=1.3.0
six>=1.9.0
SQLAlchemy>=0.9.7,<=0.9.99
stevedore>=1.3.0 # Apache-2.0
keystonemiddleware>=1.5.0
libvirt-python>=1.2.5 # LGPLv2+
netaddr>=0.7.12
Mako>=0.4.0
numpy # This is not in global requirements
scipy # This is not in global requirements
netifaces>=0.10.4

View File

@ -16,7 +16,6 @@ from oslo_config import cfg
import pecan
from terracotta.api import access_control
from terracotta import context as ctx
def get_pecan_config():

View File

@ -45,6 +45,7 @@ from terracotta.globals import manager as global_mgr
from terracotta import version
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
@ -108,8 +109,8 @@ def launch_gm(transport):
def launch_collector(transport):
target = messaging.Target(
topic=cfg.CONF.local_collector.topic,
server=cfg.CONF.local_collector.host
topic=cfg.CONF.collector.topic,
server=cfg.CONF.collector.host
)
global_manager = collector.Collector()
@ -119,8 +120,7 @@ def launch_collector(transport):
transport,
target,
endpoints,
executor='eventlet',
serializer=ctx.RpcContextSerializer(ctx.JsonPayloadSerializer())
executor='eventlet'
)
server.start()
@ -168,7 +168,7 @@ def main():
try:
config.parse_args()
print_service_info()
logging.setup(cfg.CONF, 'Terracotta')
logging.setup(CONF, 'Terracotta')
transport = rpc.get_transport()
launch_any(transport, set(cfg.CONF.server))

View File

@ -95,6 +95,12 @@ use_debugger = cfg.BoolOpt(
)
global_manager_opts = [
cfg.StrOpt('host', default='0.0.0.0',
help='Name of the global_manager node. This can be an opaque '
'identifier. It is not necessarily a hostname, '
'FQDN, or IP address.'),
cfg.StrOpt('topic', default='global_manager',
help='The message topic that the global_manager listens on.'),
cfg.StrOpt('vm_instance_directory', default='/var/lib/nova/instances',
help='The directory, where the VM instance data are stored'),
cfg.StrOpt('os_admin_tenant_name', default='tenantname',
@ -135,6 +141,12 @@ global_manager_opts = [
]
local_manager_opts = [
cfg.StrOpt('host', default='0.0.0.0',
help='Name of the local_manager node. This can be an opaque '
'identifier. It is not necessarily a hostname, '
'FQDN, or IP address.'),
cfg.StrOpt('topic', default='local_manager',
help='The message topic that the local_manager listens on.'),
cfg.IntOpt('local_manager_interval', default=300,
help='The time interval between subsequent invocations '
'of the local manager in seconds'),
@ -183,7 +195,13 @@ collector_opts = [
'of the physical CPU of a host, above which the host '
'is considered to be overloaded.'
'This is used for logging host overloads into the'
' database.')
' database.'),
cfg.StrOpt('host', default='0.0.0.0',
help='Name of the collector node. This can be an opaque '
'identifier. It is not necessarily a hostname, '
'FQDN, or IP address.'),
cfg.StrOpt('topic', default='collector',
help='The message topic that the collector listens on.'),
]
database_opts = [
@ -209,6 +227,7 @@ CONF.register_cli_opt(launch_opt)
def parse_args(args=None, usage=None, default_config_files=None):
logging.register_options(CONF)
CONF(
args=args,
project='terracotta',

View File

@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo import messaging
from oslo_config import cfg
from oslo_log import log as logging
from oslo_messaging.rpc import client
from terracotta import context as auth_ctx
from terracotta import exceptions as exc
@ -96,7 +96,7 @@ def wrap_messaging_exception(method):
return decorator
class EngineClient(base.Engine):
class EngineClient():
"""RPC Engine client."""
def __init__(self, transport):
@ -121,7 +121,7 @@ class LocalManagerServer(object):
self._executor = manager
class ExecutorClient(base.Executor):
class ExecutorClient():
"""RPC Executor client."""
def __init__(self, transport):