本文整理汇总了Python中trove.guestagent.manager.mysql_service.MySqlAppStatus类的典型用法代码示例。如果您正苦于以下问题:Python MySqlAppStatus类的具体用法?Python MySqlAppStatus怎么用?Python MySqlAppStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MySqlAppStatus类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: MySqlAppStatusTest
class MySqlAppStatusTest(testtools.TestCase):
def setUp(self):
super(MySqlAppStatusTest, self).setUp()
util.init_db()
self.orig_utils_execute_with_timeout = dbaas.utils.execute_with_timeout
self.orig_load_mysqld_options = dbaas.load_mysqld_options
self.orig_dbaas_os_path_exists = dbaas.os.path.exists
self.orig_dbaas_time_sleep = dbaas.time.sleep
self.FAKE_ID = randint(1, 10000)
InstanceServiceStatus.create(instance_id=self.FAKE_ID,
status=rd_instance.ServiceStatuses.NEW)
dbaas.CONF.guest_id = self.FAKE_ID
def tearDown(self):
super(MySqlAppStatusTest, self).tearDown()
dbaas.utils.execute_with_timeout = self.orig_utils_execute_with_timeout
dbaas.load_mysqld_options = self.orig_load_mysqld_options
dbaas.os.path.exists = self.orig_dbaas_os_path_exists
dbaas.time.sleep = self.orig_dbaas_time_sleep
InstanceServiceStatus.find_by(instance_id=self.FAKE_ID).delete()
dbaas.CONF.guest_id = None
def test_get_actual_db_status(self):
dbaas.utils.execute_with_timeout = Mock(return_value=(None, None))
self.mySqlAppStatus = MySqlAppStatus()
status = self.mySqlAppStatus._get_actual_db_status()
self.assertEqual(rd_instance.ServiceStatuses.RUNNING, status)
def test_get_actual_db_status_error_shutdown(self):
from trove.common.exception import ProcessExecutionError
mocked = Mock(side_effect=ProcessExecutionError())
dbaas.utils.execute_with_timeout = mocked
dbaas.load_mysqld_options = Mock()
dbaas.os.path.exists = Mock(return_value=False)
self.mySqlAppStatus = MySqlAppStatus()
status = self.mySqlAppStatus._get_actual_db_status()
self.assertEqual(rd_instance.ServiceStatuses.SHUTDOWN, status)
def test_get_actual_db_status_error_crashed(self):
from trove.common.exception import ProcessExecutionError
dbaas.utils.execute_with_timeout = MagicMock(
side_effect=[ProcessExecutionError(), ("some output", None)])
dbaas.load_mysqld_options = Mock()
dbaas.os.path.exists = Mock(return_value=True)
self.mySqlAppStatus = MySqlAppStatus()
status = self.mySqlAppStatus._get_actual_db_status()
self.assertEqual(rd_instance.ServiceStatuses.BLOCKED, status)
开发者ID:dadu1688,项目名称:trove,代码行数:57,代码来源:test_dbaas.py
示例2: prepare
def prepare(
self,
context,
databases,
memory_mb,
users,
device_path=None,
mount_point=None,
backup_id=None,
config_location=None,
config_contents=None,
):
"""Makes ready DBAAS on a Guest container."""
MySqlAppStatus.get().begin_mysql_install()
# status end_mysql_install set with secure()
app = MySqlApp(MySqlAppStatus.get())
restart_mysql = False
if device_path:
device = volume.VolumeDevice(device_path)
device.format()
# if a /var/lib/mysql folder exists, back it up.
if os.path.exists(CONF.mount_point):
# stop and do not update database
app.stop_db()
# rsync exiting data
if not backup_id:
restart_mysql = True
device.migrate_data(CONF.mount_point)
# mount the volume
device.mount(mount_point)
LOG.debug(_("Mounted the volume."))
# check mysql was installed and stopped
if restart_mysql:
app.start_mysql()
app.install_if_needed()
if backup_id:
self._perform_restore(backup_id, context, CONF.mount_point, app)
LOG.info(_("Securing mysql now."))
app.secure(config_location, config_contents)
if backup_id and MySqlAdmin().is_root_enabled():
MySqlAdmin().report_root_enabled(context)
else:
app.secure_root()
app.complete_install_or_restart()
if databases:
self.create_database(context, databases)
if users:
self.create_user(context, users)
LOG.info('"prepare" call has finished.')
开发者ID:nilakhya-gl,项目名称:trove,代码行数:52,代码来源:mysql.py
示例3: test_being_mysql_install
def test_being_mysql_install(self):
self.mySqlAppStatus = MySqlAppStatus()
self.mySqlAppStatus.begin_mysql_install()
self.assertEquals(self.mySqlAppStatus.status, ServiceStatuses.BUILDING)
开发者ID:dfecker,项目名称:trove,代码行数:7,代码来源:test_dbaas.py
示例4: test_get_actual_db_status
def test_get_actual_db_status(self):
dbaas.utils.execute_with_timeout = Mock(return_value=(None, None))
self.mySqlAppStatus = MySqlAppStatus()
status = self.mySqlAppStatus._get_actual_db_status()
self.assertEqual(rd_instance.ServiceStatuses.RUNNING, status)
开发者ID:dadu1688,项目名称:trove,代码行数:8,代码来源:test_dbaas.py
示例5: test_begin_mysql_restart
def test_begin_mysql_restart(self):
self.mySqlAppStatus = MySqlAppStatus()
self.mySqlAppStatus.restart_mode = False
self.mySqlAppStatus.begin_mysql_restart()
self.assertTrue(self.mySqlAppStatus.restart_mode)
开发者ID:dfecker,项目名称:trove,代码行数:8,代码来源:test_dbaas.py
示例6: test_wait_for_real_status_to_change_to_timeout
def test_wait_for_real_status_to_change_to_timeout(self):
self.mySqlAppStatus = MySqlAppStatus()
self.mySqlAppStatus._get_actual_db_status = \
Mock(return_value=ServiceStatuses.RUNNING)
dbaas.time.sleep = Mock()
self.assertFalse(self.mySqlAppStatus.
wait_for_real_status_to_change_to
(ServiceStatuses.SHUTDOWN, 10))
开发者ID:CiscoSystems,项目名称:openstack-trove,代码行数:9,代码来源:test_dbaas.py
示例7: test_wait_for_real_status_to_change_to
def test_wait_for_real_status_to_change_to(self):
self.mySqlAppStatus = MySqlAppStatus()
self.mySqlAppStatus._get_actual_db_status = \
Mock(return_value=rd_instance.ServiceStatuses.RUNNING)
dbaas.time.sleep = Mock()
self.assertTrue(self.mySqlAppStatus.
wait_for_real_status_to_change_to
(rd_instance.ServiceStatuses.RUNNING, 10))
开发者ID:citrix-openstack-build,项目名称:trove,代码行数:9,代码来源:test_dbaas.py
示例8: test_end_install_or_restart
def test_end_install_or_restart(self):
self.mySqlAppStatus = MySqlAppStatus()
self.mySqlAppStatus._get_actual_db_status = \
Mock(return_value=ServiceStatuses.SHUTDOWN)
self.mySqlAppStatus.end_install_or_restart()
self.assertEqual(ServiceStatuses.SHUTDOWN, self.mySqlAppStatus.status)
self.assertFalse(self.mySqlAppStatus.restart_mode)
开发者ID:dfecker,项目名称:trove,代码行数:10,代码来源:test_dbaas.py
示例9: test_get_actual_db_status_error_crashed
def test_get_actual_db_status_error_crashed(self):
from trove.common.exception import ProcessExecutionError
dbaas.utils.execute_with_timeout = MagicMock(
side_effect=[ProcessExecutionError(), ("some output", None)])
dbaas.load_mysqld_options = Mock()
dbaas.os.path.exists = Mock(return_value=True)
self.mySqlAppStatus = MySqlAppStatus()
status = self.mySqlAppStatus._get_actual_db_status()
self.assertEqual(rd_instance.ServiceStatuses.BLOCKED, status)
开发者ID:dadu1688,项目名称:trove,代码行数:12,代码来源:test_dbaas.py
示例10: test_get_actual_db_status_error_shutdown
def test_get_actual_db_status_error_shutdown(self):
from trove.common.exception import ProcessExecutionError
mocked = Mock(side_effect=ProcessExecutionError())
dbaas.utils.execute_with_timeout = mocked
dbaas.load_mysqld_options = Mock()
dbaas.os.path.exists = Mock(return_value=False)
self.mySqlAppStatus = MySqlAppStatus()
status = self.mySqlAppStatus._get_actual_db_status()
self.assertEqual(rd_instance.ServiceStatuses.SHUTDOWN, status)
开发者ID:dadu1688,项目名称:trove,代码行数:12,代码来源:test_dbaas.py
示例11: update_overrides
def update_overrides(self, context, overrides, remove=False):
app = MySqlApp(MySqlAppStatus.get())
app.update_overrides(overrides, remove=remove)
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:3,代码来源:mysql.py
示例12: apply_overrides
def apply_overrides(self, context, overrides):
app = MySqlApp(MySqlAppStatus.get())
app.apply_overrides(overrides)
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:3,代码来源:mysql.py
示例13: reset_configuration
def reset_configuration(self, context, configuration):
app = MySqlApp(MySqlAppStatus.get())
app.reset_configuration(configuration)
开发者ID:ReVolly,项目名称:trove,代码行数:3,代码来源:mysql.py
示例14: update_status
def update_status(self, context):
"""Update the status of the MySQL service"""
MySqlAppStatus.get().update()
开发者ID:ReVolly,项目名称:trove,代码行数:3,代码来源:mysql.py
示例15: stop_db
def stop_db(self, context, do_not_start_on_reboot=False):
app = MySqlApp(MySqlAppStatus.get())
app.stop_db(do_not_start_on_reboot=do_not_start_on_reboot)
开发者ID:ReVolly,项目名称:trove,代码行数:3,代码来源:mysql.py
示例16: start_db_with_conf_changes
def start_db_with_conf_changes(self, context, config_contents):
app = MySqlApp(MySqlAppStatus.get())
app.start_db_with_conf_changes(config_contents)
开发者ID:ReVolly,项目名称:trove,代码行数:3,代码来源:mysql.py
示例17: test_is_mysql_installed_none
def test_is_mysql_installed_none(self):
self.mySqlAppStatus = MySqlAppStatus()
self.mySqlAppStatus.status = None
self.assertFalse(self.mySqlAppStatus.is_mysql_installed)
开发者ID:dfecker,项目名称:trove,代码行数:6,代码来源:test_dbaas.py
示例18: test_is_mysql_installed
def test_is_mysql_installed(self):
self.mySqlAppStatus = MySqlAppStatus()
self.mySqlAppStatus.status = rd_instance.ServiceStatuses.RUNNING
self.assertTrue(self.mySqlAppStatus.is_mysql_installed)
开发者ID:citrix-openstack-build,项目名称:trove,代码行数:5,代码来源:test_dbaas.py
示例19: MySqlAppStatusTest
class MySqlAppStatusTest(testtools.TestCase):
def setUp(self):
super(MySqlAppStatusTest, self).setUp()
util.init_db()
self.orig_utils_execute_with_timeout = dbaas.utils.execute_with_timeout
self.orig_load_mysqld_options = dbaas.load_mysqld_options
self.orig_dbaas_os_path_exists = dbaas.os.path.exists
self.orig_dbaas_time_sleep = dbaas.time.sleep
self.FAKE_ID = randint(1, 10000)
InstanceServiceStatus.create(instance_id=self.FAKE_ID,
status=ServiceStatuses.NEW)
dbaas.CONF.guest_id = self.FAKE_ID
def tearDown(self):
super(MySqlAppStatusTest, self).tearDown()
dbaas.utils.execute_with_timeout = self.orig_utils_execute_with_timeout
dbaas.load_mysqld_options = self.orig_load_mysqld_options
dbaas.os.path.exists = self.orig_dbaas_os_path_exists
dbaas.time.sleep = self.orig_dbaas_time_sleep
InstanceServiceStatus.find_by(instance_id=self.FAKE_ID).delete()
dbaas.CONF.guest_id = None
def test_being_mysql_install(self):
self.mySqlAppStatus = MySqlAppStatus()
self.mySqlAppStatus.begin_mysql_install()
self.assertEquals(self.mySqlAppStatus.status, ServiceStatuses.BUILDING)
def test_begin_mysql_restart(self):
self.mySqlAppStatus = MySqlAppStatus()
self.mySqlAppStatus.restart_mode = False
self.mySqlAppStatus.begin_mysql_restart()
self.assertTrue(self.mySqlAppStatus.restart_mode)
def test_end_install_or_restart(self):
self.mySqlAppStatus = MySqlAppStatus()
self.mySqlAppStatus._get_actual_db_status = \
Mock(return_value=ServiceStatuses.SHUTDOWN)
self.mySqlAppStatus.end_install_or_restart()
self.assertEqual(ServiceStatuses.SHUTDOWN, self.mySqlAppStatus.status)
self.assertFalse(self.mySqlAppStatus.restart_mode)
def test_get_actual_db_status(self):
dbaas.utils.execute_with_timeout = Mock(return_value=(None, None))
self.mySqlAppStatus = MySqlAppStatus()
status = self.mySqlAppStatus._get_actual_db_status()
self.assertEqual(ServiceStatuses.RUNNING, status)
def test_get_actual_db_status_error_shutdown(self):
from trove.common.exception import ProcessExecutionError
mocked = Mock(side_effect=ProcessExecutionError())
dbaas.utils.execute_with_timeout = mocked
dbaas.load_mysqld_options = Mock()
dbaas.os.path.exists = Mock(return_value=False)
self.mySqlAppStatus = MySqlAppStatus()
status = self.mySqlAppStatus._get_actual_db_status()
self.assertEqual(ServiceStatuses.SHUTDOWN, status)
def test_get_actual_db_status_error_crashed(self):
from trove.common.exception import ProcessExecutionError
dbaas.utils.execute_with_timeout = \
MagicMock(side_effect=[ProcessExecutionError(),
("some output", None)])
dbaas.load_mysqld_options = Mock()
dbaas.os.path.exists = Mock(return_value=True)
self.mySqlAppStatus = MySqlAppStatus()
status = self.mySqlAppStatus._get_actual_db_status()
self.assertEqual(ServiceStatuses.BLOCKED, status)
def test_is_mysql_installed(self):
self.mySqlAppStatus = MySqlAppStatus()
self.mySqlAppStatus.status = ServiceStatuses.RUNNING
self.assertTrue(self.mySqlAppStatus.is_mysql_installed)
def test_is_mysql_installed_none(self):
self.mySqlAppStatus = MySqlAppStatus()
self.mySqlAppStatus.status = None
self.assertFalse(self.mySqlAppStatus.is_mysql_installed)
#.........这里部分代码省略.........
开发者ID:dfecker,项目名称:trove,代码行数:101,代码来源:test_dbaas.py
示例20: test_is_mysql_running_not
def test_is_mysql_running_not(self):
self.mySqlAppStatus = MySqlAppStatus()
self.mySqlAppStatus.status = ServiceStatuses.SHUTDOWN
self.assertFalse(self.mySqlAppStatus.is_mysql_running)
开发者ID:dfecker,项目名称:trove,代码行数:6,代码来源:test_dbaas.py
注:本文中的trove.guestagent.manager.mysql_service.MySqlAppStatus类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论