return -1;
}
- /* XXX We currently don't support auth, so don't bother parsing it */
-
/* uri->path is NULL if the URI does not contain slash after host:
* transport://host:port */
if (uri->path)
if (VIR_STRDUP(src->hosts->name, uri->server) < 0)
return -1;
+ /* Libvirt doesn't handle inline authentication. Make the caller aware. */
+ if (uri->user)
+ return 1;
+
return 0;
}
if (virAsprintf(&src->path, "%s/%s", target, lun) < 0)
return -1;
+ /* Libvirt doesn't handle inline authentication. Make the caller aware. */
+ if (virJSONValueObjectGetString(json, "user") ||
+ virJSONValueObjectGetString(json, "password"))
+ return 1;
+
return 0;
}
"<source protocol='http' name='file'>\n"
" <host name='example.com' port='80'/>\n"
"</source>\n");
+ TEST_BACKING_PARSE_FULL("http://user:pass@example.com/file",
+ "<source protocol='http' name='file'>\n"
+ " <host name='example.com' port='80'/>\n"
+ "</source>\n", 1);
TEST_BACKING_PARSE("rbd:testshare:id=asdf:mon_host=example.com",
"<source protocol='rbd' name='testshare'>\n"
" <host name='example.com'/>\n"
"<source protocol='nbd' name='exportname'>\n"
" <host name='example.org' port='1234'/>\n"
"</source>\n");
+ TEST_BACKING_PARSE_FULL("iscsi://testuser:testpass@example.org:1234/exportname",
+ "<source protocol='iscsi' name='exportname'>\n"
+ " <host name='example.org' port='1234'/>\n"
+ "</source>\n", 1);
#ifdef WITH_YAJL
TEST_BACKING_PARSE("json:", NULL);
"<source protocol='iscsi' name='iqn.2016-12.com.virttest:emulated-iscsi-noauth.target/0'>\n"
" <host name='test.org' port='3260'/>\n"
"</source>\n");
+ TEST_BACKING_PARSE_FULL("json:{\"file\":{\"driver\":\"iscsi\","
+ "\"transport\":\"tcp\","
+ "\"portal\":\"test.org\","
+ "\"user\":\"testuser\","
+ "\"target\":\"iqn.2016-12.com.virttest:emulated-iscsi-auth.target\""
+ "}"
+ "}",
+ "<source protocol='iscsi' name='iqn.2016-12.com.virttest:emulated-iscsi-auth.target/0'>\n"
+ " <host name='test.org' port='3260'/>\n"
+ "</source>\n", 1);
+ TEST_BACKING_PARSE_FULL("json:{\"file\":{\"driver\":\"iscsi\","
+ "\"transport\":\"tcp\","
+ "\"portal\":\"test.org\","
+ "\"password\":\"testpass\","
+ "\"target\":\"iqn.2016-12.com.virttest:emulated-iscsi-auth.target\""
+ "}"
+ "}",
+ "<source protocol='iscsi' name='iqn.2016-12.com.virttest:emulated-iscsi-auth.target/0'>\n"
+ " <host name='test.org' port='3260'/>\n"
+ "</source>\n", 1);
TEST_BACKING_PARSE("json:{\"file\":{\"driver\":\"iscsi\","
"\"transport\":\"tcp\","
"\"portal\":\"test.org:1234\","