From 5dd1553cca7f7e62eebce75e1d936fc211b239ec Mon Sep 17 00:00:00 2001 From: Luis Fernandez Alvarez Date: Tue, 25 Sep 2012 17:33:59 +0200 Subject: 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 --- nova/volume/solidfire.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'nova/volume') 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) -- cgit