Comment 6 for bug 1222847

Revision history for this message
guillaume thouvenin (guillaume-thouvenin) wrote : Re: xenapi: Fetched VDIs of type 'root' with a wrong UUID

I dig a little and there is something that I don't understand. The function _fetch_vhd_image() returns a list of dictionaries that describe VDIs. So for example if I have a disk like this one:

# xe vdi-list
uuid ( RO) : 46addb2a-52a8-0010-4751-ad2e5538440e
          name-label ( RW): 7e65ebc1-ac4a-4c35-b66d-73af3d5451c6.vhd
    name-description ( RW):
             sr-uuid ( RO): 1d0018c1-808b-4205-ba69-3ed1806d6839
        virtual-size ( RO): 42025472
            sharable ( RO): false
           read-only ( RO): false

If the disk is the root of the VM, the corresponding VDIs should be something like vdis={'root': {'uuid': '46addb2a-52a8-0010-4751-ad2e5538440e'}}

When I look the following piece of code in _fetch_vhd_image():

1222
1223 vdis = default_handler.download_image(
1224 context, session, instance, image_id)
1225
1226 sr_ref = safe_find_sr(session)
1227 _scan_sr(session, sr_ref)
1228

At 1225, for my case, the file 7e65ebc1-ac4a-4c35-b66d-73af3d5451c6.vhd has been copied in the SR and vdis = {'root': {'uuid': '7e65ebc1-ac4a-4c35-b66d-73af3d5451c6'}}.

When the SR.scan is ran, it creates the vdi shows previously (with the uuid=46a...). So shouldn't we update the vdis after the scan of the SR?