summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ctld/ctld.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2014-07-05 18:15:00 +0000
committermav <mav@FreeBSD.org>2014-07-05 18:15:00 +0000
commit4e932574fbef709769d2454c9f2aa543e4371d1b (patch)
tree401e0f3e01f44222a7f03b4f1a9591d889e2b81d /usr.sbin/ctld/ctld.c
parente78d2f6e6917c32f52879f5fc4b0159d9e4c416b (diff)
downloadFreeBSD-src-4e932574fbef709769d2454c9f2aa543e4371d1b.zip
FreeBSD-src-4e932574fbef709769d2454c9f2aa543e4371d1b.tar.gz
Create separate CTL port for every iSCSI target (and maybe portal group).
Having single port for all iSCSI connections makes problematic implementing some more advanced SCSI functionality in CTL, that require proper ports enumeration and identification. This change extends CTL iSCSI API, making ctld daemon to control list of iSCSI ports in CTL. When new target is defined in config fine, ctld will create respective port in CTL. When target is removed -- port will be also removed after all active commands through that port properly aborted. This change require ctld to be rebuilt to match the kernel. As a minor side effect, this allows to have iSCSI targets without LUNs. While that may look odd and not very useful, that is not incorrect.
Diffstat (limited to 'usr.sbin/ctld/ctld.c')
-rw-r--r--usr.sbin/ctld/ctld.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c
index 2cda316..e2b9ebe 100644
--- a/usr.sbin/ctld/ctld.c
+++ b/usr.sbin/ctld/ctld.c
@@ -1120,7 +1120,6 @@ conf_verify(struct conf *conf)
if (!found_lun) {
log_warnx("no LUNs defined for target \"%s\"",
targ->t_name);
- return (1);
}
}
TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) {
@@ -1209,19 +1208,6 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
}
}
- if (oldconf->conf_kernel_port_on != newconf->conf_kernel_port_on) {
- if (newconf->conf_kernel_port_on == true) {
- log_debugx("enabling CTL iSCSI port");
- error = kernel_port_on();
- if (error != 0)
- log_errx(1, "failed to enable CTL iSCSI port; exiting");
- } else {
- error = kernel_port_off();
- if (error != 0)
- log_warnx("failed to disable CTL iSCSI port");
- }
- }
-
/*
* XXX: If target or lun removal fails, we should somehow "move"
* the old lun or target into newconf, so that subsequent
@@ -1253,6 +1239,7 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
}
lun_delete(oldlun);
}
+ kernel_port_remove(oldtarg);
target_delete(oldtarg);
continue;
}
@@ -1387,6 +1374,8 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
cumulated_error++;
}
}
+ if (oldtarg == NULL)
+ kernel_port_add(newtarg);
}
/*
OpenPOWER on IntegriCloud