[libvirt PATCHv4 13/15] qemu: use the vhost-user schemas to find binary
Ján Tomko
jtomko at redhat.com
Wed Feb 26 10:12:57 UTC 2020
On Wed, Feb 26, 2020 at 09:53:46AM +0100, Peter Krempa wrote:
>On Thu, Feb 20, 2020 at 15:32:50 +0100, Ján Tomko wrote:
>> 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 at redhat.com>
>> Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>
>> ---
>> src/qemu/qemu_extdevice.c | 9 +++++++++
>> src/qemu/qemu_vhost_user.c | 40 ++++++++++++++++++++++++++++++++++++++
>> src/qemu/qemu_vhost_user.h | 4 ++++
>> src/qemu/qemu_virtiofs.c | 11 +++++++++++
>> src/qemu/qemu_virtiofs.h | 4 ++++
>> 5 files changed, 68 insertions(+)
>
>[...]
>
>> diff --git a/src/qemu/qemu_vhost_user.c b/src/qemu/qemu_vhost_user.c
>> index 4c25b30664..d437fd1bd5 100644
>> --- a/src/qemu/qemu_vhost_user.c
>> +++ b/src/qemu/qemu_vhost_user.c
>> @@ -416,3 +416,43 @@ 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;
>> +
>> + g_free(fs->binary);
>
>This feels weird. If the user specified a binary we shouldn't overwrite
>it. Also it's dead code as you check that it's NULL in [1].
>
Yes, artifact copied from vhost-user-gpu.
But it seems it's dead code there too - possibly a leftover from earlier
version that tried to find the best candidate.
Jano
>For now if we don't fill in anything else it doesn't matter, but it
>might later. In such case we should probably check that the binary is
>the same.
>
>Or use this just to fill the binary but in that case the feeing is not
>necessary.
>
>> + 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;
>> +}
>
>[...]
>
>> diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c
>> index 9e354a30c6..b53e5b0806 100644
>> --- a/src/qemu/qemu_virtiofs.c
>> +++ b/src/qemu/qemu_virtiofs.c
>
>[...]
>
>> @@ -326,3 +327,13 @@ qemuVirtioFSSetupCgroup(virQEMUDriverPtr driver,
>>
>> return 0;
>> }
>> +
>> +int
>> +qemuVirtioFSPrepareDomain(virQEMUDriverPtr driver,
>> + virDomainFSDefPtr fs)
>> +{
>> + if (fs->binary)
>
>[1]
>
>> + return 0;
>> +
>> + return qemuVhostUserFillDomainFS(driver, fs);
>> +}
>
>Reviewed-by: Peter Krempa <pkrempa at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200226/9ae8bbf8/attachment-0001.sig>
More information about the libvir-list
mailing list