support passing authz devices to qemu cmd, the cmd is like: qemu-kvm ... -object authz-simple,id=authz1,identity=test Signed-off-by: Zihao Chang <changzihao1@xxxxxxxxxx> --- src/qemu/qemu_command.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d5f0bcb81877..8679c62d550f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3960,6 +3960,33 @@ qemuBuildInputCommandLine(virCommandPtr cmd, } +static int +qemuBuildAuthzCommandLine(virCommandPtr cmd, + const virDomainDef *def) +{ + g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; + size_t i; + + for (i = 0; i < def->nauthzs; i++) { + virDomainAuthzDefPtr authzs = def->authzs[i]; + + virBufferFreeAndReset(&buf); + + virCommandAddArg(cmd, "-object"); + + virBufferAsprintf(&buf, "authz-%s,id=authz%lu,identity=", + virDomainAuthzModeTypeToString(authzs->mode), + authzs->index); + virQEMUBuildBufferEscapeComma(&buf, authzs->identity); + + virCommandAddArgBuffer(cmd, &buf); + + } + + return 0; +} + + static char * qemuBuildSoundDevStr(const virDomainDef *def, virDomainSoundDefPtr sound, @@ -9965,6 +9992,9 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, if (qemuBuildInputCommandLine(cmd, def, qemuCaps) < 0) return NULL; + if (qemuBuildAuthzCommandLine(cmd, def) < 0) + return NULL; + if (qemuBuildGraphicsCommandLine(cfg, cmd, def, qemuCaps) < 0) return NULL; -- 2.28.0