On 24.04.23 21:32, Juan Quintela wrote:
Signed-off-by: Juan Quintela <quint...@redhat.com>

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsement...@yandex-team.ru>


---
  migration/options.c | 7 +++++++
  migration/options.h | 1 +
  migration/tls.c     | 9 ++++-----
  3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/migration/options.c b/migration/options.c
index f65b7babef..9eabb4c25d 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -579,6 +579,13 @@ uint8_t migrate_throttle_trigger_threshold(void)
      return s->parameters.throttle_trigger_threshold;
  }
+char *migrate_tls_creds(void)

could be stricter "const char *"

+{
+    MigrationState *s = migrate_get_current();
+
+    return s->parameters.tls_creds;
+}
+
  uint64_t migrate_xbzrle_cache_size(void)
  {
      MigrationState *s = migrate_get_current();
diff --git a/migration/options.h b/migration/options.h
index 3948218dbe..47cc24585b 100644
--- a/migration/options.h
+++ b/migration/options.h
@@ -80,6 +80,7 @@ MultiFDCompression migrate_multifd_compression(void);
  int migrate_multifd_zlib_level(void);
  int migrate_multifd_zstd_level(void);
  uint8_t migrate_throttle_trigger_threshold(void);
+char *migrate_tls_creds(void);
  uint64_t migrate_xbzrle_cache_size(void);
/* parameters setters */
diff --git a/migration/tls.c b/migration/tls.c
index acd38e0b62..0d318516de 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -34,20 +34,19 @@ migration_tls_get_creds(MigrationState *s,
                          Error **errp)

"s" argument becomes unused, may be dropped.

  {
      Object *creds;
+    char *tls_creds = migrate_tls_creds();
      QCryptoTLSCreds *ret;
- creds = object_resolve_path_component(
-        object_get_objects_root(), s->parameters.tls_creds);
+    creds = object_resolve_path_component(object_get_objects_root(), 
tls_creds);
      if (!creds) {
-        error_setg(errp, "No TLS credentials with id '%s'",
-                   s->parameters.tls_creds);
+        error_setg(errp, "No TLS credentials with id '%s'", tls_creds);
          return NULL;
      }
      ret = (QCryptoTLSCreds *)object_dynamic_cast(
          creds, TYPE_QCRYPTO_TLS_CREDS);
      if (!ret) {
          error_setg(errp, "Object with id '%s' is not TLS credentials",
-                   s->parameters.tls_creds);
+                   tls_creds);
          return NULL;
      }
      if (!qcrypto_tls_creds_check_endpoint(ret, endpoint, errp)) {

--
Best regards,
Vladimir


Reply via email to