[libvirt] [PATCH] esx: Use MD5 sum of mount path as storage pool UUID

Matthias Bolte matthias.bolte at googlemail.com
Fri Aug 20 23:32:25 UTC 2010


2010/8/14 Eric Blake <eblake at redhat.com>:
> On 08/08/2010 02:56 PM, Matthias Bolte wrote:
>> With the previous storage pool UUID source not all storage pools
>> had a proper UUID, especially GSX storage pools. The mount path
>> is unique per host and cannot change during the lifetime of the
>> datastore. Therefore, its MD5 sum can be used as UUID.
>>
>> Use gnulib's crypto/md5 module to generate the MD5 sum.
>
> It looks like others have agreed on the approach; but I didn't see an
> actual ACK.  So just in case:
>
>> @@ -197,10 +198,7 @@ esxStoragePoolLookupByName(virConnectPtr conn, const char *name)
>>      esxPrivate *priv = conn->storagePrivateData;
>>      esxVI_ObjectContent *datastore = NULL;
>>      esxVI_DatastoreHostMount *hostMount = NULL;
>> -    char *suffix = NULL;
>> -    int suffixLength;
>> -    char uuid_string[VIR_UUID_STRING_BUFLEN] = "00000000-00000000-0000-000000000000";
>> -    unsigned char uuid[VIR_UUID_BUFLEN];
>> +    unsigned char md5[MD5_DIGEST_SIZE]; /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
>
> Is it worth also adding:
>
> #include "verify.h"
> ...
> verify(MD5_DIGEST_SIZE == VIR_UUID_BUFLEN)
>
> to enforce this comment's correctness?
>
> ACK with that nit addressed.
>

That's a good idea. I've folded that in and pushed the result.

Matthias




More information about the libvir-list mailing list