The test disks are not attached to any virtual machine. nothing done on the hosts.
 I just saw that the all test LUNs are still logged into target side so I went to the host(it was in the maintenance ) all disks are still there.

I just managing everything over the web gui:
Select host as SPM, then disks->new->directLUN->discovertargets->login->ok
on the host the disks are visible.
iscsiadm -m session -o show
tcp: [6] 10.10.10.35:3260,1 iqn.2003-01.org.linux-iscsi.c1701.x8664:sn.5b791971cd78 (non-flash)

Putting host to maintenance:
the disks are still there:
lsscsi
[0:0:0:0]    disk    ATA      ST3500630NS      K     /dev/sda
[11:0:0:0]   disk    LIO-ORG  c1701iser        4.0   /dev/sdb
[11:0:0:1]   disk    LIO-ORG  c1701iser32k     4.0   /dev/sdc

activating deactivating the host does not change situation.
I dont see any attempt of vdsm to logout the disks. I can see in the vdsmd.logs that "[storage.Mount] unmounting /rhev/data-center/mnt/......" unmounting the nfs part but nothing from [storage.ISCSI]



On Thu, Feb 16, 2017 at 4:25 PM, Nir Soffer <nsoffer@redhat.com> wrote:
On Thu, Feb 16, 2017 at 5:13 PM, Arman Khalatyan <arm2arm@gmail.com> wrote:
> Hi,
> In ovirt 4.1 when I put the host into maintenance mode then the nfs mounts
> are unmounted as expected.
> but the hosts are still logged into the targets.
>
> Is it expected behavior?? If yes what is  the use of it?

No, if ovirt connected to the target, it should disconnect from the target.

Maybe you connected manually to the target before that?

A good test to verify this would be to do this in maintenance mode:

    iscsiadm -m node -o delete

Then activate and deactivate the host several times, and check that
no iscsi session are active when host enter maintenance.

> Another thing concerning to the permanently removed direct LUNs.
> They are still in the /var/lib/iscsi/nodes and /var/lib/iscsi/send_targets/*
> Would be good to cleanup the folders if users are removing permanently the
> LUNs.

We don't manage the LUNs - if you are removing the LUNs manually, and
the target providing this LUNs is not needed any more, you are responsible
for removing the nodes from iscsi database.

I don't think we are removing nodes and targets from a host, only updating
them when you connect to a server. We also don't have a way to remove
a target from engine database, so engine cannot ask vdsm to remove targets.

Nir