当前位置: 首页>>代码示例>>Python>>正文


Python composer.create函数代码示例

本文整理汇总了Python中solar.core.resource.composer.create函数的典型用法代码示例。如果您正苦于以下问题:Python create函数的具体用法?Python create怎么用?Python create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了create函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_solar_agent

def add_solar_agent(i):
    solar_agent_transport = cr.create(
        "solar_agent_transport%s" % i,
        "resources/transport_solar_agent",
        {"solar_agent_user": "vagrant", "solar_agent_password": "password"},
    )[0]
    transports = resource.load("transports%s" % i)
    ssh_transport = resource.load("ssh_transport%s" % i)
    transports_for_solar_agent = cr.create("transports_for_solar_agent%s" % i, "resources/transports")[0]

    # install solar_agent with ssh
    signals.connect(transports_for_solar_agent, solar_agent_transport, {})

    signals.connect(
        ssh_transport,
        transports_for_solar_agent,
        {"key": "transports:key", "user": "transports:user", "port": "transports:port", "name": "transports:name"},
    )

    # add solar_agent to transports on this node
    signals.connect(
        solar_agent_transport,
        transports,
        {
            "solar_agent_user": "transports:user",
            "solar_agent_port": "transports:port",
            "solar_agent_password": "transports:password",
            "name": "transports:name",
        },
    )
开发者ID:openstack,项目名称:solar-resources,代码行数:30,代码来源:riaks.py

示例2: setup_resources

def setup_resources():
    ModelMeta.remove_all()

    node2 = cr.create('node2', 'resources/ro_node/', {
        'ip': '10.0.0.4',
        'ssh_key': '/vagrant/.vagrant/machines/solar-dev2/virtualbox/private_key',
        'ssh_user': 'vagrant'
    })[0]

    solar_bootstrap2 = cr.create('solar_bootstrap2', 'resources/solar_bootstrap', {'master_ip': '10.0.0.2'})[0]

    signals.connect(node2, solar_bootstrap2)

    has_errors = False
    for r in locals().values():
        if not isinstance(r, resource.Resource):
            continue

        print 'Validating {}'.format(r.name)
        errors = validation.validate_resource(r)
        if errors:
            has_errors = True
            print 'ERROR: %s: %s' % (r.name, errors)

    if has_errors:
        sys.exit(1)
开发者ID:pigmej,项目名称:solar-resources,代码行数:26,代码来源:example-bootstrap.py

示例3: setup_neutron_agent

def setup_neutron_agent(node, neutron_server_puppet):
    # NEUTRON ML2 PLUGIN & ML2-OVS AGENT WITH GRE
    neutron_agents_ml2 = cr.create('neutron_agents_ml2', 'resources/neutron_agents_ml2_ovs_puppet', {
        # TODO(bogdando) these should come from the node network resource
        'enable_tunneling': True,
        'tunnel_types': ['gre'],
        'local_ip': '10.1.0.13' # should be the IP addr of the br-mesh int.
    })[0]
    node.connect(neutron_agents_ml2)
    evapi.add_dep(neutron_server_puppet.name, neutron_agents_ml2.name, actions=('run',))

    # NEUTRON DHCP, L3, metadata agents
    neutron_agents_dhcp = cr.create('neutron_agents_dhcp', 'resources/neutron_agents_dhcp_puppet', {})[0]
    node.connect(neutron_agents_dhcp)
    evapi.add_dep(neutron_server_puppet.name, neutron_agents_dhcp.name, actions=('run',))

    neutron_agents_l3 = cr.create('neutron_agents_l3', 'resources/neutron_agents_l3_puppet', {
        # TODO(bogdando) these should come from the node network resource
        'metadata_port': 8775,
        'external_network_bridge': 'br-floating',
    })[0]
    node.connect(neutron_agents_l3)
    evapi.add_dep(neutron_server_puppet.name, neutron_agents_l3.name, actions=('run',))

    neutron_agents_metadata = cr.create('neutron_agents_metadata', 'resources/neutron_agents_metadata_puppet', {
        'sh2ared_secret': 'secret',
    })[0]
    node.connect(neutron_agents_metadata)
    neutron_server_puppet.connect(neutron_agents_metadata, {
        'auth_host', 'auth_port', 'auth_password',
        'auth_tenant', 'auth_user',
    })
    return {'neutron_agents_ml2': neutron_agents_ml2,
            'neutron_agents_dhcp': neutron_agents_dhcp,
            'neutron_agents_metadata': neutron_agents_metadata}
