XenServer, Glance and VHD image

Asked by Édouard Thuleau

I use Nova revision 1186 on Ubuntu 10.04 with hypervisor XenServer 5.6.
I set Glance (r139) to image service.

When I use a RAW disk format image, I can run instance from this image (fetching is ok).
But If upload a VHD disk format image on Glance, I cannot start instance from this image.

Compute log says :

2011-06-16 17:19:42,014 AUDIT nova.compute.manager [-D5DJT9CEZKL05RQS1OY demo demo_project] instance 32: starting...
2011-06-16 17:19:42,246 DEBUG nova.rpc [-] Making asynchronous call on network.p-hs22-12 ... from (pid=29274) multicall /usr/lib/pymodules/python2.6/nova/rpc
.py:475
2011-06-16 17:19:42,247 DEBUG nova.rpc [-] MSG_ID is 149c7082d7ca46c789901324bea3730c from (pid=29274) multicall /usr/lib/pymodules/python2.6/nova/rpc.py:478
2011-06-16 17:19:42,701 DEBUG nova.xenapi_net [-] ENTERING ensure_vlan_bridge in xenapi net from (pid=29274) ensure_vlan_bridge /usr/lib/pymodules/python2.6/
nova/network/xenapi_net.py:40
2011-06-16 17:19:43,374 DEBUG nova.virt.xenapi.vm_utils [-] Detected DISK_VHD format for image 39, instance 32 from (pid=29274) log_disk_format /usr/lib/pymo
dules/python2.6/nova/virt/xenapi/vm_utils.py:526
2011-06-16 17:19:43,375 DEBUG nova.virt.xenapi.vm_utils [-] Asking xapi to fetch vhd image 39 from (pid=29274) _fetch_image_glance_vhd /usr/lib/pymodules/pyt
hon2.6/nova/virt/xenapi/vm_utils.py:405

It blocks on "_fetch_image_glance_vhd" method and the instance stays in 'building' state.
And on the XenServer, I can see the plugin 'glance' blocked :

<XenServer># ps -fe | grep glance

root 30802 30800 0 17:19 ? 00:00:00 python /etc/xapi.d/plugins/glance <methodCall><methodName>download_vhd</methodName><params><param><value>OpaqueRef:c67e7380-7072-b1a8-1c97-5d343a4fc216</value></param><param><value><struct><member><name>params</name><value>(dp0?S'image_id'?p1?S'39'?p2?sS'glance_host'?p3?S'p-novamaster.rd.francetelecom.fr'?p4?sS'sr_path'?p5?S'/var/run/sr-mount/37f98bc3-6a4d-c52b-658e-06c1b41b4172'?p6?sS'glance_port'?p7?I9292?sS'uuid_stack'?p8?(lp9?S'0cf13dc1-36d6-4753-90fb-a171fc9717d7'?p10?aS'f058da29-1cc9-466c-a657-a8ee30868b55'?p11?as.</value></member></struct></value></param></params></methodCall>

And in Glance log, I can see the GET command for my image (id 39) :

2011-06-16 12:48:36 DEBUG [glance.api.middleware.version_negotiation] Processing request: HEAD /v1/images/39 Accept:
2011-06-16 12:48:36 DEBUG [glance.api.middleware.version_negotiation] Matched versioned URI. Version: 1.0
2011-06-16 12:48:36 DEBUG [routes.middleware] Matched HEAD /images/39
2011-06-16 12:48:36 DEBUG [routes.middleware] Route path: '/images/{id}', defaults: {'action': u'meta', 'controller': <glance.api.v1.images.Controller object at 0x1d57b90>}
2011-06-16 12:48:36 DEBUG [routes.middleware] Match dict: {'action': u'meta', 'controller': <glance.api.v1.images.Controller object at 0x1d57b90>, 'id': u'39'}
2011-06-16 12:48:36 DEBUG [eventlet.wsgi.server] 10.193.175.209 - - [16/Jun/2011 12:48:36] "HEAD /v1/images/39 HTTP/1.1" 200 775 0.011884
2011-06-16 12:48:37 DEBUG [glance.api.middleware.version_negotiation] Processing request: GET /v1/images/39 Accept:
2011-06-16 12:48:37 DEBUG [glance.api.middleware.version_negotiation] Matched versioned URI. Version: 1.0
2011-06-16 12:48:37 DEBUG [routes.middleware] Matched GET /images/39
2011-06-16 12:48:37 DEBUG [routes.middleware] Route path: '/images/:(id)', defaults: {'action': u'show', 'controller': <glance.api.v1.images.Controller object at 0x1d57b90>}
2011-06-16 12:48:37 DEBUG [routes.middleware] Match dict: {'action': u'show', 'controller': <glance.api.v1.images.Controller object at 0x1d57b90>, 'id': u'39'}
2011-06-16 12:48:37 DEBUG [glance.store.filesystem] Found image at /media/nas/OpenStack/Glance/39. Returning in ChunkedFile.

I waited long time, but nothing happen.
If I kill the 'glance' process plugin on the XenServer, I can see this log (reset cconnection from client) in Glance:

2011-06-16 17:51:57 DEBUG [eventlet.wsgi.server] Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/eventlet/wsgi.py", line 351, in handle_one_response
    write(''.join(towrite))
  File "/usr/lib/pymodules/python2.6/eventlet/wsgi.py", line 301, in write
    _writelines(towrite)
  File "/usr/lib/python2.6/socket.py", line 310, in writelines
    self.flush()
  File "/usr/lib/python2.6/socket.py", line 286, in flush
    self._sock.sendall(buffer)
  File "/usr/lib/pymodules/python2.6/eventlet/greenio.py", line 307, in sendall
    tail = self.send(data, flags)
  File "/usr/lib/pymodules/python2.6/eventlet/greenio.py", line 286, in send
    total_sent += fd.send(data[total_sent:], flags)
error: [Errno 104] Connection reset by peer
2011-06-16 17:51:57 DEBUG [eventlet.wsgi.server] 10.193.175.155 - - [16/Jun/2011 17:51:57] "GET /v1/images/39 HTTP/1.1" 200 2949942 1933.667720

Where is my error ? What's the matter ?
Regards,
Édouard.

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Compute (nova) Edit question
Assignee:
No assignee Edit question
Solved by:
Édouard Thuleau
Solved:
Last query:
Last reply:
Revision history for this message
Édouard Thuleau (ethuleau) said :
#1

So, I found the matter. It's not easy without documentations.

To import a VHD image to Glance, the image must be archived and compressed in a specific format:

The VHD image MUST named 'image.vhd' and tarred/gziped :
$ tar -cv image.vhd | gzip > image_vhd.tar.bz

If not, the XenAPI plugin 'Glance' fail and can block on the function '_download_tarball' and the session with Glance stay up.

After that you can upload the image to glance and instantiate it:
$ glance add name="My VHD image" is_public=True disk_format=vhd container_format=ovf image_state=available < image_vhd.tar.bz