コード例 #1
0
 def restart(self):
     LOG.info("Restarting your database.")
     restartcmd = self._get_run_actions('restart', excp.RestartException)
     sh.execute(*restartcmd, run_as_root=True, check_exit_code=True)
     LOG.info("Please wait %s seconds while it restarts." % self.wait_time)
     sh.sleep(self.wait_time)
     return 1
コード例 #2
0
 def restart_service(self):
     if self._service_status() != _ALIVE:
         cmd = self.distro.get_command('libvirt', 'restart')
         sh.execute(*cmd, run_as_root=True)
         LOG.info(
             "Restarting the libvirt service, please wait %s seconds until its started."
             % (self.wait_time))
         sh.sleep(self.wait_time)
コード例 #3
0
 def post_start(self):
     comp.PythonRuntime.post_start(self)
     if NO_IMG_START not in self.component_opts:
         #install any images that need activating...
         # TODO: make this less cheesy - need to wait till glance goes online
         LOG.info("Waiting %s seconds so that glance can start up before image install." % (WAIT_ONLINE_TO))
         sh.sleep(WAIT_ONLINE_TO)
         creator.ImageCreationService(self.cfg).install()
コード例 #4
0
 def post_start(self):
     comp.PythonRuntime.post_start(self)
     if "create-cidr" in self.options:
         LOG.info("Waiting %s seconds so that the melange server can start up before cidr range creation." % (self.wait_time))
         sh.sleep(self.wait_time)
         mp = dict()
         mp['CIDR_RANGE'] = self.cfg.getdefaulted('melange', 'm_mac_range', DEF_CIDR_RANGE)
         utils.execute_template(*CIDR_CREATE_CMD, params=mp)
コード例 #5
0
 def post_start(self):
     comp.PythonRuntime.post_start(self)
     if CREATE_CIDR in self.component_opts or not self.component_opts:
         LOG.info("Waiting %s seconds so that the melange server can start up before cidr range creation." % (WAIT_ONLINE_TO))
         sh.sleep(WAIT_ONLINE_TO)
         mp = dict()
         mp['CIDR_RANGE'] = self.cfg.getdefaulted('melange', 'm_mac_range', DEF_CIDR_RANGE)
         utils.execute_template(*CIDR_CREATE_CMD, params=mp)
コード例 #6
0
 def restart(self):
     LOG.info("Restarting your database.")
     restartcmd = self._get_run_actions('restart', excp.RestartException)
     sh.execute(*restartcmd,
                 run_as_root=True,
                 check_exit_code=True)
     LOG.info("Please wait %s seconds while it restarts." % self.wait_time)
     sh.sleep(self.wait_time)
     return 1
コード例 #7
0
 def post_start(self):
     comp.PythonRuntime.post_start(self)
     if 'no-load-images' in self.options:
         pass
     else:
         # Install any images that need activating...
         # TODO: make this less cheesy - need to wait till glance goes online
         LOG.info("Waiting %s seconds so that glance can start up before image install." % (self.wait_time))
         sh.sleep(self.wait_time)
         uploader.Service(self.cfg, self.pw_gen).install()
コード例 #8
0
 def start(self):
     if self.status() != comp.STATUS_STARTED:
         startcmd = self._get_run_actions('start', excp.StartException)
         sh.execute(*startcmd, run_as_root=True, check_exit_code=True)
         LOG.info("Please wait %s seconds while it starts up." %
                  self.wait_time)
         sh.sleep(self.wait_time)
         return 1
     else:
         return 0
コード例 #9
0
def restart(distro):
    if _status(distro) != _ALIVE:
        cmds = [{
            'cmd': distro.get_command('libvirt', 'restart'),
            'run_as_root': True,
        }]
        utils.execute_template(*cmds, params={})
        LOG.info(
            "Restarting the libvirt service, please wait %s seconds until its started."
            % (WAIT_ALIVE_TIME))
        sh.sleep(WAIT_ALIVE_TIME)
