def __init__(self, *args): if args.__len__() == 1: credentials = args[0] self.cfg = config.get() self.db = Database() self.__process_credentials(credentials) self.hil = HIL(base_url=self.cfg.net_isolator.url, usr=self.username, passwd=self.password) self.fs = RBD(self.cfg.fs, self.cfg.iscsi.password) self.dhcp = DNSMasq() # self.iscsi = IET(self.fs, self.config.iscsi_update_password) # Need to make this generic by passing specific config self.iscsi = TGT(self.cfg.fs.conf_file, self.cfg.fs.id, self.cfg.fs.pool) elif args.__len__() == 3: username, password, project = args self.cfg = config.get() self.username = username self.password = password self.proj = project self.db = Database() self.pid = self.__does_project_exist(self.proj) self.is_admin = self.__check_admin() self.hil = HIL(base_url=self.cfg.net_isolator.url, usr=self.username, passwd=self.password) self.fs = RBD(self.cfg.fs, self.cfg.iscsi.password) logger.debug("Username is %s and Password is %s", self.username, self.password) self.dhcp = DNSMasq() # self.iscsi = IET(self.fs, self.config.iscsi_update_password) self.iscsi = TGT(self.cfg.fs.conf_file, self.cfg.fs.id, self.cfg.fs.pool)
def __init__(self): # Loads the variable dict with the contents of config.json. self.dict = { "function-list": { "provision": "4", "deprovision": "3", "create_snapshot": "2", "list_images": "0", "list_snapshots": "0", "remove_image": "1" } } # The script name and no. of arguments. self.func_list = self.dict['function-list'] self.cfg = config.get() self.name_server = None self.main_obj = None self.__get_main_obj()
def start_rpc_server(): cfg = config.get() if cfg.bmi.service: server = MainServer() server.remake_mappings() Pyro4.config.HOST = cfg.rpc.rpc_server_ip # Starting the Pyro daemon, locating and registering object with name # server daemon = Pyro4.Daemon(port=cfg.rpc.rpc_server_port) # find the name server ns = Pyro4.locateNS(host=cfg.rpc.name_server_ip, port=cfg.rpc.name_server_port) # register the greeting maker as a Pyro object uri = daemon.register(MainServer) # register the object with a name in the name server ns.register(constants.RPC_SERVER_NAME, uri) # start the event loop of the server to wait for calls daemon.requestLoop()
def start_rpc_server(): cfg = config.get() if cfg.bmi.service: server = MainServer() server.remake_mappings() Pyro4.config.HOST = cfg.rpc.rpc_server_ip # Starting the Pyro daemon, locating and registering object with name # server daemon = Pyro4.Daemon(port=cfg.rpc.rpc_server_port) # find the name server ns = Pyro4.locateNS(host=cfg.rpc.name_server_ip, port=cfg.rpc.name_server_port) # register the greeting maker as a Pyro object uri = daemon.register(MainServer) # register the object with a name in the name server ns.register(constants.RPC_SERVER_NAME, uri) # start the event loop of the server to wait for calls daemon.requestLoop()
def __init__(self): # Loads the variable dict with the contents of config.json. self.dict = { "function-list": { "provision": "4", "deprovision": "3", "create_snapshot": "2", "list_images": "0", "list_snapshots": "0", "remove_image": "1" } } # The script name and no. of arguments. self.func_list = self.dict['function-list'] self.cfg = config.get() self.name_server = None self.main_obj = None self.__get_main_obj()
import subprocess from ims.common import config config.load() import rados import rbd from ims.common import shell from ims.common import constants from ims.einstein import ceph from ims.einstein.operations import BMI from ims.exception import file_system_exceptions from ims.common.log import trace import logging _cfg = config.get() POOL = _cfg.fs.pool CEPH_IMG = "BMI_TEST_CEPH" TEST_NOT_EXIST_IMG_NAME = "BMI_TEST_IMG_NOT_FOUND" CEPH_IMG_SIZE = 1024 INDEX_OUTSIDE_THE_IMAGE = CEPH_IMG_SIZE + 1 CEPH_SNAP_IMG = "BMI_TEST_CEPH_SNAP" TEST_DATA = 'bmi' * 10 OFFSET = 0 CEPH_CHILD_IMG = "BMI_TEST_CEPH_CHILD_IMAGE" class TestCreateImage(unittest.TestCase): """ Test create image """ @trace
def start(): setup_rpc() cfg = config.get() app.run(host=cfg.rest_api.ip, port=cfg.rest_api.port)
def runTest(self): os.environ['BMI_CONFIG'] = self.old_path config.load() cfg = config.get() self.assertEqual(cfg.tests.var1, '0')
def runTest(self): config.load(force=True) cfg = config.get() self.assertEqual(cfg.tests.var1, '0')
def start(): setup_rpc() cfg = config.get() app.run(host=cfg.rest_api.ip, port=cfg.rest_api.port)
def start_name_server(): cfg = config.get() Pyro4.naming.startNSloop(host=cfg.rpc.name_server_ip, port=cfg.rpc.name_server_port)
def runTest(self): os.environ['BMI_CONFIG'] = self.old_path config.load() cfg = config.get() self.assertEqual(cfg.tests.var1, '0')
def runTest(self): config.load(force=True) cfg = config.get() self.assertEqual(cfg.tests.var1, '0')