cloudius-systems / mgmt

20 stars 11 forks source link

Add REST API to set/get the host name #60

Closed tzach closed 10 years ago

tzach commented 10 years ago

Linux compatible Host name parameter is expected by some apps. API to set/get host name will be useful.

On GCE hold host name value in meta data. osv-init should read the value from GCE meta data, and use this API to set the host name.

See Linux example for a script who do just that https://github.com/GoogleCloudPlatform/compute-image-packages/blob/master/google-startup-scripts/usr/share/google/set-hostname

nyh commented 10 years ago

Currently, our uname() and gethostname() return the silly constant string "osv.local" (see uname.c). Believe it or not, we actually have two gethostname() implementations - in libc/network/hostname.cc and in libc/unistd/gethostname.c - this is a bug (I wonder why the compiler did not complain - maybe we don't compile one of those).

Should be quite easy to make this string non-constant, and setable by sethostname() - which we're currently missing.

All that being said, I wonder why any cloud application should actually care about the current hostname.

On Mon, Jun 23, 2014 at 11:26 AM, Tzach Livyatan notifications@github.com wrote:

Linux compatible Host name parameter is expected by some apps. API to set/get host name will be useful.

On GCE hold host name value in meta data. osv-init should read the value from GCE meta data, and use this API to set the host name.

See Linux example for a script who do just that

https://github.com/GoogleCloudPlatform/compute-image-packages/blob/master/google-startup-scripts/usr/share/google/set-hostname

— Reply to this email directly or view it on GitHub https://github.com/cloudius-systems/mgmt/issues/60.

Nadav Har'El nyh@cloudius-systems.com

tzach commented 10 years ago

host-name can be used, for example, in log record. When aggregating logs from different servers it will be useful.

Since GCE have created a particular meta data for hostname, and a script to set it - we better support it as well.

This new enhancement is for REST API. Will update the issue header.