From ae5d41b00527d289d68e73a82a2c70571f99e0f9 Mon Sep 17 00:00:00 2001 From: David Lehman Date: Thu, 8 Aug 2013 14:06:46 -0500 Subject: [PATCH 3/3] Use iscsi-iname instead of trying to reimplemnt it in python. Resolves: rhbz#966903 --- blivet/iscsi.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/blivet/iscsi.py b/blivet/iscsi.py index d35dbea..fceb881 100644 --- a/blivet/iscsi.py +++ b/blivet/iscsi.py @@ -25,8 +25,6 @@ import os import logging import shutil import time -import hashlib -import random import itertools log = logging.getLogger("blivet") @@ -60,20 +58,6 @@ def has_iscsi(): return True -def randomIname(): - """Generate a random initiator name the same way as iscsi-iname""" - - s = "iqn.1994-05.com.domain:01." - m = hashlib.md5() - u = os.uname() - for i in u: - m.update(i) - dig = m.hexdigest() - - for i in range(0, 6): - s += dig[random.randrange(0, 32)] - return s - class iscsi(object): """ iSCSI utility class. @@ -115,7 +99,7 @@ class iscsi(object): if self._initiator != "": return self._initiator - return randomIname() + return util.capture_output(["iscsi-iname"]).strip() def _setInitiator(self, val): if self.initiatorSet and val != self._initiator: -- 1.8.1.4