提交 89f7475d 编写于 作者: F Fritz Elfert 提交者: Cole Robinson

util: Remove disabling of autologin for iscsi-targets

https://bugzilla.redhat.com/show_bug.cgi?id=1331552

Instead of disabling auto-login of all scsi targets (even those
that do not "belong" to libvirt), use iscsiadm's "--op nonpersistent"
during discovery of iSCSI targets (e.g. "iscsiadm --mode discovery
--type sendtargets") in order to avoid the node database being altered
which led to the need for the "large hammer" approach taken by
commit id '3c12b654'.

This commit removes the virISCSITargetAutologin adjustment (eg. the setting
of node.startup to "manual"). The iscsiadm command has supported this mode
of operation as of commit id 'ad873767' to open-iscsi.

(cherry picked from commit 56057900)
上级 da723464
...@@ -390,24 +390,9 @@ virISCSIGetTargets(char **const groups, ...@@ -390,24 +390,9 @@ virISCSIGetTargets(char **const groups,
} }
static int
virISCSITargetAutologin(const char *portal,
const char *initiatoriqn,
const char *target,
bool enable)
{
const char *extraargv[] = { "--op", "update",
"--name", "node.startup",
"--value", enable ? "automatic" : "manual",
NULL };
return virISCSIConnection(portal, initiatoriqn, target, extraargv);
}
int int
virISCSIScanTargets(const char *portal, virISCSIScanTargets(const char *portal,
const char *initiatoriqn, const char *initiatoriqn ATTRIBUTE_UNUSED,
size_t *ntargetsret, size_t *ntargetsret,
char ***targetsret) char ***targetsret)
{ {
...@@ -432,6 +417,7 @@ virISCSIScanTargets(const char *portal, ...@@ -432,6 +417,7 @@ virISCSIScanTargets(const char *portal,
"--mode", "discovery", "--mode", "discovery",
"--type", "sendtargets", "--type", "sendtargets",
"--portal", portal, "--portal", portal,
"--op", "nonpersistent",
NULL); NULL);
memset(&list, 0, sizeof(list)); memset(&list, 0, sizeof(list));
...@@ -444,18 +430,6 @@ virISCSIScanTargets(const char *portal, ...@@ -444,18 +430,6 @@ virISCSIScanTargets(const char *portal,
&list, NULL, NULL) < 0) &list, NULL, NULL) < 0)
goto cleanup; goto cleanup;
for (i = 0; i < list.ntargets; i++) {
/* We have to ignore failure, because we can't undo
* the results of 'sendtargets', unless we go scrubbing
* around in the dirt in /var/lib/iscsi.
*/
if (virISCSITargetAutologin(portal,
initiatoriqn,
list.targets[i], false) < 0)
VIR_WARN("Unable to disable auto-login on iSCSI target %s: %s",
portal, list.targets[i]);
}
if (ntargetsret && targetsret) { if (ntargetsret && targetsret) {
*ntargetsret = list.ntargets; *ntargetsret = list.ntargets;
*targetsret = list.targets; *targetsret = list.targets;
......
...@@ -90,7 +90,9 @@ static void testIscsiadmCb(const char *const*args, ...@@ -90,7 +90,9 @@ static void testIscsiadmCb(const char *const*args,
args[4] && STREQ(args[4], "sendtargets") && args[4] && STREQ(args[4], "sendtargets") &&
args[5] && STREQ(args[5], "--portal") && args[5] && STREQ(args[5], "--portal") &&
args[6] && STREQ(args[6], "10.20.30.40:3260,1") && args[6] && STREQ(args[6], "10.20.30.40:3260,1") &&
args[7] == NULL) { args[7] && STREQ(args[7], "--op") &&
args[8] && STREQ(args[8], "nonpersistent") &&
args[9] == NULL) {
ignore_value(VIR_STRDUP(*output, iscsiadmSendtargetsOutput)); ignore_value(VIR_STRDUP(*output, iscsiadmSendtargetsOutput));
} else { } else {
*status = -1; *status = -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册