const char *transport = virJSONValueObjectGetString(json, "transport");
const char *portal = virJSONValueObjectGetString(json, "portal");
const char *target = virJSONValueObjectGetString(json, "target");
+ const char *lun = virJSONValueObjectGetStringOrNumber(json, "lun");
const char *uri;
char *port;
- unsigned int lun = 0;
- char *fulltarget = NULL;
int ret = -1;
/* legacy URI based syntax passed via 'filename' option */
src->type = VIR_STORAGE_TYPE_NETWORK;
src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
+ if (!lun)
+ lun = "0";
+
if (VIR_ALLOC(src->hosts) < 0)
goto cleanup;
*port = '\0';
}
- ignore_value(virJSONValueObjectGetNumberUint(json, "lun", &lun));
-
- if (virAsprintf(&fulltarget, "%s/%u", target, lun) < 0)
+ if (virAsprintf(&src->path, "%s/%s", target, lun) < 0)
goto cleanup;
- VIR_STEAL_PTR(src->path, fulltarget);
-
ret = 0;
cleanup:
- VIR_FREE(fulltarget);
return ret;
}
"\"transport\":\"tcp\","
"\"portal\":\"test.org:1234\","
"\"target\":\"iqn.2016-12.com.virttest:emulated-iscsi-noauth.target\","
- "\"lun\":6"
+ "\"lun\":\"6\""
"}"
"}",
"<source protocol='iscsi' name='iqn.2016-12.com.virttest:emulated-iscsi-noauth.target/6'>\n"