summaryrefslogtreecommitdiff
path: root/usr/src/cmd/iscsi
diff options
context:
space:
mode:
authorhtk <none@none>2008-06-12 10:11:02 -0700
committerhtk <none@none>2008-06-12 10:11:02 -0700
commit61f4c4b9e52e632742f8e055d0cc272a48d8ec42 (patch)
tree78154a628a37cfa455e4c3ca38eb341980353c27 /usr/src/cmd/iscsi
parent39de7e401c4775b362a283e4714b49f6859eecab (diff)
downloadillumos-joyent-61f4c4b9e52e632742f8e055d0cc272a48d8ec42.tar.gz
6711498 iscsitgt should filter incore-only target information
Diffstat (limited to 'usr/src/cmd/iscsi')
-rw-r--r--usr/src/cmd/iscsi/iscsitgtd/mgmt_modify.c16
-rw-r--r--usr/src/cmd/iscsi/iscsitgtd/mgmt_remove.c15
-rw-r--r--usr/src/cmd/iscsi/iscsitgtd/mgmt_scf.c30
3 files changed, 55 insertions, 6 deletions
diff --git a/usr/src/cmd/iscsi/iscsitgtd/mgmt_modify.c b/usr/src/cmd/iscsi/iscsitgtd/mgmt_modify.c
index 99b802de71..c0d6058578 100644
--- a/usr/src/cmd/iscsi/iscsitgtd/mgmt_modify.c
+++ b/usr/src/cmd/iscsi/iscsitgtd/mgmt_modify.c
@@ -544,8 +544,11 @@ modify_initiator(tgt_node_t *x)
}
if (changes_made == True) {
- if (mgmt_config_save2scf() == True)
+ if (mgmt_config_save2scf() == True) {
xml_rtn_msg(&msg, ERR_SUCCESS);
+ } else {
+ xml_rtn_msg(&msg, ERR_INTERNAL_ERROR);
+ }
} else {
xml_rtn_msg(&msg, ERR_SYNTAX_MISSING_OPERAND);
}
@@ -615,8 +618,11 @@ modify_admin(tgt_node_t *x)
xml_rtn_msg(&msg, ERR_ISNS_ERROR);
return (msg);
}
- if (mgmt_config_save2scf() == True)
+ if (mgmt_config_save2scf() == True) {
xml_rtn_msg(&msg, ERR_SUCCESS);
+ } else {
+ xml_rtn_msg(&msg, ERR_INTERNAL_ERROR);
+ }
} else {
xml_rtn_msg(&msg, ERR_SYNTAX_MISSING_OPERAND);
}
@@ -665,8 +671,12 @@ modify_tpgt(tgt_node_t *x)
return (msg);
}
- if (mgmt_config_save2scf() == True)
+ if (mgmt_config_save2scf() == True) {
xml_rtn_msg(&msg, ERR_SUCCESS);
+ } else {
+ /* tpgt change should be updated to smf */
+ xml_rtn_msg(&msg, ERR_INTERNAL_ERROR);
+ }
/*
* Re-register all targets, currently there's no method to
diff --git a/usr/src/cmd/iscsi/iscsitgtd/mgmt_remove.c b/usr/src/cmd/iscsi/iscsitgtd/mgmt_remove.c
index a9758aec80..fea2db3def 100644
--- a/usr/src/cmd/iscsi/iscsitgtd/mgmt_remove.c
+++ b/usr/src/cmd/iscsi/iscsitgtd/mgmt_remove.c
@@ -377,8 +377,11 @@ remove_target(tgt_node_t *x, ucred_t *cred)
}
if (change_made == True) {
- if (mgmt_config_save2scf() == True)
+ if (mgmt_config_save2scf() == True) {
xml_rtn_msg(&msg, ERR_SUCCESS);
+ } else {
+ xml_rtn_msg(&msg, ERR_INTERNAL_ERROR);
+ }
} else {
xml_rtn_msg(&msg, ERR_SYNTAX_MISSING_OPERAND);
}
@@ -420,8 +423,11 @@ remove_initiator(tgt_node_t *x)
}
(void) tgt_node_remove(main_config, node, MatchBoth);
- if (mgmt_config_save2scf() == True)
+ if (mgmt_config_save2scf() == True) {
xml_rtn_msg(&msg, ERR_SUCCESS);
+ } else {
+ xml_rtn_msg(&msg, ERR_INTERNAL_ERROR);
+ }
return (msg);
}
@@ -490,8 +496,11 @@ remove_tpgt(tgt_node_t *x)
/* Isns re-register all target */
if (isns_enabled() == True)
(void) isns_reg_all();
- if (mgmt_config_save2scf() == True)
+ if (mgmt_config_save2scf() == True) {
xml_rtn_msg(&msg, ERR_SUCCESS);
+ } else {
+ xml_rtn_msg(&msg, ERR_INTERNAL_ERROR);
+ }
} else {
xml_rtn_msg(&msg, ERR_SYNTAX_MISSING_OPERAND);
}
diff --git a/usr/src/cmd/iscsi/iscsitgtd/mgmt_scf.c b/usr/src/cmd/iscsi/iscsitgtd/mgmt_scf.c
index 978761bc8a..32594b7ce8 100644
--- a/usr/src/cmd/iscsi/iscsitgtd/mgmt_scf.c
+++ b/usr/src/cmd/iscsi/iscsitgtd/mgmt_scf.c
@@ -573,6 +573,7 @@ mgmt_config_save2scf()
scf_iter_t *iter = NULL;
char pgname[PGNAME_SIZE];
char passcode[32];
+ char *incore = NULL;
unsigned int outlen;
tgt_node_t *n = NULL;
tgt_node_t *pn = NULL;
@@ -621,6 +622,20 @@ mgmt_config_save2scf()
if (mgmt_transaction_start(h, "iscsitgt", "basic") == True) {
for (n = main_config->x_child; n; n = n->x_sibling) {
+ if ((tgt_find_attr_str(n, XML_ELEMENT_INCORE, &incore))
+ == True) {
+ if (strcmp(incore, "true") == 0) {
+ /*
+ * Ignore in core only elements.
+ * zvol target is the only one with
+ * incore attr as of now.
+ */
+ free(incore);
+ continue;
+ }
+ /* if incore is false continue on */
+ free(incore);
+ }
if (strcmp(n->x_name,
XML_ELEMENT_CHAPSECRET) == 0) {
sl_tail->next = (secret_list_t *)
@@ -661,6 +676,21 @@ mgmt_config_save2scf()
if (n->x_child == NULL)
continue;
+ if ((tgt_find_attr_str(n, XML_ELEMENT_INCORE, &incore))
+ == True) {
+ if (strcmp(incore, "true") == 0) {
+ /*
+ * Ignore in core only elements.
+ * zvol target is the only one with
+ * incore attr as of now.
+ */
+ free(incore);
+ continue;
+ }
+ /* if incore is false continue on */
+ free(incore);
+ }
+
(void) snprintf(pgname, sizeof (pgname), "%s_%s", n->x_name,
n->x_value);