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(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org