How can i upload a image from another location in glance?

Asked by lbz on 2012-08-12

I have two servers,one has the glance service running in it (S-server,IP:192.168.1.120),and the other not(N-server,IP:192.168.1.110).
And I have an image in N-server,how can i upload the image to the glance.
I have tried the commad:
>glance add name=cirros-0.3.0-x86_64 is_public=true container_format=bare disk_format=qcow2 copy_from=http://192.168.1.110/meidia/share/cirros-0.3.0-x86_64-disk.img

glance add name=cirros-0.3.0-x86_64 is_public=true container_format=bare disk_format=raw copy_from=http://root:passwd@192.168.1.110/meidia/share/cirros-0.3.0-x86_64-disk.img

it does not work,it just regist the image to glance ,does not upload the data...would you help me?thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Glance Edit question
Assignee:
No assignee Edit question
Solved by:
lbz
Solved:
2012-08-14
Last query:
2012-08-14
Last reply:
2012-08-12
lbz (lbzistc) said : #1

Failed to add image. Got error:
The request returned 500 Internal Server Error

The response body:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 336, in handle_ one_response
    result = self.application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 210, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 279, in __ call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1086, in get_re sponse
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1055, in call_a pplication
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/keystone/middleware/auth_token.py", lin e 176, in __call__
    return self.app(env, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 210, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 279, in __ call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1086, in get_re sponse
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1055, in call_a pplication
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __c all__
    response = self.app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 210, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 477, in __ call__
    request, **action_args)
  File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 494, in di spatch
    return method(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 606, in create
    image_meta = self._handle_source(req, id, image_meta, image_data)
  File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 545, in _handle_source
    image_meta = self._upload_and_activate(req, image_meta)
  File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 536, in _upload_and_activate
    location = self._upload(req, image_meta)
  File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 348, in _upload
    image_data, image_size = self._get_from_store(copy_from)
  File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 256, in _get_from_store
    image_data, image_size = get_from_backend(where)
  File "/usr/lib/python2.7/dist-packages/glance/store/__init__.py", line 194, in get_from_backend
    return store.get(loc)
  File "/usr/lib/python2.7/dist-packages/glance/store/http.py", line 116, in get
    conn, resp, content_length = self._query(location, 'GET')
  File "/usr/lib/python2.7/dist-packages/glance/store/http.py", line 146, in _qu ery
    conn.request(verb, loc.path, "", {})
  File "/usr/lib/python2.7/httplib.py", line 958, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 992, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 954, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 814, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 776, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 757, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/dist-packages/eventlet/green/socket.py", line 59, in create_connection
    raise error, msg
error: [Errno 113] EHOSTUNREACH

Note: Your image metadata may still be in the registry, but the image's status w ill likely be 'killed'.

lbz (lbzistc) said : #2

Failed to add image. Got error:
The request returned 500 Internal Server Error

The response body:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 336, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 210, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 279, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1086, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1055, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/keystone/middleware/auth_token.py", line 176, in __call__
    return self.app(env, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 210, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 279, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1086, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1055, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 210, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 477, in __call__
    request, **action_args)
  File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 494, in dispatch
    return method(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 606, in create
    image_meta = self._handle_source(req, id, image_meta, image_data)
  File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 545, in _handle_source
    image_meta = self._upload_and_activate(req, image_meta)
  File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 536, in _upload_and_activate
    location = self._upload(req, image_meta)
  File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 348, in _upload
    image_data, image_size = self._get_from_store(copy_from)
  File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 256, in _get_from_store
    image_data, image_size = get_from_backend(where)
  File "/usr/lib/python2.7/dist-packages/glance/store/__init__.py", line 194, in get_from_backend
    return store.get(loc)
  File "/usr/lib/python2.7/dist-packages/glance/store/http.py", line 116, in get
    conn, resp, content_length = self._query(location, 'GET')
  File "/usr/lib/python2.7/dist-packages/glance/store/http.py", line 146, in _query
    conn.request(verb, loc.path, "", {})
  File "/usr/lib/python2.7/httplib.py", line 958, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 992, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 954, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 814, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 776, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 757, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/dist-packages/eventlet/green/socket.py", line 59, in create_connection
    raise error, msg
error: [Errno 111] ECONNREFUSED

Note: Your image metadata may still be in the registry, but the image's status will likely be 'killed'.

Brian Waldon (bcwaldon) said : #3

I don't think Glance supports authentication for images over HTTP. You could try using the glance-replicator tool to replicate images between Glance servers.

lbz (lbzistc) said : #4

Thanks a lot.But how can i use the glance-replicator tool with a server having not glance service?(N-server,IP:192.168.1.110,has not glance service running in it...Should i install a glance client in N-server)

lbz (lbzistc) said : #5

hello Brian,

Thank you very much. I used a glanceClient to upload image to the glance server ,and the problem has been solved,thanks