本文整理汇总了Python中charmhelpers.contrib.openstack.utils.CompareOpenStackReleases方法的典型用法代码示例。如果您正苦于以下问题:Python utils.CompareOpenStackReleases方法的具体用法?Python utils.CompareOpenStackReleases怎么用?Python utils.CompareOpenStackReleases使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类charmhelpers.contrib.openstack.utils
的用法示例。
在下文中一共展示了utils.CompareOpenStackReleases方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_102_services
# 需要导入模块: from charmhelpers.contrib.openstack import utils [as 别名]
# 或者: from charmhelpers.contrib.openstack.utils import CompareOpenStackReleases [as 别名]
def test_102_services(self):
"""Verify that the expected services are running on the
corresponding service units."""
services = {
self.rmq0_sentry: ['rabbitmq-server'],
self.rmq1_sentry: ['rabbitmq-server'],
self.rmq2_sentry: ['rabbitmq-server'],
self.cinder_sentry: ['cinder-scheduler',
'cinder-volume'],
}
_release = self._get_openstack_release_string()
if CompareOpenStackReleases(_release) >= 'ocata':
services[self.cinder_sentry].append('apache2')
else:
services[self.cinder_sentry].append('cinder-api')
ret = u.validate_services_by_name(services)
if ret:
amulet.raise_status(amulet.FAIL, msg=ret)
u.log.info('OK\n')
示例2: test_keystone_v3
# 需要导入模块: from charmhelpers.contrib.openstack import utils [as 别名]
# 或者: from charmhelpers.contrib.openstack.utils import CompareOpenStackReleases [as 别名]
def test_keystone_v3(self):
"""Verify that the service is configured and operates correctly when
using Keystone v3 auth."""
os_release = self._get_openstack_release_string()
if CompareOpenStackReleases(os_release) < 'kilo':
u.log.info('Skipping test, {} < kilo'.format(os_release))
return
u.log.info('Checking that service is configured and operate correctly '
'when using Keystine v3 auth...')
if not self._set_auth_api_version('3'):
msg = "Unable to set auth_api_version to '3'"
amulet.raise_status(amulet.FAIL, msg=msg)
return
self.test_302_proxy_server_config(auth_api_version='3')
self.test_400_swift_backed_image_create()
示例3: _assert_services
# 需要导入模块: from charmhelpers.contrib.openstack import utils [as 别名]
# 或者: from charmhelpers.contrib.openstack.utils import CompareOpenStackReleases [as 别名]
def _assert_services(self, should_run):
services = ["nova-api-os-compute", "nova-cert", "nova-conductor",
"nova-scheduler", "apache2", "haproxy"]
cmp_os_release = CompareOpenStackReleases(
self._get_openstack_release_string()
)
if cmp_os_release >= 'newton':
services.remove('nova-cert')
u.get_unit_process_ids(
{self.nova_cc_sentry: services},
expect_success=should_run)
示例4: test_100_services
# 需要导入模块: from charmhelpers.contrib.openstack import utils [as 别名]
# 或者: from charmhelpers.contrib.openstack.utils import CompareOpenStackReleases [as 别名]
def test_100_services(self):
"""Verify the expected services are running on the corresponding
service units."""
u.log.debug('Checking system services on units...')
services = {
self.rabbitmq_sentry: ['rabbitmq-server'],
self.nova_cc_sentry: ['nova-api-ec2',
'nova-api-os-compute',
'nova-conductor',
'nova-objectstore',
'nova-cert',
'nova-scheduler'],
self.nova_compute_sentry: ['nova-compute',
'nova-network',
'nova-api'],
self.keystone_sentry: ['keystone'],
self.glance_sentry: ['glance-registry', 'glance-api']
}
cmp_os_release = CompareOpenStackReleases(
self._get_openstack_release_string()
)
if cmp_os_release >= 'liberty':
services[self.nova_cc_sentry].remove('nova-api-ec2')
services[self.nova_cc_sentry].remove('nova-objectstore')
if cmp_os_release >= 'newton':
services[self.nova_cc_sentry].remove('nova-cert')
if self._get_openstack_release() >= self.trusty_liberty:
services[self.keystone_sentry] = ['apache2']
if self._get_openstack_release() >= self.xenial_ocata:
services[self.nova_compute_sentry].remove('nova-network')
services[self.nova_compute_sentry].remove('nova-api')
ret = u.validate_services_by_name(services)
if ret:
amulet.raise_status(amulet.FAIL, msg=ret)
示例5: test_100_services
# 需要导入模块: from charmhelpers.contrib.openstack import utils [as 别名]
# 或者: from charmhelpers.contrib.openstack.utils import CompareOpenStackReleases [as 别名]
def test_100_services(self):
"""Verify the expected services are running on the corresponding
service units."""
u.log.debug('Checking system services on units...')
services = {
self.rabbitmq_sentry: ['rabbitmq-server'],
self.nova_compute_sentry: ['nova-compute',
'nova-network',
'nova-api'],
self.nova_cc_sentry: ['nova-conductor'],
self.keystone_sentry: ['keystone'],
self.glance_sentry: ['glance-registry',
'glance-api']
}
if self._get_openstack_release() >= self.trusty_liberty:
services[self.keystone_sentry] = ['apache2']
_os_release = self._get_openstack_release_string()
if CompareOpenStackReleases(_os_release) >= 'ocata':
services[self.nova_compute_sentry].remove('nova-network')
services[self.nova_compute_sentry].remove('nova-api')
ret = u.validate_services_by_name(services)
if ret:
amulet.raise_status(amulet.FAIL, msg=ret)
示例6: test_compare_openstack_comparator
# 需要导入模块: from charmhelpers.contrib.openstack import utils [as 别名]
# 或者: from charmhelpers.contrib.openstack.utils import CompareOpenStackReleases [as 别名]
def test_compare_openstack_comparator(self):
self.assertTrue(utils.CompareOpenStackReleases('mitaka') < 'newton')
self.assertTrue(utils.CompareOpenStackReleases('pike') > 'essex')
示例7: test_900_restart_on_config_change
# 需要导入模块: from charmhelpers.contrib.openstack import utils [as 别名]
# 或者: from charmhelpers.contrib.openstack.utils import CompareOpenStackReleases [as 别名]
def test_900_restart_on_config_change(self):
"""Verify that the specified services are restarted when the config
is changed."""
u.log.info('Checking that conf files and system services respond '
'to a charm config change...')
sentry = self.nova_cc_sentry
juju_service = 'nova-cloud-controller'
# Process names, corresponding conf files
conf_file = '/etc/nova/nova.conf'
services = {
'nova-api-ec2': conf_file,
'nova-api-os-compute': conf_file,
'nova-objectstore': conf_file,
'nova-cert': conf_file,
'nova-scheduler': conf_file,
'nova-conductor': conf_file
}
cmp_os_release = CompareOpenStackReleases(
self._get_openstack_release_string()
)
if cmp_os_release >= 'liberty':
del services['nova-api-ec2']
del services['nova-objectstore']
if cmp_os_release >= 'newton':
del services['nova-cert']
if self._get_openstack_release() >= self.xenial_ocata:
# nova-placement-api is run under apache2 with mod_wsgi
services['apache2'] = conf_file
# Expected default and alternate values
flags_default = 'quota_cores=20,quota_instances=40,quota_ram=102400'
flags_alt = 'quota_cores=10,quota_instances=20,quota_ram=51200'
set_default = {'config-flags': flags_default}
set_alternate = {'config-flags': flags_alt}
# Make config change, check for service restarts
u.log.debug('Making config change on {}...'.format(juju_service))
mtime = u.get_sentry_time(sentry)
self.d.configure(juju_service, set_alternate)
sleep_time = 60
for s, conf_file in services.iteritems():
u.log.debug("Checking that service restarted: {}".format(s))
if not u.validate_service_config_changed(sentry, mtime, s,
conf_file,
sleep_time=sleep_time):
self.d.configure(juju_service, set_default)
msg = "service {} didn't restart after config change".format(s)
amulet.raise_status(amulet.FAIL, msg=msg)
sleep_time = 0
self.d.configure(juju_service, set_default)