mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: use the vhost-user schemas to find binary
Look into /usr/share/qemu/vhost-user to see whether we can find a suitable virtiofsd binary, in case the user did not provide one in the domain XML. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com> Tested-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
9de5d69c21
commit
071a1ab92f
@ -105,6 +105,15 @@ qemuExtDevicesPrepareDomain(virQEMUDriverPtr driver,
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < vm->def->nfss; i++) {
|
||||
virDomainFSDefPtr fs = vm->def->fss[i];
|
||||
|
||||
if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) {
|
||||
if (qemuVirtioFSPrepareDomain(driver, fs) < 0)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -417,3 +417,42 @@ qemuVhostUserFillDomainGPU(virQEMUDriverPtr driver,
|
||||
VIR_FREE(vus);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuVhostUserFillDomainFS(virQEMUDriverPtr driver,
|
||||
virDomainFSDefPtr fs)
|
||||
{
|
||||
qemuVhostUserPtr *vus = NULL;
|
||||
ssize_t nvus = 0;
|
||||
ssize_t i;
|
||||
int ret = -1;
|
||||
|
||||
if ((nvus = qemuVhostUserFetchParsedConfigs(driver->privileged,
|
||||
&vus, NULL)) < 0)
|
||||
goto end;
|
||||
|
||||
for (i = 0; i < nvus; i++) {
|
||||
qemuVhostUserPtr vu = vus[i];
|
||||
|
||||
if (vu->type != QEMU_VHOST_USER_TYPE_FS)
|
||||
continue;
|
||||
|
||||
fs->binary = g_strdup(vu->binary);
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == nvus) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
_("Unable to find a satisfying virtiofsd"));
|
||||
goto end;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
end:
|
||||
for (i = 0; i < nvus; i++)
|
||||
qemuVhostUserFree(vus[i]);
|
||||
g_free(vus);
|
||||
return ret;
|
||||
}
|
||||
|
@ -45,3 +45,7 @@ qemuVhostUserFetchConfigs(char ***configs,
|
||||
int
|
||||
qemuVhostUserFillDomainGPU(virQEMUDriverPtr driver,
|
||||
virDomainVideoDefPtr video);
|
||||
|
||||
int
|
||||
qemuVhostUserFillDomainFS(virQEMUDriverPtr driver,
|
||||
virDomainFSDefPtr fs);
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "qemu_conf.h"
|
||||
#include "qemu_extdevice.h"
|
||||
#include "qemu_security.h"
|
||||
#include "qemu_vhost_user.h"
|
||||
#include "qemu_virtiofs.h"
|
||||
#include "virpidfile.h"
|
||||
#include "virqemu.h"
|
||||
@ -325,3 +326,13 @@ qemuVirtioFSSetupCgroup(virDomainObjPtr vm,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
qemuVirtioFSPrepareDomain(virQEMUDriverPtr driver,
|
||||
virDomainFSDefPtr fs)
|
||||
{
|
||||
if (fs->binary)
|
||||
return 0;
|
||||
|
||||
return qemuVhostUserFillDomainFS(driver, fs);
|
||||
}
|
||||
|
@ -40,3 +40,7 @@ int
|
||||
qemuVirtioFSSetupCgroup(virDomainObjPtr vm,
|
||||
virDomainFSDefPtr fs,
|
||||
virCgroupPtr cgroup);
|
||||
|
||||
int
|
||||
qemuVirtioFSPrepareDomain(virQEMUDriverPtr driver,
|
||||
virDomainFSDefPtr fs);
|
||||
|
Loading…
Reference in New Issue
Block a user