FranGarcia.me (Posts about lab)https://www.frangarcia.me/categories/lab.atom2023-07-01T22:22:35ZFran GarciaNikolaConfiguring an iscsi volume for RHV usagehttps://www.frangarcia.me/posts/configuring-an-iscsi-volume-for-rhv-usage/2017-08-29T08:23:07+02:002017-08-29T08:23:07+02:00Fran Garcia<p>This is a cheatsheet to quickly configure storage and export it as an iSCSI
volume using RHEL7 targetcli and have it configured under RHV. This is by no means
a production configuration as your RHEL7 system might become a single point of
failure, but it convers nicely building a home lab or test environment.</p>
<p>Just for clarity, a quick reminder of iSCSI concepts:</p>
<ul>
<li>An <strong>iSCSI target</strong> provides some storage (here called server),</li>
<li>An <strong>iSCSI initiator</strong> uses this available storage (here called client).</li>
</ul>
<h2>Prerequisites</h2>
<h3>Configure server's storage</h3>
<p>You can configure several types of backends, and for me the most versatile is
using LVM's Logical Volumes. You'll need to create your volumes in advance, for
example:</p>
<div class="code"><pre class="code literal-block">lvcreate yourVG -n yourLV1 -L 50G
</pre></div>
<h3>Install software</h3>
<p>Install the targetcli RPM:</p>
<div class="code"><pre class="code literal-block">yum install -y targetcli
</pre></div>
<p>Enable the <code>target</code> daemon (NOT <code>targetd</code>)</p>
<div class="code"><pre class="code literal-block">systemctl enable --now target.service
</pre></div>
<h3>Gather RHV configuration</h3>
<p>You'll need to gather the following information from RHV:</p>
<ul>
<li>IQN (iSCSI identifier) </li>
</ul>
<h2>Configure and enable iSCSI</h2>
<p><code>targetcli</code> provides a very simple way to create iscsi targets once you understand
how it works. Namely what needs to be done is:</p>
<ul>
<li><strong>Add your backend devices</strong>. This is where you add into targetcli's control the
LVM devices created in previous steps</li>
<li><strong>Create an IQN target</strong>. This is a collection of luns shared to the same system(s)
under the same group. It is used later to apply ACLs so only certain hosts can use
certain LUNs.</li>
<li><strong>Add LUNs into your IQN target</strong>. After creating your IQN target, you need to
add the backstore devices so they're shared via iSCSI.</li>
<li><strong>Add ACLs into your IQN target</strong>. Unless configured otherwise, LUNs are not
visible to systems unless they're added into the right ACL. </li>
</ul>
<p>Here is a dump on how all this can be accomplished with targetcli:</p>
<h2>Add storage into RHV</h2>
<p>foo</p>