+<?xml version="1.0"?>
<!-- A Relax NG schema for the libvirt storage pool XML format -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<attribute name='name'>
<text/>
</attribute>
+ <optional>
+ <attribute name='port'>
+ <ref name="PortNumber"/>
+ </attribute>
+ </optional>
<empty/>
</element>
</define>
</data>
</define>
+ <define name="PortNumber">
+ <data type="short">
+ <param name="minInclusive">-1</param>
+ </data>
+ </define>
</grammar>
char *authType = NULL;
int nsource, i;
virStoragePoolOptionsPtr options;
+ char *port;
relnode = ctxt->node;
ctxt->node = node;
}
source->host.name = virXPathString("string(./host/@name)", ctxt);
+ port = virXPathString("string(./host/@port)", ctxt);
+ if (port) {
+ if (virStrToLong_i(port, NULL, 10, &source->host.port) < 0) {
+ virStorageReportError(VIR_ERR_XML_ERROR,
+ _("Invalid port number: %s"),
+ port);
+ goto cleanup;
+ }
+ }
+
+
source->initiator.iqn = virXPathString("string(./initiator/iqn/@name)", ctxt);
nsource = virXPathNodeSet("./device", ctxt, &nodeset);
cleanup:
ctxt->node = relnode;
+ VIR_FREE(port);
VIR_FREE(authType);
VIR_FREE(nodeset);
return ret;
virBufferAddLit(buf," <source>\n");
if ((options->flags & VIR_STORAGE_POOL_SOURCE_HOST) &&
- src->host.name)
- virBufferVSprintf(buf," <host name='%s'/>\n", src->host.name);
+ src->host.name) {
+ virBufferVSprintf(buf, " <host name='%s'", src->host.name);
+ if (src->host.port)
+ virBufferVSprintf(buf, " port='%d'", src->host.port);
+ virBufferAddLit(buf, "/>\n");
+ }
if ((options->flags & VIR_STORAGE_POOL_SOURCE_DEVICE) &&
src->ndevice) {