def main(): parser = argparse.ArgumentParser(description='Start simulated salt minions.') parser.add_argument('--count', dest='count', type=int, default=3, help='Number of simulated minions') parser.add_argument('--osds-per-host', dest='osds_per_host', type=int, default=4, help='Number of OSDs on each simulated server') args = parser.parse_args() config_path = os.getcwd() handler = logging.StreamHandler() handler.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s - %(name)s %(message)s")) log.addHandler(handler) handler = logging.FileHandler("minion_sim.log") handler.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s - %(name)s %(message)s")) log.addHandler(handler) sim = MinionSim(config_path, args.count, args.osds_per_host) log.debug("Starting simulator...") sim.start() try: log.debug("Waiting for simulator...") while True: time.sleep(0.5) except KeyboardInterrupt: log.debug("Terminating simulator...") sim.stop() sim.join() log.debug("Complete.")
import json import urllib2 from minion_sim.sim import MinionSim from minion_sim.log import log as minion_sim_log from django.utils.unittest.case import SkipTest from tests.config import TestConfig config = TestConfig() logging.basicConfig() log = logging.getLogger(__name__) handler = logging.FileHandler("minion_sim.log") handler.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s - %(name)s %(message)s")) minion_sim_log.addHandler(handler) class CephControl(object): """ Interface for tests to control one or more Ceph clusters under test. This can either be controlling the minion-sim, running unprivileged in a development environment, or it can be controlling a real life Ceph cluster. Some configuration arguments may be interpreted by a dev implementation as a "simulate this", while a real-cluster implementation might interpret them as "I require this state, skip the test if this cluster can't handle that". """
import json from minion_sim.sim import MinionSim from minion_sim.log import log as minion_sim_log from django.utils.unittest.case import SkipTest from tests.config import TestConfig config = TestConfig() logging.basicConfig() log = logging.getLogger(__name__) handler = logging.FileHandler("minion_sim.log") handler.setFormatter( logging.Formatter("%(asctime)s - %(levelname)s - %(name)s %(message)s")) minion_sim_log.addHandler(handler) class CephControl(object): """ Interface for tests to control one or more Ceph clusters under test. This can either be controlling the minion-sim, running unprivileged in a development environment, or it can be controlling a real life Ceph cluster. Some configuration arguments may be interpreted by a dev implementation as a "simulate this", while a real-cluster implementation might interpret them as "I require this state, skip the test if this cluster can't handle that". """