qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] migration: allow clearing migration string parameters
@ 2017-03-01 12:32 Daniel P. Berrange
  2017-03-01 12:39 ` no-reply
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Daniel P. Berrange @ 2017-03-01 12:32 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Eric Blake, Juan Quintela,
	Dr. David Alan Gilbert, Daniel P. Berrange

Some of the migration parameters are strings, which default to NULL,
eg tls_hostname and tls_creds.

The mgmt app will set the tls_creds parameter on both source and target
QEMU instances, in order to trigger use of TLS for migration.

After performing a TLS encrypted migration though, migration might be
used for other reasons - for example, to save the QEMU state to a file.
We need TLS turned off when doing this, but the migrate-set-parameters
QAPI command does not provide any facility to clear/reset parameters
to their default state.

If you simply ommit the tls_creds parameter in migrate-set-parameters,
then 'has_tls_creds' will be false and so no action will be taken. The
only option that works with migrate-set-parameters is to treat "" on
the wire as equivalent to requesting NULL. Failing that we would have
to create a new 'migrate-reset-parameters' method to explicitly put
a parameter back to its default value.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---

CC'ing Eric & Markus since this is related to QAPI schema for migrate
monitor commands

 migration/migration.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/migration/migration.c b/migration/migration.c
index c6ae69d..a5d41a9 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -872,11 +872,19 @@ void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp)
     }
     if (params->has_tls_creds) {
         g_free(s->parameters.tls_creds);
-        s->parameters.tls_creds = g_strdup(params->tls_creds);
+        if (*params->tls_creds == '\0') {
+            s->parameters.tls_creds = NULL;
+        } else {
+            s->parameters.tls_creds = g_strdup(params->tls_creds);
+        }
     }
     if (params->has_tls_hostname) {
         g_free(s->parameters.tls_hostname);
-        s->parameters.tls_hostname = g_strdup(params->tls_hostname);
+        if (*params->tls_hostnane == '\0') {
+            s->parameters.tls_hostnane = NULL;
+        } else {
+            s->parameters.tls_hostname = g_strdup(params->tls_hostname);
+        }
     }
     if (params->has_max_bandwidth) {
         s->parameters.max_bandwidth = params->max_bandwidth;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-03-15 10:49 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-01 12:32 [Qemu-devel] [PATCH] migration: allow clearing migration string parameters Daniel P. Berrange
2017-03-01 12:39 ` no-reply
2017-03-01 12:40 ` no-reply
2017-03-01 14:36 ` Eric Blake
2017-03-01 14:48   ` Daniel P. Berrange
2017-03-01 15:36     ` Eric Blake
2017-03-02  7:55     ` Markus Armbruster
2017-03-02 12:33   ` Daniel P. Berrange
2017-03-03 14:44     ` Markus Armbruster
2017-03-03 16:18       ` Daniel P. Berrange
2017-03-03 17:05         ` Markus Armbruster
2017-03-03 17:08           ` Daniel P. Berrange
2017-03-14 18:49       ` Dr. David Alan Gilbert
2017-03-15  6:26         ` Markus Armbruster
2017-03-15  9:32           ` Dr. David Alan Gilbert
2017-03-15 10:30             ` Markus Armbruster
2017-03-15 10:36               ` Dr. David Alan Gilbert
2017-03-15 10:49                 ` Daniel P. Berrange

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).