def get_shared_params(cfg):
    mp = dict()

    host_ip = cfg.get('host', 'ip')
    mp['service_host'] = host_ip

    glance_host = cfg.getdefaulted('glance', 'glance_host', host_ip)
    glance_port = cfg.getdefaulted('glance', 'glance_port', '9292')
    glance_protocol = cfg.getdefaulted('glance', 'glance_protocol', 'http')

    # Registry should be on the same host
    glance_registry_port = cfg.getdefaulted('glance', 'glance_registry_port', '9191')

    # Uri's of the http/https endpoints
    mp['endpoints'] = {
        'admin': {
            'uri': utils.make_url(glance_protocol, glance_host, glance_port),
            'port': glance_port,
            'host': glance_host,
            'protocol': glance_protocol,
        },
        'registry': {
            'uri': utils.make_url(glance_protocol, glance_host, glance_registry_port),
            'port': glance_registry_port,
            'host': glance_host,
            'protocol': glance_protocol,
        }
    }
    mp['endpoints']['internal'] = dict(mp['endpoints']['admin'])
    mp['endpoints']['public'] = dict(mp['endpoints']['admin'])

    LOG.debug("Glance shared params: %s", mp)
    return mp
示例#2
0
文件: nova.py 项目: aababilov/anvil
def get_shared_params(
    ip, protocol, api_host, api_port, s3_host, s3_port, ec2_host, ec2_port, ec2_admin_host, ec2_admin_port, **kwargs
):
    mp = {}
    mp["service_host"] = ip

    # Uri's of the various nova endpoints
    mp["endpoints"] = {
        "ec2_admin": {
            "uri": utils.make_url(protocol, ec2_admin_host, ec2_admin_port, "services/Admin"),
            "port": ec2_admin_port,
            "host": ec2_admin_host,
            "protocol": protocol,
        },
        "ec2_cloud": {
            "uri": utils.make_url(protocol, ec2_host, ec2_port, "services/Cloud"),
            "port": ec2_port,
            "host": ec2_host,
            "protocol": protocol,
        },
        "s3": {
            "uri": utils.make_url(protocol, s3_host, s3_port),
            "port": s3_port,
            "host": s3_host,
            "protocol": protocol,
        },
        "api": {
            "uri": utils.make_url(protocol, api_host, api_port, "v2"),
            "port": api_port,
            "host": api_host,
            "protocol": protocol,
        },
    }

    return mp
示例#3
0
def get_shared_params(ip,
                      api_port=9292,
                      protocol='http',
                      reg_port=9191,
                      **kwargs):
    mp = {}
    mp['service_host'] = ip

    glance_host = ip
    glance_port = api_port
    glance_protocol = protocol
    glance_registry_port = reg_port

    # Uri's of the http/https endpoints
    mp['endpoints'] = {
        'admin': {
            'uri': utils.make_url(glance_protocol, glance_host, glance_port),
            'port': glance_port,
            'host': glance_host,
            'protocol': glance_protocol,
        },
        'registry': {
            'uri':
            utils.make_url(glance_protocol, glance_host, glance_registry_port),
            'port':
            glance_registry_port,
            'host':
            glance_host,
            'protocol':
            glance_protocol,
        }
    }
    mp['endpoints']['internal'] = dict(mp['endpoints']['admin'])
    mp['endpoints']['public'] = dict(mp['endpoints']['admin'])
    return mp
示例#4
0
def get_shared_params(ip, api_port=9292, protocol='http', reg_port=9191, **kwargs):
    mp = {}
    mp['service_host'] = ip

    glance_host = ip
    glance_port = api_port
    glance_protocol = protocol
    glance_registry_port = reg_port

    # Uri's of the http/https endpoints
    mp['endpoints'] = {
        'admin': {
            'uri': utils.make_url(glance_protocol, glance_host, glance_port),
            'port': glance_port,
            'host': glance_host,
            'protocol': glance_protocol,
        },
        'registry': {
            'uri': utils.make_url(glance_protocol, glance_host, glance_registry_port),
            'port': glance_registry_port,
            'host': glance_host,
            'protocol': glance_protocol,
        }
    }
    mp['endpoints']['internal'] = dict(mp['endpoints']['admin'])
    mp['endpoints']['public'] = dict(mp['endpoints']['admin'])
    return mp
