Code Review
/
demo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Implement batching of VES events
[demo.git]
/
vnfs
/
VES5.0
/
evel
/
evel-library
/
code
/
evel_library
/
metadata.c
diff --git
a/vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c
b/vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c
index
62ea6b5
..
fceb893
100644
(file)
--- a/
vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c
+++ b/
vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c
@@
-23,6
+23,7
@@
#include <string.h>
#include <assert.h>
#include <malloc.h>
#include <string.h>
#include <assert.h>
#include <malloc.h>
+#include <unistd.h>
#include <curl/curl.h>
#include <curl/curl.h>
@@
-313,12
+314,30
@@
exit_label:
*****************************************************************************/
void openstack_metadata_initialize()
{
*****************************************************************************/
void openstack_metadata_initialize()
{
+ char hostname[MAX_METADATA_STRING];
+
+ FILE * f = fopen ("/proc/sys/kernel/random/uuid", "r");
+
strncpy(vm_uuid,
"Dummy VM UUID - No Metadata available",
MAX_METADATA_STRING);
strncpy(vm_name,
"Dummy VM name - No Metadata available",
MAX_METADATA_STRING);
strncpy(vm_uuid,
"Dummy VM UUID - No Metadata available",
MAX_METADATA_STRING);
strncpy(vm_name,
"Dummy VM name - No Metadata available",
MAX_METADATA_STRING);
+
+ if( gethostname(hostname, 1024) != -1 )
+ strcpy(vm_name,hostname);
+
+ if (f)
+ {
+ if (fgets(vm_uuid,MAX_METADATA_STRING, f)!=NULL)
+ {
+ vm_uuid[strlen( vm_uuid ) - 1 ] = '\0';
+ EVEL_DEBUG("VM UUID: %s", vm_uuid);
+ }
+ fclose (f);
+ }
+
}
/**************************************************************************//**
}
/**************************************************************************//**