Comment 7 for bug 1619675

Revision history for this message
Vinicius G Ferreira (vini-g-fer) wrote :

Sure, here is a short code sample that reproduces the problem for me:

from openstack import connection

#Adjust these credentials according to your openstack installation
username = "demo"
password = "openstack2016"
auth_url_sdk = "http://10.10.0.1:5000/v3"
user_domain_name = "Default"
project_domain_name = "Default"
project_name = "demo"

conn = connection.Connection(
        auth_url=auth_url_sdk,
        project_name=project_name,
        project_domain_name=project_domain_name,
        username=username,
        user_domain_name=user_domain_name,
        password=password)
image_service = conn.image
compute_service = conn.compute

#Using cirros image, which is usually pre-built with openstack/devstack
image = image_service.find_image('cirros-0.3.4-x86_64-uec')
flavor = compute_service.find_flavor('m1.tiny')

user_instance = compute_service.create_server(
name="TEST",
image_id=image.id,
flavor_id=flavor.id)
compute_service.wait_for_status(user_instance, status='ACTIVE')

compute_service.create_server_image(user_instance, "Snapshot")
image = image_service.find_image("Snapshot")
image_service.wait_for_status(image, 'active')

filename = "%s.img" % image.name
with open(str(filename), 'w+') as imgFile:
    for chunk in image.download(conn.image.session):
        imgFile.write(chunk)