示例#5
0
def get_shared_params(ip, protocol, api_host, api_port, s3_host, s3_port,
                      volume_host, volume_port, ec2_host, ec2_port,
                      ec2_admin_host, ec2_admin_port, **kwargs):
    mp = {}
    mp['service_host'] = ip

    # Uri's of the various nova endpoints
    mp['endpoints'] = {
        'ec2_admin': {
            'uri':
            utils.make_url(protocol, ec2_admin_host, ec2_admin_port,
                           "services/Admin"),
            'port':
            ec2_admin_port,
            'host':
            ec2_admin_host,
            'protocol':
            protocol,
        },
        'ec2_cloud': {
            'uri': utils.make_url(protocol, ec2_host, ec2_port,
                                  "services/Cloud"),
            'port': ec2_port,
            'host': ec2_host,
            'protocol': protocol,
        },
        'volume': {
            'uri': utils.make_url(protocol, volume_host, volume_port, "v1"),
            'port': volume_port,
            'host': volume_host,
            'protocol': protocol,
        },
        's3': {
            'uri': utils.make_url(protocol, s3_host, s3_port),
            'port': s3_port,
            'host': s3_host,
            'protocol': protocol,
        },
        'api': {
            'uri': utils.make_url(protocol, api_host, api_port, "v2"),
            'port': api_port,
            'host': api_host,
            'protocol': protocol,
        },
    }

    return mp
示例#6
0
def get_shared_params(ip, protocol,
                      api_host, api_port,
                      s3_host, s3_port,
                      volume_host, volume_port,
                      ec2_host, ec2_port,
                      ec2_admin_host, ec2_admin_port, **kwargs):
    mp = {}
    mp['service_host'] = ip

    # Uri's of the various nova endpoints
    mp['endpoints'] = {
        'ec2_admin': {
            'uri': utils.make_url(protocol, ec2_admin_host, ec2_admin_port, "services/Admin"),
            'port': ec2_admin_port,
            'host': ec2_admin_host,
            'protocol': protocol,
        },
        'ec2_cloud': {
            'uri': utils.make_url(protocol, ec2_host, ec2_port, "services/Cloud"),
            'port': ec2_port,
            'host': ec2_host,
            'protocol': protocol,
        },
        'volume': {
            'uri': utils.make_url(protocol, volume_host, volume_port, "v1"),
            'port': volume_port,
            'host': volume_host,
            'protocol': protocol,
        },
        's3': {
            'uri': utils.make_url(protocol, s3_host, s3_port),
            'port': s3_port,
            'host': s3_host,
            'protocol': protocol,
        },
        'api': {
            'uri': utils.make_url(protocol, api_host, api_port, "v2"),
            'port': api_port,
            'host': api_host,
            'protocol': protocol,
        },
    }

    return mp
示例#7
0
def get_shared_params(cfgobj):
    mp = dict()

    host_ip = cfgobj.get('host', 'ip')
    mp['service_host'] = host_ip
    nova_host = cfgobj.getdefaulted('nova', 'nova_host', host_ip)
    nova_protocol = cfgobj.getdefaulted('nova', 'nova_protocol', 'http')

    # Uri's of the various nova endpoints
    mp['endpoints'] = {
        'ec2_admin': {
            'uri': utils.make_url(nova_protocol, nova_host, 8773, "services/Admin"),
            'port': 8773,
            'host': host_ip,
            'protocol': nova_protocol,
        },
        'ec2_cloud': {
            'uri': utils.make_url(nova_protocol, nova_host, 8773, "services/Cloud"),
            'port': 8773,
            'host': host_ip,
            'protocol': nova_protocol,
        },
        'volume': {
            'uri': utils.make_url(nova_protocol, host_ip, 8776, "v1"),
            'port': 8776,
            'host': host_ip,
            'protocol': nova_protocol,
        },
        's3': {
            'uri': utils.make_url('http', host_ip, 3333),
            'port': 3333,
            'host': host_ip,
            'protocol': nova_protocol,
        },
        'api': {
            'uri': utils.make_url('http', host_ip, 8774, "v2"),
            'port': 8774,
            'host': host_ip,
            'protocol': nova_protocol,
        },
    }

    return mp
