Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: setup: Use hostname for host address
......................................................................

packaging: setup: Use hostname for host address

And not IP address.

Remove _getIPAddress which isn't used anymore.

Change-Id: I6a2fc79fe6e57892f0cb9327da1ab8d44b15f29f
Bug-Url: https://bugzilla.redhat.com/1178535
Signed-off-by: Yedidyah Bar David <[email protected]>
(cherry picked from commit dc8d1a67aec35914a4a16b74ef1a60ddd111a857)
---
M src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
M src/plugins/ovirt-hosted-engine-setup/engine/fqdn.py
2 files changed, 11 insertions(+), 40 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/42/36642/1

diff --git a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py 
b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
index 9730ca0..dab5105 100644
--- a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
+++ b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
@@ -29,9 +29,7 @@
 import tempfile
 import time
 import urllib2
-
-
-import ethtool
+import socket
 
 
 import ovirtsdk.api
@@ -165,42 +163,6 @@
                         path=path
                     )
                 )
-
-    def _getIPAddress(self):
-        address = None
-        stdout = ''
-        if (
-            self.environment[ohostedcons.NetworkEnv.BRIDGE_NAME] in
-            ethtool.get_devices()
-        ):
-            self.logger.debug('Acquiring bridge address')
-            rc, stdout, stderr = self.execute(
-                args=(
-                    self.command.get('ip'),
-                    'addr',
-                    'show',
-                    self.environment[ohostedcons.NetworkEnv.BRIDGE_NAME],
-                ),
-            )
-        else:
-            self.logger.debug('Acquiring nic address')
-            rc, stdout, stderr = self.execute(
-                args=(
-                    self.command.get('ip'),
-                    'addr',
-                    'show',
-                    self.environment[ohostedcons.NetworkEnv.BRIDGE_IF],
-                ),
-            )
-        for line in stdout:
-            addressmatch = self._ADDRESS_RE.match(line)
-            if addressmatch is not None:
-                address = addressmatch.group('address')
-                break
-        if address is None:
-            raise RuntimeError(_('Cannot acquire bridge address'))
-        self.logger.debug(address)
-        return address
 
     def _wait_host_ready(self, engine_api, host):
         self.logger.info(_(
@@ -570,7 +532,10 @@
                     name=self.environment[
                         ohostedcons.EngineEnv.APP_HOST_NAME
                     ],
-                    address=self._getIPAddress(),
+                    # Note that the below is required for compatibility
+                    # with vdsm-generated pki. See bz 1178535.
+                    # TODO: Make it configurable like engine fqdn.
+                    address=socket.gethostname(),
                     reboot_after_installation=False,
                     cluster=engine_api.clusters.get(cluster_name),
                     ssh=self._ovirtsdk_xml.params.SSH(
diff --git a/src/plugins/ovirt-hosted-engine-setup/engine/fqdn.py 
b/src/plugins/ovirt-hosted-engine-setup/engine/fqdn.py
index 63670c0..33de6ce 100644
--- a/src/plugins/ovirt-hosted-engine-setup/engine/fqdn.py
+++ b/src/plugins/ovirt-hosted-engine-setup/engine/fqdn.py
@@ -293,5 +293,11 @@
                         ),
                     )
 
+    @plugin.event(
+        stage=plugin.Stages.STAGE_VALIDATION,
+    )
+    def _validation(self):
+        self._validateFQDN(socket.gethostname())
+        self._validateFQDNresolvability(socket.gethostname())
 
 # vim: expandtab tabstop=4 shiftwidth=4


-- 
To view, visit http://gerrit.ovirt.org/36642
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a2fc79fe6e57892f0cb9327da1ab8d44b15f29f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: ovirt-hosted-engine-setup-1.2
Gerrit-Owner: Yedidyah Bar David <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to