diff options
| author | Luis Fernandez Alvarez <luis.fernandez.alvarez@cern.ch> | 2012-09-25 17:33:59 +0200 |
|---|---|---|
| committer | Luis Fernandez Alvarez <luis.fernandez.alvarez@cern.ch> | 2012-09-26 13:43:16 +0200 |
| commit | 5dd1553cca7f7e62eebce75e1d936fc211b239ec (patch) | |
| tree | 0baa1235bf1c86d9f3a3f821f53db92e5012f5dd | |
| parent | c367fa5e4a5e4712bde9fc319ae6c2f4f2add606 (diff) | |
| download | nova-5dd1553cca7f7e62eebce75e1d936fc211b239ec.tar.gz nova-5dd1553cca7f7e62eebce75e1d936fc211b239ec.tar.xz nova-5dd1553cca7f7e62eebce75e1d936fc211b239ec.zip | |
Replaced default hostname function from gethostname to getfqdn
Fixes bug 1055503
The standard behaviour of the 'gethostname' function in Python differs from
Linux to Windows. A common Linux configuration returns the FQDN, while a
Windows one returns only the host name.
To resolve inconsistent node naming in deployments that mix windows and
Linux, it is proposed to use 'getfqdn' as default function instead of
'gethostname'. This is function is more predictable in all cases.
Change-Id: I3164d9a36df2b8484bbf9a57879c31fa0e342503
| -rw-r--r-- | nova/compute/manager.py | 2 | ||||
| -rw-r--r-- | nova/console/manager.py | 2 | ||||
| -rw-r--r-- | nova/flags.py | 2 | ||||
| -rw-r--r-- | nova/network/manager.py | 2 | ||||
| -rw-r--r-- | nova/openstack/common/rpc/impl_zmq.py | 2 | ||||
| -rw-r--r-- | nova/volume/solidfire.py | 8 | ||||
| -rw-r--r-- | tools/conf/extract_opts.py | 2 |
7 files changed, 10 insertions, 10 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 4d88e2772..4c8f3e1f0 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -91,7 +91,7 @@ compute_opts = [ 'fake.FakeDriver, baremetal.BareMetalDriver, ' 'vmwareapi.VMWareESXDriver'), cfg.StrOpt('console_host', - default=socket.gethostname(), + default=socket.getfqdn(), help='Console proxy host to use to connect ' 'to instances on this host.'), cfg.IntOpt('live_migration_retry_count', diff --git a/nova/console/manager.py b/nova/console/manager.py index 2352adcca..faaf58d0c 100644 --- a/nova/console/manager.py +++ b/nova/console/manager.py @@ -37,7 +37,7 @@ console_manager_opts = [ default=False, help='Stub calls to compute worker for tests'), cfg.StrOpt('console_public_hostname', - default=socket.gethostname(), + default=socket.getfqdn(), help='Publicly visible name for this console host'), ] diff --git a/nova/flags.py b/nova/flags.py index 76766b706..e39f94457 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -295,7 +295,7 @@ global_opts = [ default='nova.scheduler.manager.SchedulerManager', help='full class name for the Manager for scheduler'), cfg.StrOpt('host', - default=socket.gethostname(), + default=socket.getfqdn(), help='Name of this node. This can be an opaque identifier. ' 'It is not necessarily a hostname, FQDN, or IP address. ' 'However, the node name must be valid within ' diff --git a/nova/network/manager.py b/nova/network/manager.py index 2485fc90e..4f08c4e41 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -143,7 +143,7 @@ network_opts = [ default=False, help='Autoassigning floating ip to VM'), cfg.StrOpt('network_host', - default=socket.gethostname(), + default=socket.getfqdn(), help='Network host to use for ip allocation in flat modes'), cfg.BoolOpt('fake_call', default=False, diff --git a/nova/openstack/common/rpc/impl_zmq.py b/nova/openstack/common/rpc/impl_zmq.py index 4ffb1ae69..f3fa44c18 100644 --- a/nova/openstack/common/rpc/impl_zmq.py +++ b/nova/openstack/common/rpc/impl_zmq.py @@ -64,7 +64,7 @@ zmq_opts = [ cfg.StrOpt('rpc_zmq_ipc_dir', default='/var/run/openstack', help='Directory for holding IPC sockets'), - cfg.StrOpt('rpc_zmq_host', default=socket.gethostname(), + cfg.StrOpt('rpc_zmq_host', default=socket.getfqdn(), help='Name of this node. Must be a valid hostname, FQDN, or ' 'IP address. Must match "host" option, if running Nova.') ] diff --git a/nova/volume/solidfire.py b/nova/volume/solidfire.py index 14c9eea1c..8c4ca6684 100644 --- a/nova/volume/solidfire.py +++ b/nova/volume/solidfire.py @@ -167,7 +167,7 @@ class SolidFire(SanISCSIDriver): just return it. If not, then create it. """ - sf_account_name = socket.gethostname() + '-' + nova_project_id + sf_account_name = socket.getfqdn() + '-' + nova_project_id sfaccount = self._get_sfaccount_by_name(sf_account_name) if sfaccount is None: LOG.debug(_('solidfire account: %s does not exist, create it...'), @@ -194,7 +194,7 @@ class SolidFire(SanISCSIDriver): def _do_export(self, volume): """Gets the associated account, retrieves CHAP info and updates.""" - sfaccount_name = '%s-%s' % (socket.gethostname(), volume['project_id']) + sfaccount_name = '%s-%s' % (socket.getfqdn(), volume['project_id']) sfaccount = self._get_sfaccount_by_name(sfaccount_name) model_update = {} @@ -304,7 +304,7 @@ class SolidFire(SanISCSIDriver): """ LOG.debug(_("Enter SolidFire delete_volume...")) - sf_account_name = socket.gethostname() + '-' + volume['project_id'] + sf_account_name = socket.getfqdn() + '-' + volume['project_id'] sfaccount = self._get_sfaccount_by_name(sf_account_name) if sfaccount is None: raise exception.SfAccountNotFound(account_name=sf_account_name) @@ -352,7 +352,7 @@ class SolidFire(SanISCSIDriver): def _do_create_snapshot(self, snapshot, snapshot_name): """Creates a snapshot.""" LOG.debug(_("Enter SolidFire create_snapshot...")) - sf_account_name = socket.gethostname() + '-' + snapshot['project_id'] + sf_account_name = socket.getfqdn() + '-' + snapshot['project_id'] sfaccount = self._get_sfaccount_by_name(sf_account_name) if sfaccount is None: raise exception.SfAccountNotFound(account_name=sf_account_name) diff --git a/tools/conf/extract_opts.py b/tools/conf/extract_opts.py index e518a0009..836e48578 100644 --- a/tools/conf/extract_opts.py +++ b/tools/conf/extract_opts.py @@ -118,7 +118,7 @@ def _get_my_ip(): MY_IP = _get_my_ip() -HOST = socket.gethostname() +HOST = socket.getfqdn() def _sanitize_default(s): |