示例#8
0
def get_shared_params(ip, api_host, api_port=9696, protocol='http', **kwargs):
    mp = {}
    mp['service_host'] = ip

    # Uri's of the various quantum endpoints
    mp['endpoints'] = {
        'uri': utils.make_url(protocol, api_host, api_port),
        'port': api_port,
        'host': api_host,
        'protocol': protocol,
    }

    return mp
示例#9
0
def get_shared_params(ip, api_host, api_port=8776, protocol='http', **kwargs):
    mp = {}
    mp['service_host'] = ip

    # Uri's of the various cinder endpoints
    mp['endpoints'] = {
        'admin': {
            'uri': utils.make_url(protocol, api_host, api_port, VERSION),
            'port': api_port,
            'host': api_host,
            'protocol': protocol,
        },
    }
    mp['endpoints']['internal'] = dict(mp['endpoints']['admin'])
    mp['endpoints']['public'] = dict(mp['endpoints']['admin'])
    return mp
示例#10
0
def get_shared_params(ip, api_host, api_port=8776, protocol='http', **kwargs):
    mp = {}
    mp['service_host'] = ip

    # Uri's of the various cinder endpoints
    mp['endpoints'] = {
        'volume': {
            'uri': utils.make_url(protocol, api_host, api_port, "v2"),
            'port': api_port,
            'host': api_host,
            'protocol': protocol,
        },
        'internal': {
        }
    }

    return mp
def get_shared_params(cfg):
    mp = dict()

    host_ip = cfg.get('host', 'ip')
    mp['service_host'] = host_ip

    # Components of the various endpoints
    quantum_host = cfg.getdefaulted('quantum', 'quantum_host', host_ip)
    quantum_port = cfg.getdefaulted('quantum', 'quantum_port', '9696')
    quantum_proto = cfg.getdefaulted('quantum', 'quantum_protocol', 'http')
    quantum_uri = utils.make_url(quantum_proto, quantum_host, quantum_port)
    mp['endpoints'] = {
        'admin': {
            'uri': quantum_uri,
            'port': quantum_port,
            'protocol': quantum_proto,
            'host': quantum_host,
        },
    }
    mp['endpoints']['public'] = dict(mp['endpoints']['admin'])
    mp['endpoints']['internal'] = dict(mp['endpoints']['public'])

    return mp
示例#12
0
def get_shared_params(cfg):
    mp = dict()

    host_ip = cfg.get('host', 'ip')
    mp['service_host'] = host_ip

    # Components of the various endpoints
    swift_host = cfg.getdefaulted('swift', 'swift_host', host_ip)
    swift_port = cfg.getdefaulted('swift', 'swift_port', '8080')
    swift_proto = cfg.getdefaulted('swift', 'swift_protocol', 'http')
    swift_uri = utils.make_url(swift_proto, swift_host, swift_port)
    mp['endpoints'] = {
        'admin': {
            'uri': swift_uri,
            'port': swift_port,
            'protocol': swift_proto,
            'host': swift_host,
        },
    }
    mp['endpoints']['public'] = dict(mp['endpoints']['admin'])
    mp['endpoints']['internal'] = dict(mp['endpoints']['public'])

    return mp
