← Back to team overview

openstack team mailing list archive

I dont see authentication being handled while copying images from glance to esxi



In the file
the code which copying the image from Glance to the ESXi datastore doesnt
seem to handle the authentication.

class VMWareHTTPWriteFile(VMwareHTTPFile):
    """VMWare file write handler class."""

    def __init__(self, host, data_center_name, datastore_name, cookies,
                 file_path, file_size, scheme="https"):
        base_url = "%s://%s/folder/%s" % (scheme, host, file_path)
        param_list = {"dcPath": data_center_name, "dsName": datastore_name}
        base_url = base_url + "?" + urllib.urlencode(param_list)
        _urlparse = urlparse.urlparse(base_url)
        scheme, netloc, path, params, query, fragment = _urlparse
        if scheme == "http":
            conn = httplib.HTTPConnection(netloc)
        elif scheme == "https":
            conn = httplib.HTTPSConnection(netloc)
        conn.putrequest("PUT", path + "?" + query)
        conn.putheader("User-Agent", USER_AGENT)
        conn.putheader("Content-Length", file_size)
        conn.putheader("Cookie", self._build_vim_cookie_headers(cookies))
        self.conn = conn
        VMwareHTTPFile.__init__(self, conn)

Can some one enlighten me on how this works? When I manually tried the same
using curl and provided the username/password, the file upload worked just
fine. But when I create an instance in OpenStack, the image copy to ESXi is
not working.