开发者ID:pigmej,项目名称:solar-resources,代码行数:35,代码来源:openstack.py

示例4: prepare_nodes

def prepare_nodes(nodes_count):
    resources = cr.create('nodes', 'templates/nodes', {"count": nodes_count})
    nodes = resources.like('node')
    resources = cr.create('nodes_network', 'templates/nodes_network', {"count": nodes_count})
    nodes_sdn = resources.like('node')
    r = {}

    for node, node_sdn in zip(nodes, nodes_sdn):
        r[node.name] = node
        r[node_sdn.name] = node_sdn

        # LIBRARIAN
        librarian = cr.create('librarian_{}'.format(node.name), 'resources/librarian', {})[0]
        r[librarian.name] = librarian

        node.connect(librarian, {})

        # NETWORKING
        # TODO(bogdando) node's IPs should be populated as br-mgmt IPs, but now are hardcoded in templates
        signals.connect(node, node_sdn)
        node_sdn.connect_with_events(librarian, {'module': 'modules'}, {})
        evapi.add_dep(librarian.name, node_sdn.name, actions=('run', 'update'))

        signals.connect(node, node_sdn)
        node_sdn.connect_with_events(librarian, {'module': 'modules'}, {})
        evapi.add_dep(librarian.name, node_sdn.name, actions=('run', 'update'))

    return r
开发者ID:pigmej,项目名称:solar-resources,代码行数:28,代码来源:openstack.py

示例5: create_master

def create_master():
    master = source.master()
    try:
        resource.load('nodemaster')
    except solar.dblayer.model.DBLayerNotFound:
        cr.create('master', 'f2s/fuel_node',
                  {'index': master[0], 'ip': master[1]}, tags=['nodemaster'])
开发者ID:Mirantis,项目名称:f2s,代码行数:7,代码来源:fsclient.py

示例6: setup_master

def setup_master(config, user_config):
    master = cr.create('kube-node-master', 'k8s/node',
                       {'name': 'kube-node-master',
                        'ip': user_config['ip'],
                        'ssh_user': user_config['username'],
                        'ssh_password': user_config['password'],
                        'ssh_key': user_config['ssh_key']})['kube-node-master']

    master.connect(config, {})
    docker = cr.create('kube-docker-master',
                       'k8s/docker')['kube-docker-master']
    master.connect(docker, {})

    kubelet = cr.create('kubelet-master',
                        'k8s/kubelet_master')['kubelet-master']
    config.connect(kubelet, {'k8s_version': 'k8s_version'})

    calico = cr.create('calico-master', 'k8s/calico_master',
                       {'options': "--nat-outgoing --ipip"})['calico-master']
    master.connect(calico, {'ip': ['ip', 'etcd_host']})
    config.connect(calico, {'network': 'network',
                            'prefix': 'prefix',
                            'calico_version': 'version'})
    calico.connect(calico, {'etcd_host': 'etcd_authority',
                            'etcd_port': 'etcd_authority',
                            'etcd_authority': 'etcd_authority_internal'})
    config.connect(kubelet,
                   {'service_cluster_ip_range': "service_cluster_ip_range"})
    master.connect(kubelet, {'name': 'master_host'})
    kubelet.connect(kubelet, {'master_host': 'master_address',
                              'master_port': 'master_address'})

    add_event(Dep(docker.name, 'run', 'success', kubelet.name, 'run'))
    add_event(Dep(kubelet.name, 'run', 'success', calico.name, 'run'))
开发者ID:loles,项目名称:solar-k8s,代码行数:34,代码来源:setup_k8s.py

示例7: setup_base

