示例#1
0
文件: mysql.py 项目: DJohnstone/trove
    def prepare(self, context, databases, memory_mb, users, device_path=None,
                mount_point=None, backup_id=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(memory_mb)
        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.')
示例#2
0
    def prepare(self, context, databases, memory_mb, users, device_path=None,
                mount_point=None, backup_id=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)
        LOG.info(_("Securing mysql now."))
        app.secure(memory_mb)
        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.')
示例#3
0
文件: mysql.py 项目: DJohnstone/trove
 def update_status(self, context):
     """Update the status of the MySQL service"""
     MySqlAppStatus.get().update()
示例#4
0
文件: mysql.py 项目: DJohnstone/trove
 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)
示例#5
0
文件: mysql.py 项目: DJohnstone/trove
 def start_db_with_conf_changes(self, context, updated_memory_size):
     app = MySqlApp(MySqlAppStatus.get())
     app.start_db_with_conf_changes(updated_memory_size)
示例#6
0
文件: mysql.py 项目: DJohnstone/trove
 def restart(self, context):
     app = MySqlApp(MySqlAppStatus.get())
     app.restart()
示例#7
0
 def update_status(self, context):
     """Update the status of the MySQL service"""
     MySqlAppStatus.get().update()
示例#8
0
 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)
示例#9
0
 def start_db_with_conf_changes(self, context, updated_memory_size):
     app = MySqlApp(MySqlAppStatus.get())
     app.start_db_with_conf_changes(updated_memory_size)
示例#10
0
 def restart(self, context):
     app = MySqlApp(MySqlAppStatus.get())
     app.restart()