示例#13
0
def get_shared_params(ip, service_token, admin_password, service_password,
                      auth_host, auth_port, auth_proto, service_host,
                      service_port, service_proto, **kwargs):

    mp = {}

    # Tenants and users
    mp['tenants'] = ['admin', 'service']
    mp['users'] = ['admin']

    mp['admin_tenant'] = 'admin'
    mp['admin_user'] = '******'

    mp['service_tenant'] = 'service'
    if 'service_user' in kwargs:
        mp['users'].append(kwargs['service_user'])
        mp['service_user'] = kwargs['service_user']

    # Tokens and passwords
    mp['service_token'] = service_token
    mp['admin_password'] = admin_password
    mp['service_password'] = service_password

    host_ip = ip
    mp['service_host'] = host_ip

    # Components of the admin endpoint
    keystone_auth_host = auth_host
    keystone_auth_port = auth_port
    keystone_auth_proto = auth_proto
    keystone_auth_uri = utils.make_url(keystone_auth_proto,
                                       keystone_auth_host,
                                       keystone_auth_port,
                                       path="v2.0")

    # Components of the public+internal endpoint
    keystone_service_host = service_host
    keystone_service_port = service_port
    keystone_service_proto = service_proto
    keystone_service_uri = utils.make_url(keystone_service_proto,
                                          keystone_service_host,
                                          keystone_service_port,
                                          path="v2.0")

    mp['endpoints'] = {
        'admin': {
            'uri': keystone_auth_uri,
            'port': keystone_auth_port,
            'protocol': keystone_auth_proto,
            'host': keystone_auth_host,
        },
        'admin_templated': {
            'uri':
            utils.make_url(keystone_auth_proto,
                           keystone_auth_host,
                           port='$(admin_port)s',
                           path="v2.0"),
            'protocol':
            keystone_auth_proto,
            'host':
            keystone_auth_host,
        },
        'public': {
            'uri': keystone_service_uri,
            'port': keystone_service_port,
            'protocol': keystone_service_proto,
            'host': keystone_service_host,
        },
        'public_templated': {
            'uri':
            utils.make_url(keystone_service_proto,
                           keystone_service_host,
                           port='$(public_port)s',
                           path="v2.0"),
            'protocol':
            keystone_service_proto,
            'host':
            keystone_service_host,
        },
    }
    mp['endpoints']['internal'] = dict(mp['endpoints']['public'])
    mp['endpoints']['internal_templated'] = dict(
        mp['endpoints']['public_templated'])

    return mp
示例#14
0
def get_shared_params(ip, service_token, admin_password, demo_password, service_password,
                      auth_host, auth_port, auth_proto, service_host, service_port, service_proto,
                      **kwargs):

    mp = {}

    # Tenants and users
    mp['tenants'] = ['admin', 'service', 'demo']
    mp['users'] = ['admin', 'demo']

    mp['demo_tenant'] = 'demo'
    mp['demo_user'] = '******'

    mp['admin_tenant'] = 'admin'
    mp['admin_user'] = '******'

    mp['service_tenant'] = 'service'
    if 'service_user' in kwargs:
        mp['users'].append(kwargs['service_user'])
        mp['service_user'] = kwargs['service_user']

    # Tokens and passwords
    mp['service_token'] = service_token
    mp['admin_password'] = admin_password
    mp['demo_password'] = demo_password
    mp['service_password'] = service_password

    host_ip = ip
    mp['service_host'] = host_ip

    # Components of the admin endpoint
    keystone_auth_host = auth_host
    keystone_auth_port = auth_port
    keystone_auth_proto = auth_proto
    keystone_auth_uri = utils.make_url(keystone_auth_proto,
                                       keystone_auth_host, keystone_auth_port, path="v2.0")

    # Components of the public+internal endpoint
    keystone_service_host = service_host
    keystone_service_port = service_port
    keystone_service_proto = service_proto
    keystone_service_uri = utils.make_url(keystone_service_proto,
                                          keystone_service_host, keystone_service_port, path="v2.0")

    mp['endpoints'] = {
        'admin': {
            'uri': keystone_auth_uri,
            'port': keystone_auth_port,
            'protocol': keystone_auth_proto,
            'host': keystone_auth_host,
        },
        'admin_templated': {
            'uri': utils.make_url(keystone_auth_proto,
                            keystone_auth_host, port='$(admin_port)s', path="v2.0"),
            'protocol': keystone_auth_proto,
            'host': keystone_auth_host,
        },
        'public': {
            'uri': keystone_service_uri,
            'port': keystone_service_port,
            'protocol': keystone_service_proto,
            'host': keystone_service_host,
        },
        'public_templated': {
            'uri': utils.make_url(keystone_service_proto,
                            keystone_service_host, port='$(public_port)s', path="v2.0"),
            'protocol': keystone_service_proto,
            'host': keystone_service_host,
        },
    }
    mp['endpoints']['internal'] = dict(mp['endpoints']['public'])
    mp['endpoints']['internal_templated'] = dict(mp['endpoints']['public_templated'])

    return mp
