if (net->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) {
- /* vhostuser needs socket path in this location, and when
- * backend is passt, the path is derived from other info,
- * not taken from config.
- */
- g_free(net->data.vhostuser->data.nix.path);
- net->data.vhostuser->data.nix.path = qemuPasstCreateSocketPath(vm, net);
+ qemuPasstPrepareVhostUser(vm, net);
if (qemuPasstStart(vm, net) < 0)
goto cleanup;
}
+void
+qemuPasstPrepareVhostUser(virDomainObj *vm,
+ virDomainNetDef *net)
+{
+ /* There are some options on the QEMU commandline for a vhost-user
+ * chr device that are normally configurable, but when it is passt
+ * speaking to the vhost-user device those things are
+ * derived/fixed. This function, which is called prior to
+ * generating the QEMU commandline, sets thos derived/fixed things
+ * in the chr device object.
+ */
+
+ /* The socket path is not user-configurable for passt - it is
+ * derived from other info
+ */
+ g_free(net->data.vhostuser->data.nix.path);
+ net->data.vhostuser->data.nix.path = qemuPasstCreateSocketPath(vm, net);
+}
+
int
qemuPasstStart(virDomainObj *vm,
virDomainNetDef *net)
virDomainNetDef *net,
virCgroup *cgroup);
+void qemuPasstPrepareVhostUser(virDomainObj *vm,
+ virDomainNetDef *net);
+
char *qemuPasstCreateSocketPath(virDomainObj *vm,
virDomainNetDef *net);
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
if (net->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) {
- /* when using the passt backend, the path of the
- * unix socket is always derived from other info
- * *not* manually given in the config, but all the
- * vhostuser code looks for it there.
- */
- g_free(net->data.vhostuser->data.nix.path);
- net->data.vhostuser->data.nix.path = qemuPasstCreateSocketPath(vm, net);
+ /* some extra setup of internal data for passt vhostuser mode */
+ qemuPasstPrepareVhostUser(vm, net);
}
break;