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

Eric Blake eblake at redhat.com
Sat Aug 14 16:45:29 UTC 2010


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.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100814/c32fa2f6/attachment-0001.sig>


More information about the libvir-list mailing list