Daniel P. Berrange <berra...@redhat.com> wrote: > On Wed, Mar 07, 2018 at 11:59:50AM +0100, Juan Quintela wrote: >> We can set the port parameter as zero. This patch lets us know what >> port the system was choosen for us. Now we can migrate to this place. >> >> Signed-off-by: Juan Quintela <quint...@redhat.com>
>> +void migrate_set_port(const uint16_t port, Error **errp) >> +{ >> + MigrateSetParameters p = { >> + .has_x_tcp_port = true, >> + .x_tcp_port = port, >> + }; >> + >> + qmp_migrate_set_parameters(&p, errp); >> +} > > This is really not nice - it is requiring the QMP 'migrate-set-parameters' > command to accept an extra field that is never something we want the end > user to be allowed to set. We should not use the public QMP schema for > data items we are just passing between 2 internal pieces of code. void migrate_set_address(SocketAddress *address) { MigrationState *s = migrate_get_current(); s->parameters.has_x_socket_address = true; s->parameters.x_socket_address = address; } I hope that is ok with you O:-) Later, Juan. PD. Yes, I agree about not using QMP inside two pieces of code, but on the other hand, it make this so *future* proof O:-)