[PATCH 12/12] qemu: command: Remove qemuBuildRBDSecinfoURI

Peter Krempa posted 12 patches 3 years, 1 month ago
[PATCH 12/12] qemu: command: Remove qemuBuildRBDSecinfoURI
Posted by Peter Krempa 3 years, 1 month ago
Merge the code into the only caller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_command.c | 32 +++++---------------------------
 1 file changed, 5 insertions(+), 27 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5b738b230e..a051e5a4e8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -748,31 +748,6 @@ qemuBuildObjectSecretCommandLine(virCommand *cmd,
 }


-/* qemuBuildRBDSecinfoURI:
- * @uri: Pointer to the URI structure to add to
- * @secinfo: Pointer to the secret info data (if present)
- *
- * If we have a secinfo, then build the command line options for
- * the secret info for the RBD network storage. Assumption for this
- * is both username and secret exist for plaintext
- *
- * Returns 0 on success or if no secinfo,
- * -1 and error message if fail to add secret information
- */
-static int
-qemuBuildRBDSecinfoURI(virBuffer *buf,
-                       qemuDomainSecretInfo *secinfo)
-{
-    if (!secinfo)
-        virBufferAddLit(buf, ":auth_supported=none");
-    else
-        virBufferEscape(buf, '\\', ":", ":id=%s:auth_supported=cephx\\;none",
-                        secinfo->username);
-
-    return 0;
-}
-
-
 /* qemuBuildTLSx509BackendProps:
  * @tlspath: path to the TLS credentials
  * @listen: boolean listen for client or server setting
@@ -970,8 +945,11 @@ qemuBuildNetworkDriveStr(virStorageSource *src,
             if (src->snapshot)
                 virBufferEscape(&buf, '\\', ":", "@%s", src->snapshot);

-            if (qemuBuildRBDSecinfoURI(&buf, secinfo) < 0)
-                return NULL;
+            if (!secinfo)
+                virBufferAddLit(&buf, ":auth_supported=none");
+            else
+                virBufferEscape(&buf, '\\', ":", ":id=%s:auth_supported=cephx\\;none",
+                                secinfo->username);

             if (src->nhosts > 0) {
                 virBufferAddLit(&buf, ":mon_host=");
-- 
2.31.1