Fix bugs in load config options
The config options in DEFAULT section are not registered before use. This patch also fixed the order of import to avoid pep8 failure. Change-Id: Iadde365d5bac235423bbe9b3d9f72df11f32e30d Implements: blueprint refactoring-terracotta-as-per-requires-of-openstack-project
This commit is contained in:
parent
887a7d155e
commit
8194118843
terracotta
@ -12,9 +12,17 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
|
||||
import eventlet
|
||||
import os
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from wsgiref import simple_server
|
||||
import sys
|
||||
from terracotta.api import app
|
||||
from terracotta import config
|
||||
from terracotta import rpc
|
||||
from terracotta import version
|
||||
|
||||
eventlet.monkey_patch(
|
||||
os=True,
|
||||
@ -23,7 +31,6 @@ eventlet.monkey_patch(
|
||||
thread=False if '--use-debugger' in sys.argv else True,
|
||||
time=True)
|
||||
|
||||
import os
|
||||
|
||||
POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
os.pardir,
|
||||
@ -31,15 +38,6 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'terracotta', '__init__.py')):
|
||||
sys.path.insert(0, POSSIBLE_TOPDIR)
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from wsgiref import simple_server
|
||||
|
||||
from terracotta.api import app
|
||||
from terracotta import config
|
||||
from terracotta import rpc
|
||||
from terracotta import version
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -12,9 +12,17 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
|
||||
import eventlet
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
import sys
|
||||
from terracotta import config
|
||||
from terracotta import rpc
|
||||
from terracotta.locals import collector
|
||||
from terracotta.openstack.common import threadgroup
|
||||
from terracotta import version
|
||||
|
||||
eventlet.monkey_patch(
|
||||
os=True,
|
||||
@ -31,16 +39,6 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'terracotta', '__init__.py')):
|
||||
sys.path.insert(0, POSSIBLE_TOPDIR)
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
|
||||
from terracotta import config
|
||||
from terracotta import rpc
|
||||
from terracotta.locals import collector
|
||||
from terracotta.openstack.common import threadgroup
|
||||
from terracotta import version
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -12,9 +12,18 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
|
||||
import eventlet
|
||||
import os
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
import sys
|
||||
from terracotta import config
|
||||
from terracotta import rpc
|
||||
from terracotta.globals import manager as global_mgr
|
||||
from terracotta import version
|
||||
|
||||
|
||||
eventlet.monkey_patch(
|
||||
os=True,
|
||||
@ -23,7 +32,6 @@ eventlet.monkey_patch(
|
||||
thread=False if '--use-debugger' in sys.argv else True,
|
||||
time=True)
|
||||
|
||||
import os
|
||||
|
||||
POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
os.pardir,
|
||||
@ -31,15 +39,6 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'terracotta', '__init__.py')):
|
||||
sys.path.insert(0, POSSIBLE_TOPDIR)
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
|
||||
from terracotta import config
|
||||
from terracotta import rpc
|
||||
from terracotta.globals import manager as global_mgr
|
||||
from terracotta import version
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -12,9 +12,22 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
|
||||
import eventlet
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
from wsgiref import simple_server
|
||||
import sys
|
||||
from terracotta.api import app
|
||||
from terracotta import config
|
||||
from terracotta import rpc
|
||||
from terracotta.locals import collector
|
||||
from terracotta.locals import manager as local_mgr
|
||||
from terracotta.globals import manager as global_mgr
|
||||
from terracotta.openstack.common import threadgroup
|
||||
from terracotta import version
|
||||
|
||||
|
||||
eventlet.monkey_patch(
|
||||
os=True,
|
||||
@ -31,20 +44,6 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'terracotta', '__init__.py')):
|
||||
sys.path.insert(0, POSSIBLE_TOPDIR)
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
from wsgiref import simple_server
|
||||
|
||||
from terracotta.api import app
|
||||
from terracotta import config
|
||||
from terracotta import rpc
|
||||
from terracotta.locals import collector
|
||||
from terracotta.locals import manager as local_mgr
|
||||
from terracotta.globals import manager as global_mgr
|
||||
from terracotta.openstack.common import threadgroup
|
||||
from terracotta import version
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -12,9 +12,18 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
|
||||
import eventlet
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
import sys
|
||||
from terracotta import config
|
||||
from terracotta import rpc
|
||||
from terracotta.locals import manager as local_mgr
|
||||
from terracotta.openstack.common import threadgroup
|
||||
from terracotta import version
|
||||
import os
|
||||
|
||||
eventlet.monkey_patch(
|
||||
os=True,
|
||||
@ -23,7 +32,6 @@ eventlet.monkey_patch(
|
||||
thread=False if '--use-debugger' in sys.argv else True,
|
||||
time=True)
|
||||
|
||||
import os
|
||||
|
||||
POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
os.pardir,
|
||||
@ -31,15 +39,7 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'terracotta', '__init__.py')):
|
||||
sys.path.insert(0, POSSIBLE_TOPDIR)
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
|
||||
from terracotta import config
|
||||
from terracotta import rpc
|
||||
from terracotta.locals import manager as local_mgr
|
||||
from terracotta.openstack.common import threadgroup
|
||||
from terracotta import version
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
@ -69,12 +69,6 @@ the beginning of the global manager's execution.
|
||||
|
||||
from hashlib import sha1
|
||||
import platform
|
||||
|
||||
dist = platform.linux_distribution(full_distribution_name=0)[0]
|
||||
if dist in ['redhat', 'centos']:
|
||||
etherwake = 'ether-wake'
|
||||
else:
|
||||
etherwake = 'etherwake'
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
@ -86,6 +80,12 @@ from oslo_log import log as logging
|
||||
from terracotta import common
|
||||
from terracotta.utils import db_utils
|
||||
|
||||
dist = platform.linux_distribution(full_distribution_name=0)[0]
|
||||
if dist in ['redhat', 'centos']:
|
||||
etherwake = 'ether-wake'
|
||||
else:
|
||||
etherwake = 'etherwake'
|
||||
|
||||
|
||||
global_mgr_ops = [
|
||||
cfg.StrOpt('os_admin_user',
|
||||
|
@ -103,8 +103,35 @@ from terracotta import common
|
||||
from terracotta.openstack.common import periodic_task
|
||||
from terracotta.utils import db_utils
|
||||
|
||||
collector_opts = [
|
||||
cfg.StrOpt('local_data_directory',
|
||||
default='/var/lib/terracotta',
|
||||
help='he directory used by the data collector to store '
|
||||
'the data on the resource usage by the VMs running '
|
||||
'on the host.'),
|
||||
cfg.FloatOpt('host_cpu_usable_by_vms',
|
||||
default=1.0,
|
||||
help='The threshold on the overall (all cores) '
|
||||
'utilization of the physical CPU of a host '
|
||||
'that can be allocated to VMs.'),
|
||||
cfg.StrOpt('os_admin_user',
|
||||
default='admin',
|
||||
help='The admin user name for authentication '
|
||||
'with Nova using Keystone.'),
|
||||
cfg.StrOpt('os_admin_password',
|
||||
default='admin',
|
||||
help='The admin user password for authentication '
|
||||
'with Nova using Keystone.'),
|
||||
cfg.IntOpt('data_collector_data_length',
|
||||
default=100,
|
||||
help='The number of the latest data values stored '
|
||||
'locally by the data collector and passed to '
|
||||
'the underload / overload detection and VM '
|
||||
'placement algorithms.'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(collector_opts)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -113,7 +113,30 @@ from terracotta.openstack.common import periodic_task
|
||||
from terracotta.utils import db_utils
|
||||
|
||||
|
||||
local_manager_opts = [
|
||||
cfg.FloatOpt('host_cpu_usable_by_vms',
|
||||
default=1.0,
|
||||
help='The threshold on the overall (all cores) '
|
||||
'utilization of the physical CPU of a host '
|
||||
'that can be allocated to VMs.'),
|
||||
cfg.StrOpt('os_admin_user',
|
||||
default='admin',
|
||||
help='The admin user name for authentication '
|
||||
'with Nova using Keystone.'),
|
||||
cfg.StrOpt('os_admin_password',
|
||||
default='admin',
|
||||
help='The admin user password for authentication '
|
||||
'with Nova using Keystone.'),
|
||||
cfg.StrOpt('local_data_directory',
|
||||
default='/var/lib/terracotta',
|
||||
help='he directory used by the data collector to store '
|
||||
'the data on the resource usage by the VMs running '
|
||||
'on the host.'),
|
||||
]
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(local_manager_opts)
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user