Pradipta Banerjee has uploaded a new change for review.

Change subject: Remove explicit usage of x86_64 from bootstrap code
......................................................................

Remove explicit usage of x86_64 from bootstrap code

This patch removes the explicit usage of x86_64
and instead detect the host architecture at runtime and makes
use of the same when checking for requisite, conflicting or to_be_deleted
packages. This makes it possible to port vdsm on other architectures
(eg. ppc64).

Change-Id: I8fd5117af5328446e0e665511e0d10f4e37a0ade
Signed-off-by: Pradipta Kr. Banerjee <[email protected]>
---
M vds_bootstrap/vds_bootstrap.py
M vdsm_reg/deployUtil.py.in
2 files changed, 30 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/8011/1

diff --git a/vds_bootstrap/vds_bootstrap.py b/vds_bootstrap/vds_bootstrap.py
index 537953d..a91004a 100755
--- a/vds_bootstrap/vds_bootstrap.py
+++ b/vds_bootstrap/vds_bootstrap.py
@@ -84,8 +84,8 @@
     MINIMAL_SUPPORTED_PLATFORM = "5.5"
 
 # Required packages
-REQ_PACK = ('SDL.x86_64','bridge-utils.x86_64','mesa-libGLU.x86_64',
-            'openssl.x86_64', 'rsync.x86_64')
+REQ_PACK = ('SDL','bridge-utils','mesa-libGLU',
+            'openssl', 'rsync')
 
 if rhel6based:
     DEVEL_PACK = ()
@@ -111,13 +111,13 @@
 if rhel6based:
     CONFL_PACK = ( )
 else:
-    CONFL_PACK = ('cman.x86_64', )
+    CONFL_PACK = ('cman', )
 
 # Conflicting packages- delete if exist
 if rhel6based:
     DEL_PACK = ()
 else:
-    DEL_PACK = ('vdsm.x86_64', 'vdsm-cli.x86_64')
+    DEL_PACK = ('vdsm', 'vdsm-cli')
 
 # Services VDSM needs
 NEEDED_SERVICES = ['iscsid', 'multipathd', 'ntpd']
@@ -390,7 +390,9 @@
         self.rc = 0
 
     def _avoidPKGConflict(self):
-        for pack in CONFL_PACK:
+        arch = deployUtil.getPlatformArch()
+        for pack_prefix in CONFL_PACK:
+            pack = pack_prefix + "." + arch
             self.res, self.message = deployUtil.getPackageInfo("CONFL", pack, 
'status')
             res = self.res #Reverse display status
             if res == "WARN":
@@ -401,7 +403,9 @@
                 logging.debug('>>> Conflicting package %s installed', pack)
 
     def _delPKG(self):
-        for pack in DEL_PACK:
+        arch = deployUtil.getPlatformArch()
+        for pack_prefix in DEL_PACK:
+            pack = pack_prefix + "." + arch
             self.res, self.message = deployUtil.getPackageInfo("DEL", pack, 
'status')
             res = self.res   #Reverse display status
             if res == "WARN":
@@ -414,7 +418,9 @@
 
     def _getAllPackages(self):
         logging.debug('Check required packages ...')
-        for pack in REQ_PACK:
+        arch = deployUtil.getPlatformArch()
+        for pack_prefix in REQ_PACK:
+            pack = pack_prefix + "." + arch
             self.res, self.message = deployUtil.getPackageInfo("REQ", pack, 
'status')
             self._xmlOutput('REQ PACKAGES', self.res, "result", pack, 
self.message)
             if self.res == "WARN":
diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in
index bbda70e..3ce26bf 100644
--- a/vdsm_reg/deployUtil.py.in
+++ b/vdsm_reg/deployUtil.py.in
@@ -451,6 +451,23 @@
     logging.debug("OS Release Ver = %s", osVer[1])
     return osVer[1]
 
+
+def getPlatformArch():
+    """
+    Return the running platform arch - x86_64, ppc64 etc
+
+    Return x86_64 as default on any failure.
+    """
+
+    platformArch = platform.machine()
+    if platformArch:
+        logging.debug("Platform Arch = %s", platformArch)
+        return platformArch
+    else:
+        logging.debug("Unable to get platform arch. Using default - x86_64")
+        return 'x86_64'
+
+
 def getKernelVR():
     """Return current kernel version and release."""
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8fd5117af5328446e0e665511e0d10f4e37a0ade
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Pradipta Banerjee <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to