diff options
author | Gokul Singaraju <goksing@gmail.com> | 2017-11-28 23:42:58 -0500 |
---|---|---|
committer | Gokul Singaraju <goksing@gmail.com> | 2017-11-28 23:49:57 -0500 |
commit | f9cbe4b0ecf250f970cd8ed37b4ba3e9e8af1396 (patch) | |
tree | a73e17d2be3bd0d360cf34efc4b5fc75e1d4ecc3 /vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c | |
parent | 12fd5fcf0e58f79cd4666592dd0fc34090b298e7 (diff) |
Implement batching of VES events
Issue-ID: CERT-6
Change-Id: Ie2ba74075539e6896b1c1bd580cf0a80414a04a1
Signed-off-by: Gokul Singaraju <goksing@gmail.com>
Diffstat (limited to 'vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c')
-rw-r--r-- | vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c | 19 |
1 files changed, 19 insertions, 0 deletions
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 62ea6b51..fceb893c 100644 --- 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 <unistd.h> #include <curl/curl.h> @@ -313,12 +314,30 @@ exit_label: *****************************************************************************/ 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); + + 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); + } + } /**************************************************************************//** |