def main():
try:
if args.conf:
log.info("Reading conf from {}".format(args.conf))
with open(args.conf, 'r') as pipes_file:
conf = json.load(pipes_file,
object_pairs_hook=collections.OrderedDict)
simulators = []
cache = Cache(args.db)
admin_user = cache["users"]["admin"]
admin_user["auth_url"] = cache["api"]["auth_url"]
admin_factory = ClientFactory(admin_user)
admin_keeper = Keeper(cache, admin_factory)
if args.clean:
log.info("Starting cleanup")
admin_keeper.clean(args.clean)
sys.exit()
# This section for default initialization of cirros image
log.debug("Caching default cirros image")
(cache["glance"]["images"]
[admin_keeper.get(
"glance", "images", "name",
lambda x: x == "cirros-0.3.4-x86_64-uec")[0].id]) = False
for flavor in admin_factory.nova().flavors.list():
log.debug("Caching flavor with name {name}".
format(name=flavor.name))
(cache["nova"]["flavors"][flavor.id]) = False
for pipe_name, pipe in conf.iteritems():
simulators.append(Simulator(pipe_name, pipe, cache, admin_keeper))
for simulator in simulators:
simulator.simulate()
except KeyboardInterrupt:
print('\nThe process was interrupted by the user')
raise SystemExit
评论列表
文章目录