Blob Blame History Raw
From 653a3df662d10d0c8cc7f34138efd89a61f531a3 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 9 Jan 2019 13:03:49 +0100
Subject: [PATCH] Copy the iSCSI initiator name file to the installed system

The initiatorname.iscsi file is used (sometimes) during boot so
we need to write the configuration to the installed system.

Resolves: rhbz#1664587
---
 blivet/iscsi.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/blivet/iscsi.py b/blivet/iscsi.py
index 3e44e6ed..f053577d 100644
--- a/blivet/iscsi.py
+++ b/blivet/iscsi.py
@@ -563,6 +563,11 @@ def write(self, root, storage):  # pylint: disable=unused-argument
             shutil.copytree("/var/lib/iscsi", root + "/var/lib/iscsi",
                             symlinks=True)
 
+        # copy the initiator file too
+        if not os.path.isdir(root + "/etc/iscsi"):
+            os.makedirs(root + "/etc/iscsi", 0o755)
+        shutil.copyfile(INITIATOR_FILE, root + INITIATOR_FILE)
+
     def get_node(self, name, address, port, iface):
         for node in self.active_nodes():
             if node.name == name and node.address == address and \