Example #1
0
 def _post_restore(self):
     utils.execute_with_timeout("sudo", "chown", "-R", "-f",
                                "mysql", self.restore_location)
     self._delete_old_binlogs()
     self._reset_root_password()
     app = dbaas.MySqlApp(dbaas.MySqlAppStatus.get())
     app.start_mysql()
Example #2
0
 def pre_restore(self):
     app = dbaas.MySqlApp(dbaas.MySqlAppStatus.get())
     app.stop_db()
     LOG.info("Cleaning out restore location: %s", self.restore_location)
     utils.execute_with_timeout("sudo", "chmod", "-R", "0777",
                                self.restore_location)
     utils.clean_out(self.restore_location)
Example #3
0
 def post_restore(self):
     self._run_prepare()
     operating_system.chown(self.restore_location, 'mysql', None,
                            force=True, as_root=True)
     self._delete_old_binlogs()
     self.reset_root_password()
     app = dbaas.MySqlApp(dbaas.MySqlAppStatus.get())
     app.start_mysql()
Example #4
0
 def pre_restore(self):
     app = dbaas.MySqlApp(dbaas.MySqlAppStatus.get())
     app.stop_db()
     LOG.info(_("Cleaning out restore location: %s."),
              self.restore_location)
     operating_system.chmod(self.restore_location, FileMode.SET_FULL,
                            as_root=True)
     utils.clean_out(self.restore_location)
Example #5
0
 def _start_mysqld_with_init_file(self, init_file):
     utils.execute_with_timeout(
         'sudo', 'systemctl', 'set-environment',
         'MYSQLD_OPTS="--init-file=%s"' % init_file.name)
     app = dbaas.MySqlApp(dbaas.MySqlAppStatus.get())
     utils.execute_with_timeout(app.mysql_service['cmd_start'], shell=True)
     utils.execute_with_timeout(app.mysql_service['cmd_stop'], shell=True)
     utils.execute_with_timeout('sudo', 'systemctl', 'unset-environment',
                                'MYSQLD_OPTS')
Example #6
0
 def post_restore(self):
     self._run_prepare()
     utils.execute_with_timeout("chown", "-R", "-f", "mysql",
                                self.restore_location,
                                root_helper="sudo",
                                run_as_root=True)
     self._delete_old_binlogs()
     self.reset_root_password()
     app = dbaas.MySqlApp(dbaas.MySqlAppStatus.get())
     app.start_mysql()
Example #7
0
 def pre_restore(self):
     app = dbaas.MySqlApp(dbaas.MySqlAppStatus.get())
     app.stop_db()
     LOG.info(_("Cleaning out restore location: %s."),
              self.restore_location)
     utils.execute_with_timeout("chmod", "-R", "0777",
                                self.restore_location,
                                root_helper="sudo",
                                run_as_root=True)
     utils.clean_out(self.restore_location)
Example #8
0
    def test_get_master_UUID(self):
        app = dbaas.MySqlApp(None)

        def test_case(slave_status, expected_value):
            with patch.object(dbaas.MySqlApp, '_get_slave_status',
                              return_value=slave_status):
                assert_equal(app._get_master_UUID(), expected_value)

        test_case({'Master_UUID': '2a5b-2064-32fb'}, '2a5b-2064-32fb')
        test_case({'Master_UUID': ''}, None)
        test_case({}, None)
Example #9
0
 def test__perform_restore(self):
     backup_info = {
         'id': 'backup_id_123abc',
         'location': 'fake-location',
         'type': 'InnoBackupEx',
         'checksum': 'fake-checksum',
     }
     mock_status = MagicMock()
     self.manager.appStatus = mock_status
     dbaas.MySqlAppStatus.get = MagicMock(return_value=mock_status)
     app = dbaas.MySqlApp(dbaas.MySqlAppStatus.get())
     backup.restore = MagicMock(side_effect=ProcessExecutionError)
     self.assertRaises(ProcessExecutionError, self.manager._perform_restore,
                       backup_info, self.context, '/var/lib/mysql', app)
     app.status.set_status.assert_called_with(
         rd_instance.ServiceStatuses.FAILED)
Example #10
0
    def __init__(self):
        status = service.MySqlAppStatus(self.docker_client)
        app = service.MySqlApp(status, self.docker_client)
        adm = service.MySqlAdmin(app)

        super(Manager, self).__init__(app, status, adm)
Example #11
0
 def _build_app(self):
     return dbaas.MySqlApp(dbaas.MySqlAppStatus.get())
Example #12
0
 def _pre_restore(self):
     app = dbaas.MySqlApp(dbaas.MySqlAppStatus.get())
     app.stop_db()