コード例 #10
0
 def start(self):
     if self.status() != comp.STATUS_STARTED:
         startcmd = self._get_run_actions('start', excp.StartException)
         sh.execute(*startcmd,
             run_as_root=True,
             check_exit_code=True)
         LOG.info("Please wait %s seconds while it starts up." % self.wait_time)
         sh.sleep(self.wait_time)
         return 1
     else:
         return 0
コード例 #11
0
 def post_start(self):
     comp.PythonRuntime.post_start(self)
     if 'no-load-images' in self.options:
         pass
     else:
         # Install any images that need activating...
         # TODO: make this less cheesy - need to wait till glance goes online
         LOG.info(
             "Waiting %s seconds so that glance can start up before image install."
             % (self.wait_time))
         sh.sleep(self.wait_time)
         uploader.Service(self.cfg, self.pw_gen).install()
コード例 #12
0
def restart(distro):
    if _status(distro) != _ALIVE:
        cmds = list()
        cmds.append({
            'cmd': LIBVIRT_RESTART_CMD,
            'run_as_root': True,
        })
        mp = dict()
        mp['SERVICE'] = SV_NAME_MAP[distro]
        utils.execute_template(*cmds, params=mp)
        LOG.info("Restarting the libvirt service, please wait %s seconds until its started." % (WAIT_ALIVE_TIME))
        sh.sleep(WAIT_ALIVE_TIME)
コード例 #13
0
 def _do_screen_init(self):
     LOG.debug("Creating a new screen session named [%s]" % (SESSION_NAME))
     session_init_cmd = self._gen_cmd(SESSION_INIT)
     sh.execute(*session_init_cmd,
             shell=True,
             run_as_root=ROOT_GO,
             env_overrides=self._get_env())
     LOG.debug("Waiting %s seconds before we attempt to set the title bar for that session." % (self.wait_time))
     sh.sleep(self.wait_time)
     bar_init_cmd = self._gen_cmd(BAR_INIT)
     sh.execute(*bar_init_cmd,
             shell=True,
             run_as_root=ROOT_GO,
             env_overrides=self._get_env())
コード例 #14
0
 def post_start(self):
     tgt_fn = sh.joinpths(self.bin_dir, MANAGE_DATA_CONF)
     if sh.is_executable(tgt_fn):
         # If its still there, run it
         # these environment additions are important
         # in that they eventually affect how this script runs
         LOG.info("Waiting %s seconds so that keystone can start up before running first time init." % (self.wait_time))
         sh.sleep(self.wait_time)
         env = dict()
         env['ENABLED_SERVICES'] = ",".join(self.instances.keys())
         env['BIN_DIR'] = self.bin_dir
         setup_cmd = MANAGE_CMD_ROOT + [tgt_fn]
         LOG.info("Running %r command to initialize keystone." % (" ".join(setup_cmd)))
         sh.execute(*setup_cmd, env_overrides=env, run_as_root=False)
         utils.mark_unexecute_file(tgt_fn, env)
コード例 #15
0
 def _do_screen_init(self):
     LOG.debug("Creating a new screen session named [%s]" % (SESSION_NAME))
     session_init_cmd = self._gen_cmd(SESSION_INIT)
     sh.execute(*session_init_cmd,
                shell=True,
                run_as_root=ROOT_GO,
                env_overrides=self._get_env())
     LOG.debug(
         "Waiting %s seconds before we attempt to set the title bar for that session."
         % (self.wait_time))
     sh.sleep(self.wait_time)
     bar_init_cmd = self._gen_cmd(BAR_INIT)
     sh.execute(*bar_init_cmd,
                shell=True,
                run_as_root=ROOT_GO,
                env_overrides=self._get_env())
