

def create_server(conn):
    print('Create Server:')
    image = conn.compute.find_image(IMAGE_NAME)
    flavor = conn.compute.find_flavor(FLAVOR_NAME)
    network = conn.network.find_network(NETWORK_NAME)
    keypair = create_keypair(conn)
    server = conn.compute.create_server(name=SERVER_NAME, image_id=image.id, flavor_id=flavor.id, networks=[{
        'uuid': network.id,
    }], key_name=keypair.name)
    server = conn.compute.wait_for_server(server)
    print('ssh -i {key} root@{ip}'.format(key=PRIVATE_KEYPAIR_FILE, ip=server.access_ipv4))

dataset/ETHPy150Open openstack/python-openstacksdk/examples/compute/create.py create_server/original