def import_from_glance(request, glance_id):
    '\n    Creates a local db entry for the glance image\n    Everything in Wistar depends on a db entry in the Images table\n    If you have an existing openstack cluster, you may want to import those\n    images here without having to physically copy the images to local disk\n    :param request: HTTPRequest object\n    :param glance_id: id of the glance image to import\n    :return: redirect to /images/image_id\n    '
    if openstackUtils.connect_to_openstack():
        image_details = openstackUtils.get_glance_image_detail(glance_id)
        image = Image()
        image.description = 'Imported from Glance'
        image.name = image_details['name']
        image.type = 'blank'
        image.save()
        logger.debug('All done')
        return HttpResponseRedirect(('/images/%s' % image.id))
    context = {'error': 'Could not connect to OpenStack'}
    return render(request, 'error.html', context)
Creates a local db entry for the glance image
Everything in Wistar depends on a db entry in the Images table
If you have an existing openstack cluster, you may want to import those
images here without having to physically copy the images to local disk
:param request: HTTPRequest object
:param glance_id: id of the glance image to import
:return: redirect to /images/image_id
def import_from_glance(request, glance_id):
    '\n    Creates a local db entry for the glance image\n    Everything in Wistar depends on a db entry in the Images table\n    If you have an existing openstack cluster, you may want to import those\n    images here without having to physically copy the images to local disk\n    :param request: HTTPRequest object\n    :param glance_id: id of the glance image to import\n    :return: redirect to /images/image_id\n    '
    if openstackUtils.connect_to_openstack():
        image_details = openstackUtils.get_glance_image_detail(glance_id)
        image = Image()
        image.description = 'Imported from Glance'
        image.name = image_details['name']
        image.type = 'blank'
        image.save()
        logger.debug('All done')
        return HttpResponseRedirect(('/images/%s' % image.id))
    context = {'error': 'Could not connect to OpenStack'}
    return render(request, 'error.html', context)