コード例 #16
0
 def _setup_network_init(self):
     tgt_fn = sh.joinpths(self.bin_dir, NET_INIT_CONF)
     if sh.is_executable(tgt_fn):
         LOG.info("Creating your nova network to be used with instances.")
         # If still there, run it
         # these environment additions are important
         # in that they eventually affect how this script runs
         if 'quantum' in self.options:
             LOG.info("Waiting %s seconds so that quantum can start up before running first time init." % (self.wait_time))
             sh.sleep(self.wait_time)
         env = dict()
         env['ENABLED_SERVICES'] = ",".join(self.options)
         setup_cmd = NET_INIT_CMD_ROOT + [tgt_fn]
         LOG.info("Running %r command to initialize nova's network." % (" ".join(setup_cmd)))
         sh.execute(*setup_cmd, env_overrides=env, run_as_root=False)
         utils.mark_unexecute_file(tgt_fn, env)
コード例 #17
0
 def _setup_network_init(self):
     tgt_fn = sh.joinpths(self.bindir, NET_INIT_CONF)
     if sh.isfile(tgt_fn):
         LOG.info("Creating your nova network to be used with instances.")
         #still there, run it
         #these environment additions are important
         #in that they eventually affect how this script runs
         if utils.service_enabled(settings.QUANTUM, self.instances, False):
             LOG.info("Waiting %s seconds so that quantum can start up before running first time init." % (WAIT_ONLINE_TO))
             sh.sleep(WAIT_ONLINE_TO)
         env = dict()
         env['ENABLED_SERVICES'] = ",".join(self.instances.keys())
         setup_cmd = NET_INIT_CMD_ROOT + [tgt_fn]
         LOG.info("Running (%s) command to initialize nova's network." % (" ".join(setup_cmd)))
         sh.execute(*setup_cmd, env_overrides=env, run_as_root=False)
         LOG.debug("Removing (%s) file since we successfully initialized nova's network." % (tgt_fn))
         sh.unlink(tgt_fn)
コード例 #18
0
 def post_start(self):
     tgt_fn = sh.joinpths(self.bindir, MANAGE_DATA_CONF)
     if sh.isfile(tgt_fn):
         #still there, run it
         #these environment additions are important
         #in that they eventually affect how this script runs
         LOG.info("Waiting %s seconds so that keystone can start up before running first time init." % (WAIT_ONLINE_TO))
         sh.sleep(WAIT_ONLINE_TO)
         env = dict()
         env['ENABLED_SERVICES'] = ",".join(self.instances.keys())
         env['BIN_DIR'] = self.bindir
         setup_cmd = MANAGE_CMD_ROOT + [tgt_fn]
         LOG.info("Running (%s) command to initialize keystone." % (" ".join(setup_cmd)))
         (sysout, _) = sh.execute(*setup_cmd, env_overrides=env, run_as_root=False)
         if sysout:
             sh.write_file(sh.abspth(settings.EC2RC_FN), sysout.strip())
         LOG.debug("Removing (%s) file since we successfully initialized keystone." % (tgt_fn))
         sh.unlink(tgt_fn)
コード例 #19
0
 def post_start(self):
     tgt_fn = sh.joinpths(self.bin_dir, MANAGE_DATA_CONF)
     if sh.is_executable(tgt_fn):
         # If its still there, run it
         # these environment additions are important
         # in that they eventually affect how this script runs
         LOG.info(
             "Waiting %s seconds so that keystone can start up before running first time init."
             % (self.wait_time))
         sh.sleep(self.wait_time)
         env = dict()
         env['ENABLED_SERVICES'] = ",".join(self.instances.keys())
         env['BIN_DIR'] = self.bin_dir
         setup_cmd = MANAGE_CMD_ROOT + [tgt_fn]
         LOG.info("Running %r command to initialize keystone." %
                  (" ".join(setup_cmd)))
         sh.execute(*setup_cmd, env_overrides=env, run_as_root=False)
         utils.mark_unexecute_file(tgt_fn, env)