def get_shared_params(cfg, service_user=None):

    mp = dict()

    # Tenants and users
    mp['tenants'] = ['admin', 'service', 'demo']
    mp['users'] = ['admin', 'demo']

    mp['demo_tenant'] = 'demo'
    mp['demo_user'] = '******'

    mp['admin_tenant'] = 'admin'
    mp['admin_user'] = '******'

    mp['service_tenant'] = 'service'
    if service_user:
        mp['users'].append(service_user)
        mp['service_user'] = service_user

    # Tokens and passwords
    mp['service_token'] = cfg.get_password(
        "service_token",
        'the service admin token',
        )
    mp['admin_password'] = cfg.get_password(
        'horizon_keystone_admin',
        'the horizon and keystone admin',
        length=20,
        )
    mp['demo_password'] = mp['admin_password']
    mp['service_password'] = cfg.get_password(
        'service_password',
        'service authentication',
        )

    host_ip = cfg.get('host', 'ip')
    mp['service_host'] = host_ip

    # Components of the admin endpoint
    keystone_auth_host = cfg.getdefaulted('keystone', 'keystone_auth_host', host_ip)
    keystone_auth_port = cfg.getdefaulted('keystone', 'keystone_auth_port', '35357')
    keystone_auth_proto = cfg.getdefaulted('keystone', 'keystone_auth_protocol', 'http')
    keystone_auth_uri = utils.make_url(keystone_auth_proto,
                            keystone_auth_host, keystone_auth_port, path="v2.0")

    # Components of the public+internal endpoint
    keystone_service_host = cfg.getdefaulted('keystone', 'keystone_service_host', host_ip)
    keystone_service_port = cfg.getdefaulted('keystone', 'keystone_service_port', '5000')
    keystone_service_proto = cfg.getdefaulted('keystone', 'keystone_service_protocol', 'http')
    keystone_service_uri = utils.make_url(keystone_service_proto,
                            keystone_service_host, keystone_service_port, path="v2.0")

    mp['endpoints'] = {
        'admin': {
            'uri': keystone_auth_uri,
            'port': keystone_auth_port,
            'protocol': keystone_auth_proto,
            'host': keystone_auth_host,
        },
        'admin_templated': {
            'uri': utils.make_url(keystone_auth_proto,
                            keystone_auth_host, port='$(admin_port)s', path="v2.0"),
            'protocol': keystone_auth_proto,
            'host': keystone_auth_host,
        },
        'public': {
            'uri': keystone_service_uri,
            'port': keystone_service_port,
            'protocol': keystone_service_proto,
            'host': keystone_service_host,
        },
        'public_templated': {
            'uri': utils.make_url(keystone_service_proto,
                            keystone_service_host, port='$(public_port)s', path="v2.0"),
            'protocol': keystone_service_proto,
            'host': keystone_service_host,
        },
    }
    mp['endpoints']['internal'] = dict(mp['endpoints']['public'])
    mp['endpoints']['internal_templated'] = dict(mp['endpoints']['public_templated'])

    LOG.debug("Keystone shared params: %s", mp)
    return mp