def setup_base(node, librarian):
    # MARIADB
    mariadb_service = cr.create('mariadb_service1', 'resources/mariadb_service', {
        'image': 'mariadb',
        'port': 3306
    })[0]

    node.connect(mariadb_service)

    # RABBIT
    rabbitmq_service = cr.create('rabbitmq_service1', 'resources/rabbitmq_service/', {
        'management_port': 15672,
        'port': 5672,
    })[0]
    openstack_vhost = cr.create('openstack_vhost', 'resources/rabbitmq_vhost/', {
        'vhost_name': 'openstack'
    })[0]

    openstack_rabbitmq_user = cr.create('openstack_rabbitmq_user', 'resources/rabbitmq_user/', {
        'user_name': 'openstack',
        'password': 'openstack_password'
    })[0]

    node.connect(rabbitmq_service)
    rabbitmq_service.connect_with_events(librarian, {'module': 'modules'}, {})
    evapi.add_dep(librarian.name, rabbitmq_service.name, actions=('run', 'update'))
    rabbitmq_service.connect(openstack_vhost)
    rabbitmq_service.connect(openstack_rabbitmq_user)
    openstack_vhost.connect(openstack_rabbitmq_user, {
        'vhost_name',
    })
    return {'mariadb_service': mariadb_service,
            'rabbitmq_service1': rabbitmq_service,
            'openstack_vhost': openstack_vhost,
            'openstack_rabbitmq_user': openstack_rabbitmq_user}
开发者ID:pigmej,项目名称:solar-resources,代码行数:35,代码来源:openstack.py

示例8: master

def master(env):
    master = source.master()
    cr.create('master', 'vrs/fuel_node',
        {'index': master[0], 'ip': master[1]})

    cr.create('genkeys', 'vrs/genkeys', {
        'node': 'node'+master[0],
        'index': int(env)})
开发者ID:loles,项目名称:f2s,代码行数:8,代码来源:fsclient.py

示例9: setup_riak

def setup_riak(nodes_num=None, hosts_mapping=False):

    if nodes_num is None:
        nodes_num = NODES
    db.clear()

    resources = cr.create('nodes', 'templates/nodes', {'count': nodes_num})
    nodes = [x for x in resources if x.name.startswith('node')]
    hosts_services = [x for x in resources if x.name.startswith('hosts_file')]

    riak_services = []
    ips = '10.0.0.%d'
    for i in xrange(nodes_num):
        num = i + 1
        r = cr.create('riak_service%d' % num,
                      'resources/riak_node',
                      {'riak_self_name': 'riak%d' % num,
                       'riak_hostname': 'riak_server%d.solar' % num,
                       'riak_name': 'riak%[email protected]_server%d.solar' % (num, num)})[0]
        riak_services.append(r)

    for i, riak in enumerate(riak_services):
        nodes[i].connect(riak)

    for i, riak in enumerate(riak_services[1:]):
        riak_services[0].connect(riak, {'riak_name': 'join_to'})

    if hosts_mapping:
        for riak in riak_services:
            for hosts_file in hosts_services:
                riak.connect_with_events(hosts_file,
                    {'riak_hostname': 'hosts:name',
                     'ip': 'hosts:ip'})

    res_errors = resource.validate_resources()
    for r, error in res_errors:
        click.echo('ERROR: %s: %s' % (r.name, error))
    has_errors = False

    if has_errors:
        click.echo("ERRORS")
        sys.exit(1)

    events = []
    for x in xrange(nodes_num):
        i = x + 1
        if hosts_mapping:
            events.append(Dep('hosts_file%d' % i, 'run', 'success', 'riak_service%d' % i, 'run'))
        if i >= 2:
            events.append(React('riak_service%d' % i, 'run', 'success', 'riak_service%d' % i, 'join'))
        events.append(React('riak_service%d' % i, 'join', 'success', 'riak_service1', 'commit'))

    for event in events:
        add_event(event)

    click.echo('Use solar changes process & orch')
    sys.exit(0)
开发者ID:pigmej,项目名称:solar-resources,代码行数:57,代码来源:riaks_big.py

示例10: setup_cinder_volume