コード例 #20
0
 def _setup_network_init(self):
     tgt_fn = sh.joinpths(self.bin_dir, NET_INIT_CONF)
     if sh.is_executable(tgt_fn):
         LOG.info("Creating your nova network to be used with instances.")
         # If still there, run it
         # these environment additions are important
         # in that they eventually affect how this script runs
         if 'quantum' in self.options:
             LOG.info(
                 "Waiting %s seconds so that quantum can start up before running first time init."
                 % (self.wait_time))
             sh.sleep(self.wait_time)
         env = dict()
         env['ENABLED_SERVICES'] = ",".join(self.options)
         setup_cmd = NET_INIT_CMD_ROOT + [tgt_fn]
         LOG.info("Running %r command to initialize nova's network." %
                  (" ".join(setup_cmd)))
         sh.execute(*setup_cmd, env_overrides=env, run_as_root=False)
         utils.mark_unexecute_file(tgt_fn, env)
コード例 #21
0
 def _do_start(self, session, prog_name, cmd):
     init_cmd = list()
     mp = dict()
     run_cmd = " ".join(cmd)
     mp['SESSION_NAME'] = session
     mp['NAME'] = prog_name
     mp['CMD'] = run_cmd
     init_cmd = self._gen_cmd(CMD_INIT, mp)
     LOG.debug("Creating a new screen window named [%s] in session [%s]" % (prog_name, session))
     sh.execute(*init_cmd,
         shell=True,
         run_as_root=ROOT_GO,
         env_overrides=self._get_env())
     LOG.debug("Waiting %s seconds before we attempt to run command [%s] in that window." % (self.wait_time, run_cmd))
     sh.sleep(self.wait_time)
     start_cmd = self._gen_cmd(CMD_START, mp)
     sh.execute(*start_cmd,
         shell=True,
         run_as_root=ROOT_GO,
         env_overrides=self._get_env())
コード例 #22
0
 def _do_start(self, session, prog_name, cmd):
     init_cmd = list()
     mp = dict()
     run_cmd = " ".join(cmd)
     mp['SESSION_NAME'] = session
     mp['NAME'] = prog_name
     mp['CMD'] = run_cmd
     init_cmd = self._gen_cmd(CMD_INIT, mp)
     LOG.debug("Creating a new screen window named [%s] in session [%s]" %
               (prog_name, session))
     sh.execute(*init_cmd,
                shell=True,
                run_as_root=ROOT_GO,
                env_overrides=self._get_env())
     LOG.debug(
         "Waiting %s seconds before we attempt to run command [%s] in that window."
         % (self.wait_time, run_cmd))
     sh.sleep(self.wait_time)
     start_cmd = self._gen_cmd(CMD_START, mp)
     sh.execute(*start_cmd,
                shell=True,
                run_as_root=ROOT_GO,
                env_overrides=self._get_env())
コード例 #23
0
 def restart(self):
     LOG.info("Restarting rabbit-mq.")
     self._run_cmd(self.distro.get_command('rabbit-mq', 'restart'))
     LOG.info("Please wait %s seconds while it starts up." % (self.wait_time))
     sh.sleep(self.wait_time)
     return 1
コード例 #24
0
 def restart_service(self):
     if self._service_status() != _ALIVE:
         cmd = self.distro.get_command('libvirt', 'restart')
         sh.execute(*cmd, run_as_root=True)
         LOG.info("Restarting the libvirt service, please wait %s seconds until its started." % (self.wait_time))
         sh.sleep(self.wait_time)
コード例 #25
0
 def restart(self):
     LOG.info("Restarting rabbit-mq.")
     self._run_cmd(self.distro.get_command('rabbit-mq', 'restart'))
     LOG.info("Please wait %s seconds while it starts up." % (self.wait_time))
     sh.sleep(self.wait_time)
     return 1
コード例 #26
0
 def restart(self):
     LOG.info("Restarting rabbit-mq.")
     self._run_cmd(RESTART_CMD)
     LOG.info("Please wait %s seconds while it starts up." % (WAIT_ON_TIME))
     sh.sleep(WAIT_ON_TIME)
     return 1