示例#16
0
def get_shared_params(
    ip,
    service_token,
    admin_password,
    demo_password,
    service_password,
    auth_host,
    auth_port,
    auth_proto,
    service_host,
    service_port,
    service_proto,
    **kwargs
):

    mp = {}

    # Tenants and users
    mp["tenants"] = ["admin", "service", "demo"]
    mp["users"] = ["admin", "demo"]

    mp["demo_tenant"] = "demo"
    mp["demo_user"] = "******"

    mp["admin_tenant"] = "admin"
    mp["admin_user"] = "******"

    mp["service_tenant"] = "service"
    if "service_user" in kwargs:
        mp["users"].append(kwargs["service_user"])
        mp["service_user"] = kwargs["service_user"]

    # Tokens and passwords
    mp["service_token"] = service_token
    mp["admin_password"] = admin_password
    mp["demo_password"] = demo_password
    mp["service_password"] = service_password

    host_ip = ip
    mp["service_host"] = host_ip

    # Components of the admin endpoint
    keystone_auth_host = auth_host
    keystone_auth_port = auth_port
    keystone_auth_proto = auth_proto
    keystone_auth_uri = utils.make_url(keystone_auth_proto, keystone_auth_host, keystone_auth_port, path="v2.0")

    # Components of the public+internal endpoint
    keystone_service_host = service_host
    keystone_service_port = service_port
    keystone_service_proto = service_proto
    keystone_service_uri = utils.make_url(
        keystone_service_proto, keystone_service_host, keystone_service_port, path="v2.0"
    )

    mp["endpoints"] = {
        "admin": {
            "uri": keystone_auth_uri,
            "port": keystone_auth_port,
            "protocol": keystone_auth_proto,
            "host": keystone_auth_host,
        },
        "admin_templated": {
            "uri": utils.make_url(keystone_auth_proto, keystone_auth_host, port="$(admin_port)s", path="v2.0"),
            "protocol": keystone_auth_proto,
            "host": keystone_auth_host,
        },
        "public": {
            "uri": keystone_service_uri,
            "port": keystone_service_port,
            "protocol": keystone_service_proto,
            "host": keystone_service_host,
        },
        "public_templated": {
            "uri": utils.make_url(keystone_service_proto, keystone_service_host, port="$(public_port)s", path="v2.0"),
            "protocol": keystone_service_proto,
            "host": keystone_service_host,
        },
    }
    mp["endpoints"]["internal"] = dict(mp["endpoints"]["public"])
    mp["endpoints"]["internal_templated"] = dict(mp["endpoints"]["public_templated"])

    return mp
示例#17
0
    'libvirt_vif_driver': 'nova.virt.libvirt.vif.LibvirtOpenVswitchDriver',
    'linuxnet_interface_driver': 'nova.network.linux_net.LinuxOVSInterfaceDriver',
    'quantum_use_dhcp': True,
}

# Known mq types
MQ_TYPES = ['rabbit', 'qpid', 'zeromq']

# Xenserver specific defaults
XS_DEF_INTERFACE = 'eth1'
XA_CONNECTION_ADDR = '169.254.0.1'
XS_VNC_ADDR = XA_CONNECTION_ADDR
XS_DEF_BRIDGE = 'xapi1'
XA_CONNECTION_PORT = 80
XA_DEF_USER = '******'
XA_DEF_CONNECTION_URL = utils.make_url('http', XA_CONNECTION_ADDR, XA_CONNECTION_PORT)

# Vnc specific defaults
VNC_DEF_ADDR = '127.0.0.1'

# Nova std compute extensions
STD_COMPUTE_EXTS = 'nova.api.openstack.compute.contrib.standard_extensions'


# These are used for nova volumes
VG_CHECK_CMD = [
    {'cmd': ['vgs', '%VOLUME_GROUP%'],
     'run_as_root': True}
]
VG_DEV_CMD = [
    {'cmd': ['losetup', '-f', '--show', '%VOLUME_BACKING_FILE%'],