예제 #1
0
    def test_full_dryrun(self):
        self.ch = ResourceHandler(self.cfg)
        with util.global_dry_run():
            nid = self.ch.create_node(cfg.node_defs['node1'])

            self.sc = sc.ConfigManager.instantiate(protocol='dummy')
            self.uds = UDS.instantiate(protocol='dict')
            mib = ib.real_main_info_broker = \
                ib.InfoRouter(sub_providers=[
                    self.uds,
                    self.sc,
                    dsp.DynamicStateProvider(self.sc, self.ch),
                    sp.SynchronizationProvider(),
                    ResourceHandlerProvider(self.ch)
                ])

            try:
                log.debug(
                    mib.get(
                        'node.resource.state',
                        dict(instance_id=nid,
                             node_id="test",
                             backend_id='lpds')))
            finally:
                self.ch.drop_node(
                    dict(instance_id=nid, node_id="test", backend_id='lpds'))
예제 #2
0
    def test_create_using_ip(self):
        node_def = cfg.node_defs['node_lpds']
        self.ch = ResourceHandler(self.cfg)
        self.sc = sc.ConfigManager.instantiate(protocol='dummy')
        self.uds = UDS.instantiate(protocol='dict')
        self.uds.kvstore.set_item('node_def:test', [node_def])
        mib = ib.InfoRouter(main_info_broker=True,
                            sub_providers=[
                                self.uds, self.sc,
                                dsp.DynamicStateProvider(self.sc, self.ch),
                                sp.SynchronizationProvider(),
                                ResourceHandlerProvider(self.ch)
                            ])

        eid = str(uuid.uuid4())
        nid = str(uuid.uuid4())
        node_desc = dict(infra_id=eid,
                         node_id=nid,
                         type='test',
                         user_id=1,
                         name='test')
        infrap = ip.InfraProcessor.instantiate('basic', self.uds, self.ch,
                                               self.sc)
        cmd_cre = infrap.cri_create_infrastructure(eid)
        cmd_crn = infrap.cri_create_node(node_desc)
        infrap.push_instructions(cmd_cre)
        node = infrap.push_instructions(cmd_crn)[0]
        status = mib.get('node.resource.state', node)
        self.drop_nodes.append(dict(instance_id=nid, node_id="test"))
예제 #3
0
    def test_node_status(self):
        self.ch = ResourceHandler(self.cfg)
        last_exception = None

        self.sc = sc.ConfigManager.instantiate(protocol='dummy')
        self.uds = UDS.instantiate(protocol='dict')
        mib = ib.InfoRouter(main_info_broker=True,
                            sub_providers=[
                                self.uds, self.sc,
                                dsp.DynamicStateProvider(self.sc, self.ch),
                                sp.SynchronizationProvider(),
                                ResourceHandlerProvider(self.ch)
                            ])

        for i in self.drop_nodes:
            try:
                node_state = mib.get('node.resource.state', i)
                log.info("Status of node %r is %r", i, node_state)
            except Exception as ex:
                log.exception('Failure:')
                last_exception = ex
        if last_exception:
            raise last_exception, None, sys.exc_info()[2]