def setup_cinder_volume(node, cinder_puppet):
    # CINDER VOLUME
    cinder_volume = cr.create('cinder_volume_{}'.format(node.name), 'resources/volume_group',
            {'path': '/root/cinder.img', 'volume_name': 'cinder-volume'})[0]
    node.connect(cinder_volume)

    cinder_volume_puppet = cr.create('cinder_volume_puppet', 'resources/cinder_volume_puppet', {})[0]
    node.connect(cinder_volume_puppet)
    cinder_puppet.connect(cinder_volume_puppet)
    evapi.add_react(cinder_puppet.name, cinder_volume_puppet.name, actions=('update',))
    cinder_volume.connect(cinder_volume_puppet, {'volume_name': 'volume_group'})
    return {'cinder_volume_puppet': cinder_volume_puppet}
开发者ID:pigmej,项目名称:solar-resources,代码行数:12,代码来源:openstack.py

示例11: run

def run():
    ModelMeta.remove_all()

    resources = cr.create('nodes', 'templates/nodes', {'count': 2})

    node1, node2 = [x for x in resources if x.name.startswith('node')]
    hosts1, hosts2 = [x for x in resources
                      if x.name.startswith('hosts_file')]

    node1.connect(hosts1, {
        'name': 'hosts:name',
        'ip': 'hosts:ip',
    })

    node2.connect(hosts1, {
        'name': 'hosts:name',
        'ip': 'hosts:ip',
    })

    node1.connect(hosts2, {
        'name': 'hosts:name',
        'ip': 'hosts:ip',
    })

    node2.connect(hosts2, {
        'name': 'hosts:name',
        'ip': 'hosts:ip',
    })
开发者ID:pigmej,项目名称:solar-resources,代码行数:28,代码来源:hosts.py

示例12: test_create_resource

def test_create_resource():
    node_path = os.path.join(
        os.path.dirname(os.path.realpath(__file__)),
        'resource_fixtures', 'node')
    resources = cr.create('node1', node_path)
    assert len(resources) == 1
    assert resources[0].name == 'node1'
开发者ID:loles,项目名称:solar-1,代码行数:7,代码来源:test_composer.py

示例13: setup_cinder_scheduler

def setup_cinder_scheduler(node, cinder_puppet):
    # CINDER SCHEDULER
    cinder_scheduler_puppet = cr.create('cinder_scheduler_puppet', 'resources/cinder_scheduler_puppet', {})[0]
    node.connect(cinder_scheduler_puppet)
    cinder_puppet.connect(cinder_scheduler_puppet)
    evapi.add_react(cinder_puppet.name, cinder_scheduler_puppet.name, actions=('update',))
    return {'cinder_scheduler_puppet': cinder_scheduler_puppet}
开发者ID:pigmej,项目名称:solar-resources,代码行数:7,代码来源:openstack.py

示例14: setup_nova_conductor

def setup_nova_conductor(node, nova_puppet, nova_api_puppet):
    # NOVA CONDUCTOR
    nova_conductor_puppet = cr.create('nova_conductor_puppet', 'resources/nova_conductor_puppet', {})[0]
    node.connect(nova_conductor_puppet)
    nova_puppet.connect(nova_conductor_puppet)
    evapi.add_dep(nova_api_puppet.name, nova_conductor_puppet.name, actions=('run',))
    evapi.add_react(nova_puppet.name, nova_conductor_puppet.name, actions=('update',))
    return {'nova_conductor': nova_conductor_puppet}
开发者ID:pigmej,项目名称:solar-resources,代码行数:8,代码来源:openstack.py

示例15: setup_openrc

def setup_openrc(node, keystone_puppet, admin_user):
    # OPENRC
    openrc = cr.create('openrc_file', 'resources/openrc_file', {})[0]

    node.connect(openrc)
    keystone_puppet.connect(openrc, {'ip': 'keystone_host', 'admin_port':'keystone_port'})
    admin_user.connect(openrc, {'user_name': 'user_name','user_password':'password', 'tenant_name': 'tenant'})
    return {'openrc_file' : openrc}
开发者ID:pigmej,项目名称:solar-resources,代码行数:8,代码来源:openstack.py


注:本文中的solar.core.resource.composer.create函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。