コード例 #1
0
ファイル: manager.py プロジェクト: cretta/trove
 def prepare(self, context, packages, databases, memory_mb, users,
             device_path=None, mount_point=None, backup_info=None,
             config_contents=None, root_password=None, overrides=None,
             cluster_config=None, snapshot=None):
     """
     This is called when the trove instance first comes online.
     It is the first rpc message passed from the task manager.
     prepare handles all the base configuration of the redis instance.
     """
     try:
         app = RedisApp(RedisAppStatus.get())
         RedisAppStatus.get().begin_install()
         if device_path:
             device = volume.VolumeDevice(device_path)
             # unmount if device is already mounted
             device.unmount_device(device_path)
             device.format()
             device.mount(mount_point)
             operating_system.chown(mount_point, 'redis', 'redis',
                                    as_root=True)
             LOG.debug('Mounted the volume.')
         app.install_if_needed(packages)
         LOG.info(_('Writing redis configuration.'))
         app.write_config(config_contents)
         app.restart()
         LOG.info(_('Redis instance has been setup and configured.'))
     except Exception:
         LOG.exception(_("Error setting up Redis instance."))
         app.status.set_status(rd_instance.ServiceStatuses.FAILED)
         raise RuntimeError("prepare call has failed.")
コード例 #2
0
ファイル: manager.py プロジェクト: cretta/trove
 def update_status(self, context):
     """
     Updates the redis trove instance. It is decorated with
     perodic task so it is automatically called every 3 ticks.
     """
     LOG.debug("Update status called.")
     RedisAppStatus.get().update()
コード例 #3
0
ファイル: manager.py プロジェクト: edwardt/trove
 def update_status(self, context):
     """
     Updates the redis trove instance. It is decorated with
     perodic task so it is automatically called every 3 ticks.
     """
     LOG.debug("Update status called.")
     RedisAppStatus.get().update()
コード例 #4
0
ファイル: manager.py プロジェクト: cretta/trove
 def start_db_with_conf_changes(self, context, config_contents):
     """
     Start this redis instance with new conf changes.
     """
     LOG.debug("Start DB with conf changes called.")
     app = RedisApp(RedisAppStatus.get())
     app.start_db_with_conf_changes(config_contents)
コード例 #5
0
ファイル: manager.py プロジェクト: edwardt/trove
 def start_db_with_conf_changes(self, context, config_contents):
     """
     Start this redis instance with new conf changes.
     """
     LOG.debug("Start DB with conf changes called.")
     app = RedisApp(RedisAppStatus.get())
     app.start_db_with_conf_changes(config_contents)
コード例 #6
0
ファイル: manager.py プロジェクト: cretta/trove
 def reset_configuration(self, context, configuration):
     """
     Resets to the default configuration,
     currently this does nothing.
     """
     LOG.debug("Reset configuration called.")
     app = RedisApp(RedisAppStatus.get())
     app.reset_configuration(configuration)
コード例 #7
0
ファイル: manager.py プロジェクト: edwardt/trove
 def reset_configuration(self, context, configuration):
     """
     Resets to the default configuration,
     currently this does nothing.
     """
     LOG.debug("Reset configuration called.")
     app = RedisApp(RedisAppStatus.get())
     app.reset_configuration(configuration)
コード例 #8
0
ファイル: manager.py プロジェクト: cretta/trove
 def stop_db(self, context, do_not_start_on_reboot=False):
     """
     Stop this redis instance.
     This method is called when the guest agent
     gets a stop message from the taskmanager.
     """
     LOG.debug("Stop DB called.")
     app = RedisApp(RedisAppStatus.get())
     app.stop_db(do_not_start_on_reboot=do_not_start_on_reboot)
コード例 #9
0
ファイル: manager.py プロジェクト: cretta/trove
 def restart(self, context):
     """
     Restart this redis instance.
     This method is called when the guest agent
     gets a restart message from the taskmanager.
     """
     LOG.debug("Restart called.")
     app = RedisApp(RedisAppStatus.get())
     app.restart()
コード例 #10
0
ファイル: manager.py プロジェクト: edwardt/trove
 def stop_db(self, context, do_not_start_on_reboot=False):
     """
     Stop this redis instance.
     This method is called when the guest agent
     gets a stop message from the taskmanager.
     """
     LOG.debug("Stop DB called.")
     app = RedisApp(RedisAppStatus.get())
     app.stop_db(do_not_start_on_reboot=do_not_start_on_reboot)
コード例 #11
0
ファイル: manager.py プロジェクト: edwardt/trove
 def restart(self, context):
     """
     Restart this redis instance.
     This method is called when the guest agent
     gets a restart message from the taskmanager.
     """
     LOG.debug("Restart called.")
     app = RedisApp(RedisAppStatus.get())
     app.restart()
コード例 #12
0
ファイル: manager.py プロジェクト: edwardt/trove
 def prepare(self,
             context,
             packages,
             databases,
             memory_mb,
             users,
             device_path=None,
             mount_point=None,
             backup_info=None,
             config_contents=None,
             root_password=None,
             overrides=None,
             cluster_config=None,
             snapshot=None):
     """
     This is called when the trove instance first comes online.
     It is the first rpc message passed from the task manager.
     prepare handles all the base configuration of the redis instance.
     """
     try:
         app = RedisApp(RedisAppStatus.get())
         RedisAppStatus.get().begin_install()
         if device_path:
             device = volume.VolumeDevice(device_path)
             # unmount if device is already mounted
             device.unmount_device(device_path)
             device.format()
             device.mount(mount_point)
             operating_system.chown(mount_point,
                                    'redis',
                                    'redis',
                                    as_root=True)
             LOG.debug('Mounted the volume.')
         app.install_if_needed(packages)
         LOG.info(_('Writing redis configuration.'))
         app.write_config(config_contents)
         app.restart()
         LOG.info(_('Redis instance has been setup and configured.'))
     except Exception:
         LOG.exception(_("Error setting up Redis instance."))
         app.status.set_status(rd_instance.ServiceStatuses.FAILED)
         raise RuntimeError("prepare call has failed.")