Skip to content

Commit

Permalink
Generate new initiatorname from scratch (Fixes: oVirt#14)
Browse files Browse the repository at this point in the history
Since the el9 packages don't build an initiatorname by default, we
should not depend/use the file in factory anymore, but just generate the
string ourselves.

Signed-off-by: Jean-Louis Dupond <jean-louis@dupond.be>
  • Loading branch information
dupondje authored and sandrobonazzola committed Nov 29, 2022
1 parent db2a669 commit b05cbe3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/imgbased/plugins/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import os.path
import re
import uuid
from glob import glob

from .. import command, constants
Expand Down Expand Up @@ -55,9 +54,8 @@ def _generate_iqn(self):
if os.path.exists(initiator):
return
log.debug("Description=Generate a random iSCSI initiator IQN name")
suuid = str(uuid.uuid4()).split("-")[-1]
factory_f = File("/usr/share/factory/etc/iscsi/initiatorname.iscsi")
iqn = factory_f.contents.split(":")[0] + ":" + suuid + "\n"
identifier = command.call("/usr/sbin/iscsi-iname")
iqn = "InitiatorName=" + identifier.decode("utf-8").strip() + "\n"
File(initiator).write(iqn)

def _copy_files_to_boot(self):
Expand Down

0 comments on commit b05cbe3

Please # to comment.