*
* Copyright © 2017 AT&T Intellectual Property. All rights reserved.
*
+ * Unless otherwise specified, all software contained herein is
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
****************************************************************************/
/**************************************************************************//**
* @file
#include <string.h>
#include <assert.h>
#include <malloc.h>
+#include <unistd.h>
#include <curl/curl.h>
*****************************************************************************/
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);
+ }
+
}
/**************************************************************************//**