Exemple #1
0
    def __init__(self, openstack_compatible=True):
        LOG.info("Virtman: start to create a Virtman Compute_node")
        self.openstack_compatible = openstack_compatible
        self.images = {}
        self.instance_names = {}
        self.lock = threading.Lock()

        if self.openstack_compatible:
            config_files = ['/etc/nova/nova.conf', '/etc/virtman/virtman.conf']
        else:
            config_files = ['/etc/virtman/virtman.conf']
        CONF(sys.argv[1:], project='virtman', default_config_files=config_files)

        logging.setup('virtman')
        if not fcg.is_valid():
            fcg.create_group()

        self.heartbeat_event = threading.Event()
        self.heartbeat_thread = threading.Thread(target=self.heartbeat_clock)
        self.heartbeat_thread.daemon = True
        self.heartbeat_thread.start()
        LOG.info("Virtman: create a Virtman Compute_node completed")
Exemple #2
0
    def destroy(self, instance_name):
        return self.cn.destroy(instance_name)

    def list(self):
        return self.cn.list()

    @staticmethod
    def create_image_target(image_name, file_path, loop_dev, iqn_prefix):
        return imageservice.create_image_target(image_name, file_path, loop_dev,
                                                iqn_prefix)

    @staticmethod
    def destroy_image_target(image_name):
        return imageservice.destroy_image_target(image_name)

    @staticmethod
    def list_image_target():
        return imageservice.list_image_target()

if __name__ == '__main__':
    CONF(sys.argv[1:], project='virtman',
         default_config_files=['/etc/virtman/virtman.conf'])
    logging.setup('virtman')
    server = SimpleXMLRPCServer(("0.0.0.0", 7774), RequestHandler,
                                allow_none=True)
    server.register_introspection_functions()
    sc = SimpleCompute()
    server.register_instance(sc)
    print "Virtman Server Run ..."
    server.serve_forever()
Exemple #3
0
    @staticmethod
    def _get_func(callable_fun):
        if hasattr(callable_fun, 'func'):
            return callable_fun.func
        return callable_fun

if __name__ == "__main__":
    " Test and demostrate Chain itself "
    import sys
    from oslo.config import cfg

    CONF = cfg.CONF
    CONF(sys.argv[1:], project=__name__, default_config_files=[
        '/etc/virtman/virtman.conf'])

    logging.setup(__name__)
    c = Chain()

    def asdf(n):
        print '%s' % n

    def qwer(n):
        print 'except %s' % n
        raise OverflowError()

    print sys.argv
    c.add_step(partial(asdf, 1), partial(asdf, -1))
    c.add_step(partial(asdf, 2), partial(asdf, -2))
    c.add_step(partial(asdf, 3), partial(asdf, -3))
    c.do()