public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Mira Limbeck <m.limbeck@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
	Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [PATCH v2 storage 09/15] iscsi: remove stale sessions in non-mapping case
Date: Tue, 26 May 2026 10:48:58 +0200	[thread overview]
Message-ID: <df8775d6-d655-43fa-82a1-68b388509c1f@proxmox.com> (raw)
In-Reply-To: <20260523212856.2822353-7-t.lamprecht@proxmox.com>

On 5/23/26 11:28 PM, Thomas Lamprecht wrote:
> On Thu, 30 Apr 2026 19:27:07 +0200, Mira Limbeck wrote:
>> diff --git a/src/PVE/Storage/ISCSIPlugin.pm b/src/PVE/Storage/ISCSIPlugin.pm
>> @@ -736,6 +736,41 @@ sub activate_storage {
>> +    # log out of stale sessions
>> +    # should only be needed for the non-mapping case
>> +    if (!$local_cfg->{is_mapping}) {
>> +        for my $target (keys $targets->%*) {
>> +            for my $session ($targets->{$target}->{sessions}->@*) {
>> +                my $portals = $targets->{$target}->{portals};
>> +                if (!grep(/^\Q$session->{portal}\E$/, $portals->@*)) {
>> +                    my $sid = $session->{session_id};
>> +                    my $portal = $session->{portal};
>> +                    print "logging out of stale iscsi session: $sid for $target via $portal\n";
>> +                    my $cmd = [
>> +                        $ISCSIADM, '--mode', 'session', '--sid', $sid, '--logout',
>> +                    ];
>> +                    eval { run_command($cmd); };
>> +                    warn "failed to log out of stale session: $@\n" if $@;
> 
> In the non-mapping case $portals is whatever discovery returned this cycle
> (see 07/15) - driven by the SAN's sendtargets output, or kept as-is if
> discovery failed. So if the SAN momentarily stops announcing a portal (or
> discovery partially fails), its live session here gets logged out and the
> node entry deleted. Under shared LVM-on-iSCSI that can pull a PV out from an
> active VG; under multipath it can remove the last surviving path. It also
> runs counter to the "keep configured entries, clean up manually" caution
> added in 07/15.
> 
> I'd suggest dropping this for now, or reworking it to be opt-in, to act only
> after a successful full discovery against all portals, to never remove the
> last path, and to never remove a session that is a member of an active
> multipath map.

It shouldn't be able to ever remove the last one, since in
get_local_config() it should fall back to all node entries when none can
be discovered. So at least one session should always remain until the
next reboot.

This is actually the only patch I'm not so sure about, since it changes
the behavior we had so far, and we usually don't clean up connections
for storages (see NFS) when it could lead to issues.
That's why I mentioned it is optional (no patch after it depends on it),
and controversial.
So I'm fine with just dropping it entirely and keeping cleaning up the
responsibility of the admin.




  reply	other threads:[~2026-05-26  8:49 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30 17:26 [PATCH v2 cluster/storage/manager 00/15] storage mapping Mira Limbeck
2026-04-30 17:26 ` [PATCH v2 cluster 01/15] mapping: add storage.cfg Mira Limbeck
2026-04-30 17:27 ` [PATCH v2 storage 02/15] mapping: add base plugin Mira Limbeck
2026-04-30 17:35   ` Mira Limbeck
2026-05-23 21:26   ` Thomas Lamprecht
2026-04-30 17:27 ` [PATCH v2 storage 03/15] mapping: add iSCSI plugin Mira Limbeck
2026-04-30 17:27 ` [PATCH v2 storage 04/15] iscsi: introduce mapping support Mira Limbeck
2026-04-30 17:27 ` [PATCH v2 storage 05/15] iscsi: add helper to get local config Mira Limbeck
2026-05-23 21:26   ` Thomas Lamprecht
2026-04-30 17:27 ` [PATCH v2 storage 06/15] iscsi: change functions to handle mappings Mira Limbeck
2026-05-23 21:26   ` Thomas Lamprecht
2026-04-30 17:27 ` [PATCH v2 storage 07/15] iscsi: introduce helper to update discovery db Mira Limbeck
2026-05-11 16:46   ` Samuel Rufinatscha
2026-05-23 21:26   ` Thomas Lamprecht
2026-04-30 17:27 ` [PATCH v2 storage 08/15] iscsi: rework to update discovery db and simplify login Mira Limbeck
2026-05-23 21:26   ` Thomas Lamprecht
2026-05-26  8:42     ` Mira Limbeck
2026-04-30 17:27 ` [PATCH v2 storage 09/15] iscsi: remove stale sessions in non-mapping case Mira Limbeck
2026-05-23 21:26   ` Thomas Lamprecht
2026-05-26  8:48     ` Mira Limbeck [this message]
2026-04-30 17:27 ` [PATCH v2 storage 10/15] api: add mapping support Mira Limbeck
2026-05-23 21:26   ` Thomas Lamprecht
2026-04-30 17:27 ` [PATCH v2 storage 11/15] mapping: iscsi: add discovery-portal config option Mira Limbeck
2026-04-30 17:27 ` [PATCH v2 storage 12/15] iscsi: add support for non-persistent discovery Mira Limbeck
2026-04-30 17:38   ` Mira Limbeck
2026-05-23 21:26   ` Thomas Lamprecht
2026-05-26  8:36     ` Mira Limbeck
2026-04-30 17:27 ` [PATCH v2 storage 13/15] api: add non-persistent iscsi discovery option Mira Limbeck
2026-05-23 21:26   ` Thomas Lamprecht
2026-04-30 17:27 ` [POC v2 storage 14/15] mapping: add zfspool plugin Mira Limbeck
2026-05-23 21:26   ` Thomas Lamprecht
2026-04-30 17:27 ` [PATCH v2 manager 15/15] api: mapping: add storage mapping path Mira Limbeck
2026-05-11 17:05 ` [PATCH v2 cluster/storage/manager 00/15] storage mapping Samuel Rufinatscha
2026-05-23 21:26 ` Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df8775d6-d655-43fa-82a1-68b388509c1f@proxmox.com \
    --to=m.limbeck@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal