[PATCH 2/6] authz: support passing authz device to qemu cmd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux