提交 84955c62 编写于 作者: P Peter Krempa

qemu: block: Add JSON props generator for NBD storage backing

上级 ea0cc4f4
......@@ -775,6 +775,34 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr src)
}
static virJSONValuePtr
qemuBlockStorageSourceGetNBDProps(virStorageSourcePtr src)
{
virJSONValuePtr serverprops;
virJSONValuePtr ret = NULL;
if (src->nhosts != 1) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("nbd protocol accepts only one host"));
return NULL;
}
serverprops = qemuBlockStorageSourceBuildJSONSocketAddress(&src->hosts[0],
false);
if (!serverprops)
return NULL;
ignore_value(virJSONValueObjectCreate(&ret,
"s:driver", "nbd",
"a:server", serverprops,
"S:export", src->path,
"S:tls-creds", src->tlsAlias,
NULL));
return ret;
}
/**
* qemuBlockStorageSourceGetBackendProps:
* @src: disk source
......@@ -830,6 +858,10 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src)
break;
case VIR_STORAGE_NET_PROTOCOL_NBD:
if (!(fileprops = qemuBlockStorageSourceGetNBDProps(src)))
return NULL;
break;
case VIR_STORAGE_NET_PROTOCOL_RBD:
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
case VIR_STORAGE_NET_PROTOCOL_SSH:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册